本文整理汇总了PHP中UTF8::lessenAsByte方法的典型用法代码示例。如果您正苦于以下问题:PHP UTF8::lessenAsByte方法的具体用法?PHP UTF8::lessenAsByte怎么用?PHP UTF8::lessenAsByte使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UTF8
的用法示例。
在下文中一共展示了UTF8::lessenAsByte方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
}
示例2: date
$s_feedrecent_rep = $skin->parseTag('feeds_recent_title', $recent['title'], $s_feedrecent_rep);
$s_feedrecent_rep = $skin->parseTag('feeds_recent_date', date('Y-m-d H:i',$recent['written']), $s_feedrecent_rep);
$sp_feedrecent_rep .= $s_feedrecent_rep;
}
$s_feedrecent .= $skin->dressOn('feedrecent_rep', $src_feedrecent_rep, $sp_feedrecent_rep, $src_feedrecent);
} else {
$s_feedrecent = '';
}
$sp_feeds = $skin->parseTag('feed_position', ($index==1?'firstItem':($index==count($feeds)?'lastItem':'')), $sp_feeds);
$sp_feeds = $skin->dressOn('feedrecent', $src_feedrecent, $s_feedrecent, $sp_feeds);
$sp_feeds = $skin->parseTag('feeds_desc', $event->on('Text.feedDescription', UTF8::lessenAsByte($feed['description'], 200)), $sp_feeds);
$sp_feeds = $skin->parseTag('feeds_blogurl', $feed['blogURL'], $sp_feeds);
$sp_feeds = $skin->parseTag('feeds_created', $event->on('Text.feedCreated', (Validator::is_digit($feed['created']) ? date('Y-m-d H:i', $feed['created']) : $feed['created'])), $sp_feeds);
$sp_feeds = $skin->parseTag('feeds_lastupdate', $event->on('Text.feedLastupdate', (Validator::is_digit($feed['lastUpdate']) ? date('Y-m-d H:i', $feed['lastUpdate']) : $feed['lastUpdate'])), $sp_feeds);
//$sp_feeds = $skin->parseTag('feeds_search_url', $service['path'].'/?blogURL='.str_replace('http://','',Func::lastSlashDelete($feed['blogURL'])), $sp_feeds);
$sp_feeds = $skin->parseTag('feeds_linkurl', $service['path'].'/blog/'.$feed['id'], $sp_feeds);
$sp_feeds = $skin->parseTag('feeds_feedurl', $service['path'].'/rss/blog/'.$feed['id'], $sp_feeds);
$s_feeds_rep .= $event->on('Text.feed', $sp_feeds);
$sp_feeds = '';
}
$s_feeds = $skin->dressOn('feedlist_rep', $src_feed_rep, $s_feeds_rep, $src_feeds);
} else {
$s_feeds_rep = '<div class="no_article">'._t("블로그 목록이 비어있습니다.").'</div>';
示例3: lessen
function lessen($str, $length = 255, $tail = '..') {
global $database;
return ($database['utf8']) ? UTF8::lessen($str, $length, $tail) : UTF8::lessenAsByte($str, $length, $tail);
}
示例4: getIssueFocus
//.........这里部分代码省略.........
<?php
}
?>
</ul>
<div class="clear"></div>
<?php
// 포커스 내용
if($config['useFocus']) {
?>
<ul id="_issueFocus_focus_item" class="item _issueFocus_item viewed">
<?php
if(count($focusFeedItems)>0) {
foreach($focusFeedItems as $feedItem) {
$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>
<?php
}
?>
<div class="data <?php echo empty($thumbnailFile)?'data2':'';?>">
<h3><a href="<?php echo $link_url;?>" target="_blank"><?php echo UTF8::lessenAsByte(func::stripHTML($feedItem['title']),$config['issueTitleLength']);?></a></h3>
<div class="desc">
<?php echo UTF8::lessenAsByte(func::htmltrim(func::stripHTML($feedItem['description'])),$config['issueDescLength']);?>
</div>
</div>
<div class="clear"></div>
</li>
<?php
}
} else {
?>
<li class="empty">포커스로 지정된 글이 없습니다.</li>
<?php
}
?>
</ul>
<?php
}
// 이슈태그 내용
$index = 0;
foreach($issueTags as $tag) {
$index ++;
?>
<ul id="_issueFocus_<?php echo $index;?>_item" class="item _issueFocus_item<?php echo (!$config['useFocus']&&($index==1))?' viewed':'';?>">
<?php
if(count($tag['feedItems'])>0) {
foreach($tag['feedItems'] as $feedItem) {
$thumbnailFile = '';
if($media = Media::getMedia($feedItem['thumbnailId'])) {
$thumbnailFile = Media::getMediaFile($media['thumbnail']);
示例5: htmlspecialchars
if(!empty($thumbnailFile)) {
$s_thumbnail = (!Validator::is_empty($thumbnailFile)) ? $skin->parseTag('boom_thumbnail', $thumbnailFile, $src_thumbnail) : '';
$sp_booms = $skin->dressOn('cond_boom_thumbnail', $src_thumbnail, $s_thumbnail, $src_booms_rep);
$sp_booms = $skin->parseTag('boom_thumbnail_exist', 'boom_thumbnail_exist', $sp_booms);
} else {
$sp_booms = $skin->dressOn('cond_boom_thumbnail', $src_thumbnail, '', $src_booms_rep);
$sp_booms = $skin->parseTag('boom_thumbnail_exist', 'boom_thumbnail_nonexistence', $sp_booms);
}
$link_url = $config->addressType == 'id' ? $service['path'].'/go/'.$item['id'] : $service['path'].'/go/'.$item['permalink'];
$sp_booms = $skin->parseTag('boom_url', htmlspecialchars($item['permalink']), $sp_booms);
$sp_booms = $skin->parseTag('boom_link_url', $link_url , $sp_booms);
$sp_booms = $skin->parseTag('boom_title', UTF8::clear(UTF8::lessenAsByte(func::stripHTML($item['title']), $skinConfig->boomTitleLength)), $sp_booms);
$sp_booms = $skin->parseTag('boom_description', UTF8::clear(UTF8::lessenAsByte(func::htmltrim(func::stripHTML($item['description'])),$skinConfig->boomDescLength)), $sp_booms);
$sp_booms = $skin->parseTag('boom_author', UTF8::clear($item['author']), $sp_booms);
$sp_booms = $skin->parseTag('boom_date', (Validator::is_digit($item['written']) ? date('Y-m-d', $item['written']) : $item['written']), $sp_booms);
$s_booms_rep .= $sp_booms;
$sp_booms = '';
}
$s_booms = $skin->dressOn('boom_rep', $src_booms_rep, $s_booms_rep, $src_booms);
} else {
$s_booms = '';
}
$skin->dress('boom', $s_booms);
// ** 태그 클라우드
$skin->dress('tagcloud', SkinElement::getTagCloud($skinConfig->tagCloudOrder, $skinConfig->tagCloudLimit));
示例6: empty
if(isset($categories)) {
$s_categories = '';
$src_categories = $skin->cutSkinTag('categorylist');
$subpath = empty($accessInfo['subpath'])?'':'/'.func::firstSlashDelete($accessInfo['subpath']);
$skinConfig->categoryListNameLength = 30;
if(count($categories) > 0) {
$s_categories_rep = '';
$src_category_rep = $skin->cutSkinTag('categorylist_rep');
$index = 0;
foreach ($categories as $category) {
$index ++;
$category = $event->on('Data.category', $category);
$sp_categories = $skin->parseTag('category_name', $event->on('Text.categoryName', UTF8::lessenAsByte($category['name'], $skinConfig->categoryListNameLength)), $src_category_rep);
$s_categoryrecent = '';
$src_categoryrecent = $skin->cutSkinTag('categoryrecent');
$src_categoryrecent_rep = $skin->cutSkinTag('categoryrecent_rep');
$s_categoryrecent_rep = '';
if ($category['posts']) {
$sp_categoryrecent_rep = '';
foreach($category['posts'] as $post) {
$link_url = $config->addressType == 'id' ? $service['path'].'/go/'.$post['id'] : $service['path'].'/go/'.$post['permalink'];
$post['thumbnail'] = '';
if($media = Media::getMedia($post['thumbnailId'])) {
$post['thumbnail'] = $media['thumbnail'];
}
示例7: getMagazineFocus
//.........这里部分代码省略.........
</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>
<?php
}
?>
<div class="data <?php echo empty($thumbnailFile)?'data2':'';?>">
<h3><a href="<?php echo $link_url;?>" target="_blank"><?php echo UTF8::lessenAsByte(func::stripHTML($feedItem['title']),60);?></a></h3>
<div class="permalink">
<a href="<?php echo $feedItem['permalink'];?>" target="_blank"><?php echo $feedItem['permalink'];?></a>
</div>
<div class="desc">
<?php echo UTF8::lessenAsByte(func::stripHTML($feedItem['description']),140);?>
</div>
</div>
<div class="clear"></div>
</li>
<?php
if(count($tag['feedItems'])>1) {
for($i=1;$i<count($tag['feedItems']);$i++) {
$tagItem = $tag['feedItems'][$i];
$link_url = $config->addressType == 'id' ? $service['path'].'/go/'.$tagItem['id'] : $service['path'].'/go/'.$tagItem['permalink'];
?>
<li class="title_only">
<a href="<?php echo $link_url;?>" target="_blank"><?php echo UTF8::lessenAsByte(func::stripHTML($tagItem['title']),60);?></a> <span class="sep">|</span> <span class="feedTitle"><?php echo Feed::get($tagItem['feed'],'title');?></span>
</li>
<?php
}
} else {
?>
<li class="title_only"></li>
<?php
}
}
?>
</ul>
<?php
示例8: htmlspecialchars
$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'))) {
$keyword_pattern = "/([^<]*)".str_replace("\0","\\0",preg_quote($searchKeyword,"/"))."([^>]*)/i";
$post_description = preg_replace($keyword_pattern, "\\1<span class=\"point\">" . $searchKeyword . "</span>\\2", $post_description);
}
$sp_posts = $skin->parseTag('post_description_slashed', addslashes($post_description), $sp_posts);
$sp_posts = $skin->parseTag('post_description', $post_description, $sp_posts);
$post_description = str_replace('/cache/images/',$service['path'] . '/cache/images/', $item['description']);
$sp_posts = $skin->parseTag('post_description_original', $post_description, $sp_posts);
示例9: exportFunction_iframe
function exportFunction_iframe($params, $exportConfig) {
global $export, $service, $config, $event;
$page = isset($params['get']['page'])?$params['get']['page']:1;
if($page <= 0) $page = 1;
$thumbnail = isset($exportConfig) && isset($exportConfig['thumbnail']) ? Validator::getBool($exportConfig['thumbnail']) : true;
$pageCount = isset($exportConfig) && isset($exportConfig['count']) ? $exportConfig['count'] : 10;
$newWindow = isset($exportConfig) && isset($exportConfig['popup']) ? Validator::getBool($exportConfig['popup']) : true;
$categoryView = isset($exportConfig) && isset($exportConfig['category_view']) ? Validator::getBool($exportConfig['category_view']) : false;
$focusView = isset($exportConfig) && isset($exportConfig['focus_view']) ? ($exportConfig['focus_view'] == 'focus' ? true : false) : false;
if($focusView) {
list($posts, $totalFeedItems) = FeedItem::getFeedItems('focus', 'y', '', $page, $pageCount);
} else {
if($categoryView) {
$categoryValue = isset($exportConfig) && isset($exportConfig['category']) ? $exportConfig['category'] : '';
list($posts, $totalFeedItems) = FeedItem::getFeedItems('category', $categoryValue, '', $page, $pageCount);
} else {
list($posts, $totalFeedItems) = FeedItem::getFeedItems('', '', '', $page, $pageCount);
}
}
$paging = Func::makePaging($page, $pageCount, $totalFeedItems);
requireComponent('LZ.PHP.Media');
ob_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ko">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title><?php echo $config->title;?></title>
<link rel="stylesheet" media="screen" type="text/css" href="<?php echo $export->exportURL;?>/style.css" />
<link rel="shortcut icon" href="<?php echo $service['path'];?>/images/favicon.ico" />
</head>
<body>
<div id="export_iframe_wrap">
<ul>
<?php
foreach($posts as $post) {
$post['thumbnail'] = '';
if($media = Media::getMedia($post['thumbnailId'])) {
$post['thumbnail'] = $media['thumbnail'];
}
$thumbnailFile = $event->on('Text.postThumbnail', Media::getMediaFile($post['thumbnail']));
$post['description'] = func::stripHTML($post['description'].'>');
if (substr($post['description'], -1) == '>') $post['description'] = substr($post['description'], 0, strlen($post['description']) - 1);
$post_description = UTF8::lessenAsByte(func::htmltrim($post['description']), 300);
if (strlen($post_description) == 0) $post_description = '<span class="empty">'._t('(글의 앞부분이 이미지 혹은 HTML 태그만으로 되어있습니다)').'</span>';
$post_description = $event->on('Text.postDescription', $post_description);
?>
<li class="<?php echo empty($thumbnailFile)||!$thumbnail?'thumbnail_nonexistence':'';?>">
<?php
if($thumbnail) {
$link_url = $config->addressType == 'id' ? $service['path'].'/go/'.$post['id'] : $service['path'].'/go/'.$post['permalink'];
if(!empty($post['thumbnail'])) {
?>
<div class="thumbnail">
<a href="<?php echo $link_url;?>" target="<?php echo $newWindow?'_blank':'_parent';?>"><img src="<?php echo $thumbnailFile;?>" alt="thumnail" /></a>
</div>
<?php
}
}
?>
<div class="data">
<h3><a href="<?php echo $link_url;?>" target="<?php echo $newWindow?'_blank':'_parent';?>"><?php echo UTF8::clear($event->on('Text.postTitle', func::stripHTML($post['title'])));?></a></h3>
<p><?php echo $post_description;?></p>
</div>
<div class="clear"></div>
</li>
<?php
}
?>
</ul>
<div class="paging">
<?php echo func::printPaging($paging);?>
</div>
</div>
</body>
</html>
<?php
$content = ob_get_contents();
ob_end_clean();
return $content;
}
示例10: printCategoryFocusView
function printCategoryFocusView($categories, $index, $config) {
global $service, $event;
$pluginURL = $event->pluginURL;
if($index < 0 || $index >= count($categories)) {
return false;
}
$category = $categories[$index];
$result = '';
$entries = FeedItem::getRecentFeedItemsByCategory($category['id'], $config['categoryFeedCount']+1);
?>
<div class="title">
<h3><a href="<?php echo $service['path'];?>/category/<?php echo func::encode($category['name']);?>"><?php echo $category['name'];?></a></h3>
<div class="more">
<a href="<?php echo $service['path'];?>/category/<?php echo func::encode($category['name']);?>"><img src="<?php echo $pluginURL;?>/images/bt_more.gif" alt="<?php echo _t('더보기');?>" /></a>
</div>
<div class="clear"></div>
</div>
<ul>
<?php
if(count($entries)>0) {
$entry = $entries[0];
?>
<li class="detail">
<?php
$thumbnailFile = '';
if($media = Media::getMedia($entry['thumbnailId'])) {
$thumbnailFile = Media::getMediaFile($media['thumbnail']);
}
$link_url = $config->addressType == 'id' ? $service['path'].'/go/'.$entry['id'] : $service['path'].'/go/'.$entry['permalink'];
if(!empty($thumbnailFile)) {
?>
<div class="thumbnail">
<img src="<?php echo $thumbnailFile;?>" alt="<?php echo _t('미리보기 이미지');?>" />
</div>
<div class="data">
<h3><a href="<?php echo $link_url;?>" target="_blank"><?php echo UTF8::lessenAsByte(func::stripHTML($entry['title']),$config['categoryTitleLength']);?></a></h3>
<div class="desc">
<?php echo UTF8::lessenAsByte(func::stripHTML($entry['description']),$config['categoryDescLength']);?>
</div>
</div>
<?php
} else {
?>
<div class="data data_full">
<h3><a href="<?php echo $link_url;?>" target="_blank"><?php echo UTF8::lessenAsByte(func::stripHTML($entry['title']),$config['categoryTitleLength']);?></a></h3>
<div class="desc">
<?php echo UTF8::lessenAsByte(func::stripHTML($entry['description']),$config['categoryDescLength']);?>
</div>
</div>
<?php
}
?>
<div class="clear"></div>
</li>
<?php
}
for($i=1;$i<count($entries);$i++) {
$entry = $entries[$i];
$link_url = $config->addressType == 'id' ? $service['path'].'/go/'.$entry['id'] : $service['path'].'/go/'.$entry['permalink'];
?>
<li class="list"><a href="<?php echo $link_url;?>" target="_blank"><?php echo UTF8::lessenAsByte(func::stripHTML($entry['title']),$config['categoryTitleLength']);?></a></li>
<?php
}
?>
</ul>
<?php
return $result;
}