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


PHP CharsetConverter类代码示例

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


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

示例1: execute

 public static function execute()
 {
     global $USER;
     $result = array();
     $error = false;
     if (!CModule::IncludeModule('voximplant')) {
         $error = 'Module voximplant is not installed.';
     } else {
         if (!is_object($USER) || !$USER->IsAuthorized()) {
             $error = GetMessage('ACCESS_DENIED');
         } else {
             if (!CVoxImplantMain::CheckAccess()) {
                 $error = GetMessage('ACCESS_DENIED');
             } else {
                 if (!check_bitrix_sessid()) {
                     $error = GetMessage('ACCESS_DENIED');
                 } else {
                     if ($_REQUEST["act"] == "edit") {
                         $result = self::executeEditPhones($error);
                     } else {
                         if ($_REQUEST["act"] == "getInfo") {
                             $result = self::executeGetInfo($error);
                         } else {
                             if ($_REQUEST["act"] == "option") {
                                 $result = self::executeSaveOption($error);
                             }
                         }
                     }
                 }
             }
         }
     }
     self::returnJson(array_merge(array('result' => $error === false ? 'ok' : 'error', 'error' => CharsetConverter::ConvertCharset($error, SITE_CHARSET, 'UTF-8')), $result));
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:34,代码来源:ajax.php

示例2: referenceItemsStart

 public function referenceItemsStart($path, $attr)
 {
     if ($this->NS["fp"] <= 0) {
         $this->error = GetMessage("CC_BCIH_XML_PARSE_ERROR", array("#CODE#" => 10));
     } else {
         $this->deleteBySessid($this->NS["HL"], $this->NS["SESSID"]);
         $xmlPosition = $this->xmlStream->getPosition();
         $filePosition = $this->decodePostion($xmlPosition);
         $xmlString = $this->xmlStream->readFilePart($this->NS["fp"], $filePosition);
         $error = "";
         if ($xmlPosition[0]) {
             $xmlString = CharsetConverter::convertCharset($xmlString, $xmlPosition[0], LANG_CHARSET, $error);
         }
         $xmlString .= "</" . GetMessage("CC_BCIH_XML_REFERENCE") . ">";
         $xmlObject = new CDataXML();
         if ($xmlObject->loadString($xmlString)) {
             $highBlockID = $this->checkReference($xmlObject->GetArray());
             $this->dataClass = "";
             $this->step = true;
             $this->message = GetMessage("CC_BCIH_REFERENCE_FOUND_OR_CREATED", array("#CODE#" => $highBlockID));
             if ($highBlockID > 0) {
                 $this->NS["HL"] = $highBlockID;
                 $this->NS["FM"] = array();
                 $this->NS["C"] = 0;
             } else {
                 $this->error = GetMessage("CC_BCIH_XML_PARSE_ERROR", array("#CODE#" => 30));
             }
         } else {
             $this->error = GetMessage("CC_BCIH_XML_PARSE_ERROR", array("#CODE#" => 20));
         }
     }
 }
开发者ID:Satariall,项目名称:izurit,代码行数:32,代码来源:class.php

示例3: GetInstance

	/**
	 * @static
	 * @return CharsetConverter
	 */
	public static function GetInstance()
	{
		if (!isset(self::$instance))
		{
			$c = __CLASS__;
			self::$instance = new $c;
		}

		return self::$instance;
	}
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:14,代码来源:charset_converter.php

示例4: qiwiWalletXmlResponse

 function qiwiWalletXmlResponse($code)
 {
     global $APPLICATION;
     $APPLICATION->RestartBuffer();
     header("Content-Type: text/xml");
     header("Pragma: no-cache");
     $xml = '<?xml version="1.0" encoding="UTF-8"?><result><result_code>' . $code . '</result_code></result>';
     $siteCharset = Application::getInstance()->getContext()->getCulture()->getCharset();
     print \CharsetConverter::getInstance()->ConvertCharset($xml, $siteCharset, "utf-8");
     die;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:11,代码来源:functions.php

示例5: createDomain

 public static function createDomain($user, $password, $domain, $params, &$error)
 {
     $domain = CharsetConverter::ConvertCharset($domain, SITE_CHARSET, 'UTF-8');
     $result = CMailRegru::createDomain($user, $password, $domain, array('period' => 1, 'enduser_ip' => $params['ip'], 'profile_type' => $params['profile_type'], 'profile_name' => $params['profile_name'], 'nss' => array('ns0' => 'ns1.reg.ru.', 'ns1' => 'ns2.reg.ru.')), $error);
     if ($result !== false) {
         if (isset($result['dname']) && strtolower($result['dname']) == strtolower($domain)) {
             return true;
         } else {
             $error = 'unknown';
         }
     }
     $error = self::getErrorCode($result['error_code']);
     return null;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:14,代码来源:domain_registrar.php

示例6: readXml

 /**
  * Reads xml chunk from the file preserving it's position
  *
  * @param int $startPosition
  * @param int $endPosition
  * @return CDataXML|false
  */
 private function readXml($startPosition, $endPosition)
 {
     $savedPosition = ftell($this->fileHandler);
     fseek($this->fileHandler, $startPosition);
     $xmlChunk = fread($this->fileHandler, $endPosition - $startPosition);
     fseek($this->fileHandler, $savedPosition);
     if ($xmlChunk && $this->fileCharset) {
         $error = "";
         $xmlChunk = CharsetConverter::convertCharset($xmlChunk, $this->fileCharset, LANG_CHARSET, $error);
     }
     $xmlObject = new CDataXML();
     if ($xmlObject->loadString($xmlChunk)) {
         return $xmlObject;
     } else {
         return false;
     }
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:24,代码来源:xml.php

示例7: _extractFile

 private function _extractFile(&$arEntry, $path, $removePath, $removeAllPath, &$arParams)
 {
     if (($res = $this->_readFileHeader($header)) != 1) {
         return $res;
     }
     //to be checked: file header should be coherent with $arEntry info
     $arEntry["filename"] = CharsetConverter::ConvertCharset($arEntry["filename"], "cp866", $this->fileSystemEncoding);
     $arEntry["stored_filename"] = CharsetConverter::ConvertCharset($arEntry["stored_filename"], "cp866", $this->fileSystemEncoding);
     //protecting against ../ etc in file path
     //only absolute path should be in the $arEntry
     $arEntry['filename'] = _normalizePath($arEntry['filename']);
     $arEntry['stored_filename'] = _normalizePath($arEntry['stored_filename']);
     if ($removeAllPath == true) {
         $arEntry['filename'] = basename($arEntry['filename']);
     } else {
         if ($removePath != "") {
             if ($this->_containsPath($removePath, $arEntry['filename']) == 2) {
                 //change file status
                 $arEntry['status'] = "filtered";
                 return $res;
             }
             $removePath_size = strlen($removePath);
             if (substr($arEntry['filename'], 0, $removePath_size) == $removePath) {
                 //remove path
                 $arEntry['filename'] = substr($arEntry['filename'], $removePath_size);
             }
         }
     }
     //making absolute path to the extracted file out of filename stored in the zip header and passed extracting path
     if ($path != '') {
         $arEntry['filename'] = $path . "/" . $arEntry['filename'];
     }
     //pre-extract callback
     if (isset($arParams['callback_pre_extract']) && $arParams['callback_pre_extract'] != '') {
         //generate local info
         $arLocalHeader = array();
         $this->_convertHeader2FileInfo($arEntry, $arLocalHeader);
         //callback call
         eval('$res = ' . $arParams['callback_pre_extract'] . '(\'callback_pre_extract\', $arLocalHeader);');
         //change file status
         if ($res == 0) {
             $arEntry['status'] = "skipped";
             $res = 1;
         }
         //update the info, only some fields can be modified
         $arEntry['filename'] = $arLocalHeader['filename'];
     }
     //check if extraction should be done
     if ($arEntry['status'] == 'ok') {
         $logicalFilename = $this->io->GetLogicalName($arEntry['filename']);
         if ((HasScriptExtension($arEntry['filename']) || IsFileUnsafe($arEntry['filename']) || !$this->io->ValidatePathString($logicalFilename) || !$this->io->ValidateFilenameString(GetFileName($logicalFilename))) && $this->checkBXPermissions == true) {
             $arEntry['status'] = "no_permissions";
         } else {
             //if the file exists, change status
             if (file_exists($arEntry['filename'])) {
                 if (is_dir($arEntry['filename'])) {
                     $arEntry['status'] = "already_a_directory";
                 } else {
                     if (!is_writeable($arEntry['filename'])) {
                         $arEntry['status'] = "write_protected";
                     } else {
                         if (filemtime($arEntry['filename']) > $arEntry['mtime'] && !$this->replaceExistentFiles) {
                             $arEntry['status'] = "newer_exist";
                         }
                     }
                 }
             } else {
                 //check the directory availability and create it if necessary
                 if (($arEntry['external'] & 0x10) == 0x10 || substr($arEntry['filename'], -1) == '/') {
                     $checkDir = $arEntry['filename'];
                 } else {
                     if (!strstr($arEntry['filename'], "/")) {
                         $checkDir = "";
                     } else {
                         $checkDir = dirname($arEntry['filename']);
                     }
                 }
                 if (($res = $this->_checkDir($checkDir, ($arEntry['external'] & 0x10) == 0x10)) != 1) {
                     //change file status
                     $arEntry['status'] = "path_creation_fail";
                     //return $res;
                     $res = 1;
                 }
             }
         }
     }
     //check if extraction should be done
     if ($arEntry['status'] == 'ok') {
         //if not a folder - extract
         if (!(($arEntry['external'] & 0x10) == 0x10)) {
             //if zip file with 0 compression
             if ($arEntry['compression'] == 0 && $arEntry['compressed_size'] == $arEntry['size']) {
                 if (($destFile = @fopen($arEntry['filename'], 'wb')) == 0) {
                     $arEntry['status'] = "write_error";
                     return $res;
                 }
                 //reading the fileby by self::ReadBlockSize octets blocks
                 $size = $arEntry['compressed_size'];
                 while ($size != 0) {
                     $length = $size < self::ReadBlockSize ? $size : self::ReadBlockSize;
//.........这里部分代码省略.........
开发者ID:ASDAFF,项目名称:entask.ru,代码行数:101,代码来源:zip.php

示例8: chr

 protected static function chr($a)
 {
     return \CharsetConverter::ConvertCharset($a, 'cp1251', SITE_CHARSET);
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:4,代码来源:textparser.php

示例9: LocalRedirect

             if (!empty($arResult['SETTINGS']['link'])) {
                 LocalRedirect($arResult['SETTINGS']['link'], true);
             } else {
                 LocalRedirect($APPLICATION->GetCurPage() . '?STEP=setup');
             }
         }
     }
     break;
 case 'check':
     $APPLICATION->RestartBuffer();
     $error = false;
     $unseen = CMailUtil::CheckImapMailbox($acc['SERVER'], $acc['PORT'], $acc['USE_TLS'], $acc['LOGIN'], $acc['PASSWORD'], $error, 30);
     CUserCounter::Set($USER->GetID(), 'mail_unseen', $unseen, SITE_ID);
     CUserOptions::SetOption('global', 'last_mail_check_' . SITE_ID, time());
     CUserOptions::SetOption('global', 'last_mail_check_success_' . SITE_ID, $unseen >= 0);
     $response = array('result' => $error === false ? 'ok' : 'error', 'unseen' => $unseen, 'error' => CharsetConverter::ConvertCharset($error, SITE_CHARSET, 'UTF-8'));
     header('Content-Type: application/x-javascript; charset=' . LANG_CHARSET);
     echo json_encode($response);
     die;
     break;
 case 'setup':
     if ($_SERVER['REQUEST_METHOD'] == 'POST' && !empty($_POST['SERVICE'])) {
         $arResult['ERRORS'] = array();
         $arResult['SETTINGS'] = $arParams['SERVICES'][$arResult['SERVICE']];
         foreach ($arParams['OPTIONS'] as $option) {
             if (empty($arResult['SETTINGS'][$option])) {
                 unset($error);
                 $arResult['SETTINGS'][$option] = isset($_REQUEST[$option]) ? $_REQUEST[$option] : null;
                 $arResult['SETTINGS'][$option] = CheckOption($option, $arResult['SETTINGS'][$option], $error);
                 if (!empty($error)) {
                     $arResult['ERRORS'][] = $error;
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php

示例10: prepareAnswer

 protected function prepareAnswer($result)
 {
     if (!defined("BX_UTF")) {
         $result = CharsetConverter::ConvertCharset($result, "utf-8", LANG_CHARSET);
     }
     $res = CUtil::JsObjectToPhp($result);
     if (!$res) {
         AddMessage2Log('Strange answer from Network! ' . $result . print_r($res, 1));
     }
     return $res;
 }
开发者ID:rasuldev,项目名称:torino,代码行数:11,代码来源:bitrix24net.php

示例11: GetVideoOembed

	public static function GetVideoOembed($url = '')
	{
		// Get oembed url
		$oembed = self::GetOembedUrlInfo($url);
		$output = array('result' => false, 'error' => "");
		$http = new \Bitrix\Main\Web\HttpClient();
		$resp = $http->get($oembed['url']);
		if ($resp === false)
		{
			$error = $http->getError();
			foreach($error as $errorCode => $errorMessage)
			{
				$output['error'] .=  '['.$errorCode.'] '.$errorMessage.";\n";
			}
		}
		else
		{
			$resParams = json_decode($resp, true);
			if ($resParams && is_array($resParams))
			{
				if (!defined('BX_UTF') || BX_UTF !== true)
				{
					$resParams['title'] = CharsetConverter::ConvertCharset($resParams['title'], 'UTF-8', SITE_CHARSET);
					$resParams['html'] = CharsetConverter::ConvertCharset($resParams['html'], 'UTF-8', SITE_CHARSET);
					$resParams['provider_name'] = CharsetConverter::ConvertCharset($resParams['provider_name'], 'UTF-8', SITE_CHARSET);

				}

				$resParams['html'] = preg_replace("/https?:\/\//is", '//', $resParams['html']);
				$output['result'] = true;
				$output['data'] = array(
					'html' => $resParams['html'],
					'title' => $resParams['title'],
					'width' => intval($resParams['width']),
					'height' => intval($resParams['height']),
					'provider' => $resParams['provider_name']
				);
			}
			else
			{
				$output['error'] .=  '[FVID404] '.GetMessage('HTMLED_VIDEO_NOT_FOUND').";\n";
			}
		}

		return $output;
	}
开发者ID:ASDAFF,项目名称:entask.ru,代码行数:46,代码来源:html_editor.php

示例12: query

 protected function query($url)
 {
     if ($this->access_token === false) {
         return false;
     }
     $http = new HttpClient();
     $http->setHeader("authorization", "Bearer " . $this->access_token);
     $result = $http->get($url);
     if (!defined("BX_UTF")) {
         $result = CharsetConverter::ConvertCharset($result, "utf-8", LANG_CHARSET);
     }
     $result = CUtil::JsObjectToPhp($result);
     return $result;
 }
开发者ID:webgksupport,项目名称:alpina,代码行数:14,代码来源:googleplus.php

示例13: StrangeUrlEncode

 public static function StrangeUrlEncode($url)
 {
     if (!defined('BX_UTF')) {
         $url = CharsetConverter::ConvertCharset($url, SITE_CHARSET, "UTF-8");
     }
     $ind = strpos($url, "?");
     $url = str_replace("%2F", "/", rawurlencode(substr($url, 0, $ind))) . substr($url, $ind);
     return $url;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:9,代码来源:uploader.php

示例14: array

<?php

require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php";
include_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/bizproc/include.php";
if (!check_bitrix_sessid()) {
    die;
}
if (!CBPDocument::CanUserOperateDocumentType(CBPCanUserOperateOperation::CreateWorkflow, $GLOBALS["USER"]->GetID(), $_REQUEST['DocumentType'])) {
    die;
}
$runtime = CBPRuntime::GetRuntime();
$runtime->StartRuntime();
$documentService = $runtime->GetService("DocumentService");
CUtil::DecodeUriComponent($_REQUEST);
CUtil::DecodeUriComponent($_POST);
if (LANG_CHARSET != "UTF-8" && isset($_REQUEST['Type']['Options']) && is_array($_REQUEST['Type']['Options'])) {
    $newarr = array();
    foreach ($_REQUEST['Type']['Options'] as $k => $v) {
        $newarr[CharsetConverter::ConvertCharset($k, "UTF-8", LANG_CHARSET)] = $v;
    }
    $_REQUEST['Type']['Options'] = $newarr;
}
$v = $documentService->GetFieldInputValue($_REQUEST['DocumentType'], $_REQUEST['Type'], $_REQUEST['Field'], $_REQUEST, $arErrors);
$vp = $documentService->GetFieldInputValuePrintable($_REQUEST['DocumentType'], $_REQUEST['Type'], $v);
if (is_array($vp)) {
    $vp = implode(", ", $vp);
}
echo CUtil::PhpToJSObject(array($v, $vp));
开发者ID:k-kalashnikov,项目名称:geekcon.local,代码行数:28,代码来源:bizproc_set_field.php

示例15: GetCurrentUserFriends

 public function GetCurrentUserFriends($limit, &$next)
 {
     if ($this->access_token === false) {
         return false;
     }
     $http = new HttpClient();
     $http->setHeader('GData-Version', '3.0');
     $http->setHeader('Authorization', 'Bearer ' . $this->access_token);
     $url = static::FRIENDS_URL . '?';
     $limit = intval($limit);
     $next = intval($next);
     if ($limit > 0) {
         $url .= '&max-results=' . $limit;
     }
     if ($next > 0) {
         $url .= '&start-index=' . $next;
     }
     $result = $http->get($url);
     if (!defined("BX_UTF")) {
         $result = CharsetConverter::ConvertCharset($result, "utf-8", LANG_CHARSET);
     }
     if ($http->getStatus() == 200) {
         $obXml = new \CDataXML();
         if ($obXml->loadString($result)) {
             $tree = $obXml->getTree();
             $total = $tree->elementsByName("totalResults");
             $total = intval($total[0]->textContent());
             $limitNode = $tree->elementsByName("itemsPerPage");
             $next += intval($limitNode[0]->textContent());
             if ($next >= $total) {
                 $next = '__finish__';
             }
             $arFriends = array();
             $arEntries = $tree->elementsByName('entry');
             foreach ($arEntries as $entry) {
                 $arEntry = array();
                 $entryChildren = $entry->children();
                 foreach ($entryChildren as $child) {
                     $tag = $child->name();
                     switch ($tag) {
                         case 'category':
                         case 'updated':
                         case 'edited':
                             break;
                         case 'name':
                             $arEntry[$tag] = array();
                             foreach ($child->children() as $subChild) {
                                 $arEntry[$tag][$subChild->name()] = $subChild->textContent();
                             }
                             break;
                         case 'email':
                             if ($child->getAttribute('primary') == 'true') {
                                 $arEntry[$tag] = $child->getAttribute('address');
                             }
                             break;
                         default:
                             $tagContent = $tag == 'link' ? $child->getAttribute('href') : $child->textContent();
                             if ($child->getAttribute('rel')) {
                                 if (!isset($arEntry[$tag])) {
                                     $arEntry[$tag] = array();
                                 }
                                 $arEntry[$tag][preg_replace("/^[^#]*#/", "", $child->getAttribute('rel'))] = $tagContent;
                             } elseif (isset($arEntry[$tag])) {
                                 if (!is_array($arEntry[$tag][0]) || !isset($arEntry[$tag][0])) {
                                     $arEntry[$tag] = array($arEntry[$tag], $tagContent);
                                 } else {
                                     $arEntry[$tag][] = $tagContent;
                                 }
                             } else {
                                 $arEntry[$tag] = $tagContent;
                             }
                     }
                 }
                 if ($arEntry['email']) {
                     $arFriends[] = $arEntry;
                 }
             }
             return $arFriends;
         }
     }
     return false;
 }
开发者ID:rasuldev,项目名称:torino,代码行数:82,代码来源:google.php


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