本文整理匯總了PHP中IPSText::wordwrap方法的典型用法代碼示例。如果您正苦於以下問題:PHP IPSText::wordwrap方法的具體用法?PHP IPSText::wordwrap怎麽用?PHP IPSText::wordwrap使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類IPSText
的用法示例。
在下文中一共展示了IPSText::wordwrap方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _viewModern
//.........這裏部分代碼省略.........
list($be_anon, $loggedin) = explode('&', $this->memberData['login_anonymous']);
if (!$be_anon) {
$this->_addRecentVisitor($member, $this->memberData['member_id']);
}
}
//-----------------------------------------
// DST?
//-----------------------------------------
if ($member['dst_in_use'] == 1) {
$member['time_offset'] += 1;
}
//-----------------------------------------
// Format extra user data
//-----------------------------------------
$member['_age'] = $member['bday_year'] ? date('Y') - $member['bday_year'] : 0;
if ($member['bday_month'] > date('n')) {
$member['_age'] -= 1;
} else {
if ($member['bday_month'] == date('n')) {
if ($member['bday_day'] > date('j')) {
$member['_age'] -= 1;
}
}
}
$member['_local_time'] = $member['time_offset'] != "" ? gmstrftime($this->settings['clock_long'], time() + $member['time_offset'] * 3600 + $time_adjust * 60) : '';
$member['g_title'] = IPSLib::makeNameFormatted($member['g_title'], $member['g_id'], $member['prefix'], $member['suffix']);
$member['_posts_day'] = 0;
$member['_total_pct'] = 0;
$member['_bday_month'] = $member['bday_month'] ? $this->lang->words['M_' . $member['bday_month']] : 0;
//-----------------------------------------
// BIO
//-----------------------------------------
$member['pp_bio_content'] = IPSText::getTextClass('bbcode')->stripBadWords($member['pp_bio_content']);
$member['pp_bio_content'] = IPSText::wordwrap($member['pp_bio_content'], '25', ' ');
if (!$this->settings['disable_profile_stats']) {
$posts = $this->DB->buildAndFetch(array('select' => "COUNT(*) as total_posts", 'from' => "posts", 'where' => "author_id=" . $member['member_id']));
$member['posts'] = $posts['total_posts'];
//-----------------------------------------
// Total posts
//-----------------------------------------
if ($member['posts'] and $board_posts) {
$member['_posts_day'] = round($member['posts'] / ((time() - $member['joined']) / 86400), 2);
# Fix the issue when there is less than one day
$member['_posts_day'] = $member['_posts_day'] > $member['posts'] ? $member['posts'] : $member['_posts_day'];
$member['_total_pct'] = sprintf('%.2f', $member['posts'] / $board_posts * 100);
}
$member['_posts_day'] = floatval($member['_posts_day']);
//-----------------------------------------
// Most active in
//-----------------------------------------
$favorite = $this->DB->buildAndFetch(array('select' => 'COUNT(p.author_id) as f_posts', 'from' => array('posts' => 'p'), 'where' => 'p.author_id=' . $member['member_id'] . ' AND ' . $this->registry->permissions->buildPermQuery('i'), 'order' => 'f_posts DESC', 'group' => 't.forum_id', 'add_join' => array(array('select' => 't.forum_id', 'from' => array('topics' => 't'), 'where' => 't.tid=p.topic_id'), array('from' => array('permission_index' => 'i'), 'where' => "i.perm_type='forum' AND i.perm_type_id=t.forum_id"))));
$member['favorite_id'] = $favorite['forum_id'];
$member['_fav_posts'] = $favorite['f_posts'];
if ($member['posts']) {
$member['_fav_percent'] = round($favorite['f_posts'] / $member['posts'] * 100);
}
}
//-----------------------------------------
// Comments
//-----------------------------------------
if ($member['pp_setting_count_comments']) {
require_once IPSLib::getAppDir('members') . '/sources/comments.php';
$comment_lib = new profileCommentsLib($this->registry);
$comment_html = $comment_lib->buildComments($member);
}
//-----------------------------------------
示例2: _viewComments
/**
* Loads the content for the comments tab
*
* @access private
* @return void [Prints to screen]
* @since IPB 2.2.0.2006-08-02
*/
private function _viewComments()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$member_id = intval($this->request['member_id']);
$md5check = IPSText::md5Clean($this->request['md5check']);
$content = '';
$comment_perpage = 10;
$pages = '';
$start = intval($this->request['st']);
$sql_extra = '';
//-----------------------------------------
// MD5 check
//-----------------------------------------
if ($md5check != $this->member->form_hash) {
die('');
}
//-----------------------------------------
// Not my tab? So no moderation...
//-----------------------------------------
if ($member_id != $this->memberData['member_id'] and !$this->memberData['g_is_supmod']) {
$sql_extra = ' AND comment_approved=1';
}
//-----------------------------------------
// Load member
//-----------------------------------------
$member = IPSMember::load($member_id);
//-----------------------------------------
// Check
//-----------------------------------------
if (!$member['member_id']) {
die('');
}
//-----------------------------------------
// How many comments must a man write down
// before he is considered a spammer?
//-----------------------------------------
$comment_count = $this->DB->buildAndFetch(array('select' => 'count(*) as count_comment', 'from' => 'profile_comments', 'where' => 'comment_for_member_id=' . $member_id . $sql_extra));
//-----------------------------------------
// Pages
//-----------------------------------------
$pages = $this->registry->output->generatePagination(array('totalItems' => intval($comment_count['count_comment']), 'itemsPerPage' => $comment_perpage, 'currentStartValue' => $start, 'baseUrl' => $this->settings['base_url'] . 'app=members&section=comments&module=profile&member_id=' . $member_id . '&do=view&md5check=' . $this->member->form_hash));
//-----------------------------------------
// Regenerate comments...
//-----------------------------------------
$this->DB->build(array('select' => 'pc.*', 'from' => array('profile_comments' => 'pc'), 'where' => 'pc.comment_for_member_id=' . $member_id . $sql_extra, 'order' => 'pc.comment_date DESC', 'limit' => array($start, $comment_perpage), 'add_join' => array(0 => array('select' => 'm.members_display_name, m.login_anonymous', 'from' => array('members' => 'm'), 'where' => 'm.member_id=pc.comment_by_member_id', 'type' => 'left'), 1 => array('select' => 'pp.*', 'from' => array('profile_portal' => 'pp'), 'where' => 'pp.pp_member_id=m.member_id', 'type' => 'left'))));
$o = $this->DB->execute();
while ($row = $this->DB->fetch($o)) {
$row['comment_content'] = IPSText::wordwrap($row['comment_content'], '19', ' ');
$row = IPSMember::buildDisplayData($row, 0);
if (!$row['members_display_name_short']) {
$row = array_merge($row, IPSMember::setUpGuest());
}
$comments[] = $row;
}
//-----------------------------------------
// Ok.. show the settings
//-----------------------------------------
$content = $this->registry->getClass('output')->getTemplate('profile')->showIframeComments($member, $comments, $pages);
$this->registry->getClass('output')->setTitle($this->settings['board_name']);
$this->registry->getClass('output')->popUpWindow($content);
}