forked from fkrauthan/wp-mpdf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wp-mpdf_admin.php
549 lines (486 loc) · 18.9 KB
/
wp-mpdf_admin.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
<?php
/*
* This file is part of wp-mpdf.
* wp-mpdf is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* wp-mpdf is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with wp-mpdf. If not, see <http://www.gnu.org/licenses/>.
*/
function mpdf_admin_display() {
echo '<h1>Configure wp-mpdf</h1>';
echo '<table style="width: 100%;" border="0">';
echo '<tr><td style="vertical-align: top;">';
mpdf_admin_options();
echo '<br />';
mpdf_admin_stats();
echo '</td><td style="vertical-align: top;">';
mpdf_admin_allowedprintedpages();
echo '<br />';
mpdf_admin_loginneededpages();
echo '</td><td style="vertical-align: top;">';
mpdf_admin_cache();
echo '<br />';
mpdf_admin_pdfname();
echo '</td></tr></table>';
}
function mpdf_admin_options() {
echo '<h2>Options</h2>';
if ( isset( $_POST['save_options'] ) ) {
update_option( 'mpdf_theme', $_POST['theme'] );
update_option( 'mpdf_code_page', $_POST['codepage'] );
update_option( 'mpdf_cron_user', $_POST['cron_user'] );
update_option( 'mpdf_caching', isset( $_POST['caching'] ) );
update_option( 'mpdf_geshi', isset( $_POST['geshi'] ) );
update_option( 'mpdf_geshi_linenumbers', isset( $_POST['geshi_linenumbers'] ) );
update_option( 'mpdf_stats', isset( $_POST['stats'] ) );
update_option( 'mpdf_debug', isset( $_POST['debug'] ) );
if ( isset( $_POST['allow_all'] ) ) {
update_option( 'mpdf_allow_all', true );
} else {
update_option( 'mpdf_allow_all', $_POST['use_list_as'] );
}
if ( ! isset( $_POST['need_login'] ) ) {
update_option( 'mpdf_need_login', false );
} else {
update_option( 'mpdf_need_login', $_POST['login_use_list_as'] );
}
echo '<p style="color: green;">Options Saved</p>';
}
echo '<form action="?page=' . $_GET['page'] . '" method="post">';
echo '<table border="0">';
echo '<tr><td>Theme: </td><td>';
echo '<select name="theme">';
// Search for Themes
$existingFiles = array();
$themes_path = array(
dirname( __FILE__ ) . '/../../wp-mpdf-themes/',
dirname( __FILE__ ) . '/themes/'
);
foreach ($themes_path as $path) {
if (is_dir($path) && $dir = opendir($path)) {
while ($file = readdir($dir)) {
if (is_dir($path . $file) || $file === '.' || $file === '..') {
continue;
}
if ( mpdf_extension( $file ) !== 'php' || in_array( $file, $existingFiles ) ) {
continue;
}
$filename = mpdf_filename($file);
$existingFiles[] = $file;
echo '<option value="' . $filename . '" ' . selected( get_option( 'mpdf_theme' ), $filename, false ) . '>';
echo str_replace( '_', ' ', $filename ) . '</option>';
}
}
}
echo '</select>';
echo '</td></tr>';
$CODEPAGES_ARRAY = array(
'utf-8',
'win-1251',
'win-1252',
'iso-8859-2',
'iso-8859-4',
'iso-8859-7',
'iso-8859-9',
'big5',
'gbk',
'uhc',
'shift_jis'
);
echo '<tr><td>Codepage: </td><td>';
echo '<select name="codepage">';
$cur_cp = get_option( 'mpdf_code_page' );
if ( $cur_cp == '' ) {
$cur_cp = 'utf-8';
}
foreach ( $CODEPAGES_ARRAY as $cp ) {
echo '<option value="' . $cp . '" ';
if ( $cur_cp == $cp ) {
echo 'selected="selected"';
}
echo '>' . $cp . '</option>';
}
echo '</select>';
echo '</td></tr>';
echo '<tr><td>Caching: </td><td><input type="checkbox" name="caching" ';
if ( get_option( 'mpdf_caching' ) == true ) {
echo 'checked="checked"';
}
echo '/></td></tr>';
echo '<tr><td>Download stats: </td><td><input type="checkbox" name="stats" ';
if ( get_option( 'mpdf_stats' ) == true ) {
echo 'checked="checked"';
}
echo '/></td></tr>';
echo '<tr><td>Geshi Parsing: </td><td><input type="checkbox" name="geshi" ';
if ( get_option( 'mpdf_geshi' ) == true ) {
echo 'checked="checked"';
}
echo '/></td></tr>';
echo '<tr><td>Geshi Line numbers: </td><td><input type="checkbox" name="geshi_linenumbers" ';
if ( get_option( 'mpdf_geshi_linenumbers' ) == true ) {
echo 'checked="checked"';
}
echo '/></td></tr>';
echo '<tr><td>Allow to Print all Pages: </td><td><input type="checkbox" name="allow_all" ';
if ( get_option( 'mpdf_allow_all' ) == 1 ) {
echo 'checked="checked"';
}
echo '/></td></tr>';
echo '<tr><td>If not use list as: </td><td><select name="use_list_as">';
echo '<option value="2" ';
if ( get_option( 'mpdf_allow_all' ) == 2 ) {
echo 'selected="selected"';
}
echo '>Whitelist</option>';
echo '<option value="3" ';
if ( get_option( 'mpdf_allow_all' ) == 3 ) {
echo 'selected="selected"';
}
echo '>Blacklist</option>';
echo '</select></td></tr>';
echo '<tr><td>Need login: </td><td><input type="checkbox" name="need_login" ';
if ( get_option( 'mpdf_need_login' ) != 0 ) {
echo 'checked="checked"';
}
echo '/></td></tr>';
echo '<tr><td>If checked use list as: </td><td><select name="login_use_list_as">';
echo '<option value="2" ';
if ( get_option( 'mpdf_need_login' ) == 2 ) {
echo 'selected="selected"';
}
echo '>Whitelist</option>';
echo '<option value="3" ';
if ( get_option( 'mpdf_need_login' ) == 3 ) {
echo 'selected="selected"';
}
echo '>Blacklist</option>';
echo '</select></td></tr>';
echo '<tr><td>Enable Debuging: </td><td><input type="checkbox" name="debug" ';
if ( get_option( 'mpdf_debug' ) == true ) {
echo 'checked="checked"';
}
echo '/></td></tr>';
//Cron generating User
global $wpdb;
echo '<tr><td>User for generating per Cron: </td><td><select name="cron_user">';
echo '<option value="" ';
if ( get_option( 'mpdf_cron_user' ) == '' ) {
echo 'selected="selected"';
}
echo '>None</option>';
echo '<option value="auto" ';
if ( get_option( 'mpdf_cron_user' ) == 'auto' ) {
echo 'selected="selected"';
}
echo '>Auto</option>';
$aUsersID = $wpdb->get_results( 'SELECT ID FROM ' . $wpdb->users . ' ORDER BY user_nicename ASC' );
foreach ( $aUsersID as $iUserID ) {
$user = get_userdata( $iUserID->ID );
echo '<option value="' . $iUserID->ID . '" ';
if ( $iUserID == get_option( 'mpdf_cron_user' ) ) {
echo 'selected="selected"';
}
echo '>' . $user->user_nicename . '</option>';
}
echo '</select></td></tr>';
echo '</table>';
echo '<input type="submit" value="Save" name="save_options" /> <input type="reset" />';
echo '</form>';
}
function mpdf_admin_listposts() {
echo '<select name="post">';
echo '<optgroup label="Draft">';
$posts = get_posts( 'numberposts=-1&order=ASC&orderby=title&post_type=any&post_status=draft' );
foreach ( $posts as $post ) {
if ( $post->post_type == 'attachment' ) {
continue;
}
echo '<option value="' . $post->ID . '">' . $post->post_title . '</option>';
}
echo '</optgroup>';
echo '<optgroup label="Future">';
$posts = get_posts( 'numberposts=-1&order=ASC&orderby=title&post_type=any&post_status=future' );
foreach ( $posts as $post ) {
if ( $post->post_type == 'attachment' ) {
continue;
}
echo '<option value="' . $post->ID . '">' . $post->post_title . '</option>';
}
echo '</optgroup>';
echo '<optgroup label="Private">';
$posts = get_posts( 'numberposts=-1&order=ASC&orderby=title&post_type=any&post_status=private' );
foreach ( $posts as $post ) {
if ( $post->post_type == 'attachment' ) {
continue;
}
echo '<option value="' . $post->ID . '">' . $post->post_title . '</option>';
}
echo '</optgroup>';
echo '<optgroup label="Publish">';
$posts = get_posts( 'numberposts=-1&order=ASC&orderby=title&post_type=any&post_status=publish' );
foreach ( $posts as $post ) {
if ( $post->post_type == 'attachment' ) {
continue;
}
echo '<option value="' . $post->ID . '">' . $post->post_title . '</option>';
}
echo '</optgroup>';
echo '</select>';
}
function mpdf_admin_allowedprintedpages() {
global $wpdb;
$table_name = $wpdb->prefix . WP_MPDF_POSTS_DB;
echo '<h2>Black/White List - Printed Pages</h2>';
if ( isset( $_GET['delallowedprintedpage'] ) ) {
$wpdb->query( 'UPDATE ' . $table_name . ' SET general=0 WHERE id=' . $_GET['delallowedprintedpage'] . ' LIMIT 1' );
echo '<p style="color: green;">Delete allowed Page with id "' . $_GET['delallowedprintedpage'] . '"</p>';
}
if ( isset( $_GET['clearallowedpage'] ) ) {
$wpdb->query( 'UPDATE ' . $table_name . ' SET general=0' );
echo '<p style="color: green;">All posts are deleted from the black/white list.</p>';
}
if ( isset( $_POST['addallowedpage'] ) ) {
$page = get_post( $_POST['post'] );
if ( $page != null ) {
$sql = 'SELECT id FROM ' . $table_name . ' WHERE post_id=' . $page->ID . ' AND post_type="' . $page->post_type . '" LIMIT 1';
$db_id = $wpdb->get_var( $sql );
if ( $db_id == null ) {
$sql = 'INSERT INTO ' . $table_name . ' (post_type, post_id, general, login, pdfname, downloads) VALUES (%s, %d, 1, 0, "", 0)';
$wpdb->query( $wpdb->prepare( $sql, $page->post_type, $page->ID ) );
} else {
$sql = 'UPDATE ' . $table_name . ' SET general=1 WHERE id=%d LIMIT 1';
$wpdb->query( $wpdb->prepare( $sql, $db_id ) );
}
echo '<p style="color: green;">Post has been added to the .</p>';
} else {
echo '<p style="color: red;">Post not found.</p>';
}
} else if ( isset( $_GET['addallowedpage'] ) ) {
echo '<form action="?page=' . $_GET['page'] . '" method="post">';
echo 'Post: ';
mpdf_admin_listposts();
echo '<br />';
echo '<input type="submit" value="Add Entry" name="addallowedpage" />';
echo '</form>';
echo '<br />';
}
echo '<a href="?page=' . $_GET['page'] . '&addallowedpage=1">New Entry</a> <a href="?page=' . $_GET['page'] . '&clearallowedpage=1">Clear All Entries</a>';
echo '<table border="1">';
$sql = 'SELECT id,post_type,post_id FROM ' . $table_name . ' WHERE general=1';
$data = $wpdb->get_results( $sql, OBJECT );
for ( $i = 0; $i < count( $data ); $i ++ ) {
echo '<tr>';
echo '<td>' . $data[ $i ]->post_type . '</td>';
echo '<td> </td>';
if ( $data[ $i ]->post_type == 'post' ) {
$post = get_post( $data[ $i ]->post_id );
echo '<td>' . $post->post_title . '</td>';
} else {
$page = get_page( $data[ $i ]->post_id );
echo '<td>' . $page->post_title . '</td>';
}
echo '<td> </td>';
echo '<td><a href="?page=' . $_GET['page'] . '&delallowedprintedpage=' . $data[ $i ]->id . '">Delete</a></td>';
echo '</tr>';
}
echo '</table>';
}
function mpdf_admin_pdfname() {
global $wpdb;
$table_name = $wpdb->prefix . WP_MPDF_POSTS_DB;
echo '<h2>Custom pdf filenames</h2>';
if ( isset( $_GET['delcustomname'] ) ) {
$wpdb->query( 'UPDATE ' . $table_name . ' SET pdfname="" WHERE id=' . $_GET['delcustomname'] . ' LIMIT 1' );
echo '<p style="color: green;">Delete pdf name from page with id "' . $_GET['delcustomname'] . '"</p>';
}
if ( isset( $_GET['clearcustomname'] ) ) {
$wpdb->query( 'UPDATE ' . $table_name . ' SET pdfname=""' );
echo '<p style="color: green;">All pdf names from posts are deleted.</p>';
}
if ( isset( $_POST['addcustomname'] ) ) {
$page = get_post( $_POST['post'] );
if ( $page != null ) {
$sql = 'SELECT id FROM ' . $table_name . ' WHERE post_id=' . $page->ID . ' AND post_type="' . $page->post_type . '" LIMIT 1';
$db_id = $wpdb->get_var( $sql );
$pdfname = $_POST['pdfname'];
if ( $db_id == null ) {
$sql = 'INSERT INTO ' . $table_name . ' (post_type, post_id, general, login, pdfname, downloads) VALUES (%s, %d, 0, 0, %s, 0)';
$wpdb->query( $wpdb->prepare( $sql, $page->post_type, $page->ID, $pdfname ) );
} else {
$sql = 'UPDATE ' . $table_name . ' SET pdfname=%s WHERE id=%d LIMIT 1';
$wpdb->query( $wpdb->prepare( $sql, $pdfname, $db_id ) );
}
echo '<p style="color: green;">Post has been added to the .</p>';
} else {
echo '<p style="color: red;">Post not found.</p>';
}
} else if ( isset( $_GET['addcustomname'] ) ) {
echo '<form action="?page=' . $_GET['page'] . '" method="post">';
echo 'Post: ';
mpdf_admin_listposts();
echo '<br />';
echo 'New pdf name: <input type="text" name="pdfname" value="" /><br />';
echo '<input type="submit" value="Add Entry" name="addcustomname" />';
echo '</form>';
echo '<br />';
}
echo '<a href="?page=' . $_GET['page'] . '&addcustomname=1">New Entry</a> <a href="?page=' . $_GET['page'] . '&clearcustomname=1">Clear All Entries</a>';
echo '<table border="1">';
$sql = 'SELECT id,post_type,post_id,pdfname FROM ' . $table_name . ' WHERE pdfname!=""';
$data = $wpdb->get_results( $sql, OBJECT );
for ( $i = 0; $i < count( $data ); $i ++ ) {
echo '<tr>';
echo '<td>' . $data[ $i ]->post_type . '</td>';
echo '<td> </td>';
if ( $data[ $i ]->post_type == 'post' ) {
$post = get_post( $data[ $i ]->post_id );
echo '<td>' . $post->post_title . '</td>';
} else {
$page = get_page( $data[ $i ]->post_id );
echo '<td>' . $page->post_title . '</td>';
}
echo '<td> -> </td>';
echo '<td>' . $data[ $i ]->pdfname . '</td>';
echo '<td> </td>';
echo '<td><a href="?page=' . $_GET['page'] . '&delcustomname=' . $data[ $i ]->id . '">Delete</a></td>';
echo '</tr>';
}
echo '</table>';
}
function mpdf_admin_stats() {
global $wpdb;
$table_name = $wpdb->prefix . WP_MPDF_POSTS_DB;
echo '<h2>Statistic</h2>';
if ( isset( $_GET['resetstat'] ) ) {
$wpdb->query( 'UPDATE ' . $table_name . ' SET downloads=0 WHERE id=' . $_GET['resetstat'] . ' LIMIT 1' );
echo '<p style="color: green;">Stats for page with id "' . $_GET['resetstat'] . '" is resetet</p>';
}
if ( isset( $_GET['clearstats'] ) ) {
$wpdb->query( 'UPDATE ' . $table_name . ' SET downloads=0' );
echo '<p style="color: green;">All stats are resetet.</p>';
}
echo '<a href="?page=' . $_GET['page'] . '&clearstats=1">Clear All</a>';
echo '<table border="1">';
$sql = 'SELECT id,post_type,post_id,downloads FROM ' . $table_name . ' ORDER BY downloads DESC';
$data = $wpdb->get_results( $sql, OBJECT );
for ( $i = 0; $i < count( $data ); $i ++ ) {
echo '<tr>';
echo '<td>' . ( $i + 1 ) . '. (' . $data[ $i ]->downloads . ')</td>';
echo '<td> </td>';
echo '<td>' . $data[ $i ]->post_type . '</td>';
echo '<td> </td>';
if ( $data[ $i ]->post_type == 'post' ) {
$post = get_post( $data[ $i ]->post_id );
echo '<td>' . $post->post_title . '</td>';
} else {
$page = get_page( $data[ $i ]->post_id );
echo '<td>' . $page->post_title . '</td>';
}
echo '<td> </td>';
echo '<td><a href="?page=' . $_GET['page'] . '&resetstat=' . $data[ $i ]->id . '">Clear</a></td>';
echo '</tr>';
}
echo '</table>';
}
function mpdf_admin_loginneededpages() {
global $wpdb;
$table_name = $wpdb->prefix . WP_MPDF_POSTS_DB;
echo '<h2>Black/White List - Login needs</h2>';
if ( isset( $_GET['delloginneededpages'] ) ) {
$wpdb->query( 'UPDATE ' . $table_name . ' SET login=0 WHERE id=' . $_GET['delloginneededpages'] . ' LIMIT 1' );
echo '<p style="color: green;">Delete allowed Page with id "' . $_GET['delloginneededpages'] . '"</p>';
}
if ( isset( $_GET['clearloginneededpages'] ) ) {
$wpdb->query( 'UPDATE ' . $table_name . ' SET login=0' );
echo '<p style="color: green;">All posts are deleted from the black/white list.</p>';
}
if ( isset( $_POST['addneedloginpage'] ) ) {
$page = get_post( $_POST['post'] );
if ( $page != null ) {
$sql = 'SELECT id FROM ' . $table_name . ' WHERE post_id=' . $page->ID . ' AND post_type="' . $page->post_type . '" LIMIT 1';
$db_id = $wpdb->get_var( $sql );
if ( $db_id == null ) {
$sql = 'INSERT INTO ' . $table_name . ' (post_type, post_id, general, login, pdfname, downloads) VALUES (%s, %d, 0, 1, "", 0)';
$wpdb->query( $wpdb->prepare( $sql, $page->post_type, $page->ID ) );
} else {
$sql = 'UPDATE ' . $table_name . ' SET login=1 WHERE id=%d LIMIT 1';
$wpdb->query( $wpdb->prepare( $sql, $db_id ) );
}
echo '<p style="color: green;">Post has been added to the .</p>';
} else {
echo '<p style="color: red;">Post not found.</p>';
}
} else if ( isset( $_GET['addneedloginpage'] ) ) {
echo '<form action="?page=' . $_GET['page'] . '" method="post">';
mpdf_admin_listposts();
echo '<br />';
echo '<input type="submit" value="Add Entry" name="addneedloginpage" />';
echo '</form>';
echo '<br />';
}
echo '<a href="?page=' . $_GET['page'] . '&addneedloginpage=1">New Entry</a> <a href="?page=' . $_GET['page'] . '&clearloginneededpages=1">Clear All Entries</a>';
echo '<table border="1">';
$sql = 'SELECT id,post_type,post_id FROM ' . $table_name . ' WHERE login=1';
$data = $wpdb->get_results( $sql, OBJECT );
for ( $i = 0; $i < count( $data ); $i ++ ) {
echo '<tr>';
echo '<td>' . $data[ $i ]->post_type . '</td>';
echo '<td> </td>';
if ( $data[ $i ]->post_type == 'post' ) {
$post = get_post( $data[ $i ]->post_id );
echo '<td>' . $post->post_title . '</td>';
} else {
$page = get_page( $data[ $i ]->post_id );
echo '<td>' . $page->post_title . '</td>';
}
echo '<td> </td>';
echo '<td><a href="?page=' . $_GET['page'] . '&delloginneededpages=' . $data[ $i ]->id . '">Delete</a></td>';
echo '</tr>';
}
echo '</table>';
}
function mpdf_admin_cache() {
echo '<h2>Cache</h2>';
$path = dirname( __FILE__ ) . '/cache/';
if ( isset( $_GET['delfile'] ) ) {
if ( file_exists( dirname( __FILE__ ) . '/cache/' . $_GET['delfile'] ) ) {
unlink( dirname( __FILE__ ) . '/cache/' . $_GET['delfile'] );
}
if ( file_exists( dirname( __FILE__ ) . '/cache/' . $_GET['delfile'] . '.cache' ) ) {
unlink( dirname( __FILE__ ) . '/cache/' . $_GET['delfile'] . '.cache' );
}
echo '<p style="color: green;">Cache file "' . $_GET['delfile'] . '" is deleted</p>';
}
if ( isset( $_GET['clearcache'] ) ) {
if ( $dir = opendir( $path ) ) {
while ( $file = readdir( $dir ) ) {
if ( ! is_dir( $path . $file ) && $file != "." && $file != ".." ) {
unlink( dirname( __FILE__ ) . '/cache/' . $file );
}
}
}
echo '<p style="color: green;">Cache is cleared</p>';
}
echo '<p><a href="?page=' . $_GET['page'] . '&clearcache=1">Clear Cache</a></p>';
echo '<table border="1">';
if ( $dir = opendir( $path ) ) {
while ( $file = readdir( $dir ) ) {
if ( ! is_dir( $path . $file ) && $file != "." && $file != ".." ) {
if ( strtolower( substr( $file, strlen( $file ) - 5 ) ) == 'cache' ) {
$pdffilename = substr( $file, 0, strlen( $file ) - 6 );
echo '<tr>';
echo '<td style="padding: 5px;">' . file_get_contents( dirname( __FILE__ ) . '/cache/' . $file ) . '</td>';
echo '<td style="padding: 5px;"><a href="../wp-content/plugins/wp-mpdf/cache/' . $pdffilename . '">' . $pdffilename . '</a></td>';
echo '<td style="padding: 5px;"><a href="?page=' . $_GET['page'] . '&delfile=' . $pdffilename . '">Delete</a></td>';
echo '</tr>';
}
}
}
}
echo '</table>';
}
?>