function getDesignBoxMenu($sId, $mixedItems, $iIndex = 1) { $oTemplate = BxDolStudioTemplate::getInstance(); if (is_array($mixedItems)) { $mixedButtons = array(); foreach ($mixedItems as $sId => $aAction) { $sClass = isset($aAction['class']) ? ' class="' . bx_html_attribute($aAction['class']) . '"' : ''; $mixedButtons[] = array('id' => $sId, 'title' => bx_process_output(_t($aAction['title'])), 'class' => $sClass, 'icon' => isset($aAction['icon']) ? '<img' . $sClass . ' src="' . bx_html_attribute($aAction['icon']) . '" />' : '', 'href' => isset($aAction['href']) ? ' href="' . bx_html_attribute($aAction['href']) . '"' : '', 'target' => isset($aAction['target']) ? ' target="' . bx_html_attribute($aAction['target']) . '"' : '', 'on_click' => isset($aAction['onclick']) ? ' onclick="' . bx_html_attribute($aAction['onclick']) . '"' : '', 'bx_if:hide_active' => array('condition' => !isset($aAction['active']) || $aAction['active'] != 1, 'content' => array()), 'bx_if:hide_inactive' => array('condition' => isset($aAction['active']) && $aAction['active'] == 1, 'content' => array())); } } else { $mixedButtons = $mixedItems; } return $oTemplate->parseHtmlByName('designbox_menu_' . $iIndex . '.html', array('id' => $sId, 'bx_repeat:actions' => $mixedButtons)); }
function unit($aData, $isCheckPrivateContent = true, $sTemplateName = 'unit.html') { $this->getCssJs(); if ($sTemplateName == 'unit.html') { return $this->getPost($aData); } $oModule = $this->getModule(); $CNF =& $this->_oConfig->CNF; if ($isCheckPrivateContent && CHECK_ACTION_RESULT_ALLOWED !== ($sMsg = $oModule->isAllowedView($aData))) { $aVars = array('summary' => $sMsg); return $this->parseHtmlByName('unit_private.html', $aVars); } list($sAuthorName, $sAuthorUrl, $sAuthorIcon) = $oModule->getUserInfo($aData['object_id']); $bAuthorIcon = !empty($sAuthorIcon); // generate html $aVars = array('id' => $aData['id'], 'author' => $sAuthorName, 'author_url' => $sAuthorUrl, 'title' => bx_process_output($aData['title']), 'item_url' => $this->_oConfig->getItemViewUrl($aData), 'item_date' => bx_time_js($aData['date'], BX_FORMAT_DATE), 'module_name' => _t($CNF['T']['txt_sample_single_ext']), 'ts' => $aData['date'], 'bx_if:show_icon' => array('condition' => $bAuthorIcon, 'content' => array('author_icon' => $sAuthorIcon)), 'bx_if:show_icon_empty' => array('condition' => !$bAuthorIcon, 'content' => array())); return $this->parseHtmlByName($sTemplateName, $aVars); }
/** * SERVICE METHODS */ public function serviceGetBlockForm() { $aDefaultFields = array('name', 'email', 'subject', 'body', 'do_submit'); $mixedAllowed = $this->isAllowedContact(); if ($mixedAllowed !== true) { return array('content' => MsgBox($mixedAllowed)); } $sResult = ''; bx_import('BxDolForm'); $oForm = BxDolForm::getObjectInstance($this->_oConfig->getObject('form_contact'), $this->_oConfig->getObject('form_display_contact_send'), $this->_oTemplate); $oForm->initChecker(); if ($oForm->isSubmittedAndValid()) { $iId = $oForm->insert(array('uri' => $oForm->generateUri(), 'date' => time())); if ($iId !== false) { $sCustomFields = ''; $aCustomFields = array(); foreach ($oForm->aInputs as $aInput) { if (in_array($aInput['name'], $aDefaultFields)) { continue; } $aCustomFields[$aInput['name']] = bx_process_output($oForm->getCleanValue($aInput['name'])); $sCustomFields .= $aInput['caption'] . ': ' . $aCustomFields[$aInput['name']] . '<br />'; } $aTemplateKeys = array('SenderName' => bx_process_output($oForm->getCleanValue('name')), 'SenderEmail' => bx_process_output($oForm->getCleanValue('email')), 'MessageSubject' => bx_process_output($oForm->getCleanValue('subject')), 'MessageBody' => bx_process_output(nl2br($oForm->getCleanValue('body')), BX_DATA_TEXT_MULTILINE), 'CustomFields' => $sCustomFields); $aTemplateKeys = array_merge($aTemplateKeys, $aCustomFields); bx_import('BxDolEmailTemplates'); $aMessage = BxDolEmailTemplates::getInstance()->parseTemplate('bx_contact_contact_form_message', $aTemplateKeys); $sResult = ''; $sRecipientEmail = $this->_oConfig->getEmail(); if (sendMail($sRecipientEmail, $aMessage['Subject'], $aMessage['Body'], 0, array(), BX_EMAIL_SYSTEM)) { $this->onContact(); $sResult = '_ADM_PROFILE_SEND_MSG'; } else { $sResult = '_Email sent failed'; } $sResult = MsgBox(_t($sResult)); } } return array('content' => $sResult . $oForm->getCode()); }
/** * page code function */ function PageCompMainCode() { ob_start(); if (bx_get('my_textarea')) { echo 'Submitted data:<hr class="bx-def-hr" />' . bx_process_output(bx_get('my_textarea')) . '<hr class="bx-def-hr" />'; } echo '<form method="post" id="my_form">'; // form must have id echo '<textarea id="my_textarea" name="my_textarea" rows="20" cols="80">some text here</textarea>'; // print text area element echo '<input type="submit" value="Submit" class="bx-btn bx-def-margin-sec-top" style="float:none;" />'; echo '</form>'; bx_import('BxDolEditor'); // import editor class $oEditor = BxDolEditor::getObjectInstance(); // get default editor object instance if ($oEditor) { // check if editor is available for using echo $oEditor->attachEditor('#my_textarea'); } // output HTML which will automatically apply editor to textarea element by its id // print all available editors and editors view modes below echo '<hr class="bx-def-hr" />'; $aEditors = array('sys_tinymce'); $aViewModes = array(BX_EDITOR_MINI => 'Mini', BX_EDITOR_STANDARD => 'Standard', BX_EDITOR_FULL => 'Full'); foreach ($aViewModes as $iViewMode => $sViewModeHeader) { echo "<h1>{$sViewModeHeader}</h1>"; foreach ($aEditors as $sEditor) { $sId = 'textarea_' . $sEditor . '_' . $iViewMode; echo '<textarea id="' . $sId . '" name="' . $sId . '" rows="20" cols="80">some text here</textarea>'; $oEditor = BxDolEditor::getObjectInstance($sEditor); if (!$oEditor) { continue; } echo $oEditor->attachEditor('#' . $sId, $iViewMode); echo '<hr class="bx-def-hr" />'; } } return DesignBoxContent("Visual editor", ob_get_clean(), BX_DB_PADDING_DEF); }
public function serviceGetBlockFormRequest() { if (!$this->_oConfig->isRequestInvite()) { return array('content' => MsgBox(_t('_bx_invites_err_not_available'))); } $mixedAllowed = $this->isAllowedRequest(0); if ($mixedAllowed !== true) { return array('content' => MsgBox($mixedAllowed)); } $sResult = ''; $oForm = BxDolForm::getObjectInstance($this->_oConfig->getObject('form_request'), $this->_oConfig->getObject('form_display_request_send')); $oForm->initChecker(); if ($oForm->isSubmittedAndValid()) { $sIp = getVisitorIP(); $iId = (int) $oForm->insert(array('nip' => ip2long($sIp), 'date' => time())); if ($iId !== false) { $sRequestsEmail = $this->_oConfig->getRequestsEmail(); if (!empty($sRequestsEmail)) { $sManageUrl = BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=invites-requests'); $aMessage = BxDolEmailTemplates::getInstance()->parseTemplate('bx_invites_request_form_message', array('sender_name' => bx_process_output($oForm->getCleanValue('name')), 'sender_email' => bx_process_output($oForm->getCleanValue('email')), 'sender_ip' => $sIp, 'manage_url' => $sManageUrl)); sendMail($sRequestsEmail, $aMessage['Subject'], $aMessage['Body'], 0, array(), BX_EMAIL_SYSTEM); } $sResult = MsgBox(_t('_bx_invites_msg_request_sent')); } } return array('content' => $sResult . $oForm->getCode()); }
protected function _prepareTextForOutput($s) { $sHttp = ''; $sPattern = $this->_oConfig->getPregPattern('url'); $aMatches = array(); if (preg_match($sPattern, $s, $aMatches) && empty($aMatches[1])) { $sHttp = 'http://'; } $s = bx_process_output($s, BX_DATA_TEXT_MULTILINE); $s = preg_replace($sPattern, '<a href="' . $sHttp . '$0" target="_blank">$0</a>', $s); return $s; }
protected static function _error($sType, $sParam1 = '', $sParam2 = '') { header('Status: 404 Not Found'); header('HTTP/1.0 404 Not Found'); require_once BX_DIRECTORY_PATH_INC . "design.inc.php"; bx_import('BxDolTemplate'); bx_import('BxDolLanguages'); $oTemplate = BxDolTemplate::getInstance(); $oTemplate->setPageNameIndex(BX_PAGE_DEFAULT); $oTemplate->setPageHeader(_t("_sys_request_" . $sType . "_not_found_cpt")); $oTemplate->setPageContent('page_main_code', DesignBoxContent('', MsgBox(_t("_sys_request_" . $sType . "_not_found_cnt", bx_process_output($sParam1), bx_process_output($sParam2))), BX_DB_PADDING_NO_CAPTION)); $oTemplate->getPageCode(); exit; }
protected function getConfigUpdate($sConfigPathModule, $sConfigPathUpdate, $aInstalledModule = array()) { $aModule = $this->getConfigModule($sConfigPathModule, $aInstalledModule); if (empty($aModule) || !$aModule['installed']) { return array(); } $aConfig = self::getModuleConfig($sConfigPathUpdate); if (empty($aConfig) || !is_array($aConfig)) { return array(); } return array('title' => bx_process_output($aConfig['title']), 'vendor' => $aConfig['vendor'], 'version_from' => $aConfig['version_from'], 'version_to' => $aConfig['version_to'], 'dir' => $aConfig['home_dir'], 'module_type' => $aModule['type'], 'module_name' => $aModule['name'], 'module_dir' => $aModule['dir'], 'module_version' => $aModule['version']); }
public function getBlockRequestText($aRequest) { return $this->parseHtmlByName('request_text.html', array('style_prefix' => $this->_oConfig->getPrefix('style'), 'text' => bx_process_output(nl2br($aRequest['text']), BX_DATA_TEXT_MULTILINE))); }
function getMediaTitle($aMediaInfo) { $oModule = BxDolModule::getInstance($this->MODULE); $CNF =& $oModule->_oConfig->CNF; $sText = bx_process_output($aMediaInfo['title']); if (!empty($CNF['OBJECT_METATAGS_MEDIA'])) { $oMetatags = BxDolMetatags::getObjectInstance($CNF['OBJECT_METATAGS_MEDIA']); if ($oMetatags->keywordsIsEnabled()) { $sText = $oMetatags->keywordsParse($aMediaInfo['id'], $sText); } } return $sText; }
function bx_process_pass($mixedData, $iDataType = BX_DATA_TEXT, $mixedParams = false, $isCheckMagicQuotes = true) { return bx_process_output(bx_process_input($mixedData, $iDataType, $mixedParams, $isCheckMagicQuotes), $iDataType, $mixedParams); }
/** * Parse system keys. * * @param string $sKey key * @return string value associated with the key. */ function parseSystemKey($sKey, $mixedKeyWrapperHtml = null, $bProcessInjection = true) { $aKeyWrappers = $this->_getKeyWrappers($mixedKeyWrapperHtml); $sRet = ''; switch ($sKey) { case 'page_charset': $sRet = 'UTF-8'; break; case 'page_robots': if (!empty($this->aPage['robots']) && is_string($this->aPage['robots'])) { $sRet = '<meta name="robots" content="' . bx_html_attribute($this->aPage['robots']) . '" />'; } break; case 'meta_info': $sRet = $this->getMetaInfo(); break; case 'page_header': if (isset($this->aPage['header'])) { $sRet = bx_process_output(strip_tags($this->aPage['header'])); } break; case 'page_header_text': if (isset($this->aPage['header_text'])) { $sRet = bx_process_output($this->aPage['header_text']); } break; case 'popup_loading': bx_import('BxTemplFunctions'); $s = $this->parsePageByName('popup_loading.html', array()); $sRet = BxTemplFunctions::getInstance()->transBox('bx-popup-loading', $s, true); bx_import('BxTemplSearch'); $oSearch = new BxTemplSearch(); $oSearch->setLiveSearch(true); $sRet .= $this->parsePageByName('search.html', array('search_form' => $oSearch->getForm(BX_DB_CONTENT_ONLY), 'results' => $oSearch->getResultsContainer())); $sRet .= $this->getMenu('sys_site'); $sRet .= isLogged() ? $this->getMenu('sys_add_content') : ''; $sRet .= isLogged() ? $this->getMenu('sys_account_popup') : ''; break; case 'lang': $sRet = bx_lang_name(); break; case 'main_logo': bx_import('BxTemplFunctions'); $sRet = BxTemplFunctions::getInstance()->getMainLogo(); break; case 'informer': bx_import('BxDolInformer'); $oInformer = BxDolInformer::getInstance($this); $sRet = $oInformer ? $oInformer->display() : ''; break; case 'dol_images': $sRet = $this->_processJsImages(); break; case 'dol_lang': $sRet = $this->_processJsTranslations(); break; case 'dol_options': $sRet = $this->_processJsOptions(); break; case 'bottom_text': $sRet = _t('_bottom_text', date('Y')); break; case 'copyright': $sRet = _t('_copyright', date('Y')) . getVersionComment(); break; case 'extra_js': $sRet = empty($this->aPage['extra_js']) ? '' : $this->aPage['extra_js']; break; case 'is_profile_page': $sRet = defined('BX_PROFILE_PAGE') ? 'true' : 'false'; break; default: bx_import('BxTemplFunctions'); $sRet = ($sTemplAdd = BxTemplFunctions::getInstance()->TemplPageAddComponent($sKey)) !== false ? $sTemplAdd : $aKeyWrappers['left'] . $sKey . $aKeyWrappers['right']; } if ($bProcessInjection) { $sRet = $this->processInjection($this->getPageNameIndex(), $sKey, $sRet); } return $sRet; }
/** * get one just posted comment * * @param int $iCmtId - comment id * @return string */ function getComment($mixedCmt, $aBp = array(), $aDp = array()) { $oTemplate = BxDolTemplate::getInstance(); $iUserId = $this->_getAuthorId(); $aCmt = !is_array($mixedCmt) ? $this->getCommentRow((int) $mixedCmt) : $mixedCmt; if (!$aCmt) { return ''; } list($sAuthorName, $sAuthorLink, $sAuthorIcon) = $this->_getAuthorInfo($aCmt['cmt_author_id']); $sClass = ''; if (isset($aCmt['vote_rate']) && (double) $aCmt['vote_rate'] < $this->_aSystem['viewing_threshold']) { $oTemplate->pareseHtmlByName('comment_hidden.html', array('js_object' => $this->_sJsObjName, 'id' => $aCmt['cmt_id'], 'title' => bx_process_output(_t('_hidden_comment', $sAuthorName)), 'bx_if:show_replies' => array('condition' => $aCmt['cmt_replies'] > 0, 'content' => array('replies' => _t('_Show N replies', $aCmt['cmt_replies']))))); $sClass = ' cmt-hidden'; } if ($aCmt['cmt_author_id'] == $iUserId) { $sClass .= ' cmt-mine'; } if (!empty($aDp['blink']) && in_array($aCmt['cmt_id'], $aDp['blink'])) { $sClass .= ' cmt-blink'; } $sActions = $this->_getActionsBox($aCmt, $aDp); $aTmplReplyTo = array(); if ((int) $aCmt['cmt_parent_id'] != 0) { $aParent = $this->getCommentRow($aCmt['cmt_parent_id']); list($sParAuthorName, $sParAuthorLink, $sParAuthorIcon) = $this->_getAuthorInfo($aParent['cmt_author_id']); $aTmplReplyTo = array('style_prefix' => $this->_sStylePrefix, 'par_cmt_link' => $this->getBaseUrl() . '#' . $this->_sSystem . $aCmt['cmt_parent_id'], 'par_cmt_title' => bx_html_attribute(_t('_in_reply_to', $sParAuthorName)), 'par_cmt_author' => $sParAuthorName); } $aTmplImages = array(); if ($this->isAttachImageEnabled()) { $aImages = $this->_oQuery->getImages($this->_aSystem['system_id'], $aCmt['cmt_id']); if (!empty($aImages) && is_array($aImages)) { $oStorage = BxDolStorage::getObjectInstance($this->getStorageObjectName()); $oTranscoder = BxDolTranscoderImage::getObjectInstance($this->getTranscoderPreviewName()); foreach ($aImages as $aImage) { $aTmplImages[] = array('style_prefix' => $this->_sStylePrefix, 'js_object' => $this->_sJsObjName, 'image' => $oTranscoder->getFileUrl($aImage['image_id']), 'image_orig' => $oStorage->getFileUrlById($aImage['image_id'])); } } } $sReplies = ''; if ((int) $aCmt['cmt_replies'] > 0 && !empty($aDp) && $aDp['type'] == BX_CMT_DISPLAY_THREADED) { $aDp['show_empty'] = false; $sReplies = $this->getComments(array('parent_id' => $aCmt['cmt_id'], 'vparent_id' => $aCmt['cmt_id'], 'type' => $aBp['type']), $aDp); } $sAgo = bx_time_js($aCmt['cmt_time']); $bObjectTitle = !empty($this->_aSystem['trigger_field_title']); return $oTemplate->parseHtmlByName('comment.html', array_merge(array('system' => $this->_sSystem, 'style_prefix' => $this->_sStylePrefix, 'js_object' => $this->_sJsObjName, 'id' => $aCmt['cmt_id'], 'class' => $sClass, 'bx_if:show_reply_to' => array('condition' => !empty($aTmplReplyTo), 'content' => $aTmplReplyTo), 'bx_if:show_ago_link' => array('condition' => $bObjectTitle, 'content' => array('style_prefix' => $this->_sStylePrefix, 'view_link' => $this->getViewUrl($aCmt['cmt_id']), 'ago' => $sAgo)), 'bx_if:show_ago_text' => array('condition' => !$bObjectTitle, 'content' => array('ago' => $sAgo)), 'bx_if:show_attached' => array('condition' => !empty($aTmplImages), 'content' => array('style_prefix' => $this->_sStylePrefix, 'bx_repeat:attached' => $aTmplImages)), 'actions' => $sActions, 'replies' => $sReplies), $this->_getTmplVarsAuthor($aCmt), $this->_getTmplVarsText($aCmt))); }
/** * get one just posted comment * * @param int $iCmtId - comment id * @return string */ function getComment($mixedCmt, $aBp = array(), $aDp = array()) { $oTemplate = BxDolTemplate::getInstance(); $iUserId = $this->_getAuthorId(); $aCmt = !is_array($mixedCmt) ? $this->getCommentRow((int) $mixedCmt) : $mixedCmt; list($sAuthorName, $sAuthorLink, $sAuthorIcon) = $this->_getAuthorInfo($aCmt['cmt_author_id']); $sClass = ''; if (isset($aCmt['vote_rate']) && (double) $aCmt['vote_rate'] < $this->_aSystem['viewing_threshold']) { $oTemplate->pareseHtmlByName('comment_hidden.html', array('js_object' => $this->_sJsObjName, 'id' => $aCmt['cmt_id'], 'title' => bx_process_output(_t('_hidden_comment', $sAuthorName)), 'bx_if:show_replies' => array('condition' => $aCmt['cmt_replies'] > 0, 'content' => array('replies' => _t('_Show N replies', $aCmt['cmt_replies']))))); $sClass = ' cmt-hidden'; } if ($aCmt['cmt_author_id'] == $iUserId) { $sClass .= ' cmt-mine'; } $sActions = $this->_getActionsBox($aCmt, $aDp); $sText = $aCmt['cmt_text']; $sTextMore = ''; $iMaxLength = (int) $this->_aSystem['chars_display_max']; if (strlen($sText) > $iMaxLength) { $iLength = strpos($sText, ' ', $iMaxLength); $sTextMore = trim(substr($sText, $iLength)); $sText = trim(substr($sText, 0, $iLength)); } $sText = $this->_prepareTextForOutput($sText); $sTextMore = $this->_prepareTextForOutput($sTextMore); $aTmplReplyTo = array(); if ((int) $aCmt['cmt_parent_id'] != 0) { $aParent = $this->getCommentRow($aCmt['cmt_parent_id']); list($sParAuthorName, $sParAuthorLink, $sParAuthorIcon) = $this->_getAuthorInfo($aParent['cmt_author_id']); $aTmplReplyTo = array('style_prefix' => $this->_sStylePrefix, 'par_cmt_link' => $this->getBaseUrl() . '#' . $this->_sSystem . $aCmt['cmt_parent_id'], 'par_cmt_author' => $sParAuthorName); } $aTmplImages = array(); if ($this->isAttachImageEnabled()) { $aImages = $this->_oQuery->getImages($this->_aSystem['system_id'], $aCmt['cmt_id']); if (!empty($aImages) && is_array($aImages)) { bx_import('BxDolStorage'); $oStorage = BxDolStorage::getObjectInstance($this->_sStorageObject); bx_import('BxDolImageTranscoder'); $oTranscoder = BxDolImageTranscoder::getObjectInstance($this->_sTranscoderPreview); foreach ($aImages as $aImage) { $aTmplImages[] = array('style_prefix' => $this->_sStylePrefix, 'js_object' => $this->_sJsObjName, 'image' => $oTranscoder->getImageUrl($aImage['image_id']), 'image_orig' => $oStorage->getFileUrlById($aImage['image_id'])); } } } $sReplies = ''; if ((int) $aCmt['cmt_replies'] > 0 && !empty($aDp) && $aDp['type'] == BX_CMT_DISPLAY_THREADED) { $sReplies = $this->getComments(array('parent_id' => $aCmt['cmt_id'], 'vparent_id' => $aCmt['cmt_id'], 'type' => $aBp['type']), $aDp); } $bAuthorIcon = !empty($sAuthorIcon); return $oTemplate->parseHtmlByName('comment.html', array('system' => $this->_sSystem, 'style_prefix' => $this->_sStylePrefix, 'js_object' => $this->_sJsObjName, 'id' => $aCmt['cmt_id'], 'class' => $sClass, 'bx_if:show_icon' => array('condition' => $bAuthorIcon, 'content' => array('author_icon' => $sAuthorIcon)), 'bx_if:show_icon_empty' => array('condition' => !$bAuthorIcon, 'content' => array()), 'bx_if:show_author_link' => array('condition' => !empty($sAuthorLink), 'content' => array('author_link' => $sAuthorLink, 'author_name' => $sAuthorName)), 'bx_if:show_author_text' => array('condition' => empty($sAuthorLink), 'content' => array('author_name' => $sAuthorName)), 'bx_if:show_reply_to' => array('condition' => !empty($aTmplReplyTo), 'content' => $aTmplReplyTo), 'text' => $sText, 'bx_if:show_more' => array('condition' => !empty($sTextMore), 'content' => array('style_prefix' => $this->_sStylePrefix, 'js_object' => $this->_sJsObjName, 'text_more' => $sTextMore)), 'bx_if:show_attached' => array('condition' => !empty($aTmplImages), 'content' => array('style_prefix' => $this->_sStylePrefix, 'bx_repeat:attached' => $aTmplImages)), 'actions' => $sActions, 'replies' => $sReplies)); }
protected function _getCellDesc($mixedValue, $sKey, $aField, $aRow) { $mixedValue = bx_process_output(_t($aRow['Desc'])); $mixedValue = $this->_limitMaxLength($mixedValue, $sKey, $aField, $aRow, $this->_isDisplayPopupOnTextOverflow); return parent::_getCellDefault($mixedValue, $sKey, $aField, $aRow); }
public static function displayDateTime($i) { return bx_process_output($i, BX_DATA_DATETIME_TS); }
protected function _getCellData($sKey, $aField, $aRow) { if (isset($aRow[$sKey])) { if (!empty($aField['display'])) { bx_import('BxDolForm'); $sDisplayFunc = 'display' . $aField['display']; $oDisplay = new BxDolFormCheckerHelper(); return $oDisplay->{$sDisplayFunc}($aRow[$sKey]); } else { return bx_process_output($aRow[$sKey]); } } else { return _t('_undefined'); } }
protected function _prepareTextForOutput($s, $iCmtId = 0) { $iDataAction = $this->isNl2br() ? BX_DATA_TEXT_MULTILINE : BX_DATA_HTML; $s = bx_process_output($s, $iDataAction); $s = bx_linkify_html($s); if ($this->_sMetatagsObj && $iCmtId) { $oMetatags = BxDolMetatags::getObjectInstance($this->_sMetatagsObj); $s = $oMetatags->keywordsParse($this->_oQuery->getUniqId($this->_aSystem['system_id'], $iCmtId), $s); } return $s; }
protected function _prepareTextForOutput($s, $iEventId = 0) { $oTemplate =& $this; $sPattern = $this->_oConfig->getPregPattern('url'); $bAddNofollow = $this->_oDb->getParam('sys_add_nofollow') == 'on'; $s = bx_process_output($s, BX_DATA_TEXT_MULTILINE); $s = preg_replace_callback($sPattern, function ($aMatches) use($oTemplate, $bAddNofollow) { $aLinkAttrs = array(array('key' => 'target', 'value' => '_blank')); if ($bAddNofollow && strncmp(BX_DOL_URL_ROOT, $aMatches[0], strlen(BX_DOL_URL_ROOT)) != 0) { $aLinkAttrs[] = array('key' => 'rel', 'value' => 'nofollow'); } return $oTemplate->parsePageByName('bx_a.html', array('href' => (empty($aMatches[1]) ? 'http://' : '') . $aMatches[0], 'title' => $aMatches[0], 'bx_repeat:attrs' => $aLinkAttrs, 'content' => $aMatches[0])); }, $s); bx_import('BxDolMetatags'); $oMetatags = BxDolMetatags::getObjectInstance($this->_oConfig->getObject('metatags')); $s = $oMetatags->keywordsParse($iEventId, $s); return $s; }
function entryAttachments($aData) { $oModule = BxDolModule::getInstance($this->MODULE); $CNF =& $oModule->_oConfig->CNF; bx_import('BxTemplFunctions'); bx_import('BxDolStorage'); bx_import('BxDolTranscoderImage'); $oStorage = BxDolStorage::getObjectInstance($CNF['OBJECT_STORAGE']); $oTranscoder = BxDolTranscoderImage::getObjectInstance($CNF['OBJECT_IMAGES_TRANSCODER_PREVIEW']); $aTranscodersVideo = false; if ($CNF['OBJECT_VIDEOS_TRANSCODERS']) { $aTranscodersVideo = array('poster' => BxDolTranscoderImage::getObjectInstance($CNF['OBJECT_VIDEOS_TRANSCODERS']['poster']), 'mp4' => BxDolTranscoderImage::getObjectInstance($CNF['OBJECT_VIDEOS_TRANSCODERS']['mp4']), 'webm' => BxDolTranscoderImage::getObjectInstance($CNF['OBJECT_VIDEOS_TRANSCODERS']['webm'])); } $aGhostFiles = $oStorage->getGhosts($aData[$CNF['FIELD_AUTHOR']], $aData[$CNF['FIELD_ID']]); if (!$aGhostFiles) { return false; } foreach ($aGhostFiles as $k => $a) { $isImage = $oTranscoder && 0 == strncmp('image/', $a['mime_type'], 6); // preview for images, transcoder object for preview must be defined $isVideo = $aTranscodersVideo && 0 == strncmp('video/', $a['mime_type'], 6); // preview for videos, transcoder object for video must be defined $sUrlOriginal = $oStorage->getFileUrlById($a['id']); $sImgPopupId = 'bx-messages-atachment-popup-' . $a['id']; // images are displayed with preview and popup upon clicking $aGhostFiles[$k]['bx_if:image'] = array('condition' => $isImage, 'content' => array('url_original' => $sUrlOriginal, 'attr_file_name' => bx_html_attribute($a['file_name']), 'popup_id' => $sImgPopupId, 'url_preview' => $oTranscoder->getFileUrl($a['id']), 'popup' => BxTemplFunctions::getInstance()->transBox($sImgPopupId, '<img src="' . $sUrlOriginal . '" />', true, true))); // videos are displayed inline $aGhostFiles[$k]['bx_if:video'] = array('condition' => $isVideo, 'content' => array('video' => $aTranscodersVideo ? BxTemplFunctions::getInstance()->videoPlayer($aTranscodersVideo['poster']->getFileUrl($a['id']), $aTranscodersVideo['mp4']->getFileUrl($a['id']), $aTranscodersVideo['webm']->getFileUrl($a['id']), false, '') : '')); // non-images are displayed as text links to original file $aGhostFiles[$k]['bx_if:not_image'] = array('condition' => !$isImage && !$isVideo, 'content' => array('url_original' => $sUrlOriginal, 'attr_file_name' => bx_html_attribute($a['file_name']), 'file_name' => bx_process_output($a['file_name']))); } $aVars = array('bx_repeat:attachments' => $aGhostFiles); return $this->parseHtmlByName('attachments.html', $aVars); }
/** * Parse system keys. * * @param string $sKey key * @return string value associated with the key. */ function parseSystemKey($sKey, $mixedKeyWrapperHtml = null, $bProcessInjection = true) { $aKeyWrappers = $this->_getKeyWrappers($mixedKeyWrapperHtml); $sRet = ''; switch ($sKey) { case 'page_charset': $sRet = 'UTF-8'; break; case 'page_robots': if (!empty($this->aPage['robots']) && is_string($this->aPage['robots'])) { $sRet = '<meta name="robots" content="' . bx_html_attribute($this->aPage['robots']) . '" />'; } break; case 'page_keywords': if (!empty($this->aPage['keywords']) && is_array($this->aPage['keywords'])) { $sRet = '<meta name="keywords" content="' . bx_html_attribute(implode(',', $this->aPage['keywords'])) . '" />'; } break; case 'page_description': if (!empty($this->aPage['description']) && is_string($this->aPage['description'])) { $sRet = '<meta name="description" content="' . bx_html_attribute($this->aPage['description']) . '" />'; } break; case 'page_header': if (isset($this->aPage['header'])) { $sRet = bx_process_output(strip_tags($this->aPage['header'])); } break; case 'page_header_text': if (isset($this->aPage['header_text'])) { $sRet = bx_process_output($this->aPage['header_text']); } break; case 'page_icons': bx_import('BxTemplFunctions'); $sRet = BxTemplFunctions::getInstance()->getMetaIcons(); break; case 'popup_loading': $sContent = $this->parsePageByName('popup_loading.html', array()); bx_import('BxTemplFunctions'); $sRet = BxTemplFunctions::getInstance()->transBox('bx-popup-loading', $sContent, true); break; case 'lang': $sRet = bx_lang_name(); break; case 'main_logo': bx_import('BxTemplFunctions'); $sRet = BxTemplFunctions::getInstance()->getMainLogo(); break; case 'informer': bx_import('BxDolInformer'); $oInformer = BxDolInformer::getInstance($this); $sRet = $oInformer ? $oInformer->display() : ''; break; case 'dol_images': $sRet = $this->_processJsImages(); break; case 'dol_lang': $sRet = $this->_processJsTranslations(); break; case 'dol_options': $sRet = $this->_processJsOptions(); break; case 'bottom_text': $sRet = _t('_bottom_text', date('Y')); break; case 'copyright': $sRet = _t('_copyright', date('Y')) . getVersionComment(); break; case 'extra_js': $sRet = empty($this->aPage['extra_js']) ? '' : $this->aPage['extra_js']; break; case 'is_profile_page': $sRet = defined('BX_PROFILE_PAGE') ? 'true' : 'false'; break; default: bx_import('BxTemplFunctions'); $sRet = ($sTemplAdd = BxTemplFunctions::getInstance()->TemplPageAddComponent($sKey)) !== false ? $sTemplAdd : $aKeyWrappers['left'] . $sKey . $aKeyWrappers['right']; } if ($bProcessInjection) { $sRet = $this->processInjection($this->getPageNameIndex(), $sKey, $sRet); } return $sRet; }
protected function _sendNotificationEmail($iCmtId, $iCmtParentId) { $aCmt = $this->getCommentRow($iCmtId); $aCmtParent = $this->getCommentRow($iCmtParentId); if (empty($aCmt) || !is_array($aCmt) || empty($aCmtParent) || !is_array($aCmtParent) || (int) $aCmt['cmt_author_id'] == (int) $aCmtParent['cmt_author_id']) { return; } $oProfile = $this->_getAuthorObject($aCmtParent['cmt_author_id']); if ($oProfile instanceof BxDolProfileUndefined) { return; } $iAccount = $oProfile->getAccountId(); $aAccount = BxDolAccount::getInstance($iAccount)->getInfo(); $aPlus = array(); $aPlus['reply_text'] = bx_process_output($aCmt['cmt_text']); $aPlus['comment_url'] = sprintf('%scmts.php?sys=%s&id=%d&cmt_id=%d', BX_DOL_URL_ROOT, $this->_sSystem, $this->_iId, $iCmtParentId); $aTemplate = BxDolEmailTemplates::getInstance()->parseTemplate('t_CommentReplied', $aPlus); return $aTemplate && sendMail($aAccount['email'], $aTemplate['Subject'], $aTemplate['Body']); }
function genInfoIcon($sInfo) { return '<div class="bx-form-info bx-def-font-grayed bx-def-font-small">' . bx_process_output($sInfo) . '</div>'; }
protected function _getCellHeaderDefault($sKey, $aField) { $sHeader = bx_process_output($aField['title']); if (!empty($this->_aOptions['sorting_fields']) && is_array($this->_aOptions['sorting_fields']) && in_array($sKey, $this->_aOptions['sorting_fields'])) { $sHeader = '<a href="javascript:void(0);" class="bx-grid-sort-handle">' . $sHeader . '</a><span class="bx-grid-sort-indi"></span>'; $aField['attr_head']['bx_grid_sort_head'] = $sKey; } $sAttr = $this->_convertAttrs($aField, 'attr_head', 'bx-def-padding-sec-bottom bx-def-padding-sec-top bx-grid-header-' . $sKey, isset($aField['width']) ? 'width:' . $aField['width'] : false); return $this->_getCellHeaderWrapper($sKey, $aField, $sHeader, $sAttr); }
protected function _prepareTextForOutput($s, $iEventId = 0) { $s = bx_process_output($s, BX_DATA_HTML); $s = bx_convert_links($s); $oMetatags = BxDolMetatags::getObjectInstance($this->_oConfig->getObject('metatags')); $s = $oMetatags->keywordsParse($iEventId, $s); return $s; }