本文整理汇总了PHP中UTF8::lessen方法的典型用法代码示例。如果您正苦于以下问题:PHP UTF8::lessen方法的具体用法?PHP UTF8::lessen怎么用?PHP UTF8::lessen使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UTF8
的用法示例。
在下文中一共展示了UTF8::lessen方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dressNotice
function dressNotice($input, $config) {
global $database, $db, $skin;
$blogid = isset($config['blog'])?$config['blog']:'';
$tag = isset($config['tag'])?$config['tag']:'';
$count = isset($config['count'])?$config['count']:5;
$title_length = isset($config['title_length'])?$config['title_length']:15;
$src_notices = $skin->cutSkinTag('notice');
if(!empty($blogid)) {
list($notices, $totalFeeditem) = getNoticeFeedItems($blogid, 1, $count);
$s_notices_rep = '';
$src_notice_rep = $skin->cutSkinTag('notice_rep');
if($totalFeeditem > 0) {
foreach($notices as $notice) {
$sp_notices = $skin->parseTag('notice_title', UTF8::lessen($notice['title'],$title_length), $src_notice_rep);
$sp_notices = $skin->parseTag('notice_url', $notice['permalink'], $sp_notices);
$s_notices_rep .= $sp_notices;
$sp_notices = '';
}
$src_notices = $skin->dressOn('notice_rep', $src_notice_rep, $s_notices_rep, $src_notices);
} else {
$s_notices_rep = '';
$src_notices = ''; // 공지사항이 없을시 공지사항 틀도 감추기..
}
$skin->dress('notice', $src_notices);
}
return $input . $result;
}
示例2: lessenAsEncoding
static function lessenAsEncoding($str, $length = 255, $tail = '...')
{
$context = \CADB\Model\Context::getInstance();
if ($context->getProperty('database.utf8') != true) {
return UTF8::lessen($str, $length, $tail);
} else {
return UTF8::lessenAsByte($str, $length, $tail);
}
}
示例3: _t
$result = $event->on('Add.getFeed', $xml);
if(!is_array($result)) {
$result = feed::getFeedItems($xml);
}
requireComponent('Bloglounge.Data.Groups');
$groups = Group::getGroupsAll();
$users = User::getMembers();
if(count($result)>0) {
?>
<dl>
<dt><?php echo _t('글');?></dt>
<dd class="text">
<?php echo _f('가장 최신의 글 "%1"(을)를 포함한 %2개의 글이 존재합니다.','<span class="point">'.UTF8::lessen($result[0]['title'],40).'</span>', '<span class="cnt">'.count($result).'</span>');?>
</dd>
</dl>
<?php
}
?>
<div class="clear"></div>
<div class="options_wrap">
<dl>
<dt><?php echo _t('그룹');?></dt>
<dd>
<select name="group">
<option value="0"><?php echo _t('지정안함');?></option>
<?php
foreach($groups as $group) {
示例4: sendTrackback
function sendTrackback($blogid, $entryId, $url)
{
global $defaultURL, $blog;
requireModel('blog.entry');
requireModel('blog.keyword');
$entry = getEntry($blogid, $entryId);
if (is_null($entry)) {
return false;
}
$link = "{$defaultURL}/{$entryId}";
$title = htmlspecialchars($entry['title']);
$entry['content'] = getEntryContentView($blogid, $entryId, $entry['content'], $entry['contentformatter'], getKeywordNames($blogid));
$excerpt = str_tag_on(UTF8::lessen(removeAllTags(stripHTML($entry['content'])), 255));
$blogTitle = $blog['title'];
$isNeedConvert = strpos($url, '/rserver.php?') !== false || strpos($url, 'blog.naver.com/tb') !== false || strpos($url, 'news.naver.com/tb/') !== false || strpos($url, 'blog.empas.com') !== false || strpos($url, 'blog.yahoo.com') !== false || strpos($url, 'www.blogin.com/tb/') !== false || strpos($url, 'cytb.cyworld.nate.com') !== false || strpos($url, 'www.cine21.com/Movies/tb.php') !== false;
if ($isNeedConvert) {
$title = UTF8::convert($title, 'EUC-KR');
$excerpt = UTF8::convert($excerpt, 'EUC-KR');
$blogTitle = UTF8::convert($blogTitle, 'EUC-KR');
$content = "url=" . rawurlencode($link) . "&title=" . rawurlencode($title) . "&blog_name=" . rawurlencode($blogTitle) . "&excerpt=" . rawurlencode($excerpt);
$request = new HTTPRequest('POST', $url);
$request->contentType = 'application/x-www-form-urlencoded; charset=euc-kr';
$isSuccess = $request->send($content);
} else {
$content = "url=" . rawurlencode($link) . "&title=" . rawurlencode($title) . "&blog_name=" . rawurlencode($blogTitle) . "&excerpt=" . rawurlencode($excerpt);
$request = new HTTPRequest('POST', $url);
$request->contentType = 'application/x-www-form-urlencoded; charset=utf-8';
$isSuccess = $request->send($content);
}
if ($isSuccess && checkResponseXML($request->responseText) === 0) {
// $url = POD::escapeString(UTF8::lessenAsEncoding($url, 255));
$trackbacklog = new TrackbackLog();
$trackbacklog->entry = $entryId;
$trackbacklog->url = POD::escapeString(UTF8::lessenAsEncoding($url, 255));
$trackbacklog->add();
// POD::query("INSERT INTO {$database['prefix']}TrackbackLogs VALUES ($blogid, '', $entryId, '$url', UNIX_TIMESTAMP())");
return true;
}
return false;
}
示例5: lessen
function lessen($str, $length = 255, $tail = '..') {
global $database;
return ($database['utf8']) ? UTF8::lessen($str, $length, $tail) : UTF8::lessenAsByte($str, $length, $tail);
}
示例6: getCommentFeedTotal
function getCommentFeedTotal($blogid, $rawMode = false, $mode = 'rss')
{
global $database, $serviceURL, $defaultURL, $blogURL, $blog, $service;
$channel = initializeRSSchannel($blogid);
$channel['title'] = $blog['title'] . ': ' . _text('최근 댓글 목록');
$result = getRecentComments($blogid, Setting::getBlogSettingGlobal('commentsOnRSS', 20), false, true);
if (!$result) {
$result = array();
}
$channel['items'] = array();
foreach ($result as $row) {
$commentURL = $defaultURL . "/" . $row['entry'] . "#comment";
$content = htmlspecialchars($row['comment']);
$item = array('id' => $row['id'], 'title' => RSSMessage(UTF8::lessen($row['title'], 30) . ' : ' . _textf('%1님의 댓글', $row['name'])), 'link' => $commentURL . $row['id'], 'categories' => array(), 'description' => RSSMessage($content), 'author' => RSSMessage($row['name']), 'pubDate' => $row['written'], 'comments' => $commentURL, 'guid' => $commentURL . $row['id']);
if ($row['secret']) {
$item['title'] = $item['author'] = $item['description'] = _text('비밀 댓글입니다');
}
array_push($channel['items'], $item);
}
if ($rawMode == true) {
return $channel['items'];
}
$rss = array('channel' => $channel);
if ($mode == 'rss') {
return publishRSS($blogid, $rss);
} else {
if ($mode == 'atom') {
return publishATOM($blogid, $rss);
}
}
return false;
}
示例7: FM_default_summary
function FM_default_summary($blogid, $id, $content, $keywords = array(), $useAbsolutePath = false)
{
global $blog;
if (!$blog['publishWholeOnRSS']) {
$content = UTF8::lessen(removeAllTags(stripHTML($content)), 255);
}
return $content;
}
示例8: array
foreach($feeds as $feed) {
$data = array();
$stringDate = Func::dateToString($feed['lastUpdate']);
$lastPost = Feed::getLatestPost($feed['id']);
$isNew = Func::isNew($feed['created'],1);
$noVerifier = Validator::getBool($config->useVerifier) && !Validator::getBool($feed['isVerified']) && ($feed['owner'] != 1);
$data['id'] = 'list_item_'.$feed['id'];
$data['class'] = ($feed['visibility']=='n'?'list_item_hide':'').($feed['id']==$read?' list_item_select':'').($noVerifier?' no_verifier':'');
$data['datas'] = array();
// 블로그 등록날짜
array_push($data['datas'], array('class'=>'bloglist_date','data'=> $noVerifier ? _t('미인증') : date('y.m.d H:i:s', $feed['created']) ));
array_push($data['datas'], array('class'=>'bloglist_group','data'=> empty($group_names[$feed['group']])?'<span class="empty">'._t('그룹없음').'</span>':UTF8::lessen($group_names[$feed['group']],10) ));
// 블로그 제목
ob_start();
?>
<?php
if($noVerifier) {
?>
<div class="ftool"> <a href="#" class="microbutton" onclick="verifyFeed(<?php echo $feed['id'];?>); return false;"><span><?php echo _t('인증하기');?></span></a></div>
<?php
}
?>
<div class="ftitle<?php if(!$noVerifier) {?> noftool<?php } ?>">
<a href="<?php echo $service['path'];?>/admin/blog/list?read=<?php echo $feed['id'];?>"><?php echo UTF8::lessenAsEm(stripcslashes($feed['title']), 25);?></a> <?php echo ($isNew?' <img src="'.$service['path'].'/images/admin/icon_new.gif" alt="new" align="absmiddle"/>':'');?>
示例9: utf8Lessen
function utf8Lessen($str, $length, $tail = '..')
{
return UTF8::lessen($str, $length, $tail);
}
示例10: getMagazineFocus
//.........这里部分代码省略.........
$media = new Media;
foreach($focusImages as $item) {
if(!file_exists($path.'/'.$item['id'].'.jpg')) {
$media->getThumbnail($item['source'], 350, 160, $path, $item['id'], 'crop');
}
}
// 이슈태그
if($config['issueType'] == 'auto') {
$issueTags = Tag::getIssueTags($config['issueCount']);
} else {
$issueTags = explode(',', $config['issueTag']);
foreach($issueTags as $key=>$tag) {
$issueTags[$key] = array('name'=>trim($tag));
}
}
// 이슈태그
ob_start();
?>
<div class="magazineFocusWrap">
<table class="magazineFocusTable" cellpadding="0" cellspacing="0">
<tr>
<td class="leftTab">
<ul>
<?php
$index = 0;
foreach($issueTags as $key=>$tag) {
list($issueTags[$key]['feedItems'], $totalFeedItemCount) = FeedItem::getFeedItems('tag', $tag['name'], null, 1, $config['issueFeedCount']);
$index++;
?>
<li id="_magazineFocus_<?php echo $index;?>_menu" class="<?php echo ($index==1)?'first selected ':'';?>_magazineFocus_menu" onclick="goto('<?php echo $service['path'];?>/search/tag/<?php echo rawurlencode($tag['name']);?>'); return false;" onmouseover="magazineFocusMouseOverMenu('_magazineFocus_<?php echo $index;?>');" title="클릭하시면 태그검색이 가능합니다."><span><?php echo UTF8::lessen($tag['name'],10);?></span></li>
<?php
}
?> <li class="dummy"></li>
</ul>
</td>
<td class="mainData">
<?php
// 이슈태그 내용
$index = 0;
foreach($issueTags as $tag) {
$index ++;
?>
<ul id="_magazineFocus_<?php echo $index;?>_item" class="item _magazineFocus_item<?php echo ($index==1)?' viewed':'';?>">
<?php
if(count($tag['feedItems'])>0) {
$feedItem = current($tag['feedItems']);
$thumbnailFile = '';
if($media = Media::getMedia($feedItem['thumbnailId'])) {
$thumbnailFile = Media::getMediaFile($media['thumbnail']);
}
$link_url = $config->addressType == 'id' ? $service['path'].'/go/'.$feedItem['id'] : $service['path'].'/go/'.$feedItem['permalink'];
?>
<li>
<?php
if(!empty($thumbnailFile)) {
?>
<div class="thumbnail">
<img src="<?php echo $thumbnailFile;?>" alt="미리보기" />
</div>
示例11: htmlspecialchars
$sp_posts = $skin->dressOn('cond_logo', $src_logo, '', $sp_posts);
$sp_posts = $skin->parseTag('post_logo_exist', 'post_logo_nonexistence', $sp_posts);
}
$sp_posts = $skin->parseTag('post_position', ($index==1?'firstItem':($index==$lastIndex?'lastItem':'')), $sp_posts);
$sp_posts = $skin->parseTag('post_id', $item['id'], $sp_posts);
$link_url = $config->addressType == 'id' ? $service['path'].'/go/'.$item['id'] : $service['path'].'/go/'.htmlspecialchars($item['permalink']);
$sp_posts = $skin->parseTag('post_url', $event->on('Text.postURL',(Validator::getBool($config->directView)?$service['path'].'/read/'.$item['id']:$link_url)), $sp_posts);
$sp_posts = $skin->parseTag('post_link_target', (Validator::getBool($config->directView)?'_self':'_blank'), $sp_posts);
$sp_posts = $skin->parseTag('post_permalink', htmlspecialchars($item['permalink']), $sp_posts);
$sp_posts = $skin->parseTag('post_visibility', (($item['visibility'] == 'n' || $item['feedVisibility'] == 'n') ? 'hidden' : 'visible' ), $sp_posts);
$sp_posts = $skin->parseTag('post_title', UTF8::clear($event->on('Text.postTitle', UTF8::lessen(func::stripHTML($item['title']), $skinConfig->postTitleLength))), $sp_posts);
$sp_posts = $skin->parseTag('post_author', UTF8::clear($event->on('Text.postAuthor',$item['author'])), $sp_posts);
list($post_category) = explode(',', UTF8::clear($item['tags']), 2);
$sp_posts = $skin->parseTag('post_category', $post_category, $sp_posts);
$sp_posts = $skin->parseTag('post_date', $event->on('Text.postDate',(Validator::is_digit($item['written']) ? date('Y-m-d h:i a', $item['written']) : $item['written'])), $sp_posts);
$sp_posts = $skin->parseTag('post_view', $item['click'], $sp_posts);
$post_description = func::stripHTML($item['description'].'>');
if (substr($post_description, -1) == '>') $post_description = substr($post_description, 0, strlen($post_description) - 1);
$post_description = UTF8::lessenAsByte(func::htmltrim($post_description), $skinConfig->postDescLength);
if (strlen($post_description) == 0) $post_description = '<span class="empty">'._t('(글의 앞부분이 이미지 혹은 HTML 태그만으로 되어있습니다)').'</span>';
$post_description = $event->on('Text.postDescription', $post_description);
if(!empty($searchKeyword) && in_array($searchType,array('title','description','title+description'))) {