diff options
author | tcitworld <tcit@tcit.fr> | 2014-08-04 21:34:44 +0200 |
---|---|---|
committer | tcitworld <tcit@tcit.fr> | 2014-08-04 21:34:44 +0200 |
commit | b83690ebd873abc29a3f365b0cc69125eb6021a1 (patch) | |
tree | 62f2b59a6a14d96ccde65db94e43747ae62bf43a /inc/3rdparty/libraries/mpdf/examples/formsubmit.php | |
parent | 358c689cec917c173ee080777a8dc51603a3979c (diff) | |
download | wallabag-b83690ebd873abc29a3f365b0cc69125eb6021a1.tar.gz wallabag-b83690ebd873abc29a3f365b0cc69125eb6021a1.tar.zst wallabag-b83690ebd873abc29a3f365b0cc69125eb6021a1.zip |
removing examples for mpdf
Diffstat (limited to 'inc/3rdparty/libraries/mpdf/examples/formsubmit.php')
-rw-r--r-- | inc/3rdparty/libraries/mpdf/examples/formsubmit.php | 94 |
1 files changed, 0 insertions, 94 deletions
diff --git a/inc/3rdparty/libraries/mpdf/examples/formsubmit.php b/inc/3rdparty/libraries/mpdf/examples/formsubmit.php deleted file mode 100644 index f13a3951..00000000 --- a/inc/3rdparty/libraries/mpdf/examples/formsubmit.php +++ /dev/null | |||
@@ -1,94 +0,0 @@ | |||
1 | <?php | ||
2 | |||
3 | echo '<'.'!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" | ||
4 | "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | ||
5 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | ||
6 | <head> | ||
7 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> | ||
8 | </head> | ||
9 | <body> | ||
10 | <h2>Submitted data from PDF Form</h2> | ||
11 | <p style="font-size:0.9em;">(See formsubmit.php in the Examples folder for details)</p> | ||
12 | '; | ||
13 | |||
14 | |||
15 | if (count($_POST)) { | ||
16 | // To display HTML output from PDF form | ||
17 | echo '<h4>HTML format data sent as POST</h4>'; | ||
18 | foreach($_POST AS $name=>$val) { | ||
19 | $t = mb_convert_encoding(PDFDocEncodingToWin1252($val), 'UTF-8', 'Windows-1252' ); // If from core fonts doc | ||
20 | echo '<p>PDFDocEnc: '.$name.' => '.htmlspecialchars($t).'</p>'; | ||
21 | } | ||
22 | } | ||
23 | else if (count($_GET)) { | ||
24 | // To display HTML output from PDF form | ||
25 | echo '<h4>HTML format data sent as GET</h4>'; | ||
26 | foreach($_GET AS $name=>$val) { | ||
27 | $t = mb_convert_encoding(PDFDocEncodingToWin1252($val), 'UTF-8', 'Windows-1252' ); // If from core fonts doc | ||
28 | echo '<p>PDFDocEnc: '.$name.' => '.htmlspecialchars($t).'</p>'; | ||
29 | } | ||
30 | } | ||
31 | |||
32 | else { | ||
33 | $postdata = file_get_contents("php://input"); | ||
34 | |||
35 | if ($postdata) { | ||
36 | echo '<h4>XFDF format data detected</h4>'; | ||
37 | // To parse XFDF | ||
38 | if (preg_match_all('/<field name="([^>]*)"\s*>\s*(<value\s*>(.*?)<\/value\s*>)\s*<\/field\s*>/s', $postdata, $m)) { | ||
39 | for($i=0; $i<count($m[0]); $i++) { | ||
40 | // if multiple values in response e.g. from multiple selected options | ||
41 | preg_match_all('/<value\s*>(.*?)<\/value\s*>/s', $m[2][$i], $v); | ||
42 | if (count($v[0])>1) { | ||
43 | $values = array(); | ||
44 | foreach($v[1] AS $val) { $values[] = $val; } | ||
45 | //foreach($v[1] AS $val) { $values[] = htmlspecialchars_decode($val); } | ||
46 | echo '<p>Field: '.$m[1][$i].' => [array of values] ('.implode(', ',$values).')</p>'; | ||
47 | } | ||
48 | else { | ||
49 | //echo '<p>Field: '.$m[1][$i].' => '.htmlspecialchars_decode($m[3][$i]).'</p>'; | ||
50 | echo '<p>Field: '.$m[1][$i].' => '.$m[3][$i].'</p>'; | ||
51 | } | ||
52 | } | ||
53 | } | ||
54 | if (preg_match_all('/<field name="([^>]*)"\s*>\s*<value\s*\/\s*>\s*<\/field\s*>/s', $postdata, $m)) { | ||
55 | for($i=0; $i<count($m[0]); $i++) { | ||
56 | echo '<p>Field: '.$m[1][$i].' => [blank]</p>'; | ||
57 | } | ||
58 | } | ||
59 | if (preg_match_all('/<field name="([^>]*)"\s*\/\s*>/s', $postdata, $m)) { | ||
60 | for($i=0; $i<count($m[0]); $i++) { | ||
61 | echo '<p>Field: '.$m[1][$i].' => [no value]</p>'; | ||
62 | } | ||
63 | } | ||
64 | |||
65 | |||
66 | // To display whole XFDF | ||
67 | //$postdata = preg_replace("/[\n\r]/", "", $postdata); | ||
68 | //$postdata = preg_replace('/>\s*</', ">\n<", $postdata); | ||
69 | //echo nl2br(htmlspecialchars($postdata)); | ||
70 | } | ||
71 | else { echo "No form data detected"; } | ||
72 | } | ||
73 | |||
74 | |||
75 | |||
76 | echo '</body></html>'; | ||
77 | |||
78 | exit; | ||
79 | |||
80 | function PDFDocEncodingToWin1252($txt) { | ||
81 | $Win1252ToPDFDocEncoding = array( | ||
82 | chr(0200) => chr(0240), chr(0214) => chr(0226), chr(0212) => chr(0227), chr(0237) => chr(0230), | ||
83 | chr(0225) => chr(0200), chr(0210) => chr(0032), chr(0206) => chr(0201), chr(0207) => chr(0202), | ||
84 | chr(0205) => chr(0203), chr(0227) => chr(0204), chr(0226) => chr(0205), chr(0203) => chr(0206), | ||
85 | chr(0213) => chr(0210), chr(0233) => chr(0211), chr(0211) => chr(0213), chr(0204) => chr(0214), | ||
86 | chr(0223) => chr(0215), chr(0224) => chr(0216), chr(0221) => chr(0217), chr(0222) => chr(0220), | ||
87 | chr(0202) => chr(0221), chr(0232) => chr(0235), chr(0230) => chr(0037), chr(0231) => chr(0222), | ||
88 | chr(0216) => chr(0231) | ||
89 | ); | ||
90 | return strtr($txt, array_flip($Win1252ToPDFDocEncoding) ); | ||
91 | } | ||
92 | |||
93 | |||
94 | ?> \ No newline at end of file | ||