| @@ -1,25 +1,6 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | - | |
| 4 | -// mPDF 6 | |
| 5 | -// Function only available PHP >=5.5.0 | |
| 6 | -if(!function_exists('imagepalettetotruecolor')) { | |
| 7 | - function imagepalettetotruecolor(&$src) { | |
| 8 | - if(imageistruecolor($src)) { | |
| 9 | - return(true); | |
| 10 | - } | |
| 11 | - $dst = imagecreatetruecolor(imagesx($src), imagesy($src)); | |
| 12 | - | |
| 13 | - imagecopy($dst, $src, 0, 0, 0, 0, imagesx($src), imagesy($src)); | |
| 14 | - imagedestroy($src); | |
| 15 | - | |
| 16 | - $src = $dst; | |
| 17 | - | |
| 18 | - return(true); | |
| 19 | - } | |
| 20 | -} | |
| 21 | - | |
| 22 | 3 | // mPDF 5.7 |
| 23 | 4 | // Replace a section of an array with the elements in reverse |
| 24 | 5 | function array_splice_reverse(&$arr, $offset, $length) { |
| 25 | 6 | $tmp = (array_reverse(array_slice($arr, $offset, $length))); |
| @@ -26,8 +7,9 @@ | ||
| 26 | 7 | array_splice($arr, $offset, $length, $tmp); |
| 27 | 8 | } |
| 28 | 9 | |
| 29 | 10 | |
| 11 | +// mPDF 5.6.23 | |
| 30 | 12 | function array_insert(&$array, $value, $offset) { |
| 31 | 13 | if (is_array($array)) { |
| 32 | 14 | $array = array_values($array); |
| 33 | 15 | $offset = intval($offset); |
| @@ -43,10 +25,10 @@ | ||
| 43 | 25 | else { $array = array($value); } |
| 44 | 26 | return count($array); |
| 45 | 27 | } |
| 46 | 28 | |
| 47 | -// mPDF 5.7.4 URLs | |
| 48 | -function urldecode_parts($url) { | |
| 29 | +function urlencode_part($url) { // mPDF 5.6.02 | |
| 30 | + if (!preg_match('/^[a-z]+:\/\//i',$url)) { return $url; } | |
| 49 | 31 | $file=$url; |
| 50 | 32 | $query=''; |
| 51 | 33 | if (preg_match('/[?]/',$url)) { |
| 52 | 34 | $bits = preg_split('/[?]/',$url,2); |
| @@ -52,10 +34,9 @@ | ||
| 52 | 34 | $bits = preg_split('/[?]/',$url,2); |
| 53 | 35 | $file=$bits[0]; |
| 54 | 36 | $query='?'.$bits[1]; |
| 55 | 37 | } |
| 56 | - $file = rawurldecode($file); | |
| 57 | - $query = urldecode($query); | |
| 38 | + $file = str_replace(array(" ","!","$","&","'","(",")","*","+",",",";","="),array("%20","%21","%24","%26","%27","%28","%29","%2A","%2B","%2C","%3B","%3D"),$file); | |
| 58 | 39 | return $file.$query; |
| 59 | 40 | } |
| 60 | 41 | |
| 61 | 42 | |
| @@ -142,9 +123,8 @@ | ||
| 142 | 123 | } |
| 143 | 124 | function codeHex2utf_lo_callback($matches) { |
| 144 | 125 | return codeHex2utf($matches[1], 1); |
| 145 | 126 | } |
| 146 | - | |
| 147 | 127 | |
| 148 | 128 | if(!function_exists('code2utf')){ |
| 149 | 129 | function code2utf($num,$lo=true){ |
| 150 | 130 | //Returns the utf string corresponding to the unicode value |