PluginProbe
PDF & Print by BestWebSoft – WordPress Posts and Pages PDF Generator Plugin / 1.5
PDF & Print by BestWebSoft – WordPress Posts and Pages PDF Generator Plugin v1.5
trunk 1.5 1.6 1.7 1.7.1 1.7.2 1.7.3 1.7.4 1.7.5 1.7.6 1.7.7 1.7.8 1.7.9 1.8.0 1.8.1 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 1.9.0 1.9.1 All 71 releases
← All changes | mpdf/includes/functions.php +9 -62 1.71.5 View file →
@@ -1,46 +1,7 @@
1 1 <?php
2 2
3 -// mPDF 5.7
4 -// Replace a section of an array with the elements in reverse
5 -function array_splice_reverse(&$arr, $offset, $length) {
6 - $tmp = (array_reverse(array_slice($arr, $offset, $length)));
7 - array_splice($arr, $offset, $length, $tmp);
8 -}
9 3
10 -
11 -// mPDF 5.6.23
12 -function array_insert(&$array, $value, $offset) {
13 - if (is_array($array)) {
14 - $array = array_values($array);
15 - $offset = intval($offset);
16 - if ($offset < 0 || $offset >= count($array)) { array_push($array, $value); }
17 - else if ($offset == 0) { array_unshift($array, $value); }
18 - else {
19 - $temp = array_slice($array, 0, $offset);
20 - array_push($temp, $value);
21 - $array = array_slice($array, $offset);
22 - $array = array_merge($temp, $array);
23 - }
24 - }
25 - else { $array = array($value); }
26 - return count($array);
27 -}
28 -
29 -function urlencode_part($url) { // mPDF 5.6.02
30 - if (!preg_match('/^[a-z]+:\/\//i',$url)) { return $url; }
31 - $file=$url;
32 - $query='';
33 - if (preg_match('/[?]/',$url)) {
34 - $bits = preg_split('/[?]/',$url,2);
35 - $file=$bits[0];
36 - $query='?'.$bits[1];
37 - }
38 - $file = str_replace(array(" ","!","$","&","'","(",")","*","+",",",";","="),array("%20","%21","%24","%26","%27","%28","%29","%2A","%2B","%2C","%3B","%3D"),$file);
39 - return $file.$query;
40 -}
41 -
42 -
43 4 function _strspn($str1, $str2, $start=null, $length=null) {
44 5 $numargs = func_num_args();
45 6 if ($numargs == 2) {
46 7 return strspn($str1, $str2);
@@ -91,8 +52,9 @@
91 52 }
92 53 }
93 54
94 55 function PreparePreText($text,$ff='//FF//') {
56 + // mPDF 5.0.053
95 57 $text = htmlspecialchars($text);
96 58 if ($ff) { $text = str_replace($ff,'</pre><formfeed /><pre>',$text); }
97 59 return ('<pre>'.$text.'</pre>');
98 60 }
@@ -99,39 +61,22 @@
99 61
100 62 if(!function_exists('strcode2utf')){
101 63 function strcode2utf($str,$lo=true) {
102 64 //converts all the &#nnn; and &#xhhh; in a string to Unicode
103 - // mPDF 5.7
104 - if ($lo) {
105 - $str = preg_replace_callback('/\&\#([0-9]+)\;/m', 'code2utf_lo_callback', $str);
106 - $str = preg_replace_callback('/\&\#x([0-9a-fA-F]+)\;/m', 'codeHex2utf_lo_callback', $str);
107 - }
108 - else {
109 - $str = preg_replace_callback('/\&\#([0-9]+)\;/m', 'code2utf_callback', $str);
110 - $str = preg_replace_callback('/\&\#x([0-9a-fA-F]+)\;/m', 'codeHex2utf_callback', $str);
111 - }
65 + if ($lo) { $lo = 1; } else { $lo = 0; }
66 + $str = preg_replace('/\&\#([0-9]+)\;/me', "code2utf('\\1',{$lo})",$str);
67 + $str = preg_replace('/\&\#x([0-9a-fA-F]+)\;/me', "codeHex2utf('\\1',{$lo})",$str);
112 68 return $str;
113 69 }
114 70 }
115 -function code2utf_callback($matches) {
116 - return code2utf($matches[1], 0);
117 -}
118 -function code2utf_lo_callback($matches) {
119 - return code2utf($matches[1], 1);
120 -}
121 -function codeHex2utf_callback($matches) {
122 - return codeHex2utf($matches[1], 0);
123 -}
124 -function codeHex2utf_lo_callback($matches) {
125 - return codeHex2utf($matches[1], 1);
126 -}
127 71
128 72 if(!function_exists('code2utf')){
129 73 function code2utf($num,$lo=true){
130 74 //Returns the utf string corresponding to the unicode value
75 + //added notes - http://uk.php.net/utf8_encode
131 76 if ($num<128) {
132 77 if ($lo) return chr($num);
133 - else return '&#'.$num.';';
78 + else return '&#'.$num.';'; // i.e. no change
134 79 }
135 80 if ($num<2048) return chr(($num>>6)+192).chr(($num&63)+128);
136 81 if ($num<65536) return chr(($num>>12)+224).chr((($num>>6)&63)+128).chr(($num&63)+128);
137 82 if ($num<2097152) return chr(($num>>18)+240).chr((($num>>12)&63)+128).chr((($num>>6)&63)+128) .chr(($num&63)+128);
@@ -142,11 +87,13 @@
142 87
143 88 if(!function_exists('codeHex2utf')){
144 89 function codeHex2utf($hex,$lo=true){
145 90 $num = hexdec($hex);
146 - if (($num<128) && !$lo) return '&#x'.$hex.';';
91 + if (($num<128) && !$lo) return '&#x'.$hex.';'; // i.e. no change
147 92 return code2utf($num,$lo);
148 93 }
149 94 }
95 +
96 +
150 97
151 98
152 99 ?>