BxBaseCmts.php 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032
  1. <?php defined('BX_DOL') or die('hack attempt');
  2. /**
  3. * Copyright (c) UNA, Inc - https://una.io
  4. * MIT License - https://opensource.org/licenses/MIT
  5. *
  6. * @defgroup UnaBaseView UNA Base Representation Classes
  7. * @{
  8. */
  9. /**
  10. * @see BxDolCmts
  11. */
  12. class BxBaseCmts extends BxDolCmts
  13. {
  14. protected static $_sTmplContentElementBlock;
  15. protected static $_sTmplContentElementInline;
  16. protected static $_sTmplContentDoCommentLabel;
  17. protected static $_sTmplContentCounter;
  18. protected $_sJsObjName;
  19. protected $_sStylePrefix;
  20. protected $_aHtmlIds;
  21. protected $_aElementDefaults;
  22. function __construct( $sSystem, $iId, $iInit = true, $oTemplate = false)
  23. {
  24. parent::__construct($sSystem, $iId, $iInit, $oTemplate);
  25. if (empty($sSystem))
  26. return;
  27. $this->_sJsObjName = 'oCmts' . bx_gen_method_name($sSystem, array('_' , '-')) . $iId;
  28. $this->_sStylePrefix = isset($this->_aSystem['root_style_prefix']) ? $this->_aSystem['root_style_prefix'] : 'cmt';
  29. $sHtmlId = str_replace(array('_' , ' '), array('-', '-'), $sSystem) . '-' . $iId;
  30. $this->_aHtmlIds = array(
  31. 'main' => 'bx-cmt-' . $sHtmlId,
  32. 'counter' => 'bx-cmt-counter-' . $sHtmlId
  33. );
  34. $this->_aElementDefaults = array(
  35. 'show_do_comment_as_button' => false,
  36. 'show_do_comment_as_button_small' => false,
  37. 'show_do_comment_image' => false,
  38. 'show_do_comment_icon' => true,
  39. 'show_do_comment_label' => false,
  40. 'show_counter' => true,
  41. 'show_counter_empty' => false
  42. );
  43. if(empty(self::$_sTmplContentElementBlock))
  44. self::$_sTmplContentElementBlock = $this->_oTemplate->getHtml('comment_element_block.html');
  45. if(empty(self::$_sTmplContentElementInline))
  46. self::$_sTmplContentElementInline = $this->_oTemplate->getHtml('comment_element_inline.html');
  47. if(empty(self::$_sTmplContentDoCommentLabel))
  48. self::$_sTmplContentDoCommentLabel = $this->_oTemplate->getHtml('comment_do_comment_label.html');
  49. if(empty(self::$_sTmplContentCounter))
  50. self::$_sTmplContentCounter = $this->_oTemplate->getHtml('comment_counter.html');
  51. $this->_oTemplate->addJsTranslation('_sys_txt_cmt_loading');
  52. }
  53. /**
  54. * Add comments CSS/JS
  55. */
  56. public function addCssJs ()
  57. {
  58. $oForm = BxDolForm::getObjectInstance($this->_sFormObject, $this->_sFormDisplayPost);
  59. $oForm->addCssJs();
  60. }
  61. public function getJsObjectName()
  62. {
  63. return $this->_sJsObjName;
  64. }
  65. /**
  66. * Get initialization section of comments box
  67. *
  68. * @return string
  69. */
  70. public function getJsScript($aBp = array(), $aDp = array())
  71. {
  72. $bMinPostForm = isset($aDp['min_post_form']) ? $aDp['min_post_form'] : $this->_bMinPostForm;
  73. $aParams = array(
  74. 'sObjName' => $this->_sJsObjName,
  75. 'sRootUrl' => BX_DOL_URL_ROOT,
  76. 'sSystem' => $this->getSystemName(),
  77. 'iAuthorId' => $this->_getAuthorId(),
  78. 'iObjId' => $this->getId(),
  79. 'sBaseUrl' => $this->getBaseUrl(),
  80. 'sPostFormPosition' => $this->_aSystem['post_form_position'],
  81. 'sBrowseType' => $this->_sBrowseType,
  82. 'sDisplayType' => $this->_sDisplayType,
  83. 'iMinPostForm' => $bMinPostForm ? 1 : 0,
  84. );
  85. $this->addCssJs();
  86. return $this->_oTemplate->_wrapInTagJsCode("if(window['" . $this->_sJsObjName . "'] == undefined) var " . $this->_sJsObjName . " = new BxDolCmts(" . json_encode($aParams) . ");");
  87. }
  88. /**
  89. * get full comments block with initializations
  90. */
  91. function getCommentsBlock($aBp = array(), $aDp = array())
  92. {
  93. $this->_getParams($aBp, $aDp);
  94. //add live update
  95. $this->actionResumeLiveUpdate();
  96. $sServiceCall = BxDolService::getSerializedService('system', 'get_live_updates_comments', array($this->_sSystem, $this->_iId, $this->_getAuthorId(), '{count}'), 'TemplCmtsServices');
  97. BxDolLiveUpdates::getInstance()->add($this->_sSystem . '_live_updates_cmts_' . $this->_iId, 1, $sServiceCall);
  98. //add live update
  99. $sCaption = _t($this->_aT['block_comments_title'], $this->getCommentsCountAll());
  100. $sContent = $this->_oTemplate->parseHtmlByName('comments_block.html', array(
  101. 'system' => $this->_sSystem,
  102. 'list_anchor' => $this->getListAnchor(),
  103. 'id' => $this->getId(),
  104. 'comments' => $this->getComments($aBp, $aDp),
  105. 'post_form_top' => $this->getFormBoxPost($aBp, array_merge($aDp, array('type' => $this->_sDisplayType, 'position' => BX_CMT_PFP_TOP))),
  106. 'post_form_bottom' => $this->getFormBoxPost($aBp, array_merge($aDp, array('type' => $this->_sDisplayType, 'position' => BX_CMT_PFP_BOTTOM))),
  107. 'view_image_popup' => $this->_getViewImagePopup(),
  108. 'script' => $this->getJsScript($aBp, $aDp)
  109. ));
  110. return $aDp['in_designbox'] ? DesignBoxContent($sCaption, $sContent, BX_DB_DEF, $this->_getControlsBox()) : array(
  111. 'title' => $sCaption,
  112. 'content' => $sContent,
  113. 'menu' => $this->_getControlsBox(),
  114. );
  115. }
  116. /**
  117. * get comments list for specified parent comment
  118. *
  119. * @param array $aBp - browse params array
  120. * @param array $aDp - display params array
  121. *
  122. */
  123. function getComments($aBp = array(), $aDp = array())
  124. {
  125. $this->_prepareParams($aBp, $aDp);
  126. $aCmts = $this->getCommentsArray($aBp['vparent_id'], $aBp['filter'], $aBp['order'], $aBp['start'], $aBp['per_view']);
  127. if(empty($aCmts) || !is_array($aCmts)) {
  128. if((int)$aBp['parent_id'] == 0 && !isLogged()) {
  129. $oPermalink = BxDolPermalinks::getInstance();
  130. return MsgBox(_t('_cmt_msg_login_required', $oPermalink->permalink('page.php?i=login'), $oPermalink->permalink('page.php?i=create-account')));
  131. }
  132. return isset($aDp['show_empty']) && $aDp['show_empty'] === true ? $this->_getEmpty() : '';
  133. }
  134. $sCmts = '';
  135. foreach($aCmts as $k => $aCmt)
  136. $sCmts .= $this->getComment($aCmt, $aBp, $aDp);
  137. $sCmts = $this->_getMoreLink($sCmts, $aBp, $aDp);
  138. return $sCmts;
  139. }
  140. /**
  141. * get comment view block with initializations
  142. */
  143. function getCommentBlock($iCmtId = 0, $aBp = array(), $aDp = array())
  144. {
  145. $mixedResult = $this->isViewAllowed();
  146. if($mixedResult !== CHECK_ACTION_RESULT_ALLOWED)
  147. return $mixedResult;
  148. $aBp = array_merge(array('type' => $this->_sBrowseType), $aBp);
  149. $aDp = array_merge(array('type' => BX_CMT_DISPLAY_THREADED), $aDp);
  150. $sComment = $this->getComment($iCmtId, $aBp, $aDp);
  151. if (!$sComment)
  152. return '';
  153. return $this->_oTemplate->parseHtmlByName('comment_block.html', array(
  154. 'system' => $this->_sSystem,
  155. 'id' => $this->getId(),
  156. 'comment' => $sComment,
  157. 'view_image_popup' => $this->_getViewImagePopup(),
  158. 'script' => $this->getJsScript($aBp, $aDp)
  159. ));
  160. }
  161. /**
  162. * get one just posted comment
  163. *
  164. * @param int $iCmtId - comment id
  165. * @return string
  166. */
  167. function getComment($mixedCmt, $aBp = array(), $aDp = array())
  168. {
  169. $iUserId = $this->_getAuthorId();
  170. $aCmt = !is_array($mixedCmt) ? $this->getCommentRow((int)$mixedCmt) : $mixedCmt;
  171. if (!$aCmt)
  172. return '';
  173. list($sAuthorName, $sAuthorLink, $sAuthorIcon) = $this->_getAuthorInfo($aCmt['cmt_author_id']);
  174. $sClass = $sClassCnt = '';
  175. if(isset($aCmt['vote_rate']) && (float)$aCmt['vote_rate'] < $this->_aSystem['viewing_threshold']) {
  176. $this->_oTemplate->pareseHtmlByName('comment_hidden.html', array(
  177. 'js_object' => $this->_sJsObjName,
  178. 'id' => $aCmt['cmt_id'],
  179. 'title' => bx_process_output(_t('_hidden_comment', $sAuthorName)),
  180. 'bx_if:show_replies' => array(
  181. 'condition' => $aCmt['cmt_replies'] > 0,
  182. 'content' => array(
  183. 'replies' => _t('_Show N replies', $aCmt['cmt_replies'])
  184. )
  185. )
  186. ));
  187. $sClass = ' ' . $this->_sStylePrefix . '-hidden';
  188. }
  189. if($aCmt['cmt_author_id'] == $iUserId)
  190. $sClass .= ' ' . $this->_sStylePrefix . '-mine';
  191. if(!empty($aDp['blink']) && in_array($aCmt['cmt_id'], $aDp['blink']))
  192. $sClass .= ' ' . $this->_sStylePrefix . '-blink';
  193. if(!empty($aDp['class_comment']))
  194. $sClass .= ' ' . $aDp['class_comment'];
  195. if(!empty($aDp['class_comment_content']))
  196. $sClassCnt .= ' ' . $aDp['class_comment_content'];
  197. $sActions = $this->_getActionsBox($aCmt, $aDp);
  198. $aTmplReplyTo = array();
  199. if((int)$aCmt['cmt_parent_id'] != 0) {
  200. $aParent = $this->getCommentRow($aCmt['cmt_parent_id']);
  201. list($sParAuthorName, $sParAuthorLink, $sParAuthorIcon) = $this->_getAuthorInfo($aParent['cmt_author_id']);
  202. $aTmplReplyTo = array(
  203. 'style_prefix' => $this->_sStylePrefix,
  204. 'par_cmt_link' => $this->getItemUrl($aCmt['cmt_parent_id']),
  205. 'par_cmt_title' => bx_html_attribute(_t('_in_reply_to', $sParAuthorName)),
  206. 'par_cmt_author' => $sParAuthorName
  207. );
  208. }
  209. $sAttachments = $this->_getAttachments($aCmt);
  210. $sReplies = '';
  211. if((int)$aCmt['cmt_replies'] > 0 && !empty($aDp) && $aDp['type'] == BX_CMT_DISPLAY_THREADED) {
  212. $aDp['show_empty'] = false;
  213. $sReplies = $this->getComments(array('parent_id' => $aCmt['cmt_id'], 'vparent_id' => $aCmt['cmt_id'], 'type' => $aBp['type']), $aDp);
  214. }
  215. $aTmplVarsMeta = array();
  216. if(!empty($this->_sMenuObjMeta)) {
  217. $oMenuMeta = BxDolMenu::getObjectInstance($this->_sMenuObjMeta, $this->_oTemplate);
  218. if($oMenuMeta) {
  219. $oMenuMeta->setCmtsData($this, $aCmt['cmt_id']);
  220. $aTmplVarsMeta = array(
  221. 'style_prefix' => $this->_sStylePrefix,
  222. 'meta' => $oMenuMeta->getCode()
  223. );
  224. }
  225. }
  226. return $this->_oTemplate->parseHtmlByName('comment.html', array_merge(array(
  227. 'system' => $this->_sSystem,
  228. 'style_prefix' => $this->_sStylePrefix,
  229. 'js_object' => $this->_sJsObjName,
  230. 'id' => $aCmt['cmt_id'],
  231. 'anchor' => $this->getItemAnchor($aCmt['cmt_id']),
  232. 'class' => $sClass,
  233. 'class_cnt' => $sClassCnt,
  234. 'bx_if:show_reply_to' => array(
  235. 'condition' => !empty($aTmplReplyTo),
  236. 'content' => $aTmplReplyTo
  237. ),
  238. 'bx_if:meta' => array(
  239. 'condition' => !empty($aTmplVarsMeta),
  240. 'content' => $aTmplVarsMeta
  241. ),
  242. 'bx_if:show_attached' => array(
  243. 'condition' => !empty($sAttachments),
  244. 'content' => array(
  245. 'style_prefix' => $this->_sStylePrefix,
  246. 'attached' => $sAttachments
  247. )
  248. ),
  249. 'actions' => $sActions,
  250. 'replies' => $sReplies
  251. ), $this->_getTmplVarsAuthor($aCmt), $this->_getTmplVarsText($aCmt)));
  252. }
  253. function getCommentSearch($iCmtId, &$sAddon)
  254. {
  255. $aBp = array();
  256. $aDp = array(
  257. 'type' => BX_CMT_DISPLAY_FLAT,
  258. 'view_only' => true
  259. );
  260. if(empty($sAddon))
  261. $sAddon = $this->getJsScript($aBp, $aDp);
  262. return $this->_oTemplate->parseHtmlByName('comment_search.html', array(
  263. 'comment' => $this->getComment($iCmtId, $aBp, $aDp),
  264. 'view_image_popup' => $this->_getViewImagePopup(),
  265. ));
  266. }
  267. /**
  268. * get one comment for "Live Search"
  269. *
  270. * @param int $iCmtId - comment id
  271. * @return string
  272. */
  273. function getCommentLiveSearch($mixedCmt, $aParams = array())
  274. {
  275. $aCmt = !is_array($mixedCmt) ? $this->getCommentRow((int)$mixedCmt) : $mixedCmt;
  276. list($sAuthorName, $sAuthorLink, $sAuthorIcon) = $this->_getAuthorInfo($aCmt['cmt_author_id']);
  277. $bAuthorIcon = !empty($sAuthorIcon);
  278. $sViewLink = $this->getViewUrl($aCmt['cmt_id']);
  279. if(empty($sViewLink))
  280. $sViewLink = '#';
  281. return $this->_oTemplate->parseHtmlByName('comment_live_search.html', array(
  282. 'bx_if:show_icon' => array(
  283. 'condition' => $bAuthorIcon,
  284. 'content' => array(
  285. 'author_icon' => $sAuthorIcon,
  286. 'view_link' => $sViewLink
  287. )
  288. ),
  289. 'bx_if:show_icon_empty' => array(
  290. 'condition' => !$bAuthorIcon,
  291. 'content' => array()
  292. ),
  293. 'view_link' => $sViewLink,
  294. 'text' => BxTemplFunctions::getInstance()->getStringWithLimitedLength(strip_tags($aCmt['cmt_text']), $this->_sSnippetLenthLiveSearch),
  295. 'sample' => isset($aParams['txt_sample_single']) ? _t($aParams['txt_sample_single']) : ''
  296. ));
  297. }
  298. function getFormBoxPost($aBp = array(), $aDp = array())
  299. {
  300. if(!$this->isPostReplyAllowed())
  301. return '';
  302. return $this->_getFormBox(BX_CMT_ACTION_POST, $aBp, $aDp);
  303. }
  304. function getFormBoxEdit($aBp = array(), $aDp = array())
  305. {
  306. return $this->_getFormBox(BX_CMT_ACTION_EDIT, $aBp, $aDp);
  307. }
  308. function getFormPost($iCmtParentId = 0, $aDp = array())
  309. {
  310. return $this->_getFormPost($iCmtParentId, $aDp);
  311. }
  312. function getFormEdit($iCmtId, $aDp = array())
  313. {
  314. return $this->_getFormEdit($iCmtId, $aDp);
  315. }
  316. function getNotification($iCountOld = 0, $iCountNew = 0)
  317. {
  318. $iCount = (int)$iCountNew - (int)$iCountOld;
  319. if($iCount < 0)
  320. return '';
  321. $aComments = $this->_oQuery->getCommentsBy(array('type' => 'latest', 'object_id' => $this->_iId, 'author' => $this->_getAuthorId(), 'others' => 1, 'start' => '0', 'per_page' => $iCount));
  322. if(empty($aComments) || !is_array($aComments))
  323. return '';
  324. $sJsObject = $this->getJsObjectName();
  325. $aComments = array_reverse($aComments);
  326. $iComments = count($aComments);
  327. $aTmplVarsNotifs = array();
  328. foreach($aComments as $iIndex => $aComment) {
  329. $iCommentId = $aComment['cmt_id'];
  330. $sShowOnClick = "javascript:" . $sJsObject . ".goTo(this, '" . $this->_sSystem . $iCommentId . "', '" . $iCommentId . "');";
  331. $sReplyOnClick = "javascript:" . $sJsObject . ".goToAndReply(this, '" . $this->_sSystem . $iCommentId . "', '" . $iCommentId . "');";
  332. $aTmplVarsNotifs[] = array(
  333. 'bx_if:show_as_hidden' => array(
  334. 'condition' => $iIndex < ($iComments - 1),
  335. 'content' => array(),
  336. ),
  337. 'item' => $this->_oTemplate->parseHtmlByName('comments_notification.html', array_merge(array(
  338. 'style_prefix' => $this->_sStylePrefix,
  339. 'onclick_show' => $sShowOnClick,
  340. 'onclick_reply' => $sReplyOnClick,
  341. ), $this->_getTmplVarsAuthor($aComment), $this->_getTmplVarsText($aComment))),
  342. 'bx_if:show_previous' => array(
  343. 'condition' => $iIndex > 0,
  344. 'content' => array(
  345. 'onclick_previous' => $sJsObject . '.previousLiveUpdate(this)'
  346. )
  347. ),
  348. 'onclick_close' => $sJsObject . '.hideLiveUpdate(this)'
  349. );
  350. }
  351. return $this->_oTemplate->parseHtmlByName('popup_chain.html', array(
  352. 'html_id' => $this->getNotificationId(),
  353. 'bx_repeat:items' => $aTmplVarsNotifs
  354. ));
  355. }
  356. public function getElementBlock($aParams = array())
  357. {
  358. $aParams['usage'] = BX_CMT_USAGE_BLOCK;
  359. return $this->getElement($aParams);
  360. }
  361. public function getElementInline($aParams = array())
  362. {
  363. $aParams['usage'] = BX_CMT_USAGE_INLINE;
  364. return $this->getElement($aParams);
  365. }
  366. public function getElement($aParams = array())
  367. {
  368. $aParams = array_merge($this->_aElementDefaults, $aParams);
  369. $bShowDoCommentAsButtonSmall = isset($aParams['show_do_comment_as_button_small']) && $aParams['show_do_comment_as_button_small'] == true;
  370. $bShowDoCommentAsButton = !$bShowDoCommentAsButtonSmall && isset($aParams['show_do_comment_as_button']) && $aParams['show_do_comment_as_button'] == true;
  371. $bShowCounterEmpty = isset($aParams['show_counter_empty']) && $aParams['show_counter_empty'] == true;
  372. $iObjectId = $this->getId();
  373. $iAuthorId = $this->_getAuthorId();
  374. $iAuthorIp = $this->_getAuthorIp();
  375. $iCount = $this->getCommentsCountAll();
  376. $bCount = (int)$iCount != 0;
  377. $isAllowedComment = $this->isPostReplyAllowed();
  378. //--- Do Comment
  379. $bTmplVarsDoComment = $this->_isShowDoComment($aParams, $isAllowedComment, $bCount);
  380. $aTmplVarsDoComment = array();
  381. if($bTmplVarsDoComment) {
  382. $sClass = '';
  383. if($bShowDoCommentAsButton)
  384. $sClass = 'bx-btn';
  385. else if ($bShowDoCommentAsButtonSmall)
  386. $sClass = 'bx-btn bx-btn-small';
  387. if(!$isAllowedComment)
  388. $sClass .= $bShowDoCommentAsButton || $bShowDoCommentAsButtonSmall ? ' bx-btn-disabled' : 'bx-cmts-disabled';
  389. $aTmplVarsDoComment = array(
  390. 'style_prefix' => $this->_sStylePrefix,
  391. 'do_comment' => $this->_oTemplate->parseLink($this->getListUrl(), $this->_getLabelDo($aParams), array(
  392. 'class' => $this->_sStylePrefix . '-do-comment ' . $this->_sStylePrefix . '-dc ' . $sClass,
  393. 'title' => _t($this->_getTitleDo())
  394. )),
  395. );
  396. }
  397. //--- Counter
  398. $bTmplVarsCounter = $this->_isShowCounter($aParams, $isAllowedComment, $bCount);
  399. $aTmplVarsCounter = array();
  400. if($bTmplVarsCounter)
  401. $aTmplVarsCounter = array(
  402. 'style_prefix' => $this->_sStylePrefix,
  403. 'bx_if:show_hidden' => array(
  404. 'condition' => !$bShowCounterEmpty && !$bCount,
  405. 'content' => array()
  406. ),
  407. 'counter' => $this->getCounter($aParams)
  408. );
  409. if(!$bTmplVarsDoComment && !$bTmplVarsCounter)
  410. return '';
  411. $sTmplName = $this->{'_getTmplElement' . bx_gen_method_name(!empty($aParams['usage']) ? $aParams['usage'] : BX_DOL_SCORE_USAGE_DEFAULT)}();
  412. return $this->_oTemplate->parseHtmlByContent($sTmplName, array(
  413. 'style_prefix' => $this->_sStylePrefix,
  414. 'html_id' => $this->_aHtmlIds['main'],
  415. 'class' => $this->_sStylePrefix . ($bShowDoCommentAsButton ? '-button' : '') . ($bShowDoCommentAsButtonSmall ? '-button-small' : ''),
  416. 'count' => $iCount,
  417. 'bx_if:show_do_comment' => array(
  418. 'condition' => $bTmplVarsDoComment,
  419. 'content' => $aTmplVarsDoComment
  420. ),
  421. 'bx_if:show_counter' => array(
  422. 'condition' => $bTmplVarsCounter,
  423. 'content' => $aTmplVarsCounter
  424. ),
  425. 'script' => ''
  426. ));
  427. }
  428. public function getCounter($aParams = array())
  429. {
  430. $bShowEmpty = isset($aParams['show_counter_empty']) && $aParams['show_counter_empty'] == true;
  431. $bShowDoCommentAsButtonSmall = isset($aParams['show_do_comment_as_button_small']) && $aParams['show_do_comment_as_button_small'] == true;
  432. $bShowDoCommentAsButton = !$bShowDoCommentAsButtonSmall && isset($aParams['show_do_comment_as_button']) && $aParams['show_do_comment_as_button'] == true;
  433. $iCount = (int)$this->getCommentsCountAll();
  434. $sClass = $this->_sStylePrefix . '-counter';
  435. if($bShowDoCommentAsButtonSmall)
  436. $sClass .= ' bx-btn-small-height';
  437. if($bShowDoCommentAsButton)
  438. $sClass .= ' bx-btn-height';
  439. return $this->_oTemplate->parseHtmlByContent($this->_getTmplCounter(), array(
  440. 'id' => $this->_aHtmlIds['counter'],
  441. 'class' => $sClass,
  442. 'content' => $iCount != 0 || $bShowEmpty ? $this->_getLabelCounter($iCount) : ''
  443. ));
  444. }
  445. protected function _getLabelDo($aParams = array())
  446. {
  447. return $this->_oTemplate->parseHtmlByContent($this->_getTmplLabelDo(), array(
  448. 'bx_if:show_image' => array(
  449. 'condition' => isset($aParams['show_do_comment_image']) && $aParams['show_do_comment_image'] == true,
  450. 'content' => array(
  451. 'src' => $this->_getImageDo()
  452. )
  453. ),
  454. 'bx_if:show_icon' => array(
  455. 'condition' => isset($aParams['show_do_comment_icon']) && $aParams['show_do_comment_icon'] == true,
  456. 'content' => array(
  457. 'name' => $this->_getIconDo()
  458. )
  459. ),
  460. 'bx_if:show_text' => array(
  461. 'condition' => isset($aParams['show_do_comment_label']) && $aParams['show_do_comment_label'] == true,
  462. 'content' => array(
  463. 'text' => _t($this->_getTitleDo())
  464. )
  465. )
  466. ));
  467. }
  468. protected function _getLabelCounter($iCount)
  469. {
  470. return (int)$iCount != 0 ? _t('_cmt_txt_counter', $iCount) : _t('_cmt_txt_counter_empty');
  471. }
  472. protected function _getTmplElementBlock()
  473. {
  474. return self::$_sTmplContentElementBlock;
  475. }
  476. protected function _getTmplElementInline()
  477. {
  478. return self::$_sTmplContentElementInline;
  479. }
  480. protected function _getTmplLabelDo()
  481. {
  482. return self::$_sTmplContentDoCommentLabel;
  483. }
  484. protected function _getTmplCounter()
  485. {
  486. return self::$_sTmplContentCounter;
  487. }
  488. /**
  489. * private functions
  490. */
  491. protected function _getControlsBox()
  492. {
  493. $sDisplay = '';
  494. $bDisplay = (int)$this->_aSystem['is_display_switch'] == 1;
  495. if($bDisplay) {
  496. $aDisplayLinks = array(
  497. array('id' => $this->_sSystem . '-flat', 'name' => $this->_sSystem . '-flat', 'class' => '', 'title' => '_cmt_display_flat', 'target' => '_self', 'onclick' => 'javascript:' . $this->_sJsObjName . '.cmtChangeDisplay(this, \'flat\');'),
  498. array('id' => $this->_sSystem . '-threaded', 'name' => $this->_sSystem . '-threaded', 'class' => '', 'title' => '_cmt_display_threaded', 'target' => '_self', 'onclick' => 'javascript:' . $this->_sJsObjName . '.cmtChangeDisplay(this, \'threaded\');')
  499. );
  500. $oMenu = new BxTemplMenuInteractive(array('template' => 'menu_interactive_vertical.html', 'menu_id'=> $this->_sSystem . '-display', 'menu_items' => $aDisplayLinks));
  501. $oMenu->setSelected('', $this->_sSystem . '-' . $this->_sDisplayType);
  502. $sDisplay = $oMenu->getCode();
  503. }
  504. $sBrowseType = '';
  505. $bBrowseType = (int)$this->_aSystem['is_browse_switch'] == 1;
  506. if($bBrowseType) {
  507. $aBrowseLinks = array(
  508. array('id' => $this->_sSystem . '-tail', 'name' => $this->_sSystem . '-tail', 'class' => '', 'title' => '_cmt_browse_tail', 'target' => '_self', 'onclick' => 'javascript:' . $this->_sJsObjName . '.cmtChangeBrowse(this, \'tail\');'),
  509. array('id' => $this->_sSystem . '-head', 'name' => $this->_sSystem . '-head', 'class' => '', 'title' => '_cmt_browse_head', 'target' => '_self', 'onclick' => 'javascript:' . $this->_sJsObjName . '.cmtChangeBrowse(this, \'head\');'),
  510. array('id' => $this->_sSystem . '-popular', 'name' => $this->_sSystem . '-popular', 'class' => '', 'title' => '_cmt_browse_popular', 'target' => '_self', 'onclick' => 'javascript:' . $this->_sJsObjName . '.cmtChangeBrowse(this, \'popular\');'),
  511. );
  512. $oMenu = new BxTemplMenuInteractive(array('template' => 'menu_interactive_vertical.html', 'menu_id'=> $this->_sSystem . '-browse', 'menu_items' => $aBrowseLinks));
  513. $oMenu->setSelected('', $this->_sSystem . '-' . $this->_sBrowseType);
  514. $sBrowseType = $oMenu->getCode();
  515. }
  516. $sBrowseFilter = '';
  517. $bBrowseFilter = (int)$this->_aSystem['is_browse_filter'] == 1;
  518. if($bBrowseFilter) {
  519. $aFilterLinks = array(
  520. array('id' => $this->_sSystem . '-all', 'name' => $this->_sSystem . '-all', 'class' => '', 'title' => '_cmt_browse_all', 'target' => '_self', 'onclick' => 'javascript:' . $this->_sJsObjName . '.cmtChangeFilter(this, \'all\');'),
  521. array('id' => $this->_sSystem . '-friends', 'name' => $this->_sSystem . '-friends', 'class' => '', 'title' => '_cmt_browse_friends', 'target' => '_self', 'onclick' => 'javascript:' . $this->_sJsObjName . '.cmtChangeFilter(this, \'friends\');'),
  522. array('id' => $this->_sSystem . '-subscriptions', 'name' => $this->_sSystem . '-subscriptions', 'class' => '', 'title' => '_cmt_browse_subscriptions', 'target' => '_self', 'onclick' => 'javascript:' . $this->_sJsObjName . '.cmtChangeFilter(this, \'subscriptions\');')
  523. );
  524. $oMenu = new BxTemplMenuInteractive(array('template' => 'menu_interactive_vertical.html', 'menu_id'=> $this->_sSystem . '-filter', 'menu_items' => $aFilterLinks));
  525. $oMenu->setSelected('', $this->_sSystem . '-' . $this->_sBrowseFilter);
  526. $sBrowseFilter = $oMenu->getCode();
  527. }
  528. return $this->_oTemplate->parseHtmlByName('comments_controls.html', array(
  529. 'display_switcher' => $bDisplay ? $sDisplay : '',
  530. 'bx_if:is_divider_1' => array(
  531. 'condition' => $bDisplay && $bBrowseType,
  532. 'content' => array(
  533. 'style_prefix' => $this->_sStylePrefix,
  534. )
  535. ),
  536. 'browse_switcher' => $bBrowseType ? $sBrowseType : '',
  537. 'bx_if:is_divider_2' => array(
  538. 'condition' => $bBrowseType && $bBrowseFilter,
  539. 'content' => array(
  540. 'style_prefix' => $this->_sStylePrefix,
  541. )
  542. ),
  543. 'filter_switcher' => $bBrowseFilter ? $sBrowseFilter : '',
  544. ));
  545. }
  546. protected function _getActionsBox(&$aCmt, $aDp = array())
  547. {
  548. $bViewOnly = isset($aDp['view_only']) && $aDp['view_only'] === true;
  549. $bDynamicMode = isset($aDp['dynamic_mode']) && $aDp['dynamic_mode'] === true;
  550. $sMenuActions = '';
  551. if(!$bViewOnly) {
  552. $oMenuActions = BxDolMenu::getObjectInstance($this->_sMenuObjActions);
  553. $oMenuActions->setCmtsData($this, $aCmt['cmt_id']);
  554. $oMenuActions->setDynamicMode($bDynamicMode);
  555. $sMenuActions = $oMenuActions->getCode();
  556. }
  557. return $this->_oTemplate->parseHtmlByName('comment_actions.html', array(
  558. 'id' => $aCmt['cmt_id'],
  559. 'js_object' => $this->_sJsObjName,
  560. 'style_prefix' => $this->_sStylePrefix,
  561. 'menu_actions' => $sMenuActions,
  562. ));
  563. }
  564. protected function _getFormBox($sType, $aBp, $aDp)
  565. {
  566. $iCmtParentId = isset($aBp['parent_id']) ? (int)$aBp['parent_id'] : 0;
  567. $sPosition = isset($aDp['position']) ? $aDp['position'] : '';
  568. $bFormMin = $iCmtParentId == 0 && isset($aDp['min_post_form']) ? $aDp['min_post_form'] : false;
  569. $sPositionSystem = $this->_aSystem['post_form_position'];
  570. if(!empty($sPosition) && $sPositionSystem != $sPosition)
  571. return '';
  572. $sClass = '';
  573. if(!empty($sPosition))
  574. $sClass .= ' ' . $this->_sStylePrefix . '-reply-' . $sPosition;
  575. if($bFormMin)
  576. $sClass .= ' ' . $this->_sStylePrefix . '-reply-min';
  577. $aTmplVarsFormMin = array();
  578. if($bFormMin) {
  579. list($sAuthorName, $sAuthorLink, $sAuthorIcon, $sAuthorUnit) = $this->_getAuthorInfo($this->_getAuthorId());
  580. $aTmplVarsFormMin = array(
  581. 'js_object' => $this->_sJsObjName,
  582. 'style_prefix' => $this->_sStylePrefix,
  583. 'author_unit' => $sAuthorUnit,
  584. 'placeholder' => _t('_cmt_txt_min_form_placeholder', $sAuthorName)
  585. );
  586. }
  587. $sMethod = '_getForm' . ucfirst($sType);
  588. $aForm = $this->$sMethod($iCmtParentId, $aDp);
  589. return $this->_oTemplate->parseHtmlByName('comment_reply_box.html', array(
  590. 'js_object' => $this->_sJsObjName,
  591. 'style_prefix' => $this->_sStylePrefix,
  592. 'class' => $sClass,
  593. 'bx_if:show_form_min' => array(
  594. 'condition' => $bFormMin,
  595. 'content' => $aTmplVarsFormMin
  596. ),
  597. 'form' => $aForm['form'],
  598. 'form_id' => $aForm['form_id'],
  599. ));
  600. }
  601. protected function _getFormPost($iCmtParentId = 0, $aDp = array())
  602. {
  603. $bDynamic = isset($aDp['dynamic_mode']) && (bool)$aDp['dynamic_mode'];
  604. $oForm = $this->_getForm(BX_CMT_ACTION_POST, $iCmtParentId);
  605. $oForm->aInputs['cmt_parent_id']['value'] = $iCmtParentId;
  606. $oForm->initChecker();
  607. if($oForm->isSubmittedAndValid()) {
  608. $iCmtAuthorId = $this->_getAuthorId();
  609. $iCmtParentId = $oForm->getCleanValue('cmt_parent_id');
  610. $sCmtText = $oForm->getCleanValue('cmt_text');
  611. $iLevel = 0;
  612. $iCmtVisualParentId = 0;
  613. if((int)$iCmtParentId > 0) {
  614. $aParent = $this->getCommentRow($iCmtParentId);
  615. $iLevel = (int)$aParent['cmt_level'] + 1;
  616. $iCmtVisualParentId = $iLevel > $this->getMaxLevel() ? $aParent['cmt_vparent_id'] : $iCmtParentId;
  617. }
  618. $iCmtId = (int)$oForm->insert(array('cmt_vparent_id' => $iCmtVisualParentId, 'cmt_object_id' => $this->_iId, 'cmt_author_id' => $iCmtAuthorId, 'cmt_level' => $iLevel, 'cmt_time' => time()));
  619. if($iCmtId != 0) {
  620. if($this->isAttachImageEnabled()) {
  621. $aImages = $oForm->getCleanValue('cmt_image');
  622. if(!empty($aImages) && is_array($aImages)) {
  623. $oStorage = BxDolStorage::getObjectInstance($this->getStorageObjectName());
  624. foreach($aImages as $iImageId)
  625. if($this->_oQuery->saveImages($this->_aSystem['system_id'], $iCmtId, $iImageId))
  626. $oStorage->afterUploadCleanup($iImageId, $iCmtAuthorId);
  627. }
  628. }
  629. if($iCmtParentId) {
  630. $this->_oQuery->updateRepliesCount($iCmtParentId, 1);
  631. if(!BxDolModuleQuery::getInstance()->isEnabledByName('bx_notifications'))
  632. $this->_sendNotificationEmail($iCmtId, $iCmtParentId);
  633. }
  634. $this->_triggerComment();
  635. $this->isPostReplyAllowed(true);
  636. if ($this->_sMetatagsObj) {
  637. $oMetatags = BxDolMetatags::getObjectInstance($this->_sMetatagsObj);
  638. $oMetatags->metaAdd($this->_oQuery->getUniqId($this->_aSystem['system_id'], $iCmtId), $sCmtText);
  639. }
  640. $this->onPostAfter($iCmtId);
  641. return array('id' => $iCmtId, 'parent_id' => $iCmtParentId);
  642. }
  643. return array('msg' => _t('_cmt_err_cannot_perform_action'));
  644. }
  645. return array('form' => $oForm->getCode($bDynamic), 'form_id' => $oForm->id);
  646. }
  647. protected function _getFormEdit($iCmtId, $aDp = array())
  648. {
  649. $bDynamic = isset($aDp['dynamic_mode']) && (bool)$aDp['dynamic_mode'];
  650. $aCmt = $this->_oQuery->getCommentSimple ((int)$this->getId(), $iCmtId);
  651. if(!$aCmt)
  652. return array('msg' => _t('_No such comment'));
  653. $iCmtAuthorId = $this->_getAuthorId();
  654. if(!$this->isEditAllowed($aCmt))
  655. return array('msg' => $aCmt['cmt_author_id'] == $iCmtAuthorId ? strip_tags($this->msgErrEditAllowed()) : _t('_Access denied'));
  656. $oForm = $this->_getForm(BX_CMT_ACTION_EDIT, $aCmt['cmt_id']);
  657. $oForm->initChecker($aCmt);
  658. if($oForm->isSubmittedAndValid()) {
  659. $sCmtText = $oForm->getCleanValue('cmt_text');
  660. if($oForm->update($iCmtId) !== false) {
  661. $this->isEditAllowed($aCmt, true);
  662. if ($this->_sMetatagsObj) {
  663. $oMetatags = BxDolMetatags::getObjectInstance($this->_sMetatagsObj);
  664. $oMetatags->metaAdd($this->_oQuery->getUniqId($this->_aSystem['system_id'], $iCmtId), $sCmtText);
  665. }
  666. $this->onEditAfter($iCmtId);
  667. return array('id' => $iCmtId, 'text' => $this->_prepareTextForOutput($sCmtText, $iCmtId));
  668. }
  669. return array('msg' => _t('_cmt_err_cannot_perform_action'));
  670. }
  671. return array('form' => $oForm->getCode($bDynamic), 'form_id' => $oForm->id);
  672. }
  673. protected function _getForm($sAction, $iId)
  674. {
  675. $oForm = $this->_getFormObject($sAction);
  676. $oForm->setId(sprintf($oForm->getAttributeMask('id'), $sAction, $this->_sSystem, $iId));
  677. $oForm->setName(sprintf($oForm->getAttributeMask('name'), $sAction, $this->_sSystem, $iId));
  678. $oForm->aParams['db']['table'] = $this->_aSystem['table'];
  679. $oForm->aInputs['sys']['value'] = $this->_sSystem;
  680. $oForm->aInputs['id']['value'] = $this->_iId;
  681. $oForm->aInputs['action']['value'] = 'Submit' . ucfirst($sAction) . 'Form';
  682. if(!$this->isAttachImageEnabled())
  683. unset($oForm->aInputs['cmt_image']);
  684. if(isset($oForm->aInputs['cmt_text'])) {
  685. $oForm->aInputs['cmt_text']['html'] = $this->_aSystem['html'];
  686. $oForm->aInputs['cmt_text']['db']['pass'] = $this->isHtml() ? 'XssHtml' : 'XssMultiline';
  687. $iCmtTextMin = (int)$this->_aSystem['chars_post_min'];
  688. $iCmtTextMax = (int)$this->_aSystem['chars_post_max'];
  689. $oForm->aInputs['cmt_text']['checker']['params'] = array($iCmtTextMin, $iCmtTextMax);
  690. $oForm->aInputs['cmt_text']['checker']['error'] = _t('_Please enter n1-n2 characters', $iCmtTextMin, $iCmtTextMax);
  691. }
  692. return $oForm;
  693. }
  694. protected function _getMoreLink($sCmts, $aBp = array(), $aDp = array())
  695. {
  696. $iStart = $iPerView = 0;
  697. switch($aBp['type']) {
  698. case BX_CMT_BROWSE_HEAD:
  699. case BX_CMT_BROWSE_POPULAR:
  700. case BX_CMT_BROWSE_CONNECTION:
  701. $iPerView = $aBp['per_view'];
  702. $iStart = $aBp['start'] + $iPerView;
  703. if($iStart >= $aBp['count'])
  704. return $sCmts;
  705. break;
  706. case BX_CMT_BROWSE_TAIL:
  707. $iPerView = $aBp['per_view'];
  708. $iStart = $aBp['start'] - $iPerView;
  709. if($iStart < 0) {
  710. $iPerView += $iStart;
  711. $iStart = 0;
  712. }
  713. if($iStart == 0 && $iPerView == 0)
  714. return $sCmts;
  715. break;
  716. }
  717. $bRoot = (int)$aBp['vparent_id'] <= 0;
  718. $sMore = $this->_oTemplate->parseHtmlByName('comment_more.html', array(
  719. 'js_object' => $this->_sJsObjName,
  720. 'style_prefix' => $this->_sStylePrefix,
  721. 'bx_if:is_root' => array(
  722. 'condition' => $bRoot,
  723. 'content' => array()
  724. ),
  725. 'parent_id' => $aBp['vparent_id'],
  726. 'start' => $iStart,
  727. 'per_view' => $iPerView,
  728. 'title' => _t('_cmt_load_more_' . ($aBp['vparent_id'] == 0 ? 'comments' : 'replies') . '_' . $aBp['type'])
  729. ));
  730. switch($aBp['type']) {
  731. case BX_CMT_BROWSE_HEAD:
  732. case BX_CMT_BROWSE_POPULAR:
  733. case BX_CMT_BROWSE_CONNECTION:
  734. $sCmts .= $sMore;
  735. break;
  736. case BX_CMT_BROWSE_TAIL:
  737. $sCmts = $sMore . $sCmts;
  738. break;
  739. }
  740. return $sCmts;
  741. }
  742. protected function _getEmpty()
  743. {
  744. return $this->_oTemplate->parseHtmlByName('comment_empty.html', array(
  745. 'style_prefix' => $this->_sStylePrefix,
  746. 'content' => MsgBox(_t('_Empty'))
  747. ));
  748. }
  749. protected function _getViewImagePopup()
  750. {
  751. $sViewImagePopupId = 'cmts-box-' . $this->_sSystem . '-' . $this->getId() . '-view-image-popup' ;
  752. $sViewImagePopupContent = $this->_oTemplate->parseHtmlByName('popup_image.html', array(
  753. 'image_url' => ''
  754. ));
  755. return BxTemplFunctions::getInstance()->transBox($sViewImagePopupId, $sViewImagePopupContent, true);
  756. }
  757. protected function _getAttachments($aCmt)
  758. {
  759. $aTmplImages = array();
  760. if(!$this->isAttachImageEnabled())
  761. return '';
  762. $aFiles = $this->_oQuery->getFiles($this->_aSystem['system_id'], $aCmt['cmt_id']);
  763. if(!empty($aFiles) && is_array($aFiles)) {
  764. $oStorage = BxDolStorage::getObjectInstance($this->getStorageObjectName());
  765. $oTranscoder = BxDolTranscoderImage::getObjectInstance($this->getTranscoderPreviewName());
  766. foreach($aFiles as $aFile) {
  767. $bImage = $oTranscoder && $oTranscoder->isMimeTypeSupported($aFile['mime_type']);
  768. $sPreview = '';
  769. if($oTranscoder && $bImage)
  770. $sPreview = $oTranscoder->getFileUrl($aFile['image_id']);
  771. if(!$sPreview)
  772. $sPreview = $this->_oTemplate->getIconUrl($oStorage->getIconNameByFileName($aFile['file_name']));
  773. $aTmplVarsFile = array(
  774. 'js_object' => $this->_sJsObjName,
  775. 'preview' => $sPreview,
  776. 'file' => $oStorage->getFileUrlById($aFile['image_id']),
  777. 'file_name' => $aFile['file_name'],
  778. 'file_icon' => $oStorage->getFontIconNameByFileName($aFile['file_name']),
  779. 'file_size' => _t_format_size($aFile['size']),
  780. );
  781. $aTmplImages[] = array(
  782. 'style_prefix' => $this->_sStylePrefix,
  783. 'bx_if:show_image' => array(
  784. 'condition' => $bImage,
  785. 'content' => $aTmplVarsFile
  786. ),
  787. 'bx_if:show_file' => array(
  788. 'condition' => !$bImage,
  789. 'content' => $aTmplVarsFile
  790. ),
  791. );
  792. }
  793. }
  794. return $this->_oTemplate->parseHtmlByName('comment_attachments.html', array(
  795. 'bx_repeat:attached' => $aTmplImages
  796. ));
  797. }
  798. protected function _getTmplVarsAuthor($aCmt)
  799. {
  800. list($sAuthorName, $sAuthorLink, $sAuthorIcon, $sAuthorUnit) = $this->_getAuthorInfo($aCmt['cmt_author_id']);
  801. $bAuthorIcon = !empty($sAuthorIcon);
  802. return array(
  803. 'author_unit' => $sAuthorUnit,
  804. 'bx_if:show_icon' => array(
  805. 'condition' => $bAuthorIcon,
  806. 'content' => array(
  807. 'author_icon' => $sAuthorIcon
  808. )
  809. ),
  810. 'bx_if:show_icon_empty' => array(
  811. 'condition' => !$bAuthorIcon,
  812. 'content' => array()
  813. ),
  814. 'bx_if:show_author_link' => array(
  815. 'condition' => !empty($sAuthorLink),
  816. 'content' => array(
  817. 'author_link' => $sAuthorLink,
  818. 'author_title' => bx_html_attribute($sAuthorName),
  819. 'author_name' => $sAuthorName
  820. )
  821. ),
  822. 'bx_if:show_author_text' => array(
  823. 'condition' => empty($sAuthorLink),
  824. 'content' => array(
  825. 'author_name' => $sAuthorName
  826. )
  827. ),
  828. );
  829. }
  830. protected function _getTmplVarsText($aCmt)
  831. {
  832. $sText = $aCmt['cmt_text'];
  833. $sTextMore = '';
  834. if(!$this->isHtml()) {
  835. $iMaxLength = (int)$this->_aSystem['chars_display_max'];
  836. if(strlen($sText) > $iMaxLength) {
  837. $iLength = strpos($sText, ' ', $iMaxLength);
  838. $sTextMore = trim(substr($sText, $iLength));
  839. $sText = trim(substr($sText, 0, $iLength));
  840. }
  841. }
  842. $sText = $this->_prepareTextForOutput($sText, $aCmt['cmt_id']);
  843. $sTextMore = $this->_prepareTextForOutput($sTextMore, $aCmt['cmt_id']);
  844. return array(
  845. 'text' => $sText,
  846. 'bx_if:show_more' => array(
  847. 'condition' => !empty($sTextMore),
  848. 'content' => array(
  849. 'style_prefix' => $this->_sStylePrefix,
  850. 'js_object' => $this->_sJsObjName,
  851. 'text_more' => $sTextMore
  852. )
  853. ),
  854. );
  855. }
  856. }
  857. /** @} */