本文整理汇总了PHP中Utils_Unicode类的典型用法代码示例。如果您正苦于以下问题:PHP Utils_Unicode类的具体用法?PHP Utils_Unicode怎么用?PHP Utils_Unicode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Utils_Unicode类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:Avantians,项目名称:Textcube,代码行数:28,代码来源:index.php
示例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;
}
开发者ID:Avantians,项目名称:Textcube,代码行数:35,代码来源:Needlworks.PHP.XMLTree.php
示例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;
}
开发者ID:ragi79,项目名称:Textcube,代码行数:28,代码来源:index.php
示例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;
}
开发者ID:Avantians,项目名称:Textcube,代码行数:9,代码来源:index.php
示例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;
}
开发者ID:ragi79,项目名称:Textcube,代码行数:9,代码来源:index.php
示例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;
}
开发者ID:ni5am,项目名称:Textcube,代码行数:10,代码来源:Textcube.Data.ServiceSetting.php
示例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;
}
开发者ID:Avantians,项目名称:Textcube,代码行数:16,代码来源:index.php
示例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;
}
开发者ID:Avantians,项目名称:Textcube,代码行数:19,代码来源:index.php
示例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);
}
开发者ID:ragi79,项目名称:Textcube,代码行数:24,代码来源:index.php
示例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;
}
开发者ID:ragi79,项目名称:Textcube,代码行数:46,代码来源:Textcube.Data.RemoteResponse.php
示例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;
}
开发者ID:ragi79,项目名称:Textcube,代码行数:19,代码来源:Textcube.Data.RefererStatistics.php
示例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;
}
开发者ID:ni5am,项目名称:Textcube,代码行数:40,代码来源:Textcube.Data.Feed.php
示例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;
}
开发者ID:Avantians,项目名称:Textcube,代码行数:52,代码来源:Textcube.Data.UserInfo.php
示例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;
}
开发者ID:Avantians,项目名称:Textcube,代码行数:44,代码来源:reader.php
示例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;
}
开发者ID:Avantians,项目名称:Textcube,代码行数:33,代码来源:view.php
示例16: api_update_attaches_with_replace
function api_update_attaches_with_replace($entryId)
{
$pool = DBModel::getInstance();
$pool->reset('Attachments');
$pool->setQualifier('blogid', 'eq', getBlogId());
$pool->setQualifier('parent', 'eq', 0);
$newFiles = $pool->getAll('name,label');
if ($newFiles) {
foreach ($newFiles as $newfile) {
$newfile['label'] = Utils_Unicode::lessenAsEncoding($newfile['label'], 64);
$pool->reset('Attachments');
$pool->setQualifier('blogid', 'eq', getBlogId());
$pool->setQualifier('parent', 'eq', $entryId);
$pool->setQualifier('label', 'eq', $newfile['label'], true);
$oldFile = $pool->getCell('name');
if (!is_null($oldFile)) {
deleteAttachment(getBlogId(), $entryId, $oldFile);
}
}
}
api_update_attaches($entryId);
}
开发者ID:Avantians,项目名称:Textcube,代码行数:22,代码来源:api.php
示例17: trashCommentInOwner
trashCommentInOwner($blogid, $comment['id']);
}
}
}
POD::free($result);
}
if ($result = POD::query("SELECT id, url, site, subject, excerpt FROM {$database['prefix']}RemoteResponses WHERE blogid = {$blogid}")) {
while ($trackback = POD::fetch($result)) {
setProgress($item++ / $items * 100, _t('걸린 글 데이터를 교정하고 있습니다.'));
$correction = '';
if (!Utils_Unicode::validate($trackback['url'])) {
$correction .= ' url = \'' . POD::escapeString(Utils_Unicode::correct($trackback['url'], '?')) . '\'';
}
if (!Utils_Unicode::validate($trackback['site'])) {
$correction .= ' site = \'' . POD::escapeString(Utils_Unicode::correct($trackback['site'], '?')) . '\'';
}
if (!Utils_Unicode::validate($trackback['subject'])) {
$correction .= ' subject = \'' . POD::escapeString(Utils_Unicode::correct($trackback['subject'], '?')) . '\'';
}
if (!Utils_Unicode::validate($trackback['excerpt'])) {
$correction .= ' excerpt = \'' . POD::escapeString(Utils_Unicode::correct($trackback['excerpt'], '?')) . '\'';
}
if (strlen($correction) > 0) {
POD::query("UPDATE {$database['prefix']}RemoteResponses SET {$correction} WHERE blogid = {$blogid} AND id = {$trackback['id']}");
$corrected++;
}
}
POD::free($result);
}
setProgress(100, _t('완료되었습니다.') . "({$corrected})");
finish();
开发者ID:Avantians,项目名称:Textcube,代码行数:31,代码来源:index.php
示例18: modifyTagsWithEntryId
function modifyTagsWithEntryId($blogid, $entry, $taglist)
{
global $database;
if (empty($taglist)) {
$taglist = array();
}
$tmptaglist = array_filter($taglist, 'Tag_removeEmptyTagHelper');
$taglist = array();
foreach ($tmptaglist as $tag) {
$tag = POD::escapeString(trim($tag));
array_push($taglist, $tag);
}
// step 1. Get deleted Tag
$tmpoldtaglist = POD::queryColumn("SELECT name FROM {$database['prefix']}Tags\n\t\t\tLEFT JOIN {$database['prefix']}TagRelations ON tag = id \n\t\t\tWHERE blogid = {$blogid} AND entry = {$entry}");
if ($tmpoldtaglist === null) {
$tmpoldtaglist = array();
}
$oldtaglist = array();
foreach ($tmpoldtaglist as $tag) {
$tag = POD::escapeString(Utils_Unicode::lessenAsEncoding(trim($tag), 255));
array_push($oldtaglist, $tag);
}
$deletedTagList = array_diff($oldtaglist, $taglist);
$insertedTagList = array_diff($taglist, $oldtaglist);
// step 2. Insert Tag
if (count($insertedTagList) > 0) {
foreach ($insertedTagList as $tg) {
if (!Tag::doesExist($tg)) {
@POD::execute("INSERT INTO {$database['prefix']}Tags (id, name) VALUES (" . (Tag::_getMaxId() + 1) . ",'" . $tg . "')");
}
}
// $tagliststr = '(\'' . implode('\') , (\'', $insertedTagList) . '\')';
// POD::execute("INSERT IGNORE INTO {$database['prefix']}Tags (name) VALUES $tagliststr ");
// step 3. Insert Relation
$tagliststr = '\'' . implode('\' , \'', $insertedTagList) . '\'';
/*
POD::execute("INSERT INTO {$database['prefix']}TagRelations
(SELECT $blogid, t.id, $entry FROM {$database['prefix']}Tags as t
WHERE
name in ( $tagliststr ) AND
t.id NOT IN
( SELECT tag FROM {$database['prefix']}TagRelations WHERE
(tag = t.id) AND (entry = $entry) AND (blogid = $blogid)
)
)");
*/
// For MySQL 3, Simple Query Version
$tagIDs = POD::queryColumn("SELECT id FROM {$database['prefix']}Tags WHERE name in ( {$tagliststr} )");
$tagrelations = array();
foreach ($tagIDs as $tagid) {
array_push($tagrelations, " ({$blogid}, {$tagid}, {$entry}) ");
}
foreach ($tagrelations as $tr) {
@POD::execute("INSERT INTO {$database['prefix']}TagRelations VALUES {$tr}");
}
//$tagRelationStr = implode(', ', $tagrelations);
//POD::execute("INSERT IGNORE INTO {$database['prefix']}TagRelations VALUES $tagRelationStr");
}
// step 4. Delete Tag
if (count($deletedTagList) > 0) {
// small step, get tag id list
$tagliststr = '\'' . implode('\' , \'', $deletedTagList) . '\'';
$t1list = POD::queryColumn("SELECT id FROM {$database['prefix']}Tags WHERE name in ( {$tagliststr} )");
if (is_null($t1list)) {
return;
}
// What?
// Flushing pageCache
foreach ($t1list as $tagids) {
CacheControl::flushTag($tagids);
}
// Make string
$t1liststr = implode(', ', $t1list);
$taglist = POD::queryColumn("SELECT tag FROM {$database['prefix']}TagRelations\n\t\t\t\t\t\tWHERE blogid = {$blogid} AND entry = {$entry} AND tag in ( {$t1liststr} )");
if (is_null($taglist)) {
return;
}
// What?
// now delete tag
$tagliststr = implode(', ', $taglist);
// step 5. Delete Relation
POD::execute("DELETE FROM {$database['prefix']}TagRelations WHERE blogid = {$blogid} AND entry = {$entry} AND tag in ( {$tagliststr} )");
// step 6. Delete Tag
$nottargets = POD::queryColumn("SELECT DISTINCT tag FROM {$database['prefix']}TagRelations WHERE tag in ( {$tagliststr} )");
if (count($nottargets) > 0) {
$nottargetstr = implode(', ', $nottargets);
POD::execute("DELETE FROM {$database['prefix']}Tags WHERE id IN ( {$tagliststr} ) AND id NOT IN ( {$nottargetstr} )");
} else {
POD::execute("DELETE FROM {$database['prefix']}Tags WHERE id IN ( {$tagliststr} )");
}
}
}
开发者ID:Avantians,项目名称:Textcube,代码行数:92,代码来源:Textcube.Data.Tag.php
示例19: saveSlogan
function saveSlogan($slogan = null)
{
global $database;
$this->init();
if (!Validator::number($this->id, 1)) {
return $this->_error('id');
}
if (!Validator::number($this->userid, 1)) {
return $this->_error('userid');
}
if (isset($slogan)) {
$this->slogan = $slogan;
}
$query = new DBModel();
$query->reset('Entries');
$query->setQualifier('blogid', $this->blogid);
if (isset($this->userid)) {
$query->setQualifier('userid', $this->userid);
}
$query->setQualifier('id', $this->id);
if (!$query->doesExist()) {
return $this->_error('id');
}
if (isset($this->slogan) && $this->validateSlogan($this->slogan)) {
$slogan0 = $this->slogan;
} else {
$slogan0 = $this->slogan = $this->makeSlogan($this->title);
}
$slogan0 = Utils_Unicode::lessenAsEncoding($slogan0, 255);
for ($i = 1; $i < 1000; $i++) {
// $checkSlogan = POD::escapeString($this->slogan);
$checkSlogan = $this->slogan;
$query->setAttribute('slogan', $checkSlogan, true);
if (!POD::queryExistence("SELECT id FROM {$database['prefix']}Entries " . "WHERE blogid = " . $this->blogid . " AND id <> {$this->id} AND slogan ='{$checkSlogan}'")) {
if (!$query->update()) {
return $this->_error('update');
}
return true;
}
$this->slogan = Utils_Unicode::lessenAsEncoding($slogan0, 245) . '-' . $i;
}
// if try saveSlogan again, slogan string has more $i
return $this->_error('limit');
}
开发者ID:Avantians,项目名称:Textcube,代码行数:44,代码来源:Textcube.Data.Notice.php
示例20: _t
?>
/owner/<?php
echo $editmode;
?>
/edit/<?php
echo $entryModifyLink;
?>
'<?php
echo $entry['draft'] ? "+(confirm('" . _t('임시 저장본을 보시겠습니까?') . "') ? '?draft' : '')" : '';
?>
; document.getElementById('list-form').submit(); return false;"><?php
echo htmlspecialchars($entry['title']);
?>
</a>
<span class="description"><?php
echo $contentLength > 0 ? Utils_Unicode::lessenAsEm(removeAllTags(strip_tags($entry['content'])), $contentLength) : '';
?>
</span>
</td>
<td class="category">
<?php
if ($entry['category'] == 0) {
?>
<a id="category_<?php
echo $entry['id'];
?>
" class="uncategorized" href="<?php
echo $context->getProperty('uri.blog');
?>
/owner/entry?category=-10"><?php
echo _t('분류 없음');
开发者ID:Avantians,项目名称:Textcube,代码行数:31,代码来源:index.php
注:本文中的Utils_Unicode类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论