Revize 1e8c793d
Přidáno uživatelem Michal Kliment před více než 9 roky(ů)
application/vendors/mpdf/includes/functions.php | ||
---|---|---|
<?php
|
||
|
||
|
||
function urldecode_pathonly($url) { // mPDF 5.5.03
|
||
// mPDF 5.7
|
||
// Replace a section of an array with the elements in reverse
|
||
function array_splice_reverse(&$arr, $offset, $length) {
|
||
$tmp = (array_reverse(array_slice($arr, $offset, $length)));
|
||
array_splice($arr, $offset, $length, $tmp);
|
||
}
|
||
|
||
|
||
// mPDF 5.6.23
|
||
function array_insert(&$array, $value, $offset) {
|
||
if (is_array($array)) {
|
||
$array = array_values($array);
|
||
$offset = intval($offset);
|
||
if ($offset < 0 || $offset >= count($array)) { array_push($array, $value); }
|
||
else if ($offset == 0) { array_unshift($array, $value); }
|
||
else {
|
||
$temp = array_slice($array, 0, $offset);
|
||
array_push($temp, $value);
|
||
$array = array_slice($array, $offset);
|
||
$array = array_merge($temp, $array);
|
||
}
|
||
}
|
||
else { $array = array($value); }
|
||
return count($array);
|
||
}
|
||
|
||
// mPDF 5.7.4 URLs
|
||
function urldecode_parts($url) {
|
||
$file=$url;
|
||
$query='';
|
||
if (preg_match('/[?]/',$url)) {
|
||
$bits = preg_split('/[?]/',$url,2);
|
||
return (urldecode($bits[0]).'?'.$bits[1]);
|
||
$file=$bits[0];
|
||
$query='?'.$bits[1];
|
||
}
|
||
else return urldecode($url);
|
||
$file = rawurldecode($file);
|
||
$query = urldecode($query);
|
||
return $file.$query;
|
||
}
|
||
|
||
|
||
... | ... | |
if(!function_exists('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);
|
||
// mPDF 5.7
|
||
if ($lo) {
|
||
$str = preg_replace_callback('/\&\#([0-9]+)\;/m', 'code2utf_lo_callback', $str);
|
||
$str = preg_replace_callback('/\&\#x([0-9a-fA-F]+)\;/m', 'codeHex2utf_lo_callback', $str);
|
||
}
|
||
else {
|
||
$str = preg_replace_callback('/\&\#([0-9]+)\;/m', 'code2utf_callback', $str);
|
||
$str = preg_replace_callback('/\&\#x([0-9a-fA-F]+)\;/m', 'codeHex2utf_callback', $str);
|
||
}
|
||
return $str;
|
||
}
|
||
}
|
||
function code2utf_callback($matches) {
|
||
return code2utf($matches[1], 0);
|
||
}
|
||
function code2utf_lo_callback($matches) {
|
||
return code2utf($matches[1], 1);
|
||
}
|
||
function codeHex2utf_callback($matches) {
|
||
return codeHex2utf($matches[1], 0);
|
||
}
|
||
function codeHex2utf_lo_callback($matches) {
|
||
return codeHex2utf($matches[1], 1);
|
||
}
|
||
|
||
if(!function_exists('code2utf')){
|
||
function code2utf($num,$lo=true){
|
Také k dispozici: Unified diff
Release 1.1.8