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


PHP Utils_Unicode::bring方法代码示例

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


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

示例3: fopen

    Respond::NotFoundPage();
}
if (!($attachment = getAttachmentByOnlyName($blogid, $suri['value']))) {
    Respond::NotFoundPage();
}
$fp = fopen(__TEXTCUBE_ATTACH_DIR__ . "/{$blogid}/{$attachment['name']}", 'rb');
if (!$fp) {
    Respond::NotFoundPage();
}
$fstat = fstat($fp);
if (!empty($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
    $modifiedSince = strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']);
    if ($modifiedSince && $modifiedSince >= $fstat['mtime']) {
        fclose($fp);
        header('HTTP/1.1 304 Not Modified');
        header('Connection: close');
        exit;
    }
}
ini_set('zlib.output_compression', 'off');
header('Content-Disposition: attachment; filename="' . rawurlencode(Utils_Unicode::bring($attachment['label'])) . '"');
header('Content-Transfer-Encoding: binary');
header('Last-Modified: ' . Timestamp::getRFC1123GMT($fstat['mtime']));
header('Content-Length: ' . $fstat['size']);
header('Content-Type: ' . $attachment['mime']);
header('Cache-Control: private');
header('Pragma: no-cache');
header('Connection: close');
fpassthru($fp);
fclose($fp);
downloadAttachment($attachment['name']);
开发者ID:webhacking,项目名称:Textcube,代码行数:31,代码来源:attachment.php

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


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