1
0

BxBaseModTextTemplate.php 40 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049
  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 BaseText Base classes for text modules
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. /**
  12. * Module representation.
  13. */
  14. class BxBaseModTextTemplate extends BxBaseModGeneralTemplate
  15. {
  16. protected $_sUnitClassShowCase;
  17. function __construct(&$oConfig, &$oDb)
  18. {
  19. parent::__construct($oConfig, $oDb);
  20. $this->_sUnitClassShowCase = 'bx-base-unit-showcase bx-base-text-unit-showcase bx-def-margin-sec-bottom';
  21. }
  22. public function addLocationBase()
  23. {
  24. parent::addLocationBase();
  25. $this->addLocation('mod_text', BX_DIRECTORY_PATH_MODULES . 'base' . DIRECTORY_SEPARATOR . 'text' . DIRECTORY_SEPARATOR, BX_DOL_URL_MODULES . 'base/text/');
  26. }
  27. public function getJsCode($sType, $aParams = array(), $bWrap = true)
  28. {
  29. $CNF = &$this->getModule()->_oConfig->CNF;
  30. $aParams = array_merge(array(
  31. 'aHtmlIds' => $this->_oConfig->getHtmlIds(),
  32. 'sEditorId' => isset($CNF['FIELD_TEXT_ID']) ? $CNF['FIELD_TEXT_ID'] : ''
  33. ), $aParams);
  34. return parent::getJsCode($sType, $aParams, $bWrap);
  35. }
  36. function unit ($aData, $isCheckPrivateContent = true, $sTemplateName = 'unit.html', $aParams = array())
  37. {
  38. if(!empty($aParams['template_name']))
  39. $sTemplateName = $aParams['template_name'];
  40. else
  41. $aParams['template_name'] = $sTemplateName;
  42. $sResult = $this->checkPrivacy ($aData, $isCheckPrivateContent, $this->getModule(), $sTemplateName);
  43. if($sResult)
  44. return $sResult;
  45. $aTemplateVars = $this->getUnit($aData, $aParams);
  46. bx_alert($this->getModule()->getName(), 'unit', 0, 0, array(
  47. 'data' => $aData,
  48. 'check_private_content' => $isCheckPrivateContent,
  49. 'template' => $sTemplateName,
  50. 'params' => $aParams,
  51. 'tmpl_name' => &$sTemplateName,
  52. 'tmpl_vars' => &$aTemplateVars
  53. ));
  54. return $this->parseHtmlByName($sTemplateName, $aTemplateVars);
  55. }
  56. function entryAttachments ($aData, $aParams = array())
  57. {
  58. $CNF = &$this->getModule()->_oConfig->CNF;
  59. $aStoragesKeys = array('OBJECT_STORAGE_PHOTOS', 'OBJECT_STORAGE_VIDEOS', 'OBJECT_STORAGE_SOUNDS', 'OBJECT_STORAGE_FILES');
  60. $aStorages = array();
  61. foreach($aStoragesKeys as $sKey)
  62. if(!empty($CNF[$sKey]))
  63. $aStorages[] = $CNF[$sKey];
  64. if(!empty($aStorages))
  65. return $this->entryAttachmentsByStorage($aStorages, $aData, array_merge($aParams, array('filter_field' => '')));
  66. return parent::entryAttachments($aData, $aParams);
  67. }
  68. function entryAuthor ($aData, $iProfileId = false, $sFuncAuthorDesc = 'getAuthorDesc', $sTemplateName = 'author.html', $sFuncAuthorAddon = 'getAuthorAddon')
  69. {
  70. $CNF = &$this->getModule()->_oConfig->CNF;
  71. if (!$iProfileId)
  72. $iProfileId = $aData[$CNF['FIELD_AUTHOR']];
  73. $oProfile = BxDolProfile::getInstanceMagic($iProfileId);
  74. $sName = $oProfile->getDisplayName();
  75. $sAddon = $sFuncAuthorAddon && is_a($oProfile, 'BxDolProfile') ? $this->$sFuncAuthorAddon($aData, $oProfile) : '';
  76. $aVars = array (
  77. 'author_url' => $oProfile->getUrl(),
  78. 'author_thumb_url' => $oProfile->getThumb(),
  79. 'author_unit' => $oProfile->getUnit(0, array('template' => 'unit_wo_info')),
  80. 'author_title' => $sName,
  81. 'author_title_attr' => bx_html_attribute($sName),
  82. 'author_desc' => $sFuncAuthorDesc ? $this->$sFuncAuthorDesc($aData, $oProfile) : '',
  83. 'author_profile_desc' => $this->getAuthorProfileDesc($aData, $oProfile),
  84. 'bx_if:addon' => array (
  85. 'condition' => (bool)$sAddon,
  86. 'content' => array (
  87. 'content' => $sAddon,
  88. ),
  89. ),
  90. );
  91. return $this->parseHtmlByName($sTemplateName, $aVars);
  92. }
  93. public function entryBreadcrumb($aContentInfo, $aTmplVarsItems = array())
  94. {
  95. if(!empty($aTmplVarsItems) && is_array($aTmplVarsItems))
  96. return parent::entryBreadcrumb($aContentInfo, $aTmplVarsItems);
  97. $CNF = &$this->getModule()->_oConfig->CNF;
  98. $aTmplVarsItems = array();
  99. if(!empty($CNF['OBJECT_CATEGORY']) && !empty($CNF['FIELD_CATEGORY'])) {
  100. $oCategory = BxDolCategory::getObjectInstance($CNF['OBJECT_CATEGORY']);
  101. $aTmplVarsItems[] = array(
  102. 'url' => $oCategory->getCategoryUrl($aContentInfo[$CNF['FIELD_CATEGORY']]),
  103. 'title' => $oCategory->getCategoryTitle($aContentInfo[$CNF['FIELD_CATEGORY']])
  104. );
  105. }
  106. $aTmplVarsItems[] = array(
  107. 'url' => BxDolPermalinks::getInstance()->permalink('page.php?i=' . $CNF['URI_VIEW_ENTRY'] . '&id=' . $aContentInfo[$CNF['FIELD_ID']]),
  108. 'title' => bx_process_output($aContentInfo[$CNF['FIELD_TITLE']])
  109. );
  110. return parent::entryBreadcrumb($aContentInfo, $aTmplVarsItems);
  111. }
  112. public function entryPolls($aData)
  113. {
  114. $CNF = &$this->getModule()->_oConfig->CNF;
  115. $aPolls = $this->_oDb->getPolls(array(
  116. 'type' => 'content_id',
  117. 'content_id' => $aData[$CNF['FIELD_ID']],
  118. ));
  119. if(empty($aPolls) || !is_array($aPolls))
  120. return;
  121. $iProfileId = bx_get_logged_profile_id();
  122. $sPolls = '';
  123. foreach($aPolls as $aPoll)
  124. $sPolls .= $this->getPollItem($aPoll, $iProfileId);
  125. if(empty($sPolls))
  126. return '';
  127. $this->_addCssJs();
  128. return $this->getJsCode('poll') . $this->parseHtmlByName('poll_items.html', array(
  129. 'polls' => $sPolls
  130. ));
  131. }
  132. public function entryPollAnswers($aPoll, $bDynamic = false)
  133. {
  134. $sContent = $this->_getPollAnswers($aPoll, $bDynamic);
  135. if(empty($sContent))
  136. return '';
  137. return array(
  138. 'content' => $sContent,
  139. 'menu' => $this->_getPollBlockMenu($aPoll, 'answers')
  140. );
  141. }
  142. public function entryPollResults($aPoll, $bDynamic = false)
  143. {
  144. $sContent = $this->_getPollResults($aPoll, $bDynamic);
  145. if(empty($sContent))
  146. return '';
  147. return array(
  148. 'content' => $sContent,
  149. 'menu' => $this->_getPollBlockMenu($aPoll, 'results')
  150. );
  151. }
  152. public function getPollForm()
  153. {
  154. $aForm = $this->getModule()->getPollForm();
  155. return $this->parseHtmlByName('poll_form.html', array(
  156. 'js_object' => $this->_oConfig->getJsObject('poll'),
  157. 'form_id' => $aForm['form_id'],
  158. 'form' => $aForm['form'],
  159. ));
  160. }
  161. public function getPollField($iContentId = 0, $iProfileId = 0)
  162. {
  163. if(empty($iProfileId))
  164. $iProfileId = bx_get_logged_profile_id();
  165. $aPolls = array();
  166. if(!empty($iContentId))
  167. $aPolls = array_merge($aPolls, $this->_oDb->getPolls(array(
  168. 'type' => 'content_id',
  169. 'content_id' => $iContentId,
  170. )));
  171. $aPolls = array_merge($aPolls, $this->_oDb->getPolls(array(
  172. 'type' => 'author_id',
  173. 'author_id' => $iProfileId,
  174. 'unused' => true
  175. )));
  176. $sPolls = '';
  177. foreach($aPolls as $aPoll)
  178. $sPolls .= $this->getPollItem($aPoll, $iProfileId, array(
  179. 'manage' => true
  180. ));
  181. return $this->parseHtmlByName('poll_form_field.html', array(
  182. 'html_id' => $this->_oConfig->getHtmlIds('add_poll_form_field'),
  183. 'polls' => $sPolls
  184. ));
  185. }
  186. public function getPollItem($mixedPoll, $iProfileId = 0, $aParams = array())
  187. {
  188. $oModule = $this->getModule();
  189. $CNF = &$oModule->_oConfig->CNF;
  190. $aPoll = is_array($mixedPoll) ? $mixedPoll : $this->_oDb->getPolls(array('type' => 'id', 'id' => (int)$mixedPoll));
  191. if(empty($aPoll) || !is_array($aPoll))
  192. return '';
  193. $sJsObject = $this->_oConfig->getJsObject('poll');
  194. $bDynamic = isset($aParams['dynamic']) && $aParams['dynamic'] === true;
  195. $bManage = isset($aParams['manage']) && $aParams['manage'] === true;
  196. $bSwitchMenu = isset($aParams['switch_menu']) ? (bool)$aParams['switch_menu'] : true;
  197. $bForceDisplayAnswers = isset($aParams['force_display_answers']) && (bool)$aParams['force_display_answers'] === true;
  198. $iPollId = (int)$aPoll[$CNF['FIELD_POLL_ID']];
  199. $sPollView = !$bForceDisplayAnswers && $oModule->isPollPerformed($iPollId, $iProfileId) ? 'results' : 'answers';
  200. $sMethod = '_getPoll' . ucfirst($sPollView);
  201. if(!method_exists($this, $sMethod))
  202. return '';
  203. $mixedMenu = '';
  204. if($bSwitchMenu)
  205. $mixedMenu = $this->_getPollBlockMenu($aPoll, $sPollView, array('template' => 'menu_interactive.html'));
  206. return $this->parseHtmlByName('poll_item.html', array(
  207. 'html_id' => $this->_oConfig->getHtmlIds('poll') . $iPollId,
  208. 'bx_if:show_input_hidden' => array(
  209. 'condition' => $bManage,
  210. 'content' => array(
  211. 'name' => $CNF['FIELD_POLL'],
  212. 'id' => $iPollId
  213. )
  214. ),
  215. 'action_menu' => !empty($mixedMenu) ? $mixedMenu->getCode() : '',
  216. 'bx_if:show_action_embed' => array(
  217. 'condition' => $bManage,
  218. 'content' => array(
  219. 'js_object' => $sJsObject,
  220. 'id' => $iPollId
  221. )
  222. ),
  223. 'bx_if:show_action_delete' => array(
  224. 'condition' => $bManage,
  225. 'content' => array(
  226. 'js_object' => $sJsObject,
  227. 'id' => $iPollId,
  228. 'editor_id' => isset($CNF['FIELD_TEXT_ID']) ? $CNF['FIELD_TEXT_ID'] : ''
  229. )
  230. ),
  231. 'text' => bx_process_output($aPoll[$CNF['FIELD_POLL_TEXT']], BX_DATA_TEXT),
  232. 'content' => $this->$sMethod($aPoll, $bDynamic)
  233. ));
  234. }
  235. public function embedPollItem($mixedPoll, $aParams = array())
  236. {
  237. $CNF = &$this->getModule()->_oConfig->CNF;
  238. $sHeader = '';
  239. $sContent = $this->getPollItem($mixedPoll, 0, $aParams);
  240. if(!empty($sContent)) {
  241. $aPoll = is_array($mixedPoll) ? $mixedPoll : $this->_oDb->getPolls(array('type' => 'id', 'id' => (int)$mixedPoll));
  242. $sHeader = strmaxtextlen($aPoll[$CNF['FIELD_POLL_TEXT']], 32, '...');
  243. $sContent = $this->getJsCode('poll') . $sContent;
  244. }
  245. $this->_addCssJs();
  246. $oTemplate = BxDolTemplate::getInstance();
  247. $oTemplate->addCssStyle($CNF['STYLES_POLLS_EMBED_CLASS'], $CNF['STYLES_POLLS_EMBED_CONTENT']);
  248. $oTemplate->setPageNameIndex(BX_PAGE_EMBED);
  249. $oTemplate->setPageHeader($sHeader);
  250. $oTemplate->setPageContent('page_main_code', $sContent);
  251. $oTemplate->getPageCode();
  252. exit;
  253. }
  254. public function embedPollItems($mixedContentInfo, $aParams = array())
  255. {
  256. $CNF = &$this->getModule()->_oConfig->CNF;
  257. $aContentInfo = is_array($mixedContentInfo) ? $mixedContentInfo : $this->_oDb->getContentInfoById((int)$mixedContentInfo);
  258. if(empty($aContentInfo) || !is_array($aContentInfo))
  259. return;
  260. $iContentId = (int)$aContentInfo[$CNF['FIELD_ID']];
  261. $aPolls = $this->_oDb->getPolls(array('type' => 'content_id', 'content_id' => $iContentId));
  262. if(empty($aPolls) || !is_array($aPolls))
  263. return;
  264. $iPolls = 0;
  265. $sContent = '';
  266. foreach($aPolls as $aPoll) {
  267. $sPoll = $this->getPollItem($aPoll, 0, $aParams);
  268. if(empty($sPoll))
  269. continue;
  270. $sContent .= $sPoll;
  271. $iPolls += 1;
  272. }
  273. if(!empty($sContent) && isset($aParams['showcase']) && (bool)$aParams['showcase'] === true) {
  274. $this->addJs(array('flickity/flickity.pkgd.min.js'));
  275. $this->addCss(BX_DIRECTORY_PATH_PLUGINS_PUBLIC . 'flickity/|flickity.css');
  276. $sContent = $this->parseHtmlByName('poll_items_showcase.html', array(
  277. 'js_object' => $this->_oConfig->getJsObject('poll'),
  278. 'html_id' => $this->_oConfig->getHtmlIds('polls_showcase') . $iContentId,
  279. 'type' => $iPolls == 1 ? 'single' : 'multiple',
  280. 'polls' => $sContent
  281. ));
  282. }
  283. $sHeader = '';
  284. if(!empty($sContent)) {
  285. $sHeader = strmaxtextlen($aContentInfo[$CNF['FIELD_TITLE']], 32, '...');
  286. $sContent = $this->getJsCode('poll') . $sContent;
  287. }
  288. $this->_addCssJs();
  289. $oTemplate = BxDolTemplate::getInstance();
  290. $oTemplate->addCssStyle($CNF['STYLES_POLLS_EMBED_CLASS'], $CNF['STYLES_POLLS_EMBED_CONTENT']);
  291. $oTemplate->setPageNameIndex(BX_PAGE_EMBED);
  292. $oTemplate->setPageHeader($sHeader);
  293. $oTemplate->setPageContent('page_main_code', $sContent);
  294. $oTemplate->getPageCode();
  295. exit;
  296. }
  297. protected function _addCssJs()
  298. {
  299. $this->addJs(array(
  300. 'modules/base/text/js/|polls.js',
  301. 'polls.js'
  302. ));
  303. $this->addCss(array('polls.css'));
  304. }
  305. protected function _getPollAnswers($aPoll, $bDynamic = false)
  306. {
  307. $CNF = &$this->getModule()->_oConfig->CNF;
  308. $aAnswers = $this->_oDb->getPollAnswers(array('type' => 'poll_id', 'poll_id' => $aPoll[$CNF['FIELD_POLL_ID']]));
  309. if(empty($aAnswers) || !is_array($aAnswers))
  310. return '';
  311. $aTmplVarsAnswers = array();
  312. foreach($aAnswers as $aAnswer) {
  313. $oVotes = BxDolVote::getObjectInstance($CNF['OBJECT_VOTES_POLL_ANSWERS'], $aAnswer['id']);
  314. $aTmplVarsAnswers[] = array(
  315. 'answer' => $oVotes->getElementBlock(array(
  316. 'dynamic_mode' => $bDynamic
  317. ))
  318. );
  319. }
  320. return $this->parseHtmlByName('poll_item_answers.html', array(
  321. 'html_id' => $this->_oConfig->getHtmlIds('poll_content') . $aPoll[$CNF['FIELD_POLL_ID']],
  322. 'bx_repeat:answers' => $aTmplVarsAnswers
  323. ));
  324. }
  325. protected function _getPollResults($aPoll, $bDynamic = false)
  326. {
  327. $CNF = &$this->getModule()->_oConfig->CNF;
  328. $aAnswers = $this->_oDb->getPollAnswers(array('type' => 'poll_id', 'poll_id' => $aPoll[$CNF['FIELD_POLL_ID']]));
  329. if(empty($aAnswers) || !is_array($aAnswers))
  330. return '';
  331. $iTotal = 0;
  332. foreach($aAnswers as $aAnswer)
  333. $iTotal += $aAnswer['votes'];
  334. $aTmplVarsAnswers = array();
  335. foreach($aAnswers as $aAnswer) {
  336. $oVotes = BxDolVote::getObjectInstance($CNF['OBJECT_VOTES_POLL_ANSWERS'], $aAnswer['id']);
  337. $aVotesParams = array('show_counter_empty' => true, 'show_counter_in_brackets' => false, 'dynamic_mode' => $bDynamic);
  338. $fPercent = $iTotal > 0 ? 100 * (float)$aAnswer['votes']/$iTotal : 0;
  339. $aTmplVarsAnswers[] = array(
  340. 'title' => bx_process_output($aAnswer['title']),
  341. 'width' => (int)round($fPercent) . '%',
  342. 'votes' => $oVotes->getCounter($aVotesParams),
  343. 'percent' => _t($CNF['T']['txt_poll_answer_vote_percent'], $iTotal > 0 ? round($fPercent, 2) : 0)
  344. );
  345. }
  346. return $this->parseHtmlByName('poll_item_results.html', array(
  347. 'html_id' => $this->_oConfig->getHtmlIds('poll_content') . $aPoll[$CNF['FIELD_POLL_ID']],
  348. 'bx_repeat:answers' => $aTmplVarsAnswers,
  349. ));
  350. }
  351. protected function _getPollBlockMenu($aPoll, $sSelected = '', $aParams = array())
  352. {
  353. $oModule = $this->getModule();
  354. $CNF = &$oModule->_oConfig->CNF;
  355. $sPostfix = '-' . time() . rand(0, PHP_INT_MAX);
  356. $sJsObject = $this->_oConfig->getJsObject('poll');
  357. $iPollId = $aPoll[$CNF['FIELD_POLL_ID']];
  358. $aViews = array(
  359. 'answers' => true,
  360. 'results' => $CNF['PARAM_POLL_HIDDEN_RESULTS'] === false || $oModule->isPollPerformed($iPollId)
  361. );
  362. $aMenu = array();
  363. foreach($aViews as $sView => $bActive) {
  364. if(!$bActive)
  365. continue;
  366. $sId = $this->_oConfig->getHtmlIds('poll_view_link_' . $sView) . $iPollId;
  367. if(!empty($sSelected) && $sSelected == $sView)
  368. $sSelected = $sId;
  369. $aMenu[] = array(
  370. 'id' => $sId,
  371. 'name' => $sId,
  372. 'class' => '',
  373. 'link' => 'javascript:void(0)',
  374. 'onclick' => 'javascript:' . $sJsObject . '.changePollView(this, \'' . $sView . '\', ' . $iPollId . ')',
  375. 'target' => '_self',
  376. 'title_attr' => _t($CNF['T']['txt_poll_menu_view_' . $sView]),
  377. 'title' => $this->parseIcon($CNF['ICON_POLLS_' . strtoupper($sView)])
  378. );
  379. }
  380. if(count($aMenu) <= 1)
  381. return '';
  382. $oMenu = new BxTemplMenuInteractive(array(
  383. 'template' => !empty($aParams['template']) ? $aParams['template'] : 'menu_interactive_vertical.html',
  384. 'menu_id' => $this->_oConfig->getHtmlIds('poll_view_menu') . $sPostfix,
  385. 'menu_items' => $aMenu
  386. ));
  387. if(!empty($sSelected))
  388. $oMenu->setSelected('', $sSelected);
  389. return $oMenu;
  390. }
  391. public function getAttachLinkForm($iContentId = 0)
  392. {
  393. $sStylePrefix = $this->_oConfig->getPrefix('style');
  394. $sJsObject = $this->_oConfig->getJsObject('links');
  395. $aForm = $this->getModule()->getFormAttachLink($iContentId);
  396. return $this->parseHtmlByName('attach_link_form.html', array(
  397. 'style_prefix' => $sStylePrefix,
  398. 'js_object' => $sJsObject,
  399. 'form_id' => $aForm['form_id'],
  400. 'form' => $aForm['form'],
  401. ));
  402. }
  403. public function getAttachLinkField($iUserId, $iContentId = 0)
  404. {
  405. $sStylePrefix = $this->_oConfig->getPrefix('style');
  406. if(!$iContentId)
  407. $aLinks = $this->_oDb->getUnusedLinks($iUserId);
  408. else
  409. $aLinks = $this->_oDb->getLinks($iContentId);
  410. $sLinks = '';
  411. foreach($aLinks as $aLink)
  412. $sLinks .= $this->getAttachLinkItem($iUserId, $aLink);
  413. return $this->parseHtmlByName('attach_link_form_field.html', array(
  414. 'html_id' => $this->_oConfig->getHtmlIds('attach_link_form_field') . $iContentId,
  415. 'style_prefix' => $sStylePrefix,
  416. 'links' => $sLinks
  417. ));
  418. }
  419. public function getAttachLinkItem($iUserId, $mixedLink)
  420. {
  421. $CNF = &$this->getModule()->_oConfig->CNF;
  422. $aLink = is_array($mixedLink) ? $mixedLink : $this->_oDb->getLinksBy(array('type' => 'id', 'id' => (int)$mixedLink, 'profile_id' => $iUserId));
  423. if(empty($aLink) || !is_array($aLink))
  424. return '';
  425. $sLinkIdPrefix = $this->_oConfig->getHtmlIds('attach_link_item');
  426. $sStylePrefix = $this->_oConfig->getPrefix('style');
  427. $sClass = $sStylePrefix . '-al-item';
  428. $sJsObject = $this->_oConfig->getJsObject('links');
  429. $oEmbed = BxDolEmbed::getObjectInstance();
  430. $bEmbed = $oEmbed !== false;
  431. $sThumbnail = '';
  432. $aLinkAttrs = array();
  433. if(!$bEmbed) {
  434. $aLinkAttrs = array(
  435. 'title' => bx_html_attribute($aLink['title'])
  436. );
  437. if(!$this->_oConfig->isEqualUrls(BX_DOL_URL_ROOT, $aLink['url'])) {
  438. $aLinkAttrs['target'] = '_blank';
  439. if($this->_oDb->getParam('sys_add_nofollow') == 'on')
  440. $aLinkAttrs['rel'] = 'nofollow';
  441. }
  442. if((int)$aLink['media_id'] != 0)
  443. $sThumbnail = BxDolTranscoderImage::getObjectInstance($CNF['OBJECT_IMAGES_TRANSCODER_PREVIEW_PHOTOS'])->getFileUrl($aLink['media_id']);
  444. }
  445. else
  446. $sClass .= ' embed';
  447. return $this->parseHtmlByName('attach_link_item.html', array(
  448. 'html_id' => $sLinkIdPrefix . $aLink['id'],
  449. 'style_prefix' => $sStylePrefix,
  450. 'class' => $sClass,
  451. 'js_object' => $sJsObject,
  452. 'id' => $aLink['id'],
  453. 'bx_if:show_embed_outer' => array(
  454. 'condition' => $bEmbed,
  455. 'content' => array(
  456. 'style_prefix' => $sStylePrefix,
  457. 'embed' => $bEmbed ? $oEmbed->getLinkHTML($aLink['url'], $aLink['title'], 300) : '',
  458. )
  459. ),
  460. 'bx_if:show_embed_inner' => array(
  461. 'condition' => !$bEmbed,
  462. 'content' => array(
  463. 'style_prefix' => $sStylePrefix,
  464. 'bx_if:show_thumbnail' => array(
  465. 'condition' => !empty($sThumbnail),
  466. 'content' => array(
  467. 'style_prefix' => $sStylePrefix,
  468. 'thumbnail' => $sThumbnail
  469. )
  470. ),
  471. 'url' => $aLink['url'],
  472. 'link' => $this->parseLink($aLink['url'], $aLink['title'], $aLinkAttrs)
  473. )
  474. ),
  475. ));
  476. }
  477. public function getEventLinks($iContentId)
  478. {
  479. $CNF = &$this->getModule()->_oConfig->CNF;
  480. $aLinks = $this->_oDb->getLinks($iContentId);
  481. if(empty($aLinks) || !is_array($aLinks))
  482. return array();
  483. $oTranscoder = BxDolTranscoderImage::getObjectInstance($CNF['OBJECT_IMAGES_TRANSCODER_PREVIEW_PHOTOS']);
  484. $aResult = array();
  485. foreach($aLinks as $aLink)
  486. $aResult[] = array(
  487. 'url' => $aLink['url'],
  488. 'title' => $aLink['title'],
  489. 'text' => $aLink['text'],
  490. 'thumbnail' => (int)$aLink['media_id'] != 0 ? $oTranscoder->getFileUrl($aLink['media_id']) : ''
  491. );
  492. return $aResult;
  493. }
  494. public function getTmplVarsText($aData)
  495. {
  496. $CNF = &$this->getModule()->_oConfig->CNF;
  497. $sStylePrefix = $this->_oConfig->getPrefix('style');
  498. $aVars = parent::getTmplVarsText($aData);
  499. $sImage = '';
  500. $mixedImage = $this->_getHeaderImage($aData);
  501. if($mixedImage !== false) {
  502. if(!empty($mixedImage['object']))
  503. $o = BxDolStorage::getObjectInstance($mixedImage['object']);
  504. else if(!empty($mixedImage['transcoder']))
  505. $o = BxDolTranscoder::getObjectInstance($mixedImage['transcoder']);
  506. if($o)
  507. $sImage = $o->getFileUrlById($mixedImage['id']);
  508. }
  509. $sAddClassPicture = "";
  510. $sAddCode = "";
  511. $oModule = $this->getModule();
  512. $bIsAllowEditPicture = CHECK_ACTION_RESULT_ALLOWED === $oModule->checkAllowedEdit($aData);
  513. if(isset($CNF['FIELD_THUMB']) && isset($CNF['OBJECT_UPLOADERS']) && isset($CNF['OBJECT_STORAGE']) && isset($CNF['OBJECT_IMAGES_TRANSCODER_PREVIEW'])){
  514. bx_alert('system', 'image_editor', 0, 0, array(
  515. 'module' => $oModule->getName(),
  516. 'content_id' => $aData[$CNF['FIELD_ID']],
  517. 'image_type' => 'header_image',
  518. 'image_url' => $sImage,
  519. 'is_allow_edit' => $bIsAllowEditPicture,
  520. 'uploader' => !empty($CNF['OBJECT_UPLOADERS']) && is_array($CNF['OBJECT_UPLOADERS']) ? $CNF['OBJECT_UPLOADERS'][0] : '',
  521. 'storage' => isset($CNF['OBJECT_STORAGE']) ? $CNF['OBJECT_STORAGE'] : '',
  522. 'transcoder' => isset($CNF['OBJECT_IMAGES_TRANSCODER_COVER']) ? $CNF['OBJECT_IMAGES_TRANSCODER_COVER'] : '',
  523. 'field' => isset($CNF['FIELD_THUMB']) ? $CNF['FIELD_THUMB'] : '',
  524. 'is_background' => false,
  525. 'add_class' => &$sAddClassPicture,
  526. 'add_code' => &$sAddCode
  527. ));
  528. }
  529. $aVars['content_description_before'] = '';
  530. $aVars['content_description_after'] = '';
  531. $aVars['bx_if:show_image'] = array(
  532. 'condition' => !empty($sImage),
  533. 'content' => array(
  534. 'entry_image' => $sImage,
  535. 'add_class' => $sAddClassPicture,
  536. 'img_class' => $sAddClassPicture != '' ? 'bx-media-editable-src' : '',
  537. 'additional_code' => $sAddCode,
  538. )
  539. );
  540. $aTmplVarsLinks = [];
  541. if(isset($CNF['FIELD_LINK'])){
  542. $aLinks = $this->getEventLinks($aData[$CNF['FIELD_ID']]);
  543. $sClass = $sStylePrefix . '-al-item';
  544. $bAddNofollow = $this->_oDb->getParam('sys_add_nofollow') == 'on';
  545. foreach($aLinks as $aLink) {
  546. $sLink = '';
  547. $oEmbed = BxDolEmbed::getObjectInstance();
  548. if ($oEmbed) {
  549. $sLink = $this->parseHtmlByName('link_embed_provider.html', array(
  550. 'style_prefix' => $sStylePrefix,
  551. 'embed' => $oEmbed->getLinkHTML($aLink['url'], $aLink['title']),
  552. ));
  553. }
  554. else {
  555. $aLinkAttrs = array(
  556. 'title' => $aLink['title']
  557. );
  558. if(!$this->_oConfig->isEqualUrls(BX_DOL_URL_ROOT, $aLink['url'])) {
  559. $aLinkAttrs['target'] = '_blank';
  560. if($bAddNofollow)
  561. $aLinkAttrs['rel'] = 'nofollow';
  562. }
  563. $sLinkAttrs = '';
  564. foreach($aLinkAttrs as $sKey => $sValue)
  565. $sLinkAttrs .= ' ' . $sKey . '="' . bx_html_attribute($sValue) . '"';
  566. $sLink = $this->parseHtmlByName('link_embed_common.html', array(
  567. 'bx_if:show_thumbnail' => [
  568. 'condition' => !empty($aLink['thumbnail']),
  569. 'content' => [
  570. 'style_prefix' => $sStylePrefix,
  571. 'thumbnail' => $aLink['thumbnail'],
  572. 'link' => !empty($aLink['url']) ? $aLink['url'] : 'javascript:void(0)',
  573. 'attrs' => $sLinkAttrs
  574. ]
  575. ],
  576. 'link' => !empty($aLink['url']) ? $aLink['url'] : 'javascript:void(0)',
  577. 'attrs' => $sLinkAttrs,
  578. 'content' => $aLink['title'],
  579. 'bx_if:show_text' => [
  580. 'condition' => !empty($aLink['text']),
  581. 'content' => [
  582. 'style_prefix' => $sStylePrefix,
  583. 'text' => $aLink['text']
  584. ]
  585. ]
  586. ));
  587. }
  588. $aTmplVarsLinks[] = [
  589. 'style_prefix' => $sStylePrefix,
  590. 'link' => $sLink
  591. ];
  592. }
  593. }
  594. $aVars['bx_if:show_links'] = [
  595. 'condition' => count($aTmplVarsLinks) > 0,
  596. 'content' => [
  597. 'style_prefix' => $sStylePrefix,
  598. 'bx_repeat:links' => $aTmplVarsLinks
  599. ]
  600. ];
  601. if(!empty($CNF['OBJECT_REACTIONS']) && ($oReactions = BxDolVote::getObjectInstance($CNF['OBJECT_REACTIONS'], $aData[$CNF['FIELD_ID']])) !== false)
  602. $aVars['content_description_after'] .= $oReactions->getCounter([
  603. 'show_counter' => true,
  604. 'show_counter_empty' => false
  605. ]);
  606. return $aVars;
  607. }
  608. function getAuthorDesc($aData, $oProfile)
  609. {
  610. $CNF = &$this->getModule()->_oConfig->CNF;
  611. $aItem = array(
  612. 'bx_if:text' => array(
  613. 'condition' => false,
  614. 'content' => array(
  615. 'content' => ''
  616. )
  617. ),
  618. 'bx_if:link' => array(
  619. 'condition' => false,
  620. 'content' => array(
  621. 'link' => '',
  622. 'content' => ''
  623. )
  624. )
  625. );
  626. $aTmplVarsItems = array();
  627. if(!empty($CNF['FIELD_ADDED']) && !empty($aData[$CNF['FIELD_ADDED']]))
  628. $aTmplVarsItems[] = array_merge($aItem, array('bx_if:text' => array(
  629. 'condition' => true,
  630. 'content' => array(
  631. 'content' => bx_time_js($aData[$CNF['FIELD_ADDED']], BX_FORMAT_DATE)
  632. )
  633. )));
  634. if(!empty($CNF['URI_AUTHOR_ENTRIES']))
  635. $aTmplVarsItems[] = array_merge($aItem, array('bx_if:link' => array(
  636. 'condition' => true,
  637. 'content' => array(
  638. 'link' => BxDolPermalinks::getInstance()->permalink('page.php?i=' . $CNF['URI_AUTHOR_ENTRIES'] . '&profile_id=' . $oProfile->id()),
  639. 'content' => _t($CNF['T']['txt_all_entries_by'], $this->getModule()->_oDb->getEntriesNumByAuthor($oProfile->id()))
  640. )
  641. )));
  642. return $this->parseHtmlByName('author_desc.html', array(
  643. 'bx_repeat:items' => $aTmplVarsItems
  644. ));
  645. }
  646. function getAuthorProfileDesc ($aData, $oProfile)
  647. {
  648. $aSnippetMeta = $this->getProfileSnippetMenu($aData);
  649. if(empty($aSnippetMeta) || !is_array($aSnippetMeta) || !isset($aSnippetMeta['meta']))
  650. return '';
  651. return $aSnippetMeta['meta'];
  652. }
  653. function getProfileSnippetMenu ($aData)
  654. {
  655. $CNF = &$this->getModule()->_oConfig->CNF;
  656. if (!($oProfile = BxDolProfile::getInstance($aData[$CNF['FIELD_AUTHOR']])))
  657. return array();
  658. return bx_srv($oProfile->getModule(), 'get_snippet_menu_vars', array($oProfile->id()));
  659. }
  660. function getAuthorAddon ($aData, $oProfile)
  661. {
  662. return '';
  663. }
  664. protected function checkPrivacy ($aData, $isCheckPrivateContent, $oModule, $sTemplateName = '')
  665. {
  666. if ($isCheckPrivateContent && CHECK_ACTION_RESULT_ALLOWED !== ($sMsg = $oModule->checkAllowedView($aData))) {
  667. $aVars = array (
  668. 'summary' => $sMsg,
  669. );
  670. return $this->parseHtmlByName($sTemplateName ? str_replace('.html', '_private.html', $sTemplateName) : 'unit_private.html', $aVars);
  671. }
  672. return '';
  673. }
  674. protected function getUnitThumbAndGallery ($aData)
  675. {
  676. $CNF = &BxDolModule::getInstance($this->MODULE)->_oConfig->CNF;
  677. $sPhotoThumb = '';
  678. $sPhotoGallery = '';
  679. if(!empty($CNF['FIELD_THUMB']) && !empty($aData[$CNF['FIELD_THUMB']])) {
  680. $oImagesTranscoder = BxDolTranscoderImage::getObjectInstance($CNF['OBJECT_IMAGES_TRANSCODER_PREVIEW']);
  681. if ($oImagesTranscoder)
  682. $sPhotoThumb = $oImagesTranscoder->getFileUrl($aData[$CNF['FIELD_THUMB']]);
  683. $oImagesTranscoder = BxDolTranscoderImage::getObjectInstance($CNF['OBJECT_IMAGES_TRANSCODER_GALLERY']);
  684. if ($oImagesTranscoder)
  685. $sPhotoGallery = $oImagesTranscoder->getFileUrl($aData[$CNF['FIELD_THUMB']]);
  686. else
  687. $sPhotoGallery = $sPhotoThumb;
  688. }
  689. return array($sPhotoThumb, $sPhotoGallery);
  690. }
  691. protected function getUnit ($aData, $aParams = array())
  692. {
  693. $CNF = &$this->_oConfig->CNF;
  694. $oModule = $this->getModule();
  695. // get thumb url
  696. list($sPhotoThumb, $sPhotoGallery) = $this->getUnitThumbAndGallery($aData);
  697. if ($sPhotoGallery == '' && isset($CNF['PARAM_USE_GALERY_AS_COVER']) && getParam($CNF['PARAM_USE_GALERY_AS_COVER']) == 'on'){
  698. if(!empty($CNF['OBJECT_STORAGE_PHOTOS'])){
  699. $sStorage = $CNF['OBJECT_STORAGE_PHOTOS'];
  700. $oStorage = BxDolStorage::getObjectInstance($sStorage);
  701. list($oTranscoder, $oTranscoderView) = $this->getAttachmentsImagesTranscoders($sStorage);
  702. $aGhostFiles = $oStorage->getGhosts($oModule->serviceGetContentOwnerProfileId($aData[$CNF['FIELD_ID']]), $aData[$CNF['FIELD_ID']]);
  703. if(!empty($aGhostFiles) && is_array($aGhostFiles)) {
  704. $aGhostFile = array_shift($aGhostFiles);
  705. $sPhotoThumb = $oTranscoderView->getFileUrl($aGhostFile['id']);
  706. $sPhotoGallery = $oTranscoder->getFileUrl($aGhostFile['id']);
  707. }
  708. }
  709. }
  710. // get entry url
  711. $sUrl = BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=' . $CNF['URI_VIEW_ENTRY'] . '&id=' . $aData[$CNF['FIELD_ID']]);
  712. $oProfile = BxDolProfile::getInstanceMagic($aData[$CNF['FIELD_AUTHOR']]);
  713. $sTitle = $this->getTitle($aData);
  714. $sText = $this->getText($aData);
  715. $sSummary = $this->getSummary($aData, $sTitle, $sText, $sUrl);
  716. $sSummaryPlain = isset($CNF['PARAM_CHARS_SUMMARY_PLAIN']) && $CNF['PARAM_CHARS_SUMMARY_PLAIN'] ? BxTemplFunctions::getInstance()->getStringWithLimitedLength(strip_tags($sSummary), (int)getParam($CNF['PARAM_CHARS_SUMMARY_PLAIN'])) : '';
  717. if(!empty($CNF['OBJECT_METATAGS'])) {
  718. $oMetatags = BxDolMetatags::getObjectInstance($CNF['OBJECT_METATAGS']);
  719. $sText = $oMetatags->metaParse($aData[$CNF['FIELD_ID']], $sText);
  720. }
  721. $aTmplVarsMeta = array();
  722. if(!empty($CNF['OBJECT_MENU_SNIPPET_META'])) {
  723. $oMenuMeta = BxDolMenu::getObjectInstance($CNF['OBJECT_MENU_SNIPPET_META'], $this);
  724. if($oMenuMeta) {
  725. $oMenuMeta->setContentId($aData[$CNF['FIELD_ID']]);
  726. $aTmplVarsMeta = array(
  727. 'meta' => $oMenuMeta->getCode()
  728. );
  729. }
  730. }
  731. $bBadgesSingle = isset($aParams['badges_single']) ? $aParams['badges_single'] : false;
  732. $bBadgesCompact = isset($aParams['badges_compact']) ? $aParams['badges_compact'] : false;
  733. $aTmplVars = array (
  734. 'class' => $this->_getUnitClass($aData,(isset($aParams['template_name']) ? $aParams['template_name'] : '')),
  735. 'id' => $aData[$CNF['FIELD_ID']],
  736. 'content_url' => $sUrl,
  737. 'title' => $sTitle,
  738. 'badges' => $oModule->serviceGetBadges($aData[$CNF['FIELD_ID']], $bBadgesSingle, $bBadgesCompact),
  739. 'title_attr' => bx_html_attribute($sTitle),
  740. 'summary' => $sSummary,
  741. 'text' => $sText,
  742. 'author' => $oProfile->getDisplayName(),
  743. 'author_url' => $oProfile->getUrl(),
  744. 'author_icon' => $oProfile->getIcon(),
  745. 'author_thumb' => $oProfile->getThumb(),
  746. 'author_avatar' => $oProfile->getAvatar(),
  747. 'entry_posting_date' => bx_time_js($aData[$CNF['FIELD_ADDED']], BX_FORMAT_DATE),
  748. 'module_name' => _t($CNF['T']['txt_sample_single']),
  749. 'ts' => $aData[$CNF['FIELD_ADDED']],
  750. 'bx_if:meta' => array(
  751. 'condition' => !empty($aTmplVarsMeta),
  752. 'content' => $aTmplVarsMeta
  753. ),
  754. 'bx_if:thumb' => array (
  755. 'condition' => $sPhotoThumb,
  756. 'content' => array (
  757. 'title' => $sTitle,
  758. 'summary_attr' => bx_html_attribute($sSummaryPlain),
  759. 'content_url' => $sUrl,
  760. 'thumb_url' => $sPhotoThumb ? $sPhotoThumb : '',
  761. 'gallery_url' => $sPhotoGallery ? $sPhotoGallery : '',
  762. 'strecher' => str_repeat('&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ', 40),
  763. ),
  764. ),
  765. 'bx_if:no_thumb' => array (
  766. 'condition' => !$sPhotoThumb,
  767. 'content' => array (
  768. 'module_icon' => $CNF['ICON'],
  769. 'content_url' => $sUrl,
  770. 'summary_plain' => $sSummaryPlain,
  771. 'strecher' => mb_strlen($sSummaryPlain) > 240 ? '' : str_repeat('&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ', round((240 - mb_strlen($sSummaryPlain)) / 6)),
  772. ),
  773. ),
  774. );
  775. if(isset($aParams['template_vars']) && is_array($aParams['template_vars']))
  776. $aTmplVars = array_merge($aTmplVars, $aParams['template_vars']);
  777. // generate html
  778. return $aTmplVars;
  779. }
  780. protected function getAttachmentsImagesTranscoders ($sStorage = '')
  781. {
  782. $CNF = &$this->getModule()->_oConfig->CNF;
  783. $oTranscoder = null;
  784. $oTranscoderView = null;
  785. if(isset($CNF['OBJECT_STORAGE_PHOTOS']) && $CNF['OBJECT_STORAGE_PHOTOS'] == $sStorage) {
  786. if(!empty($CNF['OBJECT_IMAGES_TRANSCODER_PREVIEW_PHOTOS']))
  787. $oTranscoder = BxDolTranscoderImage::getObjectInstance($CNF['OBJECT_IMAGES_TRANSCODER_PREVIEW_PHOTOS']);
  788. if(!empty($CNF['OBJECT_IMAGES_TRANSCODER_VIEW_PHOTOS']))
  789. $oTranscoderView = BxDolTranscoderImage::getObjectInstance($CNF['OBJECT_IMAGES_TRANSCODER_VIEW_PHOTOS']);
  790. else if(!empty($CNF['OBJECT_IMAGES_TRANSCODER_GALLERY_PHOTOS']))
  791. $oTranscoderView = BxDolTranscoderImage::getObjectInstance($CNF['OBJECT_IMAGES_TRANSCODER_GALLERY_PHOTOS']);
  792. }
  793. else if(isset($CNF['OBJECT_STORAGE_FILES']) && $CNF['OBJECT_STORAGE_FILES'] == $sStorage) {
  794. if(!empty($CNF['OBJECT_IMAGES_TRANSCODER_PREVIEW_FILES']))
  795. $oTranscoder = BxDolTranscoderImage::getObjectInstance($CNF['OBJECT_IMAGES_TRANSCODER_PREVIEW_FILES']);
  796. if(!empty($CNF['OBJECT_IMAGES_TRANSCODER_GALLERY_FILES']))
  797. $oTranscoderView = BxDolTranscoderImage::getObjectInstance($CNF['OBJECT_IMAGES_TRANSCODER_GALLERY_FILES']);
  798. }
  799. else
  800. list($oTranscoder, $oTranscoderView) = parent::getAttachmentsImagesTranscoders($sStorage);
  801. return array($oTranscoder, $oTranscoderView);
  802. }
  803. protected function _getUnitName($aData, $sTemplateName = 'unit.html')
  804. {
  805. return trim(str_replace('.html', '', $sTemplateName));
  806. }
  807. protected function _getUnitClass($aData, $sTemplateName = 'unit.html')
  808. {
  809. $sResult = '';
  810. switch($sTemplateName) {
  811. case 'unit_showcase.html':
  812. $sResult = $this->_sUnitClassShowCase;
  813. break;
  814. }
  815. return $sResult;
  816. }
  817. protected function _getHeaderImage($aData)
  818. {
  819. return $this->getModule()->getEntryImageData($aData);
  820. }
  821. function mediaExif ($aMediaInfo, $iProfileId = false, $sFuncAuthorDesc = '', $sTemplateName = 'media-exif.html')
  822. {
  823. if (empty($aMediaInfo['exif']))
  824. return '';
  825. $a = unserialize($aMediaInfo['exif']);
  826. $s = '';
  827. if (!empty($a['Make'])) {
  828. $oModule = BxDolModule::getInstance($this->MODULE);
  829. $CNF = &$oModule->_oConfig->CNF;
  830. $sCamera = BxDolMetatags::keywordsCameraModel($a);
  831. if (!empty($CNF['OBJECT_METATAGS_MEDIA_CAMERA'])) {
  832. $oMetatags = BxDolMetatags::getObjectInstance($CNF['OBJECT_METATAGS_MEDIA_CAMERA']);
  833. if ($oMetatags->keywordsIsEnabled()) {
  834. $sCamera = $oMetatags->keywordsParseOne($aMediaInfo['id'], $sCamera);
  835. }
  836. }
  837. if (!empty($sCamera))
  838. $s .= $this->parseHtmlByName('media-exif-value.html', array(
  839. 'key' => _t($CNF['T']['txt_media_exif_camera']),
  840. 'val' => $sCamera,
  841. ));
  842. }
  843. if (!empty($a['FocalLength']))
  844. $s .= $this->parseHtmlByName('media-exif-value.html', array(
  845. 'key' => _t($CNF['T']['txt_media_exif_focal_length']),
  846. 'val' => _t($CNF['T']['txt_media_exif_focal_length_value'], $a['FocalLength']),
  847. ));
  848. if (!empty($a['COMPUTED']['ApertureFNumber']))
  849. $s .= $this->parseHtmlByName('media-exif-value.html', array(
  850. 'key' => _t($CNF['T']['txt_media_exif_aperture']),
  851. 'val' => $a['COMPUTED']['ApertureFNumber'],
  852. ));
  853. if (!empty($a['ExposureTime']))
  854. $s .= $this->parseHtmlByName('media-exif-value.html', array(
  855. 'key' => _t($CNF['T']['txt_media_exif_shutter_speed']),
  856. 'val' => _t($CNF['T']['txt_media_exif_shutter_speed_value'], $a['ExposureTime']),
  857. ));
  858. if (!empty($a['ISOSpeedRatings']))
  859. $s .= $this->parseHtmlByName('media-exif-value.html', array(
  860. 'key' => _t($CNF['T']['txt_media_exif_iso']),
  861. 'val' => $a['ISOSpeedRatings'],
  862. ));
  863. if (empty($s))
  864. return '';
  865. return $this->parseHtmlByName($sTemplateName, array('content' => $s));
  866. }
  867. }
  868. /** @} */