本文整理汇总了PHP中strmaxtextlen函数的典型用法代码示例。如果您正苦于以下问题:PHP strmaxtextlen函数的具体用法?PHP strmaxtextlen怎么用?PHP strmaxtextlen使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了strmaxtextlen函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getLatestNews
function getLatestNews()
{
$iNewsOnHome = $this->oTemplConfig->iMaxNewsOnIndex;
$query = "\r\n\t\t\tSELECT\r\n\t\t\t\t`ID`,\r\n\t\t\t\t`Text`,\r\n\t\t\t\t`Header`,\r\n\t\t\t\t`Date`\r\n\t\t\tFROM\r\n\t\t\t\t`News`\r\n\t\t\tORDER BY `Date` DESC\r\n\r\n\t\t\tLIMIT {$iNewsOnHome}\r\n\t\t;";
$rNews = $this->oDb->getAll($query);
if (!is_array($rNews['0'])) {
return _t_action('_No news available');
}
$ret = '';
foreach ($rNews as $aNews) {
$ret .= '
<div class="indexNewsBlock">
<div class="indexNewsHeader">
<a href="' . $this->aSite['url'] . 'news_view.php?ID=' . process_line_output($aNews['ID']) . '">
' . strmaxtextlen(process_line_output($aNews['Header']), $this->oTemplConfig->iNewsHeader) . '
</a>
</div>
<div class="indexNewsText">
' . strmaxtextlen(process_html_output($aNews['Text']), $this->oTemplConfig->iNewsPreview) . '
</div>
<div class="indexNewsDate">
' . process_line_output($aNews['Date']) . '
</div>
</div>
';
}
$ret .= '<div class="indexNewsArchive"><a href="' . $this->aSite['url'] . 'news.php">' . _t("_Read news in archive") . '</a></div>';
return $ret;
}
示例2: PrintSearhResult
/**
* @description : function will generate profile block (used the profile template );
* @return : Html presentation data ;
*/
function PrintSearhResult($aProfileInfo, $aCoupleInfo = '', $aExtendedKey = null, $sTemplateName = '', $oCustomTemplate = null)
{
global $site;
global $aPreValues;
$iVisitorID = getLoggedId();
$bExtMode = !empty($_GET['mode']) && $_GET['mode'] == 'extended' || !empty($_GET['search_result_mode']) && $_GET['search_result_mode'] == 'ext';
$isShowMatchPercent = $bExtMode && $iVisitorID && $iVisitorID != $aProfileInfo['ID'] && getParam('view_match_percent') && getParam('enable_match');
$sProfileThumb = get_member_thumbnail($aProfileInfo['ID'], 'none', !$bExtMode, 'visitor');
$sProfileMatch = $isShowMatchPercent ? $GLOBALS['oFunctions']->getProfileMatch($iVisitorID, $aProfileInfo['ID']) : '';
$sProfileNickname = '<a href="' . getProfileLink($aProfileInfo['ID']) . '">' . getNickName($aProfileInfo['ID']) . '</a>';
$sProfileInfo = $GLOBALS['oFunctions']->getUserInfo($aProfileInfo['ID']);
$sProfileDesc = strmaxtextlen($aProfileInfo['DescriptionMe'], 130);
$sProfileZodiac = $bExtMode && getParam('zodiac') ? $GLOBALS['oFunctions']->getProfileZodiac($aProfileInfo['DateOfBirth']) : '';
$sProfile2ASc1 = $sProfile2ASc2 = $sProfile2Nick = $sProfile2Desc = $sProfile2Info = $sProfile2Zodiac = '';
if ($aCoupleInfo) {
$sProfile2Nick = '<a href="' . getProfileLink($aCoupleInfo['ID']) . '">' . getNickName($aCoupleInfo['ID']) . '</a>';
$sProfile2Info = $GLOBALS['oFunctions']->getUserInfo($aCoupleInfo['ID']);
$sProfile2Desc = strmaxtextlen($aCoupleInfo['DescriptionMe'], 130);
$sProfile2Zodiac = $bExtMode && getParam('zodiac') ? $GLOBALS['oFunctions']->getProfileZodiac($aCoupleInfo['DateOfBirth']) : '';
$sProfile2ASc1 = 'float:left;width:31%;margin-right:10px;';
$sProfile2ASc2 = 'float:left;width:31%;display:block;';
} else {
$sProfile2ASc2 = 'display:none;';
}
$aKeys = array('thumbnail' => $sProfileThumb, 'match' => $sProfileMatch, 'nick' => $sProfileNickname, 'info' => $sProfileInfo, 'i_am_desc' => $sProfileDesc, 'zodiac_sign' => $sProfileZodiac, 'nick2' => $sProfile2Nick, 'info2' => $sProfile2Info, 'i_am_desc2' => $sProfile2Desc, 'zodiac_sign2' => $sProfile2Zodiac, 'add_style_c1' => $sProfile2ASc1, 'add_style_c2' => $sProfile2ASc2);
if ($aExtendedKey and is_array($aExtendedKey) and !empty($aExtendedKey)) {
foreach ($aExtendedKey as $sKey => $sValue) {
$aKeys[$sKey] = $sValue;
}
} else {
$aKeys['ext_css_class'] = '';
}
return $oCustomTemplate ? $oCustomTemplate->parseHtmlByName($sTemplateName, $aKeys) : $GLOBALS['oSysTemplate']->parseHtmlByName($sTemplateName, $aKeys);
}
示例3: SendTellFriend
/**
* send "tell a friend" email
*/
function SendTellFriend($iSenderID = 0)
{
global $profileID;
$sSenderEmail = clear_xss(bx_get('sender_email'));
if (strlen(trim($sSenderEmail)) <= 0) {
return 0;
}
$sSenderName = strmaxtextlen(bx_get('sender_name'), 16);
$sSenderLink = $iSenderID != 0 ? getProfileLink($iSenderID) : BX_DOL_URL_ROOT;
$sRecipientEmail = clear_xss(bx_get('recipient_email'));
if (strlen(trim($sRecipientEmail)) <= 0) {
return 0;
}
$sLinkAdd = $iSenderID > 0 ? 'idFriend=' . $iSenderID : '';
$rEmailTemplate = new BxDolEmailTemplates();
if ($profileID) {
$aTemplate = $rEmailTemplate->getTemplate('t_TellFriendProfile', getLoggedId());
$Link = getProfileLink($profileID, $sLinkAdd);
} else {
$aTemplate = $rEmailTemplate->getTemplate('t_TellFriend', getLoggedId());
$Link = BX_DOL_URL_ROOT;
if (strlen($sLinkAdd) > 0) {
$Link .= '?' . $sLinkAdd;
}
}
return sendMail($sRecipientEmail, $aTemplate['Subject'], $aTemplate['Body'], '', array('Link' => $Link, 'SenderName' => $sSenderName, 'SenderLink' => $sSenderLink));
}
示例4: unit
function unit($aData, $isCheckPrivateContent = true, $sTemplateName = 'unit.html')
{
$oModule = BxDolModule::getInstance($this->MODULE);
$CNF =& $oModule->_oConfig->CNF;
if ($isCheckPrivateContent && CHECK_ACTION_RESULT_ALLOWED !== ($sMsg = $oModule->checkAllowedView($aData))) {
$aVars = array('summary' => $sMsg);
return $this->parseHtmlByName('unit_private.html', $aVars);
}
// get thumb url
$sPhotoThumb = '';
if ($aData[$CNF['FIELD_THUMB']]) {
bx_import('BxDolImageTranscoder');
$oImagesTranscoder = BxDolImageTranscoder::getObjectInstance($CNF['OBJECT_IMAGES_TRANSCODER_PREVIEW']);
if ($oImagesTranscoder) {
$sPhotoThumb = $oImagesTranscoder->getImageUrl($aData[$CNF['FIELD_THUMB']]);
}
}
// get entry url
bx_import('BxDolPermalinks');
$sUrl = BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=' . $CNF['URI_VIEW_ENTRY'] . '&id=' . $aData[$CNF['FIELD_ID']]);
bx_import('BxDolProfile');
$oProfile = BxDolProfile::getInstance($aData[$CNF['FIELD_AUTHOR']]);
if (!$oProfile) {
bx_import('BxDolProfileUndefined');
$oProfile = BxDolProfileUndefined::getInstance();
}
// get summary
$sLinkMore = ' <a title="' . bx_html_attribute(_t('_sys_read_more', $aData[$CNF['FIELD_TITLE']])) . '" href="' . $sUrl . '"><i class="sys-icon ellipsis-h"></i></a>';
$sSummary = strmaxtextlen($aData[$CNF['FIELD_TEXT']], (int) getParam($CNF['PARAM_CHARS_SUMMARY']), $sLinkMore);
$sSummaryPlain = BxTemplFunctions::getInstance()->getStringWithLimitedLength(strip_tags($sSummary), (int) getParam($CNF['PARAM_CHARS_SUMMARY_PLAIN']));
// generate html
$aVars = array('id' => $aData[$CNF['FIELD_ID']], 'content_url' => $sUrl, 'title' => bx_process_output($aData[$CNF['FIELD_TITLE']]), 'summary' => $sSummary, 'author' => $oProfile->getDisplayName(), 'author_url' => $oProfile->getUrl(), 'entry_posting_date' => bx_time_js($aData[$CNF['FIELD_ADDED']], BX_FORMAT_DATE), 'module_name' => _t($CNF['T']['txt_sample_single']), 'ts' => $aData[$CNF['FIELD_ADDED']], 'bx_if:thumb' => array('condition' => $sPhotoThumb, 'content' => array('title' => bx_process_output($aData[$CNF['FIELD_TITLE']]), 'summary_attr' => bx_html_attribute($sSummaryPlain), 'content_url' => $sUrl, 'thumb_url' => $sPhotoThumb ? $sPhotoThumb : '')), 'bx_if:no_thumb' => array('condition' => !$sPhotoThumb, 'content' => array('content_url' => $sUrl, 'summary_plain' => $sSummaryPlain)));
return $this->parseHtmlByName($sTemplateName, $aVars);
}
示例5: __construct
public function __construct($aObject, $oTemplate = false)
{
parent::__construct($aObject, $oTemplate);
$CNF =& $this->_oModule->_oConfig->CNF;
// select view entry submenu
$oMenuSumbemu = BxDolMenu::getObjectInstance('sys_site_submenu');
$oMenuSumbemu->setObjectSubmenu($CNF['OBJECT_MENU_SUBMENU_VIEW_ENTRY'], $CNF['OBJECT_MENU_SUBMENU_VIEW_ENTRY_MAIN_SELECTION']);
$iContentId = bx_process_input(bx_get('id'), BX_DATA_INT);
if ($iContentId) {
$this->_aContentInfo = $this->_oModule->_oDb->getContentInfoById($iContentId);
}
if ($this->_aContentInfo) {
$this->addMarkers($this->_aContentInfo);
// every field can be used as marker
$this->addMarkers(array('title' => strmaxtextlen($this->_aContentInfo[$CNF['FIELD_TEXT']], 20, '...')));
}
}
示例6: unit
function unit($aData, $isCheckPrivateContent = true, $sTemplateName = 'unit.html', $aParams = array())
{
$oModule = BxDolModule::getInstance($this->MODULE);
$CNF =& $oModule->_oConfig->CNF;
if ($s = $this->checkPrivacy($aData, $isCheckPrivateContent, $oModule)) {
return $s;
}
// get thumb url
$sPhotoThumb = '';
$sPhotoGallery = '';
if ($aData[$CNF['FIELD_THUMB']]) {
$oImagesTranscoder = BxDolTranscoderImage::getObjectInstance($CNF['OBJECT_IMAGES_TRANSCODER_PREVIEW']);
if ($oImagesTranscoder) {
$sPhotoThumb = $oImagesTranscoder->getFileUrl($aData[$CNF['FIELD_THUMB']]);
}
$oImagesTranscoder = BxDolTranscoderImage::getObjectInstance($CNF['OBJECT_IMAGES_TRANSCODER_GALLERY']);
if ($oImagesTranscoder) {
$sPhotoGallery = $oImagesTranscoder->getFileUrl($aData[$CNF['FIELD_THUMB']]);
} else {
$sPhotoGallery = $sPhotoThumb;
}
}
// get entry url
$sUrl = BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=' . $CNF['URI_VIEW_ENTRY'] . '&id=' . $aData[$CNF['FIELD_ID']]);
$oProfile = BxDolProfile::getInstance($aData[$CNF['FIELD_AUTHOR']]);
if (!$oProfile) {
$oProfile = BxDolProfileUndefined::getInstance();
}
// get summary
$sLinkMore = ' <a title="' . bx_html_attribute(_t('_sys_read_more', $aData[$CNF['FIELD_TITLE']])) . '" href="' . $sUrl . '"><i class="sys-icon ellipsis-h"></i></a>';
$sSummary = strmaxtextlen($aData[$CNF['FIELD_TEXT']], (int) getParam($CNF['PARAM_CHARS_SUMMARY']), $sLinkMore);
$sSummaryPlain = BxTemplFunctions::getInstance()->getStringWithLimitedLength(strip_tags($sSummary), (int) getParam($CNF['PARAM_CHARS_SUMMARY_PLAIN']));
$sText = $aData[$CNF['FIELD_TEXT']];
if (!empty($CNF['OBJECT_METATAGS'])) {
$oMetatags = BxDolMetatags::getObjectInstance($CNF['OBJECT_METATAGS']);
// keywords
if ($oMetatags->keywordsIsEnabled()) {
$sText = $oMetatags->keywordsParse($aData[$CNF['FIELD_ID']], $sText);
}
}
// generate html
$aVars = array('id' => $aData[$CNF['FIELD_ID']], 'content_url' => $sUrl, 'title' => bx_process_output($aData[$CNF['FIELD_TITLE']]), 'summary' => $sSummary, 'text' => $sText, 'author' => $oProfile->getDisplayName(), 'author_url' => $oProfile->getUrl(), 'entry_posting_date' => bx_time_js($aData[$CNF['FIELD_ADDED']], BX_FORMAT_DATE), 'module_name' => _t($CNF['T']['txt_sample_single']), 'ts' => $aData[$CNF['FIELD_ADDED']], 'bx_if:thumb' => array('condition' => $sPhotoThumb, 'content' => array('title' => bx_process_output($aData[$CNF['FIELD_TITLE']]), 'summary_attr' => bx_html_attribute($sSummaryPlain), 'content_url' => $sUrl, 'thumb_url' => $sPhotoThumb ? $sPhotoThumb : '', 'gallery_url' => $sPhotoGallery ? $sPhotoGallery : '', 'strecher' => str_repeat(' ', 40))), 'bx_if:no_thumb' => array('condition' => !$sPhotoThumb, 'content' => array('content_url' => $sUrl, 'summary_plain' => $sSummaryPlain, 'strecher' => mb_strlen($sSummaryPlain) > 240 ? '' : str_repeat(' ', round((240 - mb_strlen($sSummaryPlain)) / 6)))));
return $this->parseHtmlByName($sTemplateName, $aVars);
}
示例7: __construct
public function __construct($aObject, $oTemplate = false)
{
parent::__construct($aObject, $oTemplate);
$CNF =& $this->_oModule->_oConfig->CNF;
$iContentId = bx_process_input(bx_get('id'), BX_DATA_INT);
if ($iContentId) {
$this->_aContentInfo = $this->_oModule->_oDb->getContentInfoById($iContentId);
}
if ($this->_aContentInfo) {
$sTitle = isset($this->_aContentInfo[$CNF['FIELD_TITLE']]) ? $this->_aContentInfo[$CNF['FIELD_TITLE']] : strmaxtextlen($this->_aContentInfo[$CNF['FIELD_TEXT']], 20, '...');
$sUrl = BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=' . $CNF['URI_VIEW_ENTRY'] . '&id=' . $this->_aContentInfo[$CNF['FIELD_ID']]);
$this->addMarkers($this->_aContentInfo);
// every field can be used as marker
$this->addMarkers(array('title' => $sTitle, 'entry_link' => $sUrl));
// select view entry submenu
$oMenuSubmenu = BxDolMenu::getObjectInstance('sys_site_submenu');
$oMenuSubmenu->setObjectSubmenu($CNF['OBJECT_MENU_SUBMENU_VIEW_ENTRY'], array('title' => $sTitle, 'link' => $sUrl, 'icon' => $CNF['ICON']));
}
}
示例8: PrintSearhResult
/**
* @description : function will generate profile block (used the profile template );
* @return : Html presentation data ;
*/
function PrintSearhResult($aProfileInfo, $aCoupleInfo = '', $aExtendedKey = null, $sTemplateName = '', $oCustomTemplate = null)
{
global $site;
global $aPreValues;
$iVisitorID = getLoggedId();
$bExtMode = !empty($_GET['mode']) && $_GET['mode'] == 'extended' || !empty($_GET['search_result_mode']) && $_GET['search_result_mode'] == 'ext';
$isShowMatchPercent = $bExtMode && $iVisitorID && $iVisitorID != $aProfileInfo['ID'] && getParam('view_match_percent') && getParam('enable_match');
$bPublic = $bExtMode ? bx_check_profile_visibility($aProfileInfo['ID'], $iVisitorID, true) : true;
if ($bPublic && $iVisitorID != $aProfileInfo['ID'] && !isAdmin()) {
$oPrivacy = new BxDolPrivacy('sys_page_compose_privacy', 'id', 'user_id');
$iBlockID = $GLOBALS['MySQL']->getOne("SELECT `ID` FROM `sys_page_compose` WHERE `Page` = 'profile' AND `Func` = 'Description' AND `Column` != 0");
$iPrivacyId = (int) $GLOBALS['MySQL']->getOne("SELECT `id` FROM `sys_page_compose_privacy` WHERE `user_id`='{$aProfileInfo['ID']}' AND `block_id`='{$iBlockID}' LIMIT 1");
$bPublic = !$iBlockID || !$iPrivacyId || $oPrivacy->check('view_block', $iPrivacyId, $iVisitorID);
}
$sProfileThumb = get_member_thumbnail($aProfileInfo['ID'], 'none', !$bExtMode, 'visitor');
$sProfileMatch = $isShowMatchPercent ? $GLOBALS['oFunctions']->getProfileMatch($iVisitorID, $aProfileInfo['ID']) : '';
$sProfileNickname = '<a href="' . getProfileLink($aProfileInfo['ID']) . '">' . getNickName($aProfileInfo['ID']) . '</a>';
$sProfileInfo = $GLOBALS['oFunctions']->getUserInfo($aProfileInfo['ID']);
$sProfileDesc = $bPublic ? strmaxtextlen($aProfileInfo['DescriptionMe'], 130) : _t('_sys_profile_private_text_title');
$sProfileZodiac = $bPublic && $bExtMode && getParam('zodiac') ? $GLOBALS['oFunctions']->getProfileZodiac($aProfileInfo['DateOfBirth']) : '';
$sProfile2ASc1 = $sProfile2ASc2 = $sProfile2Nick = $sProfile2Desc = $sProfile2Info = $sProfile2Zodiac = '';
if ($aCoupleInfo) {
$sProfile2Nick = '<a href="' . getProfileLink($aCoupleInfo['ID']) . '">' . getNickName($aCoupleInfo['ID']) . '</a>';
$sProfile2Info = $GLOBALS['oFunctions']->getUserInfo($aCoupleInfo['ID']);
$sProfile2Desc = $bPublic ? strmaxtextlen($aCoupleInfo['DescriptionMe'], 130) : _t('_sys_profile_private_text_title');
$sProfile2Zodiac = $bPublic && $bExtMode && getParam('zodiac') ? $GLOBALS['oFunctions']->getProfileZodiac($aCoupleInfo['DateOfBirth']) : '';
$sProfile2ASc1 = 'float:left;width:31%;margin-right:10px;';
$sProfile2ASc2 = 'float:left;width:31%;display:block;';
} else {
$sProfile2ASc2 = 'display:none;';
}
$aKeys = array('thumbnail' => $sProfileThumb, 'match' => $sProfileMatch, 'nick' => $sProfileNickname, 'info' => $sProfileInfo, 'i_am_desc' => $sProfileDesc, 'zodiac_sign' => $sProfileZodiac, 'nick2' => $sProfile2Nick, 'info2' => $sProfile2Info, 'i_am_desc2' => $sProfile2Desc, 'zodiac_sign2' => $sProfile2Zodiac, 'add_style_c1' => $sProfile2ASc1, 'add_style_c2' => $sProfile2ASc2);
if ($aExtendedKey and is_array($aExtendedKey) and !empty($aExtendedKey)) {
foreach ($aExtendedKey as $sKey => $sValue) {
$aKeys[$sKey] = $sValue;
}
} else {
$aKeys['ext_css_class'] = '';
}
return $oCustomTemplate ? $oCustomTemplate->parseHtmlByName($sTemplateName, $aKeys) : $GLOBALS['oSysTemplate']->parseHtmlByName($sTemplateName, $aKeys);
}
示例9: displaySearchUnit
function displaySearchUnit($aData)
{
$sFileLink = $this->getCurrentUrl('file', $aData['id'], $aData['uri']);
$sCategoryLink = $this->getCurrentUrl('category', $aData['categoryId'], $aData['categoryUri'], array('ownerId' => $aData['ownerId'], 'ownerName' => $aData['ownerName']));
// ownerPic
$aUnit['ownerPic'] = get_member_icon($aData['ownerId'], 'left');
// category
$aUnit['category'] = isset($aData['categoryName']) ? _t('_In') . ' <a href="' . $sCategoryLink . '">' . $aData['categoryName'] . '</a>' : '';
// comment(s)
$aUnit['comment'] = isset($aData['countComment']) ? '<a href="' . $sFileLink . '">' . $aData['countComment'] . ' ' . _t('_comments') . '</a>' : '';
// tag
if (isset($aData['tag'])) {
$aTags = explode(',', $aData['tag']);
foreach ($aTags as $sValue) {
$sLink = $this->getCurrentUrl('tag', 0, $sValue);
$aUnit['tag'] .= '<a href="' . $sLink . '">' . $sValue . '</a>, ';
}
}
$aUnit['tag'] .= trim($aUnit['tag'], ', ');
// rate
if (!is_null($this->oRate) && $this->oRate->isEnabled()) {
$aUnit['rate'] = $this->oRate->getJustVotingElement(0, 0, $aData['voting_rate']);
} else {
$aUnit['rate'] = '';
}
// title
$aUnit['title'] = isset($aData['title']) ? '<a href="' . $sFileLink . '">' . $aData['title'] . '</a>' : '';
// when
$aUnit['when'] = defineTimeInterval($aData['date']);
// from
$aUnit['from'] = $aData['ownerId'] != 0 ? _t('_By') . ': <a href="' . getProfileLink($aData['ownerId']) . '">' . $aData['ownerName'] . '</a>' : _t('_By') . ': ' . _t('_Admin');
// view
$aUnit['view'] = isset($aData['view']) ? _t("_Views") . ': ' . $aData['view'] : '';
// body
$aUnit['body'] = isset($aData['bodyText']) ? process_html_output(strmaxtextlen(strip_tags($aData['bodyText']), 200)) : '';
return $GLOBALS['oSysTemplate']->parseHtmlByName('browseTextUnit.html', $aUnit, array('{', '}'));
}
示例10: serviceGetWallPostOutline
function serviceGetWallPostOutline($aEvent)
{
$sPrefix = 'bx_' . $this->_oConfig->getUri();
$aProfile = getProfileInfo($aEvent['owner_id']);
if (!$aProfile) {
return '';
}
$aObjectIds = strpos($aEvent['object_id'], ',') !== false ? explode(',', $aEvent['object_id']) : array($aEvent['object_id']);
rsort($aObjectIds);
$iItems = count($aObjectIds);
$iItemsLimit = 3;
if ($iItems > $iItemsLimit) {
$aObjectIds = array_slice($aObjectIds, 0, $iItemsLimit);
}
$bSave = false;
$aContent = array();
if (!empty($aEvent['content'])) {
$aContent = unserialize($aEvent['content']);
}
if (!isset($aContent['idims'])) {
$aContent['idims'] = array();
}
$iDeleted = 0;
$aItems = $aTmplItems = array();
foreach ($aObjectIds as $iId) {
$aItem = $this->_oDb->getPostInfo($iId);
if (empty($aItem)) {
$iDeleted++;
} else {
if ($aItem['PostStatus'] == 'approval' && $this->oPrivacy->check('view', $aItem['PostID'], $this->_iVisitorID)) {
$aItem['thumb_file'] = '';
$aItem['thumb_dims'] = array();
if (!empty($aItem['PostPhoto'])) {
$aItem['thumb_file'] = BX_BLOGS_IMAGES_URL . 'browse_' . $aItem['PostPhoto'];
$aItem['thumb_file_path'] = BX_BLOGS_IMAGES_PATH . 'browse_' . $aItem['PostPhoto'];
if (!file_exists($aItem['thumb_file_path'])) {
$aItem['thumb_file'] = BX_BLOGS_IMAGES_URL . 'big_' . $aItem['PostPhoto'];
$aItem['thumb_file_path'] = BX_BLOGS_IMAGES_PATH . 'big_' . $aItem['PostPhoto'];
}
if (!isset($aContent['idims'][$iId])) {
$sPath = file_exists($aItem['thumb_file_path']) ? $aItem['thumb_file_path'] : $aItem['thumb_file'];
$aContent['idims'][$iId] = BxDolImageResize::instance()->getImageSize($sPath);
$bSave = true;
}
$aItem['thumb_dims'] = $aContent['idims'][$iId];
$aItem['thumb_file_2x'] = BX_BLOGS_IMAGES_URL . 'orig_' . $aItem['PostPhoto'];
$aItem['thumb_file_2x_path'] = BX_BLOGS_IMAGES_PATH . 'orig_' . $aItem['PostPhoto'];
}
$aItem['PostUrl'] = $this->genUrl($aItem['PostID'], $aItem['PostUri'], 'entry');
$aItems[] = $aItem;
$aTmplItems[] = array('mod_prefix' => $sPrefix, 'item_width' => isset($aItem['thumb_dims']['w']) ? $aItem['thumb_dims']['w'] : $this->iThumbSize, 'item_height' => isset($aItem['thumb_dims']['h']) ? $aItem['thumb_dims']['h'] : $this->iThumbSize, 'item_icon' => $aItem['thumb_file'], 'item_icon_2x' => $aItem['thumb_file_2x'], 'item_page' => $aItem['PostUrl'], 'item_title' => $aItem['PostCaption'], 'item_description' => strmaxtextlen($aItem['PostText'], 300));
}
}
}
if ($iDeleted == count($aObjectIds)) {
return array('perform_delete' => true);
}
if (empty($aItems)) {
return '';
}
$aResult = array();
if ($bSave) {
$aResult['save']['content'] = serialize($aContent);
}
$sCss = '';
if ($aEvent['js_mode']) {
$sCss = $this->_oTemplate->addCss(array('wall_outline.css'), true);
} else {
$this->_oTemplate->addCss(array('wall_outline.css'));
}
$iItems = count($aItems);
$iOwner = (int) $aEvent['owner_id'];
$sOwner = getNickName($iOwner);
$sOwnerLink = getProfileLink($iOwner);
//--- Grouped events
$iItems = count($aItems);
if ($iItems > 1) {
$sTmplName = 'wall_outline_grouped.html';
$aResult['content'] = $sCss . $this->_oTemplate->parseHtmlByName($sTmplName, array('mod_prefix' => $sPrefix, 'mod_icon' => 'book', 'user_name' => $sOwner, 'user_link' => $sOwnerLink, 'bx_repeat:items' => $aTmplItems, 'item_comments' => 0 ? _t('_wall_n_comments', 0) : _t('_wall_no_comments'), 'item_comments_link' => '', 'post_id' => $aEvent['id'], 'post_ago' => $aEvent['ago']));
return $aResult;
}
//--- Single public event
$aItem = $aItems[0];
$aTmplItem = $aTmplItems[0];
$sTmplName = empty($aItem['thumb_file']) ? 'modules/boonex/wall/|outline_item_text.html' : 'modules/boonex/wall/|outline_item_image.html';
$aResult['content'] = $sCss . $this->_oTemplate->parseHtmlByName($sTmplName, array_merge($aTmplItem, array('mod_prefix' => $sPrefix, 'mod_icon' => 'book', 'user_name' => $sOwner, 'user_link' => $sOwnerLink, 'item_comments' => (int) $aItem['CommentsCount'] > 0 ? _t('_wall_n_comments', $aItem['CommentsCount']) : _t('_wall_no_comments'), 'item_comments_link' => $aItem['PostUrl'] . '#cmta-' . $sPrefix . '-' . $aItem['PostID'], 'post_id' => $aEvent['id'], 'post_ago' => $aEvent['ago'])));
return $aResult;
}
示例11: entryMessagePreviewInGrid
function entryMessagePreviewInGrid($r)
{
$oModule = BxDolModule::getInstance($this->MODULE);
$oProfileLast = BxDolProfile::getInstance($r['last_reply_profile_id']);
if (!$oProfileLast) {
$oProfileLast = BxDolProfileUndefined::getInstance();
}
$sText = strmaxtextlen($r['text'], 100);
$sTextCmt = strmaxtextlen($r['cmt_text'], 100);
if (!isset($r['unread_messages'])) {
$r['unread_messages'] = $r['comments'] - $r['read_comments'];
}
$aVars = array('url' => BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=' . $oModule->_oConfig->CNF['URI_VIEW_ENTRY'] . '&id=' . $r['id']), 'text' => $sText, 'cmt_text' => $sTextCmt, 'last_reply_time_and_replier' => _t('_bx_cnv_x_date_by_x_replier', bx_time_js($r['last_reply_timestamp'], BX_FORMAT_DATE), $oProfileLast->getDisplayName()), 'bx_if:unread_messages' => array('condition' => $r['unread_messages'] > 0, 'content' => array()));
$aVars['bx_if:unread_messages2'] = $aVars['bx_if:unread_messages'];
return $this->parseHtmlByName('message_preview_in_grid.html', $aVars);
}
示例12: getWallPostOutline
function getWallPostOutline($aEvent, $sIcon = 'save', $aParams = array())
{
$sPrefix = $this->_oConfig->getMainPrefix();
$sPrefixAlbum = $sPrefix . '_albums';
$aOwner = getProfileInfo((int) $aEvent['owner_id']);
$aObjectIds = strpos($aEvent['object_id'], ',') !== false ? explode(',', $aEvent['object_id']) : array($aEvent['object_id']);
rsort($aObjectIds);
$iItems = count($aObjectIds);
$iItemsLimit = isset($aParams['grouped']['items_limit']) ? (int) $aParams['grouped']['items_limit'] : 3;
if ($iItems > $iItemsLimit) {
$aObjectIds = array_slice($aObjectIds, 0, $iItemsLimit);
}
$bSave = false;
$aContent = array();
if (!empty($aEvent['content'])) {
$aContent = unserialize($aEvent['content']);
}
if (!isset($aContent['idims'])) {
$aContent['idims'] = array();
}
$sClassName = $this->_oConfig->getClassPrefix() . 'Search';
bx_import('Search', $this->_aModule);
$oSearch = new $sClassName();
$sItemThumbnailType = isset($aParams['thumbnail_type']) ? $aParams['thumbnail_type'] : 'browse';
$iDeleted = 0;
$aItems = $aTmplItems = array();
foreach ($aObjectIds as $iId) {
$aItem = $oSearch->serviceGetItemArray($iId, $sItemThumbnailType);
if (empty($aItem)) {
$iDeleted++;
} else {
if ($aItem['status'] == 'approved' && $this->oAlbumPrivacy->check('album_view', $aItem['album_id'], $this->oModule->_iProfileId)) {
if (!isset($aContent['idims'][$iId])) {
$sPath = isset($aItem['file_path']) && file_exists($aItem['file_path']) ? $aItem['file_path'] : $aItem['file'];
$aContent['idims'][$iId] = BxDolImageResize::instance()->getImageSize($sPath);
$bSave = true;
}
$aItem['dims'] = $aContent['idims'][$iId];
$aItems[] = $aItem;
$aItem2x = $oSearch->serviceGetItemArray($iId, $sItemThumbnailType . '2x');
$aTmplItems[] = array_merge($aItem, array('mod_prefix' => $sPrefix, 'item_width' => $aItem['dims']['w'], 'item_height' => $aItem['dims']['h'], 'item_icon' => $aItem['file'], 'item_icon_2x' => !empty($aItem2x['file']) ? $aItem2x['file'] : $aItem['file'], 'item_page' => $aItem['url'], 'item_title' => $aItem['title']));
}
}
}
if ($iDeleted == count($aObjectIds)) {
return array('perform_delete' => true);
}
if (empty($aOwner) || empty($aItems)) {
return "";
}
$aResult = array();
if ($bSave) {
$aResult['save']['content'] = serialize($aContent);
}
$sCss = "";
if ($aEvent['js_mode']) {
$sCss = $this->_oTemplate->addCss('wall_outline.css', true);
} else {
$this->_oTemplate->addCss('wall_outline.css');
}
$iOwner = (int) $aEvent['owner_id'];
$sOwner = getNickName($iOwner);
$sOwnerLink = getProfileLink($iOwner);
//--- Grouped events
$iItems = count($aItems);
if ($iItems > 1) {
$aExtra = unserialize($aEvent['content']);
$sAlbumUri = $aExtra['album'];
$oAlbum = new BxDolAlbums($sPrefix);
$aAlbumInfo = $oAlbum->getAlbumInfo(array('fileUri' => $sAlbumUri, 'owner' => $iOwner));
$oAlbumCmts = new BxTemplCmtsView($sPrefixAlbum, $aAlbumInfo['ID']);
$aAlbumInfo['comments_count'] = (int) $oAlbumCmts->getObjectCommentsCount();
$aAlbumInfo['Url'] = $oSearch->getCurrentUrl('album', $aAlbumInfo['ID'], $aAlbumInfo['Uri']) . '/owner/' . getUsername($iOwner);
$sTmplName = isset($aParams['templates']['grouped']) ? $aParams['templates']['grouped'] : 'modules/boonex/wall/|outline_item_image_grouped.html';
$aResult['content'] = $sCss . $this->_oTemplate->parseHtmlByName($sTmplName, array('mod_prefix' => $sPrefix, 'mod_icon' => $sIcon, 'user_name' => $sOwner, 'user_link' => $sOwnerLink, 'bx_repeat:items' => $aTmplItems, 'album_url' => $aAlbumInfo['Url'], 'album_title' => $aAlbumInfo['Caption'], 'album_description' => strmaxtextlen($aAlbumInfo['Description'], 200), 'album_comments' => (int) $aAlbumInfo['comments_count'] > 0 ? _t('_wall_n_comments', $aAlbumInfo['comments_count']) : _t('_wall_no_comments'), 'album_comments_link' => $aAlbumInfo['Url'] . '#cmta-' . $sPrefixAlbum . '-' . $aAlbumInfo['ID'], 'post_id' => $aEvent['id'], 'post_ago' => $aEvent['ago']));
return $aResult;
}
//--- Single public event
$aItem = $aItems[0];
$aTmplItem = $aTmplItems[0];
$sTmplName = isset($aParams['templates']['single']) ? $aParams['templates']['single'] : 'modules/boonex/wall/|outline_item_image.html';
$aResult['content'] = $sCss . $this->_oTemplate->parseHtmlByName($sTmplName, array_merge($aTmplItem, array('mod_prefix' => $sPrefix, 'mod_icon' => $sIcon, 'user_name' => $sOwner, 'user_link' => $sOwnerLink, 'item_page' => $aItem['url'], 'item_title' => $aItem['title'], 'item_description' => strmaxtextlen($aItem['description'], 200), 'item_comments' => (int) $aItem['comments_count'] > 0 ? _t('_wall_n_comments', $aItem['comments_count']) : _t('_wall_no_comments'), 'item_comments_link' => $aItem['url'] . '#cmta-' . $sPrefix . '-' . $aItem['id'], 'post_id' => $aEvent['id'], 'post_ago' => $aEvent['ago'])));
return $aResult;
}
示例13: getMembersExtended
function getMembersExtended($aProfiles, $sPaginate, $sControls)
{
$aItems = array();
foreach ($aProfiles as $aProfile) {
$aItems[$aProfile['id']] = array('id' => $aProfile['id'], 'thumbnail' => get_member_thumbnail($aProfile['id'], 'none'), 'edit_link' => $GLOBALS['site']['url'] . 'pedit.php?ID=' . $aProfile['id'], 'edit_class' => (int) $aProfile['banned'] == 1 ? 'adm-mp-banned' : ($aProfile['status'] != 'Active' ? 'adm-mp-inactive' : 'adm-mp-active'), 'username' => getNickName($aProfile['id']), 'info' => $GLOBALS['oFunctions']->getUserInfo($aProfile['id']), 'description' => strmaxtextlen($aProfile['description'], 130));
}
return $GLOBALS['oAdmTemplate']->parseHtmlByName('mp_members_extended.html', array('bx_repeat:items' => array_values($aItems), 'paginate' => $sPaginate, 'control' => $sControls));
}
示例14: serviceGetTimelinePost
/**
* Entry post for Timeline
*/
public function serviceGetTimelinePost($aEvent)
{
$aContentInfo = $this->_oDb->getContentInfoById($aEvent['object_id']);
if (empty($aContentInfo) || !is_array($aContentInfo)) {
return '';
}
$CNF =& $this->_oConfig->CNF;
$sUrl = BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=' . $CNF['URI_VIEW_ENTRY'] . '&id=' . $aContentInfo[$CNF['FIELD_ID']]);
//--- Image(s)
$aImages = $this->_getImagesForTimelinePost($aEvent, $aContentInfo, $sUrl);
//--- Votes
$oVotes = BxDolVote::getObjectInstance($CNF['OBJECT_VOTES'], $aEvent['object_id']);
$aVotes = array();
if ($oVotes && $oVotes->isEnabled()) {
$aVotes = array('system' => $CNF['OBJECT_VOTES'], 'object_id' => $aContentInfo[$CNF['FIELD_ID']], 'count' => $aContentInfo['votes']);
}
//--- Comments
$oCmts = BxDolCmts::getObjectInstance($CNF['OBJECT_COMMENTS'], $aEvent['object_id']);
$aComments = array();
if ($oCmts && $oCmts->isEnabled()) {
$aComments = array('system' => $CNF['OBJECT_COMMENTS'], 'object_id' => $aContentInfo[$CNF['FIELD_ID']], 'count' => $aContentInfo['comments']);
}
return array('owner_id' => $aContentInfo[$CNF['FIELD_AUTHOR']], 'content' => array('sample' => _t($CNF['T']['txt_sample_single']), 'url' => $sUrl, 'title' => isset($aContentInfo[$CNF['FIELD_TITLE']]) ? $aContentInfo[$CNF['FIELD_TITLE']] : strmaxtextlen($aContentInfo[$CNF['FIELD_TEXT']], 20, '...'), 'text' => $aContentInfo[$CNF['FIELD_TEXT']], 'images' => $aImages), 'date' => $aContentInfo[$CNF['FIELD_ADDED']], 'votes' => $aVotes, 'comments' => $aComments, 'title' => '', 'description' => '');
}
示例15: _formatSnippetText
function _formatSnippetText($aEntryData, $iMaxLen = 300)
{
return strmaxtextlen($aEntryData[$this->_oDb->_sFieldDescription], $iMaxLen);
}