function _getCommonData($aEvent)
 {
     $sPrefix = $this->_oConfig->getPrefix('common_post');
     $sEventType = bx_ltrim_str($aEvent['type'], $sPrefix, '');
     $sTmplName = '';
     $aTmplVars = array();
     $aResult = array('content' => '', 'comments' => '');
     switch ($sEventType) {
         case BX_WALL_PARSE_TYPE_TEXT:
             $aResult['content'] = bx_linkify_html($aEvent['content'], 'class="' . BX_DOL_LINK_CLASS . '"');
             $sTmplName = 'common';
             $aTmplVars['cpt_added_new'] = _t('_wall_added_' . $sEventType);
             break;
         case BX_WALL_PARSE_TYPE_LINK:
             $aResult['content'] = $aEvent['content'];
             $sTmplName = 'common';
             $aTmplVars['cpt_added_new'] = _t('_wall_added_' . $sEventType);
             break;
         case BX_WALL_PARSE_TYPE_PHOTOS:
         case BX_WALL_PARSE_TYPE_SOUNDS:
         case BX_WALL_PARSE_TYPE_VIDEOS:
             $aContent = unserialize($aEvent['content']);
             $iContent = (int) $aContent['id'];
             $aResult = array_merge($aResult, $this->_getCommonMedia($aContent['type'], $iContent));
             $sTmplName = 'common';
             $aTmplVars['cpt_added_new'] = _t('_wall_added_' . $sEventType);
             break;
         case BX_WALL_PARSE_TYPE_REPOST:
             if (empty($aEvent['content'])) {
                 return array();
             }
             $aContent = unserialize($aEvent['content']);
             $aReposted = $this->_oDb->getReposted($aContent['type'], $aContent['action'], $aContent['object_id']);
             $sMethod = $this->_oConfig->isSystem($aContent['type'], $aContent['action']) ? '_getSystemData' : '_getCommonData';
             $aResult = array_merge($aResult, $this->{$sMethod}($aReposted));
             if (empty($aResult) || !is_array($aResult)) {
                 return array();
             }
             $sTmplName = 'repost';
             $aTmplVars['cpt_reposted'] = _t($this->_oModule->getRepostedLanguageKey($aReposted['type'], $aReposted['action'], $aReposted['object_id']));
             break;
     }
     $aResult['content'] = $this->parseHtmlByTemplateName($sTmplName, array_merge(array('post_type' => $sEventType, 'author_url' => getProfileLink($aEvent['object_id']), 'author_username' => getNickName($aEvent['object_id']), 'bx_if:show_wall_owner' => array('condition' => (int) $aEvent['owner_id'] != 0 && (int) $aEvent['owner_id'] != (int) $aEvent['object_id'], 'content' => array('owner_url' => getProfileLink($aEvent['owner_id']), 'owner_username' => getNickName($aEvent['owner_id']))), 'content' => $aResult['content']), $aTmplVars));
     return $aResult;
 }
Exemple #2
0
function encode_post_text(&$s, $bEncodeSpecialChars = false, $bAutohyperlink = false)
{
    global $gConf;
    if ('server' == $gConf['xsl_mode']) {
    } elseif ('client' == $gConf['xsl_mode']) {
        $s = str_replace(array('&amp;', '&gt;', '&lt;'), array('&', '>', '<'), $s);
    }
    if ($bEncodeSpecialChars) {
        $s = htmlspecialchars($s, ENT_COMPAT, 'UTF-8', false);
    }
    if ($bAutohyperlink) {
        //$s = preg_replace('@([\s\n\.,\!\?]{1})(https?://([-\w\.]+)+(:\d+)?([\w/_\-\.]*(\?[^<\s]+)?(#[^<\s]+)?)?)@', '$1<a target="_blank" href="$2">$2</a>', $s);
        //$s = preg_replace('@(\w>|<br />|<br/>)(https?://([-\w\.]+)+(:\d+)?([\w/_\-\.]*(\?[^<\s]+)?(#[^<\s]+)?)?)@', '$1<a target="_blank" href="$2">$2</a>', $s);
        $s = bx_linkify_html($s, 'class="' . BX_DOL_LINK_CLASS . '"');
    }
    $s = "<![CDATA[{$s}]]>";
}
Exemple #3
0
 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;
 }
Exemple #4
0
 function _prepareTextForOutput($s)
 {
     return 0 === strpos($s, '<iframe') ? $s : bx_linkify_html($s, 'class="' . BX_DOL_LINK_CLASS . '"');
 }
 function getCommon($aEvent)
 {
     $sPrefix = $this->_oConfig->getCommonPostPrefix();
     if (strpos($aEvent['type'], $sPrefix) !== 0) {
         return '';
     }
     if (in_array($aEvent['type'], array($sPrefix . 'photos', $sPrefix . 'sounds', $sPrefix . 'videos'))) {
         $aContent = unserialize($aEvent['content']);
         $aEvent = array_merge($aEvent, $this->getCommonMedia($aContent['type'], (int) $aContent['id']));
         if (empty($aEvent['content']) || (int) $aEvent['content'] > 0) {
             return '';
         }
     } else {
         if (in_array($aEvent['type'], array($sPrefix . 'text'))) {
             $aEvent['content'] = bx_linkify_html($aEvent['content'], 'class="' . BX_DOL_LINK_CLASS . '"');
         }
     }
     $aAuthor = $this->_oDb->getUser($aEvent['object_id']);
     $aVariables = array('author_url' => getProfileLink($aAuthor['id']), 'author_username' => getNickName($aAuthor['id']), 'bx_if:show_wall_owner' => array('condition' => (int) $aEvent['owner_id'] != 0 && (int) $aEvent['owner_id'] != (int) $aEvent['object_id'], 'content' => array('owner_url' => getProfileLink($aEvent['owner_id']), 'owner_username' => getNickName($aEvent['owner_id']))), 'post_id' => $aEvent['id'], 'post_owner_icon' => get_member_thumbnail($aAuthor['id'], 'none'), 'post_content' => $aEvent['content']);
     $oComments = new BxWallCmts($this->_oConfig->getCommentSystemName(), $aEvent['id']);
     $aVariables = array_merge($aVariables, array('comments_content' => $oComments->getCommentsFirst('comment')));
     return $this->parseHtmlByTemplateName('balloon', $aVariables);
 }
 protected function _prepareTextForOutput($s, $iEventId = 0)
 {
     $s = bx_process_output($s, BX_DATA_HTML);
     $s = bx_linkify_html($s);
     $oMetatags = BxDolMetatags::getObjectInstance($this->_oConfig->getObject('metatags'));
     $s = $oMetatags->keywordsParse($iEventId, $s);
     return $s;
 }