当前位置: 首页>>代码示例>>PHP>>正文


PHP Utils_Unicode::validate方法代码示例

本文整理汇总了PHP中Utils_Unicode::validate方法的典型用法代码示例。如果您正苦于以下问题:PHP Utils_Unicode::validate方法的具体用法?PHP Utils_Unicode::validate怎么用?PHP Utils_Unicode::validate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Utils_Unicode的用法示例。


在下文中一共展示了Utils_Unicode::validate方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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

示例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();
开发者ID:Avantians,项目名称:Textcube,代码行数:31,代码来源:index.php

示例3: 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);
}
开发者ID:ragi79,项目名称:Textcube,代码行数:31,代码来源:index.php

示例4: 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);
}
开发者ID:Avantians,项目名称:Textcube,代码行数:31,代码来源:index.php

示例5: isUTF8

function isUTF8($str)
{
    return Utils_Unicode::validate($str);
}
开发者ID:ragi79,项目名称:Textcube,代码行数:4,代码来源:Textcube.Core.BackwardCompatibility.php


注:本文中的Utils_Unicode::validate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。