You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sm...@apache.org on 2015/05/03 14:39:43 UTC
[03/51] [partial] airavata-php-gateway git commit: removing vendor
files
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/patchwork/utf8/class/Patchwork/PHP/Shim/Mbstring.php
----------------------------------------------------------------------
diff --git a/vendor/patchwork/utf8/class/Patchwork/PHP/Shim/Mbstring.php b/vendor/patchwork/utf8/class/Patchwork/PHP/Shim/Mbstring.php
deleted file mode 100644
index d299c4d..0000000
--- a/vendor/patchwork/utf8/class/Patchwork/PHP/Shim/Mbstring.php
+++ /dev/null
@@ -1,523 +0,0 @@
-<?php // vi: set fenc=utf-8 ts=4 sw=4 et:
-/*
- * Copyright (C) 2013 Nicolas Grekas - p@tchwork.com
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the (at your option):
- * Apache License v2.0 (http://apache.org/licenses/LICENSE-2.0.txt), or
- * GNU General Public License v2.0 (http://gnu.org/licenses/gpl-2.0.txt).
- */
-
-namespace Patchwork\PHP\Shim;
-
-/**
- * Partial mbstring implementation in PHP, iconv based, UTF-8 centric.
- *
- * Implemented:
- * - mb_convert_encoding - Convert character encoding
- * - mb_decode_mimeheader - Decode string in MIME header field
- * - mb_encode_mimeheader - Encode string for MIME header XXX NATIVE IMPLEMENTATION IS REALLY BUGGED
- * - mb_convert_case - Perform case folding on a string
- * - mb_get_info - Get internal settings of mbstring
- * - mb_http_input - Detect HTTP input character encoding
- * - mb_http_output - Set/Get HTTP output character encoding
- * - mb_internal_encoding - Set/Get internal character encoding
- * - mb_list_encodings - Returns an array of all supported encodings
- * - mb_output_handler - Callback function converts character encoding in output buffer
- * - mb_strlen - Get string length
- * - mb_strpos - Find position of first occurrence of string in a string
- * - mb_strrpos - Find position of last occurrence of a string in a string
- * - mb_strtolower - Make a string lowercase
- * - mb_strtoupper - Make a string uppercase
- * - mb_substitute_character - Set/Get substitution character
- * - mb_substr - Get part of string
- * - mb_stripos - Finds position of first occurrence of a string within another, case insensitive
- * - mb_stristr - Finds first occurrence of a string within another, case insensitive
- * - mb_strrchr - Finds the last occurrence of a character in a string within another
- * - mb_strrichr - Finds the last occurrence of a character in a string within another, case insensitive
- * - mb_strripos - Finds position of last occurrence of a string within another, case insensitive
- * - mb_strstr - Finds first occurrence of a string within anothers
- * - mb_strwidth - Return width of string
- * - mb_substr_count - Count the number of substring occurrences
- *
- * Not implemented:
- * - mb_convert_kana - Convert "kana" one from another ("zen-kaku", "han-kaku" and more)
- * - mb_convert_variables - Convert character code in variable(s)
- * - mb_decode_numericentity - Decode HTML numeric string reference to character
- * - mb_encode_numericentity - Encode character to HTML numeric string reference
- * - mb_ereg_* - Regular expression with multibyte support
- * - mb_parse_str - Parse GET/POST/COOKIE data and set global variable
- * - mb_preferred_mime_name - Get MIME charset string
- * - mb_regex_encoding - Returns current encoding for multibyte regex as string
- * - mb_regex_set_options - Set/Get the default options for mbregex functions
- * - mb_send_mail - Send encoded mail
- * - mb_split - Split multibyte string using regular expression
- * - mb_strcut - Get part of string
- * - mb_strimwidth - Get truncated string with specified width
- */
-class Mbstring
-{
- const MB_CASE_FOLD = PHP_INT_MAX;
-
- protected static
-
- $encoding_list = array('ASCII', 'UTF-8'),
- $language = 'neutral',
- $internal_encoding = 'UTF-8',
- $caseFold = array(
- array('µ','ſ',"\xCD\x85",'ς',"\xCF\x90","\xCF\x91","\xCF\x95","\xCF\x96","\xCF\xB0","\xCF\xB1","\xCF\xB5","\xE1\xBA\x9B","\xE1\xBE\xBE"),
- array('μ','s','ι', 'σ','β', 'θ', 'φ', 'π', 'κ', 'ρ', 'ε', "\xE1\xB9\xA1",'ι' )
- );
-
-
- static function mb_convert_encoding($s, $to_encoding, $from_encoding = INF)
- {
- INF === $from_encoding && $from_encoding = self::$internal_encoding;
-
- $from_encoding = strtolower($from_encoding);
- $to_encoding = strtolower($to_encoding);
-
- if ('base64' === $from_encoding)
- {
- $s = base64_decode($s);
- $from_encoding = $to_encoding;
- }
-
- if ('base64' === $to_encoding) return base64_encode($s);
-
- if ('html-entities' === $to_encoding)
- {
- 'html-entities' === $from_encoding && $from_encoding = 'Windows-1252';
- 'utf-8' === $from_encoding
- || 'utf8' === $from_encoding
- || $s = iconv($from_encoding, 'UTF-8//IGNORE', $s);
- return preg_replace_callback('/[\x80-\xFF]+/', array(__CLASS__, 'html_encoding_callback'), $s);
- }
-
- if ('html-entities' === $from_encoding)
- {
- $s = html_entity_decode($s, ENT_COMPAT, 'UTF-8');
- $from_encoding = 'UTF-8';
- }
-
- return iconv($from_encoding, $to_encoding . '//IGNORE', $s);
- }
-
- static function mb_decode_mimeheader($s)
- {
- return iconv_mime_decode($s, 2, self::$internal_encoding . '//IGNORE');
- }
-
- static function mb_encode_mimeheader($s, $charset = INF, $transfer_encoding = INF, $linefeed = INF, $indent = INF)
- {
- user_error('mb_encode_mimeheader() is bugged. Please use iconv_mime_encode() instead', E_USER_WARNING);
- }
-
-
- static function mb_convert_case($s, $mode, $encoding = INF)
- {
- if ('' === $s .= '') return '';
-
- if (INF === $encoding) $encoding = self::$internal_encoding;
- else $encoding = strtoupper($encoding);
-
- if ('UTF-8' === $encoding || 'UTF8' === $encoding) $encoding = INF;
- else $s = iconv($encoding, 'UTF-8//IGNORE', $s);
-
- if (MB_CASE_TITLE == $mode)
- {
- $s = preg_replace_callback('/\b\p{Ll}/u', array(__CLASS__, 'title_case_upper'), $s);
- $s = preg_replace_callback('/\B[\p{Lu}\p{Lt}]+/u', array(__CLASS__, 'title_case_lower'), $s);
- }
- else
- {
- if (MB_CASE_UPPER == $mode)
- {
- static $upper;
- isset($upper) || $upper = static::getData('upperCase');
- $map = $upper;
- }
- else
- {
- if (self::MB_CASE_FOLD === $mode) $s = str_replace(self::$caseFold[0], self::$caseFold[1], $s);
-
- static $lower;
- isset($lower) || $lower = static::getData('lowerCase');
- $map = $lower;
- }
-
- static $ulen_mask = array("\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4);
-
- $i = 0;
- $len = strlen($s);
-
- while ($i < $len)
- {
- $ulen = $s[$i] < "\x80" ? 1 : $ulen_mask[$s[$i] & "\xF0"];
- $uchr = substr($s, $i, $ulen);
- $i += $ulen;
-
- if (isset($map[$uchr]))
- {
- $uchr = $map[$uchr];
- $nlen = strlen($uchr);
-
- if ($nlen == $ulen)
- {
- $nlen = $i;
- do $s[--$nlen] = $uchr[--$ulen];
- while ($ulen);
- }
- else
- {
- $s = substr_replace($s, $uchr, $i - $ulen, $ulen);
- $len += $nlen - $ulen;
- $i += $nlen - $ulen;
- }
- }
- }
- }
-
- if (INF === $encoding) return $s;
- else return iconv('UTF-8', $encoding, $s);
- }
-
- static function mb_internal_encoding($encoding = INF)
- {
- if (INF === $encoding) return self::$internal_encoding;
- else $encoding = strtoupper($encoding);
-
- if ('UTF-8' === $encoding || 'UTF8' === $encoding || false !== @iconv($encoding, $encoding, ' '))
- {
- self::$internal_encoding = 'UTF8' === $encoding ? 'UTF-8' : $encoding;
-
- return true;
- }
-
- return false;
- }
-
- static function mb_language($lang = INF)
- {
- if (INF === $lang) return self::$language;
-
- switch ($lang = strtolower($lang))
- {
- case 'uni':
- case 'neutral':
- self::$language = $lang;
- return true;
- }
-
- return false;
- }
-
- static function mb_list_encodings()
- {
- return array('UTF-8');
- }
-
- static function mb_encoding_aliases($encoding)
- {
- switch (strtolower($encoding))
- {
- case 'utf8':
- case 'utf-8': return array('utf8');
- }
-
- return false;
- }
-
- static function mb_check_encoding($var = INF, $encoding = INF)
- {
- if (INF === $encoding)
- {
- if (INF === $var) return false;
- $encoding = self::$internal_encoding;
- }
-
- return false !== mb_detect_encoding($var, array($encoding), true);
- }
-
- static function mb_detect_encoding($str, $encoding_list = INF, $strict = false)
- {
- if (INF === $encoding_list) $encoding_list = self::$encoding_list;
- else
- {
- if (! is_array($encoding_list)) $encoding_list = array_map('trim', explode(',', $encoding_list));
- $encoding_list = array_map('strtoupper', $encoding_list);
- }
-
- foreach ($encoding_list as $enc)
- {
- switch ($enc)
- {
- case 'ASCII':
- if (! preg_match('/[\x80-\xFF]/', $str)) return $enc;
- break;
-
- case 'UTF8':
- case 'UTF-8':
- if (preg_match('//u', $str)) return $enc;
- break;
-
- default:
- return strncmp($enc, 'ISO-8859-', 9) ? false : $enc;
- }
- }
-
- return false;
- }
-
- static function mb_detect_order($encoding_list = INF)
- {
- if (INF === $encoding_list) return self::$encoding_list;
-
- if (! is_array($encoding_list)) $encoding_list = array_map('trim', explode(',', $encoding_list));
- $encoding_list = array_map('strtoupper', $encoding_list);
-
- foreach ($encoding_list as $enc)
- {
- switch ($enc)
- {
- default: if (strncmp($enc, 'ISO-8859-', 9)) return false;
- case 'ASCII':
- case 'UTF8':
- case 'UTF-8':
- }
- }
-
- self::$encoding_list = $encoding_list;
-
- return true;
- }
-
- static function mb_strlen($s, $encoding = INF)
- {
- INF === $encoding && $encoding = self::$internal_encoding;
- return iconv_strlen($s, $encoding . '//IGNORE');
- }
-
- static function mb_strpos($haystack, $needle, $offset = 0, $encoding = INF)
- {
- INF === $encoding && $encoding = self::$internal_encoding;
- if ('' === $needle .= '')
- {
- user_error(__METHOD__ . ': Empty delimiter', E_USER_WARNING);
- return false;
- }
- else return iconv_strpos($haystack, $needle, $offset, $encoding . '//IGNORE');
- }
-
- static function mb_strrpos($haystack, $needle, $offset = 0, $encoding = INF)
- {
- INF === $encoding && $encoding = self::$internal_encoding;
-
- if ($offset != (int) $offset)
- {
- $offset = 0;
- }
- else if ($offset = (int) $offset)
- {
- $haystack = self::mb_substr($haystack, $offset, 2147483647, $encoding);
- }
-
- $pos = iconv_strrpos($haystack, $needle, $encoding . '//IGNORE');
-
- return false !== $pos ? $offset + $pos : false;
- }
-
- static function mb_strtolower($s, $encoding = INF)
- {
- return self::mb_convert_case($s, MB_CASE_LOWER, $encoding);
- }
-
- static function mb_strtoupper($s, $encoding = INF)
- {
- return self::mb_convert_case($s, MB_CASE_UPPER, $encoding);
- }
-
- static function mb_substitute_character($c = INF)
- {
- return INF !== $c ? false : 'none';
- }
-
- static function mb_substr($s, $start, $length = null, $encoding = INF)
- {
- INF === $encoding && $encoding = self::$internal_encoding;
-
- if ($start < 0)
- {
- $start = iconv_strlen($s, $encoding . '//IGNORE') + $start;
- if ($start < 0) $start = 0;
- }
-
- if (null === $length) $length = 2147483647;
- else if ($length < 0)
- {
- $length = iconv_strlen($s, $encoding . '//IGNORE') + $length - $start;
- if ($length < 0) return '';
- }
-
- return iconv_substr($s, $start, $length, $encoding . '//IGNORE') . '';
- }
-
- static function mb_stripos($haystack, $needle, $offset = 0, $encoding = INF)
- {
- INF === $encoding && $encoding = self::$internal_encoding;
- $haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding);
- $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding);
- return self::mb_strpos($haystack, $needle, $offset, $encoding);
- }
-
- static function mb_stristr($haystack, $needle, $part = false, $encoding = INF)
- {
- $pos = self::mb_stripos($haystack, $needle, 0, $encoding);
- return self::getSubpart($pos, $part, $haystack, $encoding);
- }
-
- static function mb_strrchr($haystack, $needle, $part = false, $encoding = INF)
- {
- INF === $encoding && $encoding = self::$internal_encoding;
- $needle = self::mb_substr($needle, 0, 1, $encoding);
- $pos = iconv_strrpos($haystack, $needle, $encoding);
- return self::getSubpart($pos, $part, $haystack, $encoding);
- }
-
- static function mb_strrichr($haystack, $needle, $part = false, $encoding = INF)
- {
- $needle = self::mb_substr($needle, 0, 1, $encoding);
- $pos = self::mb_strripos($haystack, $needle, $encoding);
- return self::getSubpart($pos, $part, $haystack, $encoding);
- }
-
- static function mb_strripos($haystack, $needle, $offset = 0, $encoding = INF)
- {
- INF === $encoding && $encoding = self::$internal_encoding;
- $haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding);
- $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding);
- return self::mb_strrpos($haystack, $needle, $offset, $encoding);
- }
-
- static function mb_strstr($haystack, $needle, $part = false, $encoding = INF)
- {
- $pos = strpos($haystack, $needle);
- if (false === $pos) return false;
- if ($part) return substr($haystack, 0, $pos);
- else return substr($haystack, $pos);
- }
-
- static function mb_get_info($type = 'all')
- {
- $info = array(
- 'internal_encoding' => self::$internal_encoding,
- 'http_output' => 'pass',
- 'http_output_conv_mimetypes' => '^(text/|application/xhtml\+xml)',
- 'func_overload' => 0,
- 'func_overload_list' => 'no overload',
- 'mail_charset' => 'UTF-8',
- 'mail_header_encoding' => 'BASE64',
- 'mail_body_encoding' => 'BASE64',
- 'illegal_chars' => 0,
- 'encoding_translation' => 'Off',
- 'language' => self::$language,
- 'detect_order' => self::$encoding_list,
- 'substitute_character' => 'none',
- 'strict_detection' => 'Off',
- );
-
- if ('all' === $type) {
- return $info;
- } elseif (isset($info[$type])) {
- return $info[$type];
- } else {
- return false;
- }
- }
-
- static function mb_http_input($type = '')
- {
- return false;
- }
-
- static function mb_http_output($encoding = INF)
- {
- return INF !== $encoding ? 'pass' === $encoding : 'pass';
- }
-
- static function mb_strwidth($s, $encoding = INF)
- {
- $encoding = INF === $encoding ? self::$internal_encoding : strtoupper($encoding);
-
- if ('UTF-8' !== $encoding && 'UTF8' !== $encoding) {
- $s = iconv($encoding, 'UTF-8//IGNORE', $s);
- }
-
- $s = preg_replace('/[\x00-\x19]/', '', $s);
-
- preg_replace('/[\x{0020}-\x{1FFF}\x{FF61}-\x{FF9F}]/u', '', $s, -1, $narrow);
-
- return (iconv_strlen($s, 'UTF-8') << 1) - $narrow;
- }
-
- static function mb_substr_count($haystack, $needle, $encoding = INF)
- {
- return substr_count($haystack, $needle);
- }
-
- static function mb_output_handler($contents, $status)
- {
- return $contents;
- }
-
- protected static function getSubpart($pos, $part, $haystack, $encoding)
- {
- INF === $encoding && $encoding = self::$internal_encoding;
-
- if (false === $pos) return false;
- if ($part) return self::mb_substr($haystack, 0, $pos, $encoding);
- else return self::mb_substr($haystack, $pos, null, $encoding);
- }
-
- protected static function html_encoding_callback($m)
- {
- $i = 1;
- $entities = '';
- $m = unpack('C*', htmlentities($m[0], ENT_COMPAT, 'UTF-8'));
-
- while (isset($m[$i])) {
- if (0x80 > $m[$i]) {
- $entities .= chr($m[$i++]);
- continue;
- }
- if (0xF0 <= $m[$i]) {
- $c = (($m[$i++] - 0xF0) << 18) + (($m[$i++] - 0x80) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
- } elseif (0xE0 <= $m[$i]) {
- $c = (($m[$i++] - 0xE0) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
- } else {
- $c = (($m[$i++] - 0xC0) << 6) + $m[$i++] - 0x80;
- }
-
- $entities .= '&#'.$c.';';
- }
-
- return $entities;
- }
-
- protected static function title_case_lower($s)
- {
- return self::mb_convert_case($s[0], MB_CASE_LOWER, 'UTF-8');
- }
-
- protected static function title_case_upper($s)
- {
- return self::mb_convert_case($s[0], MB_CASE_UPPER, 'UTF-8');
- }
-
- protected static function getData($file)
- {
- $file = __DIR__ . '/unidata/' . $file . '.ser';
- if (file_exists($file)) return unserialize(file_get_contents($file));
- else return false;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/patchwork/utf8/class/Patchwork/PHP/Shim/Normalizer.php
----------------------------------------------------------------------
diff --git a/vendor/patchwork/utf8/class/Patchwork/PHP/Shim/Normalizer.php b/vendor/patchwork/utf8/class/Patchwork/PHP/Shim/Normalizer.php
deleted file mode 100644
index c296470..0000000
--- a/vendor/patchwork/utf8/class/Patchwork/PHP/Shim/Normalizer.php
+++ /dev/null
@@ -1,295 +0,0 @@
-<?php // vi: set fenc=utf-8 ts=4 sw=4 et:
-/*
- * Copyright (C) 2013 Nicolas Grekas - p@tchwork.com
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the (at your option):
- * Apache License v2.0 (http://apache.org/licenses/LICENSE-2.0.txt), or
- * GNU General Public License v2.0 (http://gnu.org/licenses/gpl-2.0.txt).
- */
-
-namespace Patchwork\PHP\Shim;
-
-/**
- * Normalizer is a PHP fallback implementation of the Normalizer class provided by the intl extension.
- *
- * It has been validated with Unicode 6.3 Normalization Conformance Test.
- * See http://www.unicode.org/reports/tr15/ for detailed info about Unicode normalizations.
- */
-class Normalizer
-{
- const
-
- NONE = 1,
- FORM_D = 2, NFD = 2,
- FORM_KD = 3, NFKD = 3,
- FORM_C = 4, NFC = 4,
- FORM_KC = 5, NFKC = 5;
-
-
- protected static
-
- $C, $D, $KD, $cC,
- $ulen_mask = array("\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4),
- $ASCII = "\x20\x65\x69\x61\x73\x6E\x74\x72\x6F\x6C\x75\x64\x5D\x5B\x63\x6D\x70\x27\x0A\x67\x7C\x68\x76\x2E\x66\x62\x2C\x3A\x3D\x2D\x71\x31\x30\x43\x32\x2A\x79\x78\x29\x28\x4C\x39\x41\x53\x2F\x50\x22\x45\x6A\x4D\x49\x6B\x33\x3E\x35\x54\x3C\x44\x34\x7D\x42\x7B\x38\x46\x77\x52\x36\x37\x55\x47\x4E\x3B\x4A\x7A\x56\x23\x48\x4F\x57\x5F\x26\x21\x4B\x3F\x58\x51\x25\x59\x5C\x09\x5A\x2B\x7E\x5E\x24\x40\x60\x7F\x00\x01\x02\x03\x04\x05\x06\x07\x08\x0B\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F";
-
-
- static function isNormalized($s, $form = self::NFC)
- {
- if (strspn($s .= '', self::$ASCII) === strlen($s)) return true;
- if (self::NFC === $form && preg_match('//u', $s) && !preg_match('/[^\x00-\x{2FF}]/u', $s)) return true;
- return false; // Pretend false as quick checks implementented in PHP won't be so quick
- }
-
- static function normalize($s, $form = self::NFC)
- {
- if (!preg_match('//u', $s .= '')) return false;
-
- switch ($form)
- {
- case self::NONE: return $s;
- case self::NFC: $C = true; $K = false; break;
- case self::NFD: $C = false; $K = false; break;
- case self::NFKC: $C = true; $K = true; break;
- case self::NFKD: $C = false; $K = true; break;
- default: return false;
- }
-
- if ('' === $s) return '';
-
- if ($K && empty(self::$KD)) self::$KD = static::getData('compatibilityDecomposition');
-
- if (empty(self::$D))
- {
- self::$D = static::getData('canonicalDecomposition');
- self::$cC = static::getData('combiningClass');
- }
-
- if ($C)
- {
- if (empty(self::$C)) self::$C = static::getData('canonicalComposition');
- return self::recompose(self::decompose($s, $K));
- }
- else return self::decompose($s, $K);
- }
-
- protected static function recompose($s)
- {
- $ASCII = self::$ASCII;
- $compMap = self::$C;
- $combClass = self::$cC;
- $ulen_mask = self::$ulen_mask;
-
- $result = $tail = '';
-
- $i = $s[0] < "\x80" ? 1 : $ulen_mask[$s[0] & "\xF0"];
- $len = strlen($s);
-
- $last_uchr = substr($s, 0, $i);
- $last_ucls = isset($combClass[$last_uchr]) ? 256 : 0;
-
- while ($i < $len)
- {
- if ($s[$i] < "\x80")
- {
- // ASCII chars
-
- if ($tail)
- {
- $last_uchr .= $tail;
- $tail = '';
- }
-
- if ($j = strspn($s, $ASCII, $i+1))
- {
- $last_uchr .= substr($s, $i, $j);
- $i += $j;
- }
-
- $result .= $last_uchr;
- $last_uchr = $s[$i];
- ++$i;
- }
- else
- {
- $ulen = $ulen_mask[$s[$i] & "\xF0"];
- $uchr = substr($s, $i, $ulen);
-
- if ($last_uchr < "\xE1\x84\x80" || "\xE1\x84\x92" < $last_uchr
- || $uchr < "\xE1\x85\xA1" || "\xE1\x85\xB5" < $uchr
- || $last_ucls)
- {
- // Table lookup and combining chars composition
-
- $ucls = isset($combClass[$uchr]) ? $combClass[$uchr] : 0;
-
- if (isset($compMap[$last_uchr . $uchr]) && (!$last_ucls || $last_ucls < $ucls))
- {
- $last_uchr = $compMap[$last_uchr . $uchr];
- }
- else if ($last_ucls = $ucls) $tail .= $uchr;
- else
- {
- if ($tail)
- {
- $last_uchr .= $tail;
- $tail = '';
- }
-
- $result .= $last_uchr;
- $last_uchr = $uchr;
- }
- }
- else
- {
- // Hangul chars
-
- $L = ord($last_uchr[2]) - 0x80;
- $V = ord($uchr[2]) - 0xA1;
- $T = 0;
-
- $uchr = substr($s, $i + $ulen, 3);
-
- if ("\xE1\x86\xA7" <= $uchr && $uchr <= "\xE1\x87\x82")
- {
- $T = ord($uchr[2]) - 0xA7;
- 0 > $T && $T += 0x40;
- $ulen += 3;
- }
-
- $L = 0xAC00 + ($L * 21 + $V) * 28 + $T;
- $last_uchr = chr(0xE0 | $L>>12) . chr(0x80 | $L>>6 & 0x3F) . chr(0x80 | $L & 0x3F);
- }
-
- $i += $ulen;
- }
- }
-
- return $result . $last_uchr . $tail;
- }
-
- protected static function decompose($s, $c)
- {
- $result = '';
-
- $ASCII = self::$ASCII;
- $decompMap = self::$D;
- $combClass = self::$cC;
- $ulen_mask = self::$ulen_mask;
- if ($c) $compatMap = self::$KD;
-
- $c = array();
- $i = 0;
- $len = strlen($s);
-
- while ($i < $len)
- {
- if ($s[$i] < "\x80")
- {
- // ASCII chars
-
- if ($c)
- {
- ksort($c);
- $result .= implode('', $c);
- $c = array();
- }
-
- $j = 1 + strspn($s, $ASCII, $i+1);
- $result .= substr($s, $i, $j);
- $i += $j;
- }
- else
- {
- $ulen = $ulen_mask[$s[$i] & "\xF0"];
- $uchr = substr($s, $i, $ulen);
- $i += $ulen;
-
- if (isset($combClass[$uchr]))
- {
- // Combining chars, for sorting
-
- isset($c[$combClass[$uchr]]) || $c[$combClass[$uchr]] = '';
- $c[$combClass[$uchr]] .= isset($compatMap[$uchr]) ? $compatMap[$uchr] : (isset($decompMap[$uchr]) ? $decompMap[$uchr] : $uchr);
- }
- else
- {
- if ($c)
- {
- ksort($c);
- $result .= implode('', $c);
- $c = array();
- }
-
- if ($uchr < "\xEA\xB0\x80" || "\xED\x9E\xA3" < $uchr)
- {
- // Table lookup
-
- $j = isset($compatMap[$uchr]) ? $compatMap[$uchr] : (isset($decompMap[$uchr]) ? $decompMap[$uchr] : $uchr);
-
- if ($uchr != $j)
- {
- $uchr = $j;
-
- $j = strlen($uchr);
- $ulen = $uchr[0] < "\x80" ? 1 : $ulen_mask[$uchr[0] & "\xF0"];
-
- if ($ulen != $j)
- {
- // Put trailing chars in $s
-
- $j -= $ulen;
- $i -= $j;
-
- if (0 > $i)
- {
- $s = str_repeat(' ', -$i) . $s;
- $len -= $i;
- $i = 0;
- }
-
- while ($j--) $s[$i+$j] = $uchr[$ulen+$j];
-
- $uchr = substr($uchr, 0, $ulen);
- }
- }
- }
- else
- {
- // Hangul chars
-
- $uchr = unpack('C*', $uchr);
- $j = (($uchr[1]-224) << 12) + (($uchr[2]-128) << 6) + $uchr[3] - 0xAC80;
-
- $uchr = "\xE1\x84" . chr(0x80 + (int) ($j / 588))
- . "\xE1\x85" . chr(0xA1 + (int) (($j % 588) / 28));
-
- if ($j %= 28)
- {
- $uchr .= $j < 25
- ? ("\xE1\x86" . chr(0xA7 + $j))
- : ("\xE1\x87" . chr(0x67 + $j));
- }
- }
-
- $result .= $uchr;
- }
- }
- }
-
- if ($c)
- {
- ksort($c);
- $result .= implode('', $c);
- }
-
- return $result;
- }
-
- protected static function getData($file)
- {
- $file = __DIR__ . '/unidata/' . $file . '.ser';
- if (file_exists($file)) return unserialize(file_get_contents($file));
- else return false;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/patchwork/utf8/class/Patchwork/PHP/Shim/Xml.php
----------------------------------------------------------------------
diff --git a/vendor/patchwork/utf8/class/Patchwork/PHP/Shim/Xml.php b/vendor/patchwork/utf8/class/Patchwork/PHP/Shim/Xml.php
deleted file mode 100644
index 6a44df8..0000000
--- a/vendor/patchwork/utf8/class/Patchwork/PHP/Shim/Xml.php
+++ /dev/null
@@ -1,61 +0,0 @@
-<?php // vi: set fenc=utf-8 ts=4 sw=4 et:
-/*
- * Copyright (C) 2013 Nicolas Grekas - p@tchwork.com
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the (at your option):
- * Apache License v2.0 (http://apache.org/licenses/LICENSE-2.0.txt), or
- * GNU General Public License v2.0 (http://gnu.org/licenses/gpl-2.0.txt).
- */
-
-namespace Patchwork\PHP\Shim;
-
-/**
- * utf8_encode/decode
- */
-class Xml
-{
- static function utf8_encode($s)
- {
- $s .= $s;
- $len = strlen($s);
-
- for ($i = $len >> 1, $j = 0; $i < $len; ++$i, ++$j) switch (true)
- {
- case $s[$i] < "\x80": $s[$j] = $s[$i]; break;
- case $s[$i] < "\xC0": $s[$j] = "\xC2"; $s[++$j] = $s[$i]; break;
- default: $s[$j] = "\xC3"; $s[++$j] = chr(ord($s[$i]) - 64); break;
- }
-
- return substr($s, 0, $j);
- }
-
- static function utf8_decode($s)
- {
- $s .= '';
- $len = strlen($s);
-
- for ($i = 0, $j = 0; $i < $len; ++$i, ++$j)
- {
- switch ($s[$i] & "\xF0")
- {
- case "\xC0":
- case "\xD0":
- $c = (ord($s[$i] & "\x1F") << 6) | ord($s[++$i] & "\x3F");
- $s[$j] = $c < 256 ? chr($c) : '?';
- break;
-
- case "\xF0": ++$i;
- case "\xE0":
- $s[$j] = '?';
- $i += 2;
- break;
-
- default:
- $s[$j] = $s[$i];
- }
- }
-
- return substr($s, 0, $j);
- }
-}