本文整理汇总了PHP中codeHex2utf函数的典型用法代码示例。如果您正苦于以下问题:PHP codeHex2utf函数的具体用法?PHP codeHex2utf怎么用?PHP codeHex2utf使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了codeHex2utf函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: strcode2utf
function strcode2utf($str, $lo = true)
{
//converts all the &#nnn; and &#xhhh; in a string to Unicode
if ($lo) {
$lo = 1;
} else {
$lo = 0;
}
$str = preg_replace_callback('/\\&\\#([0-9]+)\\;/m', function ($m) use($lo) {
return code2utf($m[1], $lo);
}, $str);
$str = preg_replace_callback('/\\&\\#x([0-9a-fA-F]+)\\;/m', function ($m) use($lo) {
return codeHex2utf($m[1], $lo);
}, $str);
return $str;
}
示例2: strcode2utf
function strcode2utf($str, $lo = true)
{
//converts all the &#nnn; and &#xhhh; in a string to Unicode
if ($lo) {
$lo = 1;
} else {
$lo = 0;
}
// $str = preg_replace('/\&\#([0-9]+)\;/me', "code2utf('\\1',{$lo})",$str);
// $str = preg_replace('/\&\#x([0-9a-fA-F]+)\;/me', "codeHex2utf('\\1',{$lo})",$str);
$str = preg_replace_callback('/\\&\\#([0-9]+)\\;/m', function ($matches) {
return code2utf($matches[1], $lo);
}, $str);
$str = preg_replace_callback('/\\&\\#x([0-9a-fA-F]+)\\;/m', function ($matches) {
return codeHex2utf($matches[1], $lo);
}, $str);
return $str;
}
示例3: fixCSS
//.........这里部分代码省略.........
}
}
if ($bg['p']) {
$bg['p'] = preg_replace('/(left|top)/', '0%', $bg['p']);
$bg['p'] = preg_replace('/(right|bottom)/', '100%', $bg['p']);
$bg['p'] = preg_replace('/(center)/', '50%', $bg['p']);
if (!preg_match('/[\\-]{0,1}\\d+(in|cm|mm|pt|pc|em|ex|px|%)* [\\-]{0,1}\\d+(in|cm|mm|pt|pc|em|ex|px|%)*/', $bg['p'])) {
$bg['p'] = false;
}
}
if ($bg['p']) {
$newprop['BACKGROUND-POSITION'] = $bg['p'];
}
} else {
if ($k == 'IMAGE-ORIENTATION') {
if (preg_match('/([\\-]*[0-9\\.]+)(deg|grad|rad)/i', $v, $m)) {
$angle = $m[1] + 0;
if (strtolower($m[2]) == 'deg') {
$angle = $angle;
} else {
if (strtolower($m[2]) == 'grad') {
$angle *= 360 / 400;
} else {
if (strtolower($m[2]) == 'rad') {
$angle = rad2deg($angle);
}
}
}
while ($angle < 0) {
$angle += 360;
}
$angle = $angle % 360;
$angle /= 90;
$angle = round($angle) * 90;
$newprop['IMAGE-ORIENTATION'] = $angle;
}
} else {
if ($k == 'TEXT-ALIGN') {
if (preg_match('/["\'](.){1}["\']/i', $v, $m)) {
$d = array_search($m[1], $this->mpdf->decimal_align);
if ($d !== false) {
$newprop['TEXT-ALIGN'] = $d;
}
if (preg_match('/(center|left|right)/i', $v, $m)) {
$newprop['TEXT-ALIGN'] .= strtoupper(substr($m[1], 0, 1));
} else {
$newprop['TEXT-ALIGN'] .= 'R';
}
// default = R
} else {
if (preg_match('/["\'](\\\\[a-fA-F0-9]{1,6})["\']/i', $v, $m)) {
$utf8 = codeHex2utf(substr($m[1], 1, 6));
$d = array_search($utf8, $this->mpdf->decimal_align);
if ($d !== false) {
$newprop['TEXT-ALIGN'] = $d;
}
if (preg_match('/(center|left|right)/i', $v, $m)) {
$newprop['TEXT-ALIGN'] .= strtoupper(substr($m[1], 0, 1));
} else {
$newprop['TEXT-ALIGN'] .= 'R';
}
// default = R
} else {
$newprop[$k] = $v;
}
}
} else {
if ($k == 'LIST-STYLE') {
// mPDF 5.7.2
if (preg_match('/(lower-roman|upper-roman|lower-latin|lower-alpha|upper-latin|upper-alpha|none|decimal|disc|circle|square|arabic-indic|bengali|devanagari|gujarati|gurmukhi|kannada|malayalam|oriya|persian|tamil|telugu|thai|urdu|cambodian|khmer|lao)/i', $v, $m) || preg_match('/U\\+([a-fA-F0-9]+)/i', $v, $m)) {
$newprop['LIST-STYLE-TYPE'] = strtolower(trim($m[1]));
}
} else {
$newprop[$k] = $v;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
return $newprop;
}
示例4: codeHex2utf_lo_callback
function codeHex2utf_lo_callback($matches)
{
return codeHex2utf($matches[1], 1);
}
示例5: printlistbuffer
function printlistbuffer() {
//Save x coordinate
$x = $this->lMargin + $this->blk[$this->blklvl]['outer_left_margin'];
$this->cMarginL = 0;
$this->cMarginR = 0;
$currIndentLvl = -1;
$lastIndent = array();
$bak_page = $this->page;
$indent = 0;
foreach($this->listitem as $item)
{
// COLS
$oldcolumn = $this->CurrCol;
$this->bulletarray = array();
//Get list's buffered data
$this->listlvl = $lvl = $item[0];
$num = $item[1];
$this->textbuffer = $item[2];
$occur = $item[3];
if ($item[4]) { $type = $item[4]; } // listitemtype
else { $type = $this->listlist[$lvl][$occur]['TYPE']; }
$maxnum = $this->listlist[$lvl][$occur]['MAXNUM'];
$this->restoreInlineProperties($this->InlineProperties['LIST'][$lvl][$occur]);
$this->SetFont($this->FontFamily,$this->FontStyle,$this->FontSizePt,true,true); // force to write
$clh = $this->FontSize;
$this->SetLineHeight($this->FontSizePt,$this->list_lineheight[$lvl][$occur]);
$this->listOcc = $occur;
$this->listnum = $num;
if (isset($this->list_align[$this->listlvl][$occur])) { $this->divalign = $this->list_align[$this->listlvl][$occur]; }
else {
if (isset($this->blk[$this->blklvl]['direction']) && $this->blk[$this->blklvl]['direction']=='rtl') { $this->divalign = 'R'; }
else { $this->divalign = 'L'; }
}
// Set the bullet fontsize
$bullfs = $this->InlineProperties['LISTITEM'][$lvl][$occur][$num]['size'];
$space_width = $this->GetCharWidth(' ',false) * 1.5;
//Set default width & height values
$this->divwidth = $this->blk[$this->blklvl]['inner_width'];
$this->divheight = $this->lineheight;
$typefont = $this->FontFamily;
if (preg_match('/U\+([a-fA-F0-9]+)/i',$type,$m)) {
if ($this->_charDefined($this->CurrentFont['cw'],hexdec($m[1]))) { $list_item_marker = codeHex2utf($m[1]); }
else { $list_item_marker = '-'; }
$blt_width = $this->GetStringWidth($list_item_marker);
$typefont = '';
if (preg_match('/rgb\(.*?\)/',$type,$m)) {
$list_item_color = $this->ConvertColor($m[0]);
}
}
else {
$list_item_color = false;
switch($type) //Format type
{
case '1':
if ($this->listDir == 'rtl') { $list_item_marker = $this->list_number_suffix . $num; }
else { $list_item_marker = $num . $this->list_number_suffix; }
$blt_width = $this->GetStringWidth(str_repeat('5',strlen($maxnum)).$this->list_number_suffix);
break;
case 'none':
$list_item_marker = '';
$blt_width = 0;
break;
case 'A':
$anum = $this->dec2alpha($num,true);
$maxnum = $this->dec2alpha($maxnum,true);
if ($this->listDir == 'rtl') { $list_item_marker = $this->list_number_suffix . $anum; }
else { $list_item_marker = $anum . $this->list_number_suffix; }
$blt_width = $this->GetStringWidth(str_repeat('W',strlen($maxnum)).$this->list_number_suffix);
break;
case 'a':
$anum = $this->dec2alpha($num,false);
$maxnum = $this->dec2alpha($maxnum,false);
if ($this->listDir == 'rtl') { $list_item_marker = $this->list_number_suffix . $anum; }
else { $list_item_marker = $anum . $this->list_number_suffix; }
$blt_width = $this->GetStringWidth(str_repeat('m',strlen($maxnum)).$this->list_number_suffix);
break;
case 'I':
$anum = $this->dec2roman($num,true);
if ($this->listDir == 'rtl') { $list_item_marker = $this->list_number_suffix . $anum; }
else { $list_item_marker = $anum . $this->list_number_suffix; }
if ($maxnum>87) { $bbit = 87; }
else if ($maxnum>86) { $bbit = 86; }
else if ($maxnum>37) { $bbit = 38; }
else if ($maxnum>36) { $bbit = 37; }
else if ($maxnum>27) { $bbit = 28; }
else if ($maxnum>26) { $bbit = 27; }
else if ($maxnum>17) { $bbit = 18; }
else if ($maxnum>16) { $bbit = 17; }
else if ($maxnum>7) { $bbit = 8; }
else if ($maxnum>6) { $bbit = 7; }
else if ($maxnum>3) { $bbit = 4; }
else { $bbit = $maxnum; }
//.........这里部分代码省略.........