本文整理汇总了PHP中Utils_Unicode::correct方法的典型用法代码示例。如果您正苦于以下问题:PHP Utils_Unicode::correct方法的具体用法?PHP Utils_Unicode::correct怎么用?PHP Utils_Unicode::correct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Utils_Unicode
的用法示例。
在下文中一共展示了Utils_Unicode::correct方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: 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();
示例3: array
/// Copyright (c) 2004-2015, Needlworks / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)
$IV = array('GET' => array('rss' => array('url')));
require ROOT . '/library/preprocessor.php';
importlib('model.blog.link');
if (!empty($_GET['rss'])) {
list($st, $header, $body, $lmdate, $rval) = @xml_parser($_GET['rss'], '');
$result = array();
if ($rval) {
list($title, $link) = str_dbi_check(@get_siteinfo($rval));
if (Utils_Unicode::validate($title, true)) {
$result['name'] = correctTTForXmlText(Utils_Unicode::correct(htmlspecialchars(trim($title))));
} else {
$result['name'] = correctTTForXmlText(Utils_Unicode::bring(htmlspecialchars(trim($title))));
}
if (Utils_Unicode::validate($link, true)) {
$result['url'] = correctTTForXmlText(Utils_Unicode::correct(htmlspecialchars(trim($link))));
} else {
$result['url'] = correctTTForXmlText(Utils_Unicode::bring(htmlspecialchars(trim($link))));
}
Respond::PrintResult($result);
} else {
$result['url'] = $_GET['rss'];
$result['name'] = '';
Respond::PrintResult($result);
}
exit;
} else {
Respond::ResultPage(-1);
}
示例4: bringSearchWord
function bringSearchWord($originalURL, $originalHost)
{
$matches = array();
$decodedURL = '';
$decodedKeyword = '';
// $originalURL = urlutfchr($originalURL);
if (preg_match('/\\W(q|query|k|keyword|search|stext|nlia|aqa|wd)(?:=|%3D)([^&]+)/i', $originalURL, $matches)) {
$decodedKeyword = unified_decode($matches[2]);
$decodedURL = unified_decode($originalURL);
} else {
if (strpos($originalHost, 'images.google.') !== false && preg_match('/%3Fsearch%3D([^&]+)/i', $originalURL, $matches)) {
$decodedKeyword = unified_decode($matches[1]);
$decodedURL = unified_decode($originalURL);
} else {
if (strpos($originalURL, 'yahoo') !== false && preg_match('/\\Wp=([^&]+)/i', $originalURL, $matches)) {
$decodedKeyword = unified_decode($matches[1]);
$decodedURL = unified_decode($originalURL);
} else {
if (preg_match('@/search/(?:\\w+/)*([^/?]+)@i', $originalURL, $matches)) {
$decodedKeyword = unified_decode($matches[1]);
$decodedURL = unified_decode($originalURL);
}
}
}
}
if (!Utils_Unicode::validate($decodedKeyword)) {
$decodedKeyword = Utils_Unicode::correct(Utils_Unicode::bring($decodedKeyword));
$decodedURL = Utils_Unicode::correct(Utils_Unicode::bring($decodedURL));
}
return array($decodedKeyword, $decodedURL);
}
示例5: while
}
$writer->write('</comment>');
$writer->write(CRLF);
}
} while ($comment->shift());
$writer->write('</guestbook>');
$writer->write(CRLF);
$comment->close();
}
$filter = new Filter();
if ($filter->open()) {
do {
$writer->write('<filter type="' . $filter->filtertype . '">' . '<pattern>' . htmlspecialchars($filter->pattern) . '</pattern>' . '</filter>');
$writer->write(CRLF);
} while ($filter->shift());
$filter->close();
}
$feed = new Feed();
if ($feed->open()) {
do {
$writer->write('<feed>' . '<group>' . htmlspecialchars($feed->getGroupName()) . '</group>' . '<url>' . htmlspecialchars(Utils_Unicode::correct($feed->url)) . '</url>' . '</feed>');
$writer->write(CRLF);
} while ($feed->shift());
$feed->close();
}
$writer->write('</blog>');
$writer->close();
if (defined('__TEXTCUBE_BACKUP__')) {
@chmod(__TEXTCUBE_CACHE_DIR__ . "/backup/{$blogid}.xml", 0666);
Respond::ResultPage(0);
}
示例6: openFile
function openFile($filename, $correct = false)
{
if (!($fp = fopen($filename, 'r'))) {
return false;
}
$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->struct = array();
$this->_cursor =& $this->struct;
$this->_path = array('');
$this->_cdata = false;
if ($correct) {
$remains = '';
while (!feof($fp)) {
$chunk = $remains . fread($fp, 10240);
$remains = '';
if (strlen($chunk) >= 10240) {
for ($c = 1; $c <= 4; $c++) {
switch ($chunk[strlen($chunk) - $c] & "�") {
case "":
case "@":
if ($c > 1) {
$remains = substr($chunk, strlen($chunk) - $c + 1);
$chunk = substr($chunk, 0, strlen($chunk) - $c + 1);
}
$c = 5;
break;
case "�":
$remains = substr($chunk, strlen($chunk) - $c);
$chunk = substr($chunk, 0, strlen($chunk) - $c);
$c = 5;
break;
}
}
}
if (!xml_parse($p, Utils_Unicode::correct($chunk, '?'), false)) {
fclose($fp);
return $this->_error($p);
}
}
} else {
while (!feof($fp)) {
if (!xml_parse($p, fread($fp, 10240), false)) {
fclose($fp);
return $this->_error($p);
}
}
}
fclose($fp);
if (!xml_parse($p, '', true)) {
return $this->_error($p);
}
unset($this->_cursor);
unset($this->_cdata);
if (xml_get_error_code($p) != XML_ERROR_NONE) {
return $this->_error($p);
}
xml_parser_free($p);
return true;
}
示例7: Filter
}
$filter = new Filter();
if ($filter->open()) {
do {
$writer->write('<filter type="' . $filter->filtertype . '">' . '<pattern>' . htmlspecialchars($filter->pattern) . '</pattern>' . '</filter>');
$writer->write(CRLF);
} while ($filter->shift());
$filter->close();
}
$feed = new Feed();
if ($feed->open()) {
do {
$writer->write('<feed>' . '<group>' . htmlspecialchars($feed->getGroupName()) . '</group>' . '<url>' . htmlspecialchars(Utils_Unicode::correct($feed->url)) . '</url>' . '</feed>');
$writer->write(CRLF);
} while ($feed->shift());
$feed->close();
}
$line = Model_Line::getInstance();
$line->setFilter(array('blogid', 'eq', getBlogId()));
if ($lines = $line->get()) {
foreach ($lines as $lineitem) {
$writer->write('<line>' . '<author>' . htmlspecialchars(Utils_Unicode::correct($lineitem['author'])) . '</author>' . '<category>' . htmlspecialchars(Utils_Unicode::correct($lineitem['category'])) . '</category>' . '<root>' . htmlspecialchars(Utils_Unicode::correct($lineitem['root'])) . '</root>' . '<permalink>' . htmlspecialchars(Utils_Unicode::correct($lineitem['permalink'])) . '</permalink>' . '<content>' . htmlspecialchars(Utils_Unicode::correct($lineitem['content'])) . '</content>' . '<created>' . $lineitem['created'] . '</created>' . '</line>');
$writer->write(CRLF);
}
}
$writer->write('</blog>');
$writer->close();
if (defined('__TEXTCUBE_BACKUP__')) {
@chmod(__TEXTCUBE_CACHE_DIR__ . "/backup/{$blogid}.xml", 0666);
Respond::ResultPage(0);
}