本文整理汇总了PHP中Utils_Unicode::convert方法的典型用法代码示例。如果您正苦于以下问题:PHP Utils_Unicode::convert方法的具体用法?PHP Utils_Unicode::convert怎么用?PHP Utils_Unicode::convert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Utils_Unicode
的用法示例。
在下文中一共展示了Utils_Unicode::convert方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendTrackback
function sendTrackback($blogid, $entryId, $url)
{
importlib('model.blog.entry');
importlib('model.blog.keyword');
$context = Model_Context::getInstance();
$entry = getEntry($blogid, $entryId);
if (is_null($entry)) {
return false;
}
$link = $context->getProperty('uri.default') . "/" . $entryId;
$title = htmlspecialchars($entry['title']);
$entry['content'] = getEntryContentView($blogid, $entryId, $entry['content'], $entry['contentformatter'], getKeywordNames($blogid));
$excerpt = str_tag_on(Utils_Unicode::lessen(removeAllTags(stripHTML($entry['content'])), 255));
$blogTitle = $context->getProperty('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 = Utils_Unicode::convert($title, 'EUC-KR');
$excerpt = Utils_Unicode::convert($excerpt, 'EUC-KR');
$blogTitle = Utils_Unicode::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) {
$trackbacklog = new TrackbackLog();
$trackbacklog->entry = $entryId;
$trackbacklog->url = Utils_Unicode::lessenAsEncoding($url, 255);
$trackbacklog->add();
return true;
}
return false;
}