~~~
<?php
/**
* Created by nur.cn
* info: Uyghur_convert
* Date: 2016/08/12
* Time: 15:51
*/
class Uyghur_convert {
private static $uyghur_harp = array("?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?");
private static $uyghur_all = array("?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?");
private static $letters = array(
"?" => array("character" => "ا", "isoGlyph" => "ﺍ", "iniGlyph" => "ﺍ", "midGlyph" => "ﺎ", "endGlyph" => "ﺎ"),
"?" => array("character" => "ە", "isoGlyph" => "ﻩ", "iniGlyph" => "ﻩ", "midGlyph" => "ﻩ", "endGlyph" => "ﻪ"),
"?" => array("character" => "ب", "isoGlyph" => "ﺏ", "iniGlyph" => "ﺑ", "midGlyph" => "ﺒ", "endGlyph" => "ﺐ"),
"?" => array("character" => "پ", "isoGlyph" => "ﭖ", "iniGlyph" => "ﭘ", "midGlyph" => "ﭙ", "endGlyph" => "ﭗ"),
"?" => array("character" => "ت", "isoGlyph" => "ﺕ", "iniGlyph" => "ﺗ", "midGlyph" => "ﺘ", "endGlyph" => "ﺖ"),
"?" => array("character" => "ج", "isoGlyph" => "ﺝ", "iniGlyph" => "ﺟ", "midGlyph" => "ﺠ", "endGlyph" => "ﺞ"),
"?" => array("character" => "چ", "isoGlyph" => "ﭺ", "iniGlyph" => "ﭼ", "midGlyph" => "ﭽ", "endGlyph" => "ﭻ"),
"?" => array("character" => "خ", "isoGlyph" => "ﺥ", "iniGlyph" => "ﺧ", "midGlyph" => "ﺨ", "endGlyph" => "ﺦ"),
"?" => array("character" => "د", "isoGlyph" => "ﺩ", "iniGlyph" => "ﺩ", "midGlyph" => "ﺪ", "endGlyph" => "ﺪ"),
"?" => array("character" => "ر", "isoGlyph" => "ﺭ", "iniGlyph" => "ﺭ", "midGlyph" => "ﺮ", "endGlyph" => "ﺮ"),
"?" => array("character" => "ز", "isoGlyph" => "ﺯ", "iniGlyph" => "ﺯ", "midGlyph" => "ﺰ", "endGlyph" => "ﺰ"),
"?" => array("character" => "ژ", "isoGlyph" => "ﮊ", "iniGlyph" => "ﮊ", "midGlyph" => "ﮋ", "endGlyph" => "ﮋ"),
"?" => array("character" => "س", "isoGlyph" => "ﺱ", "iniGlyph" => "ﺳ", "midGlyph" => "ﺴ", "endGlyph" => "ﺲ"),
"?" => array("character" => "ش", "isoGlyph" => "ﺵ", "iniGlyph" => "ﺷ", "midGlyph" => "ﺸ", "endGlyph" => "ﺶ"),
"?" => array("character" => "غ", "isoGlyph" => "ﻍ", "iniGlyph" => "ﻏ", "midGlyph" => "ﻐ", "endGlyph" => "ﻎ"),
"?" => array("character" => "ق", "isoGlyph" => "ﻕ", "iniGlyph" => "ﻗ", "midGlyph" => "ﻘ", "endGlyph" => "ﻖ"),
"?" => array("character" => "ف", "isoGlyph" => "ﻑ", "iniGlyph" => "ﻓ", "midGlyph" => "ﻔ", "endGlyph" => "ﻒ"),
"?" => array("character" => "ك", "isoGlyph" => "ﻙ", "iniGlyph" => "ﻛ", "midGlyph" => "ﻜ", "endGlyph" => "ﻚ"),
"?" => array("character" => "گ", "isoGlyph" => "ﮒ", "iniGlyph" => "ﮔ", "midGlyph" => "ﮕ", "endGlyph" => "ﮓ"),
"?" => array("character" => "ڭ", "isoGlyph" => "ﯓ", "iniGlyph" => "ﯕ", "midGlyph" => "ﯖ", "endGlyph" => "ﯔ"),
"?" => array("character" => "ل", "isoGlyph" => "ﻝ", "iniGlyph" => "ﻟ", "midGlyph" => "ﻠ", "endGlyph" => "ﻞ"),
"?" => array("character" => "م", "isoGlyph" => "ﻡ", "iniGlyph" => "ﻣ", "midGlyph" => "ﻤ", "endGlyph" => "ﻢ"),
"?" => array("character" => "ن", "isoGlyph" => "ﻥ", "iniGlyph" => "ﻧ", "midGlyph" => "ﻨ", "endGlyph" => "ﻦ"),
"?" => array("character" => "ھ", "isoGlyph" => "ﮪ", "iniGlyph" => "ﮪ", "midGlyph" => "ﮭ", "endGlyph" => "ﮭ"),
"?" => array("character" => "و", "isoGlyph" => "ﻭ", "iniGlyph" => "ﻭ", "midGlyph" => "ﻮ", "endGlyph" => "ﻮ"),
"?" => array("character" => "ۇ", "isoGlyph" => "ﯗ", "iniGlyph" => "ﯗ", "midGlyph" => "ﯘ", "endGlyph" => "ﯘ"),
"?" => array("character" => "ۆ", "isoGlyph" => "ﯙ", "iniGlyph" => "ﯙ", "midGlyph" => "ﯚ", "endGlyph" => "ﯚ"),
"?" => array("character" => "ۈ", "isoGlyph" => "ﯛ", "iniGlyph" => "ﯛ", "midGlyph" => "ﯜ", "endGlyph" => "ﯜ"),
"?" => array("character" => "ۋ", "isoGlyph" => "ﯞ", "iniGlyph" => "ﯞ", "midGlyph" => "ﯟ", "endGlyph" => "ﯟ"),
"?" => array("character" => "ې", "isoGlyph" => "ﯤ", "iniGlyph" => "ﯦ", "midGlyph" => "ﯧ", "endGlyph" => "ﯥ"),
"?" => array("character" => "ى", "isoGlyph" => "ﻯ", "iniGlyph" => "ﯨ", "midGlyph" => "ﯩ", "endGlyph" => "ﻰ"),
"?" => array("character" => "ي", "isoGlyph" => "ﻱ", "iniGlyph" => "ﻳ", "midGlyph" => "ﻴ", "endGlyph" => "ﻲ"),
"?" => array("character" => "ئ", "isoGlyph" => "ﺋ", "iniGlyph" => "ﺋ", "midGlyph" => "ﺌ", "endGlyph" => "ﺌ"),
);
/**
* 擴展區轉
* @param $text
* @return mixed
*/
public static function asasiy($text) {
$text = str_replace(array('?', '?', '?', '?', '?'), "?", $text);
$text = str_replace(array('?', '?', '?', '?', '?'), "?", $text);
$text = str_replace(array('?', '?', '?', '?', '?'), "?", $text);
$text = str_replace(array('?', '?', '?', '?', '?'), "?", $text);
$text = str_replace(array('?', '?', '?', '?', '?'), "?", $text);
$text = str_replace(array('?', '?', '?', '?', '?'), "?", $text);
$text = str_replace(array('?', '?', '?', '?', '?'), "?", $text);
$text = str_replace(array('?', '?', '?', '?', '?'), "?", $text);
$text = str_replace(array('?', '?', '?', '?', '?'), "?", $text);
$text = str_replace(array('?', '?', '?', '?', '?'), "?", $text);
$text = str_replace(array('?', '?', '?', '?', '?'), "?", $text);
$text = str_replace(array('?', '?', '?', '?', '?'), "?", $text);
$text = str_replace(array('?', '?', '?', '?', '?'), "?", $text);
$text = str_replace(array('?', '?', '?', '?', '?'), "?", $text);
$text = str_replace(array('?', '?', '?', '?', '?'), "?", $text);
$text = str_replace(array('?', '?', '?', '?', '?'), "?", $text);
$text = str_replace(array('?', '?', '?', '?', '?'), "?", $text);
$text = str_replace(array('?', '?', '?', '?', '?'), "?", $text);
$text = str_replace(array('?', '?', '?', '?', '?'), "?", $text);
$text = str_replace(array('?', '?', '?', '?', '?'), "?", $text);
$text = str_replace(array('?', '?', '?', '?', '?'), "?", $text);
$text = str_replace(array('?', '?', '?', '?', '?'), "?", $text);
$text = str_replace(array('?', '?', '?', '?', '?'), "?", $text);
$text = str_replace(array('?', '?', '?', '?', '?'), "?", $text);
$text = str_replace(array('?', '?', '?', '?', '?'), "?", $text);
$text = str_replace(array('?', '?', '?', '?', '?'), "?", $text);
$text = str_replace(array('?', '?', '?', '?', '?'), "?", $text);
$text = str_replace(array('?', '?', '?', '?', '?'), "?", $text);
$text = str_replace(array('?', '?', '?', '?', '?'), "?", $text);
$text = str_replace(array('?', '?', '?', '?', '?'), "?", $text);
$text = str_replace(array('?', '?', '?', '?', '?'), "?", $text);
$text = str_replace(array('?', '?', '?', '?', '?'), "?", $text);
$text = str_replace(array('?', '?', '?', '?', '?'), "?", $text);
$text = str_replace(array('?', '?'), "??", $text);
$text = str_replace(':', " : ", $text);
$text = str_replace('…', "...", $text);
return $text;
}
/**
* ???????? ??????? ??????? ULY ?????? ??????????? ??????
* @param $text
* @return mixed|string
*/
public static function ULYStr($text) {
if (!$text) {
return '';
}
$text = " " . $text;
$uy = array(" ??", " ??", " ??", " ??", " ??", " ??", " ??", " ??", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?");
$uly = array(" a", " e", " é", " i", " o", " u", " ?", " ü", "a", "e", "é", "i", "o", "u", "?", "ü", "sh", "ng", "gh", "ch", "b", "d", "f", "g", "h", "j", "k", "l", "m", "n", "p", "q", "r", "s", "t", "w", "y", "z", "x", "J", ",", "?", ";");
$text = str_replace($uy, $uly, $text);
return $text;
}
/**
* Gets the current character from a UTF-8 string
*
* Returns a substitution character if the first byte is invalid.
* Expecting a valid UTF-8 string. Does not check if the bytes following
* the first one are valid.
*
* @param string $string the UTF-8 string
* @param integer &$pos the current byte position within the UTF-8 string,
* the position is updated to the next character on exit
* @param integer $length the length of the UTF-8 string
* @param boolean $lookahead update the position to the next UTF-8 character
* if true, leaves it unchanged if true
* @param string $invalid the ASCII character replacing an invalid byte, e.g. "?",
* invalid bytes are silently ignored if null
* @return string the UTF-8 character, or false if there are
* no more characters to get
* @access public
*/
private static function getChar($string, &$pos, $length, $lookahead = false, $invalid = '?') {
if ($pos >= $length) {
// no more character to read
return false;
}
// saves the current character position if lookahead
$lookahead and $copy = $pos;
// gets the first byte
$char = $string{$pos++};
if ($char < "\x80") {
// a 1-byte character
} else if ($char < "\xC0") {
// error: invalid as a first byte
$char = $invalid;
} else if ($char < "\xE0") {
// a 2-byte character
$char .= $string{$pos++};
} else if ($char < "\xF0") {
// a 3-byte character
$char .= substr($string, $pos, 2);
$pos += 2;
} else if ($char < "\xF8") {
// a 4-byte character
$char .= substr($string, $pos, 3);
$pos += 3;
} else {
// error: out of range as a first byte
$char = $invalid;
}
// restores the current character position if lookahead
$lookahead and $pos = $copy;
return $char;
}
private static function checkLinkBefore($currentChar, $beforeChar) {
return in_array($beforeChar, self::$uyghur_harp);
}
private static function checkLinkAfter($currentChar, $afterChar) {
if (strcmp($currentChar, "?") == 0) {
return false;
}
return in_array($afterChar, self::$uyghur_all);
}
private static function unicode_convert($string) {
$result = "";
$La = "";
$length_of_the_string = strlen($string);
$postionBefore = 0;
$postionMiddle = 0;
$position = 0;
$i = 0;
$canLinkBefore = false;
$canLinkAfter = false;
$charaterBefore = "";
$charaterMiddle = "";
$charaterAfter = "";
do {
$postionBefore = $postionMiddle;
$postionMiddle = $position;
$charaterAfter = self::getChar($string, $position, $length_of_the_string, false, null);
if (isset(self::$letters[$charaterMiddle])) {
$letter = self::$letters[$charaterMiddle];
if ($postionBefore == 0) {
$canLinkBefore = false;
} else {
$canLinkBefore = self::checkLinkBefore($charaterMiddle, $charaterBefore);
}
if ($position == "end or string") {
$canLinkAfter = false;
} else {
$canLinkAfter = self::checkLinkAfter($charaterMiddle, $charaterAfter);
}
if (strcmp($charaterMiddle, "?") == 0 && (strcmp($La, "ل") == 0 || strcmp($La, "ﻝ") == 0 || strcmp($La, "ﻟ") == 0)) {
$LaPosition = strlen($result) - strlen($La);
$result = substr_replace($result, "ﻻ", $LaPosition);
} else if (strcmp($charaterMiddle, "?") == 0 && (strcmp($La, "ل") == 0 || strcmp($La, "ﻠ") == 0 || strcmp($La, "ﻞ") == 0)) {
$LaPosition = strlen($result) - strlen($La);
$result = substr_replace($result, "ﻼ", $LaPosition);
} else if ($canLinkBefore && $canLinkAfter) {
$result .= $letter['midGlyph'];
$La = $letter['midGlyph'];
} else if (!$canLinkBefore && !$canLinkAfter) {
$result .= $letter['isoGlyph'];
$La = $letter['isoGlyph'];
} else if ($canLinkBefore && !$canLinkAfter) {
$result .= $letter['endGlyph'];
$La = $letter['endGlyph'];
} else if (!$canLinkBefore && $canLinkAfter) {
$result .= $letter['iniGlyph'];
$La = $letter['iniGlyph'];
}
} else {
$result .= $charaterMiddle;
$La = $charaterMiddle;
}
$charaterBefore = $charaterMiddle;
$charaterMiddle = $charaterAfter;
} while ($postionMiddle < $length_of_the_string);
return $result;
}
public static function html_convert($string) {
//return self::unicode_convert($string);
return html_entity_decode(self::unicode_convert($string), ENT_NOQUOTES, "UTF-8");
}
/**
* ??????????? ????? ???????????
* @param $string
* @return string
*/
public static function html_convert_words($string) {
$words_text = ""; /* words_text */
foreach ($list = explode("\n", $string) as $words) {
$words_text .= self::html_convert($words) . "\n";
} /*foreach*/
return $words_text;
}
/**
* 過濾有些字符串
* @param $words_text
* @return mixed
*/
public static function html_filter_convert($words_text) {
$words_text = self::html_convert_words($words_text);
return str_replace(array('?', '?', '?', '?'), array('<b></b>?<b></b>', '<b></b>?<b></b>', ' ', ''), $words_text);
}
public static function html_convert_format($words_text) {
$words_text = self::html_convert($words_text);
return str_replace(array('?', '?', '?', '?'), array('<b></b>?<b></b>', '<b></b>?<b></b>', ' ', ''), $words_text);
}
/***************************************/
/***************************************/
/***************************************/
/**
* utf8 split 實現
* @param $str
* @param int $split_len
* @return array|bool
*/
private static function utf8_str_split($str, $split_len = 1) {
if (!preg_match('/^[0-9]+$/', $split_len) || $split_len < 1) {
return FALSE;
}
$len = mb_strlen($str, 'UTF-8');
if ($len <= $split_len) {
return array($str);
}
preg_match_all('/.{' . $split_len . '}|[^\x00]{1,' . $split_len . '}$/us', $str, $ar);
return $ar[0];
}
/**
* utf8 text convert ps
* @param $string
* @return string
*/
public static function utf8_ps_reverse($string) {
$content = ''; /*返回內容*/
foreach (explode(" ", $string) as $key => $value) {
$content .= ' ' . implode("", array_reverse(self::utf8_str_split($value)));
}/* foreach */
return trim($content);
}
/**
* 內容轉photoshop文本模式
* @param string $ThisText 字符串
* @param boolean $convert 轉換
* @return null
*/
public static function convert_to_ps($ThisText, $convert = true) {
if ($convert === true) {
$ThisText = self::html_convert($ThisText);
} /* end */
$ThisText = self::_ReverseString($ThisText);
return self::_ReverseAscii($ThisText);
}
/**
* @param $source
* @return string
*/
private static function _ReverseString($source) {
return implode("", array_reverse(self::utf8_str_split($source)));
}
/**
* @param $source
* @return string|string[]|null
*/
private static function _ReverseAscii($source) {
return preg_replace_callback("/([^\x{FB00}-\x{FEFF}\s]+)/u",
function ($word) {
return self::_ReverseString($word[0]);
},
$source);
}
/**
* GD庫生成圖片中文自動換行
* @param string $fontsize 字體大小
* @param string $angle 角度
* @param string $fontface 字體名稱
* @param string $string 字符串
* @param string $width 預設寬度
* @return string
*/
public static function auto_wrap($fontsize, $angle, $fontface, $string, $width) {
$content = "";
$letter = self::utf8_str_split($string);
foreach ($letter as $l) {
$teststr = $content . "" . $l;
$testbox = imagettfbbox($fontsize, $angle, $fontface, $teststr);
/* 判斷拼接后的字符串是否超過預設的寬度 */
if (($testbox[2] > $width) && ($content !== "")) {
$content .= "\n";
} /* end */
$content .= $l;
} /* foreach */
$content = mb_convert_encoding($content, "html-entities", "utf-8");
return $content;
}
}
~~~
- 后端
- composer
- composer配置國內鏡像
- composer安裝及設置2
- PHP
- 貝塔SG11加密
- 申請KEY
- 開始加密
- php 中連接tcp服務的三種方式
- php websocket 教程
- editor內容轉換數組
- 使用正則判斷中文維吾爾文
- PHP常用函數總結
- 常用助手函數
- 通過Imagick把pdf轉換圖片
- 維吾爾語基本區轉換擴展區
- php GD庫生成一個由文字和圖片生成新的圖片
- aes加密
- php數組函數 -- array_column,array_multisort 實現二維數組排序
- PHP操作Excel
- php更新內容
- 輔助查詢(*)
- 【時間】操作
- 時間函數例子
- Date/Time 函數(不包含別名函數)
- php網絡相關
- HTTP請求的返回值含義說明
- 使用php語言開發一個類似數據庫操作的文件表類
- pinyin
- 維吾爾語基本區轉換擴展區(2)
- php獲取當前環境的信息
- laravel
- laravel 隊列的使用
- laravel 自定義助手函數
- laravel seeder的使用
- laravel項目從git下載命令
- laravel 多個數據庫配置
- laravel 填充假數據
- laravel 動態路由
- laravel 自定義 validate 響應
- laravel 創建追加字段的模擬訪問器
- laravel 線上環境的數據庫更改或添加字段
- laravel 模型查詢按照whereIn排序
- laravel 使用 workerman 通過TCP 文件傳輸功能
- laravel api Header添加Accept頭
- Laraval IDE 自動補全插件 laravel-ide-helper
- laravel 網站后臺
- laravel 設置路由
- laravel-第三方composer包
- laravel 開發技巧
- laravel 昨天,今天時間
- 使用寶塔計劃任務啟動laravel調度器
- laravel結合workerman第二節
- Laravel - 上傳多個文件
- 查詢聊天好友列表
- 事件系統 event, listener
- laravel 安裝 laravel-modules
- 自定義求看守器-toekn
- laravel限流
- 使用 Laravel api Resource 類時自定義分頁信息
- Laravel php artisan命令大全
- 驗證器
- workerman 創建wss服務
- 架構師必須知道的26項PHP安全實踐
- python
- Python讀取文件代碼塊已經備好,用的時候光拿(建議收藏)
- Python常用庫大全
- api 簽名驗證
- git
- git命令
- 十分鐘學會git基礎
- Git代碼同時上傳到GitHub和Gitee(碼云)
- Git - 多人協同開發利器,團隊協作流程規范與注意事項
- 刪除遠程倉庫的文件
- github查詢方法
- 錯誤
- 解除項目git版本控制
- linux
- sentos安裝supervisor
- PHP怎么守護進程運行php腳本
- 600條最強Linux命令總結
- centos開啟防火墻、開放指定端口
- 前端
- vue
- vue2發布之前的config簡單配置
- vue2安裝scss命令
- vue2父子組件之間雙向數據綁定
- 國際化雙語--安裝VueI18n
- vue3-setup 組件傳參(defineProps、defineEmits、defineExpose
- Vue3 新寫法速覽:十分鐘內輕松get
- 關于vue的外連接
- watch講解
- computed
- webpack 打包后生成很多小文件怎么優化?
- vue2 vue.config.js常見配置和打包部署測試
- 小程序
- 小程序長期訂閱消息
- 小程序自定義TabBar后如何實現keep-alive
- 收藏的html和css和js
- CSS 省略號(單行省略號、多行省略號)
- UyghurInput_a.js
- font.css
- 漂亮按鈕樣式
- clock.html
- css
- scroll css樣式
- CSS流動布局-頁面自適應
- css grid布局
- 禁止wap頁面調整字體大小
- CSS @media 和 min-width/max-width
- 網站變灰是怎么實現的
- 瀑布流實現方式
- javascript
- SortableJS拖動排序
- wondow scroll滾動到上邊
- 原生js插入HTML元素
- Konva.js —— 像操作DOM一樣操作canvas
- 通過canvas合并倆個圖片
- js scroll更多加載
- js 實現復制功能
- js判斷安卓和蘋果或者微信
- 瀏覽器打開控制臺禁止
- 原生js一些dom操作
- js http客戶端集合
- fetch
- axios
- canvas 點鐘
- layer dialog
- jquery 和 laravel ajax全局配置
- layui 獲取select的自定義參數
- konva.js中文開發文檔
- js 大文件分片上傳
- js監聽網絡狀態實現斷網重連后自動刷新頁面
- js生成video縮略圖
- JS獲取當前系統電量情況
- uniapp
- uni-app swiper數量過多時卡頓優化方案
- uniapp 帖子集合
- 微信wap
- wap分享朋友和朋友圈
- wap 手機頁面微信支付
- JsSdk微信公眾號支付
- 通用各種小知識
- 正則表達式
- JS正則匹配過濾字符串中的html標簽及html標簽內的內容
- 判斷維吾爾文輸入
- 正則表達式符號
- 正則表達式練習
- 百度網盤不限速下載助手
- 解決VSCode下載慢或下載失敗的問題
- 性能測試 使用Apache的ab測試工具
- nginx從入門到精通
- nginx
- Nginx 是怎么禁止訪問php的 ?
- 寶塔面板
- supervisor
- 卸載寶塔
- redis
- redis實用筆記
- redis入門到精通
- phpredis
- redis數據庫基礎
- PHP對Redis的基本操作
- ffmpeg
- 合并多個音視
- 獲取音視時長
- FFmpeg視頻處理入門教程(新手必看)
- 外連接
- 安裝
- PHP基于ffmpeg實現轉換視頻,截圖及生成縮略圖的方法
- Linux安裝ffmpeg
- docker
- 服務實現
- docker基本命令
- rewrite筆記
- 別人筆記鏈接
- 計算機常用知識
- 二進制1-10
- 斐波那契數列
- mysql
- 高性能高可用的MySQL,得從各種規范開始
- 讀寫分離配置
- 重要外連接,前端/ 后端/數據庫等等
- 關于程序必須收藏的文章鏈接集合
- markdown
- 一篇文章講清楚markdown