本文整理汇总了PHP中Utils_Unicode类的典型用法代码示例。如果您正苦于以下问题:PHP Utils_Unicode类的具体用法?PHP Utils_Unicode怎么用?PHP Utils_Unicode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Utils_Unicode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CT_Start_Default
function CT_Start_Default($target)
{
importlib("model.blog.attachment");
$context = Model_Context::getInstance();
$blogURL = $context->getProperty('uri.blog');
$blogid = $context->getProperty('blog.id');
$target .= '<ul>';
$target .= '<li><a href="' . $blogURL . '/owner/entry/post">' . _t('새 글을 씁니다') . '</a></li>' . CRLF;
$latestEntryId = Setting::getBlogSettingGlobal('LatestEditedEntry_user' . getUserId(), 0);
if ($latestEntryId !== 0) {
$latestEntry = CT_Start_Default_getEntry($blogid, $latestEntryId);
if ($latestEntry != false) {
$target .= '<li><a href="' . $blogURL . '/owner/entry/edit/' . $latestEntry['id'] . '">' . _f('최근글(%1) 수정', htmlspecialchars(Utils_Unicode::lessenAsEm($latestEntry['title'], 10))) . '</a></li>';
}
}
if (Acl::check('group.administrators')) {
$target .= '<li><a href="' . $blogURL . '/owner/skin">' . _t('스킨을 변경합니다') . '</a></li>' . CRLF;
$target .= '<li><a href="' . $blogURL . '/owner/skin/sidebar">' . _t('사이드바 구성을 변경합니다') . '</a></li>' . CRLF;
$target .= '<li><a href="' . $blogURL . '/owner/skin/setting">' . _t('블로그에 표시되는 값들을 변경합니다') . '</a></li>' . CRLF;
$target .= '<li><a href="' . $blogURL . '/owner/entry/category">' . _t('카테고리를 변경합니다') . '</a></li>' . CRLF;
$target .= '<li><a href="' . $blogURL . '/owner/plugin">' . _t('플러그인을 켜거나 끕니다') . '</a></li>' . CRLF;
}
if ($context->getProperty('service.reader', false) != false) {
$target .= '<li><a href="' . $blogURL . '/owner/network/reader">' . _t('RSS 리더를 봅니다') . '</a></li>' . CRLF;
}
$target .= '</ul>';
return $target;
}
示例2: open
function open($xml, $encoding = null)
{
if (!empty($encoding) && strtolower($encoding) != 'utf-8' && !Utils_Unicode::validate($xml)) {
if (preg_match('/^<\\?xml[^<]*\\s+encoding=["\']?([\\w-]+)["\']?/', $xml, $matches)) {
$encoding = $matches[1];
$xml = preg_replace('/^(<\\?xml[^<]*\\s+encoding=)["\']?[\\w-]+["\']?/', '$1"utf-8"', $xml, 1);
}
if (strcasecmp($encoding, 'utf-8')) {
$xml = Utils_Unicode::bring($xml, $encoding);
if (is_null($xml)) {
$this->error = XML_ERROR_UNKNOWN_ENCODING;
return false;
}
}
} else {
if (substr($xml, 0, 3) == "") {
$xml = substr($xml, 3);
}
}
$p = xml_parser_create();
xml_set_object($p, $this);
xml_parser_set_option($p, XML_OPTION_CASE_FOLDING, 0);
xml_set_element_handler($p, 'o', 'c');
xml_set_character_data_handler($p, 'd');
xml_set_default_handler($p, 'x');
$this->tree = array('children' => array());
$this->_cursor =& $this->tree;
$this->_cdata = false;
xml_parse($p, $xml);
unset($this->_cursor);
unset($this->_cdata);
$this->error = xml_get_error_code($p);
xml_parser_free($p);
return $this->error == XML_ERROR_NONE;
}
示例3: CT_Start_Default
function CT_Start_Default($target)
{
requireModel("blog.attachment");
requireComponent("Eolin.PHP.Core");
requireComponent("Textcube.Function.misc");
global $blogid, $blogURL, $database, $service;
$target .= '<ul>';
$target .= '<li><a href="' . $blogURL . '/owner/entry/post">' . _t('새 글을 씁니다') . '</a></li>' . CRLF;
$latestEntryId = Setting::getBlogSettingGlobal('LatestEditedEntry_user' . getUserId(), 0);
if ($latestEntryId !== 0) {
$latestEntry = CT_Start_Default_getEntry($blogid, $latestEntryId);
if ($latestEntry != false) {
$target .= '<li><a href="' . $blogURL . '/owner/entry/edit/' . $latestEntry['id'] . '">' . _f('최근글(%1) 수정', htmlspecialchars(Utils_Unicode::lessenAsEm($latestEntry['title'], 10))) . '</a></li>';
}
}
if (Acl::check('group.administrators')) {
$target .= '<li><a href="' . $blogURL . '/owner/skin">' . _t('스킨을 변경합니다') . '</a></li>' . CRLF;
$target .= '<li><a href="' . $blogURL . '/owner/skin/sidebar">' . _t('사이드바 구성을 변경합니다') . '</a></li>' . CRLF;
$target .= '<li><a href="' . $blogURL . '/owner/skin/setting">' . _t('블로그에 표시되는 값들을 변경합니다') . '</a></li>' . CRLF;
$target .= '<li><a href="' . $blogURL . '/owner/entry/category">' . _t('카테고리를 변경합니다') . '</a></li>' . CRLF;
$target .= '<li><a href="' . $blogURL . '/owner/plugin">' . _t('플러그인을 켜거나 끕니다') . '</a></li>' . CRLF;
}
if ($service['reader'] != false) {
$target .= '<li><a href="' . $blogURL . '/owner/network/reader">' . _t('RSS 리더를 봅니다') . '</a></li>' . CRLF;
}
$target .= '</ul>';
return $target;
}
示例4: FM_Textile_summary
function FM_Textile_summary($blogid, $id, $content, $keywords = array(), $useAbsolutePath = true)
{
$context = Model_Context::getInstance();
$view = FM_Textile_format($blogid, $id, $content, $keywords, $useAbsolutePath, true);
if (!$context->getProperty("blog.publishWholeOnRSS")) {
$view = Utils_Unicode::lessen(removeAllTags(stripHTML($view)), 255);
}
return $view;
}
示例5: FM_TTML_summary
function FM_TTML_summary($blogid, $id, $content, $keywords = array(), $useAbsolutePath = true)
{
global $blog;
$view = FM_TTML_format($blogid, $id, $content, $keywords, $useAbsolutePath, true);
if (!$blog['publishWholeOnRSS']) {
$view = Utils_Unicode::lessen(removeAllTags(stripHTML($view)), 255);
}
return $view;
}
示例6: _buildQuery
function _buildQuery()
{
$query = DBModel::getInstance();
$query->reset('ServiceSettings');
$query->setQualifier('name', 'equals', Utils_Unicode::lessenAsEncoding($this->name, 32), false);
if (isset($this->value)) {
$query->setAttribute('value', Utils_Unicode::lessenAsEncoding($this->value, 255), true);
}
return $query;
}
示例7: _getRecentEntriesView
function _getRecentEntriesView($entries, $template)
{
$context = Model_Context::getInstance();
ob_start();
foreach ($entries as $entry) {
$view = $template;
Utils_Misc::dress('rctps_rep_link', $context->getProperty('uri.blog') . "/" . $entry['id'], $view);
Utils_Misc::dress('rctps_rep_edit_link', $context->getProperty('uri.blog') . "/owner/entry/edit/" . $entry['id'], $view);
Utils_Misc::dress('rctps_rep_title', htmlspecialchars(Utils_Unicode::lessenAsEm($entry['title'], 30)), $view);
Utils_Misc::dress('rctps_rep_rp_cnt', "<span id=\"commentCountOnRecentEntries{$entry['id']}\">" . ($entry['comments'] > 0 ? "({$entry['comments']})" : '') . '</span>', $view);
print $view;
}
$view = ob_get_contents();
ob_end_clean();
return $view;
}
示例8: RecentRP_getRecentCommentsView
function RecentRP_getRecentCommentsView($comments, $template)
{
global $contentContainer;
$context = Model_Context::getInstance();
ob_start();
foreach ($comments as $comment) {
$view = "{$template}";
Utils_Misc::dress('rctrp_rep_link', $context->getProperty('uri.blog') . "/{$comment['entry']}#comment{$comment['id']}", $view);
$contentContainer["recent_comment_{$comment['id']}"] = htmlspecialchars(Utils_Unicode::lessenAsEm(strip_tags($comment['comment']), 30));
Utils_Misc::dress('rctrp_rep_desc', setTempTag("recent_comment_{$comment['id']}"), $view);
Utils_Misc::dress('rctrp_rep_desc', htmlspecialchars(Utils_Unicode::lessenAsEm(strip_tags($comment['comment']), 30)), $view);
Utils_Misc::dress('rctrp_rep_time', fireEvent('ViewRecentCommentDate', Timestamp::format3($comment['written'])), $view);
Utils_Misc::dress('rctrp_rep_name', htmlspecialchars(Utils_Unicode::lessenAsEm(strip_tags($comment['name']), 10)) . $comment['secret'] . $comment['replier'], $view);
print $view;
}
$view = ob_get_contents();
ob_end_clean();
return $view;
}
示例9: SyndicateToEolin
/**
* @brief Syndicating routine.
* @see Tag, User, DBModel, Model_Context
*/
function SyndicateToEolin($entryId, $entry, $mode)
{
$context = Model_Context::getInstance();
$blogid = $context->getProperty('blog.id');
$rpc = new XMLRPC();
$rpc->url = 'http://ping.eolin.com/';
$summary = array('blogURL' => $context->getProperty('uri.default'), 'syncURL' => $context->getProperty('uri.default') . "/plugin/abstractToEolin?entryId={$entryId}");
if ($mode == 'create') {
$summary['blogTitle'] = $context->getProperty('blog.title');
$summary['language'] = $context->getProperty('blog.language');
$summary['permalink'] = $context->getProperty('uri.default') . "/" . ($context->getProperty('blog.useSloganOnPost') ? "entry/{$entry['slogan']}" : $entry['id']);
$summary['title'] = Utils_Unicode::lessenAsByte($entry['title'], 255);
$summary['content'] = Utils_Unicode::lessenAsByte(stripHTML(getEntryContentView($blogid, $entry['id'], $entry['content'], $entry['contentformatter'])), 1023, '');
$summary['author'] = User::authorName($entry['userid'], $entryId);
$summary['tags'] = Tag::getTagsWithEntryId($blogid, $entry);
$summary['location'] = $entry['location'];
$summary['written'] = Timestamp::getRFC1123($entry['published']);
}
return $rpc->call("sync.{$mode}", $summary);
}
示例10: _buildQuery
function _buildQuery()
{
$query = DBModel::getInstance();
$query->reset('RemoteResponses');
$query->setQualifier('blogid', getBlogId());
$query->setQualifier('responsetype', 'pingback');
if (isset($this->id)) {
if (!Validator::number($this->id, 1)) {
return $this->_error('id');
}
$query->setQualifier('id', $this->id);
}
if (isset($this->entry)) {
if (!Validator::number($this->entry, 1)) {
return $this->_error('entry');
}
$query->setQualifier('entry', $this->entry);
}
if (isset($this->url)) {
$this->url = Utils_Unicode::lessenAsEncoding(trim($this->url), 255);
if (empty($this->url)) {
return $this->_error('url');
}
$query->setQualifier('url', $this->url, true);
}
if (isset($this->ip)) {
if (!Validator::ip($this->ip)) {
return $this->_error('ip');
}
$query->setAttribute('ip', $this->ip, true);
}
if (isset($this->received)) {
if (!Validator::timestamp($this->received)) {
return $this->_error('received');
}
$query->setAttribute('written', $this->received);
}
if (isset($this->isFiltered)) {
if ($this->isFiltered) {
$query->setAttribute('isFiltered', 'UNIX_TIMESTAMP()');
} else {
$query->setAttribute('isFiltered', Validator::getBit($this->isFiltered));
}
}
return $query;
}
示例11: _buildQuery
function _buildQuery()
{
global $database;
$this->host = Utils_Unicode::lessenAsEncoding(trim($this->host), 64);
if (empty($this->host)) {
return $this->_error('host');
}
$query = DBModel::getInstance();
$query->reset('RefererStatistics');
$query->setQualifier('blogid', 'equals', getBlogId());
$query->setQualifier('host', 'equals', $this->host, true);
if (isset($this->count)) {
if (!Validator::number($this->count, 1)) {
return $this->_error('count');
}
$query->setAttribute('count', $this->count);
}
return $query;
}
示例12: add
function add()
{
global $database;
$this->id = null;
$this->link = Utils_Unicode::lessenAsEncoding(trim($this->link), 255);
if (empty($this->link)) {
return false;
}
if (isset($this->group)) {
if (is_numeric($this->group) && $this->group > 0) {
FeedGroup::getName($this->group);
}
}
if (!is_numeric($this->feed)) {
return false;
}
if (!is_numeric($this->published)) {
return false;
}
$query = DBModel::getInstance();
$query->reset('FeedItems');
$query->setQualifier('feed', 'equals', $this->feed);
$query->setQualifier('permalink', 'equals', $this->link, true);
$this->id = $query->getCell('id');
if (is_null($this->id)) {
$query->setAttribute('id', $this->_getMaxId() + 1);
$query->setAttribute('title', Utils_Unicode::lessenAsEncoding($this->title, 255), true);
$query->setAttribute('description', $this->description, true);
$query->setAttribute('tags', Utils_Unicode::lessenAsEncoding($this->tags, 255), true);
$query->setAttribute('enclosure', Utils_Unicode::lessenAsEncoding($this->enclosure, 255), true);
$query->setAttribute('author', Utils_Unicode::lessenAsEncoding($this->author, 255), true);
$query->setAttribute('written', $this->published);
$this->id = $query->insert();
//echo mysql_error(), '<br />';
if ($this->id === false) {
return false;
}
}
return true;
}
示例13: _buildQuery
function _buildQuery()
{
$query = DBModel::getInstance();
$query->reset('Users');
$query->setQualifier('userid', getUserId());
if (isset($this->userid)) {
if (!Validator::number($this->userid, 1)) {
return $this->_error('userid');
}
$query->setQualifier('userid', $this->userid);
}
if (isset($this->loginid)) {
$this->loginid = Utils_Unicode::lessenAsEncoding(trim($this->loginid), 64);
if (empty($this->loginid)) {
return $this->_error('loginid');
}
$query->setAttribute('loginid', $this->loginid, true);
}
if (isset($this->password)) {
$this->password = trim($this->password);
if (empty($this->password)) {
return $this->_error('password');
}
$query->setAttribute('password', $this->password, true);
}
if (isset($this->name)) {
$this->name = Utils_Unicode::lessenAsEncoding(trim($this->name), 32);
if (empty($this->name)) {
return $this->_error('name');
}
$query->setAttribute('name', $this->name, true);
}
if (isset($this->created)) {
if (!Validator::number($this->created, 0)) {
return $this->_error('created');
}
$query->setAttribute('created', $this->created);
}
if (isset($this->lastLogin)) {
if (!Validator::number($this->lastLogin, 1)) {
return $this->_error('lastLogin');
}
$query->setAttribute('lastLogin', $this->lastLogin);
}
if (isset($this->host)) {
if (!Validator::number($this->host, 0)) {
return $this->_error('host');
}
$query->setAttribute('host', $this->host);
}
return $query;
}
示例14: saveFeedItem
function saveFeedItem($feedId, $item)
{
global $database;
$item = fireEvent('SaveFeedItem', $item);
$item['permalink'] = POD::escapeString(Utils_Unicode::lessenAsEncoding(Utils_Unicode::correct($item['permalink'])));
$item['author'] = POD::escapeString(Utils_Unicode::lessenAsEncoding(Utils_Unicode::correct($item['author'])));
$item['title'] = POD::escapeString(Utils_Unicode::lessenAsEncoding(Utils_Unicode::correct($item['title'])));
$item['description'] = POD::escapeString(Utils_Unicode::lessenAsEncoding(Utils_Unicode::correct($item['description']), 65535));
$tagString = POD::escapeString(Utils_Unicode::lessenAsEncoding(Utils_Unicode::correct(implode(', ', $item['tags']))));
$enclosureString = POD::escapeString(Utils_Unicode::lessenAsEncoding(Utils_Unicode::correct(implode('|', $item['enclosures']))));
if ($item['written'] > gmmktime() + 86400) {
return false;
}
$deadLine = 0;
$feedlife = POD::queryCell("SELECT feedlife FROM {$database['prefix']}FeedSettings");
if ($feedlife > 0) {
$deadLine = gmmktime() - $feedlife * 86400;
}
if ($id = POD::queryCell("SELECT id FROM {$database['prefix']}FeedItems WHERE permalink='{$item['permalink']}'") && $item['written'] != 0) {
$result = POD::query("UPDATE {$database['prefix']}FeedItems SET author = '{$item['author']}', title = '{$item['title']}', description = '{$item['description']}', tags = '{$tagString}', enclosure = '{$enclosureString}', written = {$item['written']} WHERE id = {$id}");
/*
TODO : 읽은글이 읽지않은 글로 표시되는 문제 원인이 찾아질때 까지 막아둠
if (POD::num_rows($result) > 0)
POD::query("DELETE FROM {$database['prefix']}FeedReads WHERE item = $id");
*/
} else {
if ($id != null) {
return false;
} else {
if ($item['written'] == 0) {
$item['written'] = gmmktime();
}
if ($item['written'] > $deadLine) {
$id = POD::queryCell("SELECT max(id) FROM {$database['prefix']}FeedItems");
if (!$id) {
$id = 0;
}
$id++;
POD::query("INSERT INTO {$database['prefix']}FeedItems VALUES({$id}, {$feedId}, '{$item['author']}', '{$item['permalink']}', '{$item['title']}', '{$item['description']}', '{$tagString}', '{$enclosureString}', {$item['written']})");
}
}
}
return true;
}
示例15: getLinkListView
function getLinkListView($links)
{
$context = Model_Context::getInstance();
if (rtrim($context->getProperty('suri.url'), '/') == $context->getProperty('uri.path')) {
$home = true;
} else {
$home = false;
}
$categoryName = null;
$buffer = '<ul>' . CRLF;
$showXfn = Setting::getBlogSettingGlobal('useMicroformat', 3) > 1;
foreach ($links as $link) {
if (!doesHaveOwnership() && $link['visibility'] == 0 || !doesHaveMembership() && $link['visibility'] < 2) {
continue;
}
if ($categoryName != $link['categoryName']) {
if (!empty($categoryName)) {
$buffer .= '</ul>' . CRLF . '</li>' . CRLF;
}
$categoryName = $link['categoryName'];
$buffer .= '<li><span class="link_ct">' . htmlspecialchars($link['categoryName']) . '</span>' . CRLF . '<ul>' . CRLF;
}
if ($showXfn && $home && $link['xfn']) {
addXfnAttrs(htmlspecialchars($link['url']), htmlspecialchars($link['xfn']), $link['url']);
}
$buffer .= '<li><a href="' . htmlspecialchars($link['url']) . '">' . fireEvent('ViewLink', htmlspecialchars(Utils_Unicode::lessenAsEm($link['name'], $context->getProperty('skin.linkLength')))) . '</a></li>' . CRLF;
}
if (!empty($categoryName)) {
$buffer .= '</ul>' . CRLF . '</li>' . CRLF;
}
$buffer .= '</ul>' . CRLF;
return $buffer;
}