PluginProbe
E2Pdf – Export Pdf Tool for WordPress / 1.32.49
E2Pdf – Export Pdf Tool for WordPress v1.32.49
1.32.51 1.32.49 1.32.48 1.32.43 1.32.40 1.32.34 1.32.32 1.32.31 1.32.26 1.32.22 1.32.23 1.32.18 1.32.17 1.32.15 trunk 1.00.00 1.00.13 1.01.01 1.02.02 1.03.07 1.04.07 1.05.03 1.06.02 1.07.11 1.08.00 All 73 releases
← All changes | classes/view/page-e2pdf-templates.php +180 -105 1.08.001.32.49 View file →
@@ -2,13 +2,19 @@
2 2 if (!defined('ABSPATH')) {
3 3 die('Access denied.');
4 4 }
5 5 ?>
6 -<div class='wrap js'>
6 +<?php
7 +$wrapper = '';
8 +if ($this->get->get('action') && ($this->get->get('action') === 'create' || ($this->get->get('action') === 'edit') && $this->view->template) && get_option('e2pdf_new_edit_layout', '1')) {
9 + $wrapper = 'e2pdf-new-edit-layout';
10 +}
11 +?>
12 +<div class='wrap js <?php echo esc_attr($wrapper); ?>'>
7 13 <?php if (!$this->get->get('action')) { ?>
8 14 <h1><?php _e('Templates', 'e2pdf'); ?>
9 - <a href="<?php echo ($this->helper->get_url(array('page' => 'e2pdf-templates', 'action' => 'create'))); ?>" class="page-title-action">
10 - <?php _e('Add new', 'e2pdf') ?>
15 + <a href="<?php echo esc_url($this->helper->get_url(array('page' => 'e2pdf-templates', 'action' => 'create'))); ?>" class="page-title-action">
16 + <?php _e('Add New', 'e2pdf') ?>
11 17 </a>
12 18 </h1>
13 19 <hr class="wp-header-end">
14 20 <?php $this->render('blocks', 'notifications'); ?>
@@ -13,13 +19,12 @@
13 19 <hr class="wp-header-end">
14 20 <?php $this->render('blocks', 'notifications'); ?>
15 21 <?php $this->render('blocks', 'sub-filters'); ?>
16 22 <form id="e2pdf-templates-filter" method="post">
17 - <input type="hidden" name="_nonce" value="<?php echo wp_create_nonce('e2pdf_post') ?>">
23 + <input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce('e2pdf_templates'); ?>">
18 24 <p class="search-box">
19 - <label class="screen-reader-text" for="post-search-input"><?php _e('Search Templates', 'e2pdf'); ?></label>
20 - <input type="search" id="post-search-input" name="s" value="<?php echo $this->get->get('s'); ?>">
21 - <input type="submit" id="search-submit" class="button" value="<?php _e('Search Templates', 'e2pdf'); ?>">
25 + <input type="search" id="post-search-input" name="s" placeholder="<?php _e('Search...', 'e2pdf'); ?>" value="<?php echo esc_attr($this->get->get('s')); ?>">
26 + <input type="submit" id="search-submit" class="button" value="<?php _e('Search', 'e2pdf'); ?>">
22 27 </p>
23 28 <div class="tablenav top e2pdf-templates-list-tablenav">
24 29 <?php
25 30 if ($this->get->get('status') == 'trash') {
@@ -35,14 +40,16 @@
35 40 $this->render('blocks', 'bulk-actions', array(
36 41 'id' => 'doaction',
37 42 'name' => 'action',
38 43 'options' => array(
39 - 'trash' => __('Move To Trash', 'e2pdf')
44 + 'activate' => __('Activate', 'e2pdf'),
45 + 'deactivate' => __('Deactivate', 'e2pdf'),
46 + 'trash' => __('Trash', 'e2pdf'),
40 47 )
41 48 ));
42 49 }
43 50 ?>
44 - <div class="alignright actions bulkactions"><a href="<?php echo ($this->helper->get_url(array('page' => 'e2pdf-templates', 'action' => 'import'))); ?>" class="button action">
51 + <div class="alignright actions bulkactions"><a href="<?php echo esc_url($this->helper->get_url(array('page' => 'e2pdf-templates', 'action' => 'import'))); ?>" class="button action">
45 52 <?php _e('Import', 'e2pdf') ?>
46 53 </a></div>
47 54 </div>
48 55 <table class="wp-list-table widefat fixed striped pages e2pdf-templates-list">
@@ -51,14 +58,14 @@
51 58 <td id="cb" class="manage-column column-cb check-column"><label class="screen-reader-text" for="cb-select-all-1"><?php _e('Select All', 'e2pdf'); ?></label><input id="cb-select-all-1" type="checkbox"></td>
52 59 <th scope="col" id="id" class="manage-column column-id sortable <?php if ($this->get->get('orderby') == 'id') { ?>sorted<?php } ?> <?php if ($this->get->get('orderby') == 'id' && $this->get->get('order') == 'asc') { ?>asc<?php } else { ?>desc<?php } ?>">
53 60 <a href="<?php
54 61 if ($this->get->get('orderby') == 'id' && $this->get->get('order') == 'asc') {
55 - echo $this->helper->get_url(array('page' => 'e2pdf-templates', 'status' => $this->get->get('status'), 's' => $this->get->get('s'), 'orderby' => 'id', 'order' => 'desc'));
62 + echo esc_url($this->helper->get_url(array('page' => 'e2pdf-templates', 'status' => $this->get->get('status'), 's' => $this->get->get('s'), 'orderby' => 'id', 'order' => 'desc')));
56 63 } else {
57 - echo $this->helper->get_url(array('page' => 'e2pdf-templates', 'status' => $this->get->get('status'), 's' => $this->get->get('s'), 'orderby' => 'id', 'order' => 'asc'));
64 + echo esc_url($this->helper->get_url(array('page' => 'e2pdf-templates', 'status' => $this->get->get('status'), 's' => $this->get->get('s'), 'orderby' => 'id', 'order' => 'asc')));
58 65 }
59 66 ?>">
60 - <span><?php _e('ID', 'e2pdf'); ?></span>
67 + <span>ID</span>
61 68 <span class="sorting-indicator"></span>
62 69 </a>
63 70 </th>
64 71 <th scope="col" id="title" class="manage-column column-title column-primary sortable <?php if ($this->get->get('orderby') == 'title') { ?>sorted<?php } ?> <?php if ($this->get->get('orderby') == 'title' && $this->get->get('order') == 'asc') { ?>asc<?php } else { ?>desc<?php } ?>">
@@ -63,11 +70,11 @@
63 70 </th>
64 71 <th scope="col" id="title" class="manage-column column-title column-primary sortable <?php if ($this->get->get('orderby') == 'title') { ?>sorted<?php } ?> <?php if ($this->get->get('orderby') == 'title' && $this->get->get('order') == 'asc') { ?>asc<?php } else { ?>desc<?php } ?>">
65 72 <a href="<?php
66 73 if ($this->get->get('orderby') == 'title' && $this->get->get('order') == 'asc') {
67 - echo $this->helper->get_url(array('page' => 'e2pdf-templates', 'status' => $this->get->get('status'), 's' => $this->get->get('s'), 'orderby' => 'title', 'order' => 'desc'));
74 + echo esc_url($this->helper->get_url(array('page' => 'e2pdf-templates', 'status' => $this->get->get('status'), 's' => $this->get->get('s'), 'orderby' => 'title', 'order' => 'desc')));
68 75 } else {
69 - echo $this->helper->get_url(array('page' => 'e2pdf-templates', 'status' => $this->get->get('status'), 's' => $this->get->get('s'), 'orderby' => 'title', 'order' => 'asc'));
76 + echo esc_url($this->helper->get_url(array('page' => 'e2pdf-templates', 'status' => $this->get->get('status'), 's' => $this->get->get('s'), 'orderby' => 'title', 'order' => 'asc')));
70 77 }
71 78 ?>">
72 79 <span><?php _e('Title', 'e2pdf'); ?></span>
73 80 <span class="sorting-indicator"></span>
@@ -72,16 +79,16 @@
72 79 <span><?php _e('Title', 'e2pdf'); ?></span>
73 80 <span class="sorting-indicator"></span>
74 81 </a>
75 82 </th>
76 - <th scope="col" id="item" class="manage-column column-item"><?php _e('Item', 'e2pdf'); ?></th>
83 + <th scope="col" id="item" class="manage-column column-item"><?php _e('Connection', 'e2pdf'); ?></th>
77 84 <th scope="col" id="shortcodes" class="manage-column column-shortcode"><?php _e('Shortcode', 'e2pdf'); ?></th>
78 85 <th scope="col" id="updated" class="manage-column column-updated sortable <?php if ($this->get->get('orderby') == 'updated_at') { ?>sorted<?php } ?> <?php if ($this->get->get('orderby') == 'updated_at' && $this->get->get('order') == 'asc') { ?>asc<?php } else { ?>desc<?php } ?>">
79 86 <a href="<?php
80 87 if ($this->get->get('orderby') == 'updated_at' && $this->get->get('order') == 'asc') {
81 - echo $this->helper->get_url(array('page' => 'e2pdf-templates', 'status' => $this->get->get('status'), 's' => $this->get->get('s'), 'orderby' => 'updated_at', 'order' => 'desc'));
88 + echo esc_url($this->helper->get_url(array('page' => 'e2pdf-templates', 'status' => $this->get->get('status'), 's' => $this->get->get('s'), 'orderby' => 'updated_at', 'order' => 'desc')));
82 89 } else {
83 - echo $this->helper->get_url(array('page' => 'e2pdf-templates', 'status' => $this->get->get('status'), 's' => $this->get->get('s'), 'orderby' => 'updated_at', 'order' => 'asc'));
90 + echo esc_url($this->helper->get_url(array('page' => 'e2pdf-templates', 'status' => $this->get->get('status'), 's' => $this->get->get('s'), 'orderby' => 'updated_at', 'order' => 'asc')));
84 91 }
85 92 ?>">
86 93 <span><?php _e('Updated', 'e2pdf'); ?></span>
87 94 <span class="sorting-indicator">
@@ -94,38 +101,79 @@
94 101 <tbody id="the-list">
95 102 <?php if ($this->is_empty($this->controller->get_templates_list($this->get->get()))) { ?>
96 103 <tr class="no-items">
97 104 <td class="colspanchange" colspan="7">
98 - <?php _e('No Templates Found', 'e2pdf'); ?> <a href="<?php echo ($this->helper->get_url(array('page' => 'e2pdf-templates', 'action' => 'create'))); ?>"><?php _e('Add new', 'e2pdf') ?></a>
105 + <?php _e('No Templates Found', 'e2pdf'); ?> <a href="<?php echo esc_url($this->helper->get_url(array('page' => 'e2pdf-templates', 'action' => 'create'))); ?>"><?php _e('Add New', 'e2pdf') ?></a>
99 106 </td>
100 107 </tr>
101 108 <?php } else { ?>
102 109 <?php foreach ($this->controller->get_templates_list($this->get->get()) as $key => $template) { ?>
103 - <tr id="post-<?php echo $template->get('ID'); ?>" class="iedit author-self level-0 post-<?php echo $template->get('ID'); ?> type-page status-publish hentry">
110 + <tr id="post-<?php echo (int) $template->get('ID'); ?>" class="iedit author-self level-0 post-<?php echo (int) $template->get('ID'); ?> type-page status-publish hentry">
104 111 <th scope="row" class="check-column">
105 112 <label class="screen-reader-text" for="cb-select-2">Select Sample Page</label>
106 - <input id="cb-select-2" type="checkbox" name="post[]" value="<?php echo $template->get('ID'); ?>">
113 + <input id="cb-select-2" type="checkbox" name="post[]" value="<?php echo (int) $template->get('ID'); ?>">
107 114 </th>
108 - <td class="id column-id" data-colname="ID"><?php echo $template->get('ID'); ?></td>
115 + <td class="id column-id" data-colname="ID"><?php echo (int) $template->get('ID'); ?></td>
109 116 <td class="title column-title has-row-actions column-primary page-title" data-colname="Title"><div class="locked-info"><span class="locked-avatar"></span><span class="locked-text"></span></div>
110 - <strong><a class="row-title" href="<?php echo $this->helper->get_url(array('page' => 'e2pdf-templates', 'action' => 'edit', 'id' => $template->get('ID'))); ?>"><?php echo $template->get('title'); ?></a></strong>
117 + <strong><a class="row-title" href="<?php echo esc_url($this->helper->get_url(array('page' => 'e2pdf-templates', 'action' => 'edit', 'id' => $template->get('ID')))); ?>"><?php echo esc_html($template->get('title')); ?></a></strong>
111 118 <div class="row-actions">
112 119 <?php if ($this->get->get('status') == 'trash') { ?>
113 - <span class="restore"><a href="<?php echo $this->helper->get_url(array('page' => 'e2pdf-templates', 'action' => 'restore', 'id' => $template->get('ID'), 'status' => $this->get->get('status'), 's' => $this->get->get('s'), 'orderby' => $this->get->get('orderby'), 'order' => $this->get->get('order'))); ?>" rel="permalink"><?php _e('Restore', 'e2pdf'); ?></a> | </span>
114 - <span class="delete"><a href="<?php echo $this->helper->get_url(array('page' => 'e2pdf-templates', 'action' => 'delete', 'id' => $template->get('ID'), 'status' => $this->get->get('status'), 's' => $this->get->get('s'), 'orderby' => $this->get->get('orderby'), 'order' => $this->get->get('order'))); ?>" onclick="return confirm('<?php _e('Delete permanently?', 'e2pdf'); ?> ')" class="submitdelete"><?php _e('DELETE', 'e2pdf'); ?></a></span>
120 + <span class="restore"><a href="<?php echo esc_url($this->helper->get_url(array('page' => 'e2pdf-templates', 'action' => 'restore', 'id' => $template->get('ID'), '_wpnonce' => wp_create_nonce('e2pdf_templates'), 'status' => $this->get->get('status'), 's' => $this->get->get('s'), 'orderby' => $this->get->get('orderby'), 'order' => $this->get->get('order')))); ?>" rel="permalink"><?php _e('Restore', 'e2pdf'); ?></a> | </span>
121 + <span class="delete"><a href="<?php echo esc_url($this->helper->get_url(array('page' => 'e2pdf-templates', 'action' => 'delete', 'id' => $template->get('ID'), '_wpnonce' => wp_create_nonce('e2pdf_templates'), 'status' => $this->get->get('status'), 's' => $this->get->get('s'), 'orderby' => $this->get->get('orderby'), 'order' => $this->get->get('order')))); ?>" onclick="return confirm('<?php _e('Template will be removed! Continue?', 'e2pdf'); ?> ')" class="submitdelete"><?php _e('Delete', 'e2pdf'); ?></a></span>
115 122 <?php } else { ?>
116 - <span class="edit"><a href="<?php echo $this->helper->get_url(array('page' => 'e2pdf-templates', 'action' => 'edit', 'id' => $template->get('ID'))); ?>"><?php _e('Edit', 'e2pdf'); ?></a> | </span>
117 - <span class="duplicate"><a href="<?php echo $this->helper->get_url(array('page' => 'e2pdf-templates', 'action' => 'duplicate', 'id' => $template->get('ID'))); ?>"><?php _e('Duplicate', 'e2pdf'); ?></a> | </span>
118 - <span class="trash"><a href="<?php echo $this->helper->get_url(array('page' => 'e2pdf-templates', 'action' => 'trash', 'id' => $template->get('ID'), 'status' => $this->get->get('status'), 's' => $this->get->get('s'), 'orderby' => $this->get->get('orderby'), 'order' => $this->get->get('order'))); ?>" class="submitdelete"><?php _e('Delete', 'e2pdf'); ?></a> | </span>
119 - <span class="view"><a target="_blank" href="<?php echo $this->helper->get_url(array('page' => 'e2pdf-templates', 'action' => 'view', 'id' => $template->get('ID'))); ?>" rel="permalink"><?php _e('View', 'e2pdf'); ?></a> | </span>
120 - <span class="backup"><a href="<?php echo $this->helper->get_url(array('page' => 'e2pdf-templates', 'action' => 'backup', 'id' => $template->get('ID'))); ?>" rel="permalink"><?php _e('Backup', 'e2pdf'); ?></a></span>
123 + <span class="edit"><a href="<?php echo esc_url($this->helper->get_url(array('page' => 'e2pdf-templates', 'action' => 'edit', 'id' => $template->get('ID')))); ?>"><?php _e('Edit', 'e2pdf'); ?></a> | </span>
124 + <span class="duplicate"><a href="<?php echo esc_url($this->helper->get_url(array('page' => 'e2pdf-templates', 'action' => 'duplicate', 'id' => $template->get('ID'), '_wpnonce' => wp_create_nonce('e2pdf_templates')))); ?>"><?php _e('Duplicate', 'e2pdf'); ?></a> | </span>
125 + <span class="trash"><a href="<?php echo esc_url($this->helper->get_url(array('page' => 'e2pdf-templates', 'action' => 'trash', 'id' => $template->get('ID'), '_wpnonce' => wp_create_nonce('e2pdf_templates'), 'status' => $this->get->get('status'), 's' => $this->get->get('s'), 'orderby' => $this->get->get('orderby'), 'order' => $this->get->get('order')))); ?>" class="submitdelete"><?php _e('Trash', 'e2pdf'); ?></a> | </span>
126 + <span class="view"><a target="_blank" href="<?php echo esc_url($this->helper->get_url(array('page' => 'e2pdf-templates', 'action' => 'view', 'id' => $template->get('ID')))); ?>" rel="permalink"><?php _e('View', 'e2pdf'); ?></a> | </span>
127 + <span class="download"><a href="<?php echo esc_url($this->helper->get_url(array('page' => 'e2pdf-templates', 'action' => 'download', 'id' => $template->get('ID')))); ?>" rel="permalink"><?php _e('Download', 'e2pdf'); ?></a></span>
128 + <?php if ($template->get('activated')) { ?>
129 + <span class="export"> | <a target="_blank" href="<?php echo esc_url($this->helper->get_url(array('page' => 'e2pdf', 'id' => $template->get('ID')))); ?>"><?php _e('Create PDF', 'e2pdf'); ?></a></span>
130 + <?php } ?>
121 131 <?php } ?>
122 132 </div>
123 - <button type="button" class="toggle-row"><span class="screen-reader-text"><?php _e('Show more details', 'e2pdf'); ?></span></button>
133 + <button type="button" class="toggle-row"></button>
124 134 </td>
125 135 <td class="item column-item" data-colname="Item">
126 - <div><?php if ($template->extension()->method('item') && $template->get('item')) { ?><a target="_blank" href="<?php echo $template->extension()->item()->url; ?>"><?php echo $template->extension()->item()->name; ?></a><?php } else { ?>—<?php } ?></div>
127 - <div class="e2pdf-small"><?php if ($template->extension()->method('info')) { ?> <?php echo $template->extension()->info('title'); ?> <?php } ?></div>
136 + <div>
137 + <?php if ($template->extension()->method('item') && $template->get('item')) { ?>
138 + <?php if ($template->get('item') == '-2') { ?>
139 + <?php if ($template->get('item1') || $template->get('item2')) { ?>
140 + <?php if ($template->get('item1')) { ?>
141 + <?php if ($template->extension()->item($template->get('item1'))->url) { ?>
142 + <a target="_blank" href="<?php echo esc_url($template->extension()->item($template->get('item1'))->url); ?>" class="e2pdf-link">
143 + <?php echo esc_html($template->extension()->item($template->get('item1'))->name) ?>
144 + </a>
145 + <?php } else { ?>
146 + <?php echo $template->extension()->item($template->get('item1'))->name ? esc_html($template->extension()->item($template->get('item1'))->name) : __('N/A', 'e2pdf'); ?>
147 + <?php } ?>
148 + <?php } ?>
149 + <?php if ($template->get('item1') && $template->get('item2')) { ?>
150 + |
151 + <?php } ?>
152 + <?php if ($template->get('item2')) { ?>
153 + <?php if ($template->extension()->item($template->get('item2'))->url) { ?>
154 + <a target="_blank" href="<?php echo esc_url($template->extension()->item($template->get('item2'))->url); ?>" class="e2pdf-link">
155 + <?php echo esc_html($template->extension()->item($template->get('item2'))->name) ?>
156 + </a>
157 + <?php } else { ?>
158 + <?php echo $template->extension()->item($template->get('item2'))->name ? esc_html($template->extension()->item($template->get('item2'))->name) : __('N/A', 'e2pdf'); ?>
159 + <?php } ?>
160 + <?php } ?>
161 + <?php } else { ?>
162 +
163 + <?php } ?>
164 + <?php } else { ?>
165 + <?php if ($template->extension()->item()->url) { ?>
166 + <a target="_blank" href="<?php echo esc_url($template->extension()->item()->url); ?>"><?php echo esc_html($template->extension()->item()->name); ?></a>
167 + <?php } else { ?>
168 + <?php echo $template->extension()->item()->name ? esc_html($template->extension()->item()->name) : __('N/A', 'e2pdf'); ?>
169 + <?php } ?>
170 + <?php } ?>
171 + <?php } else { ?>
172 +
173 + <?php } ?>
174 + </div>
175 + <div class="e2pdf-small"><?php if ($template->extension()->method('info')) { ?> <?php echo esc_html($template->extension()->info('title')); ?> <?php } ?></div>
128 176 </td>
129 177 <td class="shortcode column-shortcode" data-colname="Shortcode">
130 178 <div class="e2pdf-rel e2pdf-closed">
131 179 <a href="javascript:void(0);" class="e2pdf-link e2pdf-hidden-dropdown button e2pdf-w100 e2pdf-center"><?php _e('Shortcodes', 'e2pdf') ?> <span class="toggle-indicator" aria-hidden="true"></span></a>
@@ -130,32 +178,35 @@
130 178 <div class="e2pdf-rel e2pdf-closed">
131 179 <a href="javascript:void(0);" class="e2pdf-link e2pdf-hidden-dropdown button e2pdf-w100 e2pdf-center"><?php _e('Shortcodes', 'e2pdf') ?> <span class="toggle-indicator" aria-hidden="true"></span></a>
132 180 <div class="e2pdf-hidden-dropdown-content">
133 181 <div class="misc-pub-section misc-pub-e2pdf-shortcode">
134 - <input placeholder="<?php _e('Shortcode', 'e2pdf') ?>" class="e2pdf-center e2pdf-copy-field e2pdf-w100" type="text" readonly="readonly" value='[e2pdf-attachment id="<?php echo $template->get('ID'); ?>"]'>
182 + <input placeholder="<?php _e('Shortcode', 'e2pdf') ?>" class="e2pdf-center e2pdf-copy-field e2pdf-w100" type="text" readonly="readonly" value='[e2pdf-attachment id="<?php echo (int) $template->get('ID'); ?>"]'>
135 183 </div>
136 184 <div class="misc-pub-section misc-pub-e2pdf-shortcode">
137 - <input placeholder="<?php _e('Shortcode', 'e2pdf') ?>" class="e2pdf-center e2pdf-copy-field e2pdf-w100" type="text" readonly="readonly" value='[e2pdf-download id="<?php echo $template->get('ID'); ?>"]'>
185 + <input placeholder="<?php _e('Shortcode', 'e2pdf') ?>" class="e2pdf-center e2pdf-copy-field e2pdf-w100" type="text" readonly="readonly" value='[e2pdf-download id="<?php echo (int) $template->get('ID'); ?>"]'>
138 186 </div>
139 187 <div class="misc-pub-section misc-pub-e2pdf-shortcode">
140 - <input placeholder="<?php _e('Shortcode', 'e2pdf') ?>" class="e2pdf-center e2pdf-copy-field e2pdf-w100" type="text" readonly="readonly" value='[e2pdf-save id="<?php echo $template->get('ID'); ?>"]'>
188 + <input placeholder="<?php _e('Shortcode', 'e2pdf') ?>" class="e2pdf-center e2pdf-copy-field e2pdf-w100" type="text" readonly="readonly" value='[e2pdf-save id="<?php echo (int) $template->get('ID'); ?>"]'>
141 189 </div>
142 190 <div class="misc-pub-section misc-pub-e2pdf-shortcode">
143 - <input placeholder="<?php _e('Shortcode', 'e2pdf') ?>" class="e2pdf-center e2pdf-copy-field e2pdf-w100" type="text" readonly="readonly" value='[e2pdf-view id="<?php echo $template->get('ID'); ?>"]'>
191 + <input placeholder="<?php _e('Shortcode', 'e2pdf') ?>" class="e2pdf-center e2pdf-copy-field e2pdf-w100" type="text" readonly="readonly" value='[e2pdf-view id="<?php echo (int) $template->get('ID'); ?>"]'>
144 192 </div>
193 + <div class="misc-pub-section misc-pub-e2pdf-shortcode">
194 + <input placeholder="<?php _e('Shortcode', 'e2pdf') ?>" class="e2pdf-center e2pdf-copy-field e2pdf-w100" type="text" readonly="readonly" value='[e2pdf-zapier id="<?php echo (int) $template->get('ID'); ?>"]'>
195 + </div>
145 196 </div>
146 197 </div>
147 198 </td>
148 199 <td class="updated column-updated" data-colname="<?php _e('Updated', 'e2pdf') ?>">
149 - <abbr title="<?php echo $template->get('updated_at'); ?>"><?php echo $template->get('updated_at'); ?></abbr>
150 - <div class="e2pdf-small">by <strong><?php echo get_userdata($template->get('author'))->user_nicename; ?></strong></div>
200 + <?php echo esc_html($template->get('updated_at')); ?>
201 + <div class="e2pdf-small">by <strong><?php echo esc_html(get_userdata((int) $template->get('author'))->user_nicename); ?></strong></div>
151 202 </td>
152 203 <td class="author column-activation" data-colname="Activation">
153 204 <span id="e2pdf-list-post-activation">
154 205 <?php if ($template->get('activated')) { ?>
155 - <a class="e2pdf-color-green e2pdf-deactivate-template e2pdf-link" data-id="<?php echo $template->get('ID'); ?>" href="javascript:void(0);"><?php _e('Activated', 'e2pdf'); ?></a>
206 + <a class="e2pdf-color-green e2pdf-deactivate-template e2pdf-link" data-id="<?php echo (int) $template->get('ID'); ?>" href="javascript:void(0);" _wpnonce="<?php echo wp_create_nonce('e2pdf_templates'); ?>"><?php _e('Activated', 'e2pdf'); ?></a>
156 207 <?php } else { ?>
157 - <a class="e2pdf-color-red e2pdf-activate-template e2pdf-link" data-id="<?php echo $template->get('ID'); ?>" href="javascript:void(0);"><?php _e('Not Activated', 'e2pdf'); ?></a>
208 + <a class="e2pdf-color-red e2pdf-activate-template e2pdf-link" data-id="<?php echo (int) $template->get('ID'); ?>" href="javascript:void(0);" _wpnonce="<?php echo wp_create_nonce('e2pdf_templates'); ?>"><?php _e('Not Activated', 'e2pdf'); ?></a>
158 209 <?php } ?></span>
159 210 </td>
160 211 </tr>
161 212 <?php } ?>
@@ -162,18 +213,18 @@
162 213 <?php } ?>
163 214 </tbody>
164 215 <tfoot>
165 216 <tr>
166 - <td id="cb" class="manage-column column-cb check-column"><label class="screen-reader-text" for="cb-select-all-1"><?php echo _e('Select All', 'e2pdf'); ?></label><input id="cb-select-all-1" type="checkbox"></td>
217 + <td id="cb" class="manage-column column-cb check-column"><label class="screen-reader-text" for="cb-select-all-1"><?php _e('Select All', 'e2pdf'); ?></label><input id="cb-select-all-1" type="checkbox"></td>
167 218 <th scope="col" id="id" class="manage-column column-id sortable <?php if ($this->get->get('orderby') == 'id') { ?>sorted<?php } ?> <?php if ($this->get->get('orderby') == 'id' && $this->get->get('order') == 'asc') { ?>asc<?php } else { ?>desc<?php } ?>">
168 219 <a href="<?php
169 220 if ($this->get->get('orderby') == 'id' && $this->get->get('order') == 'asc') {
170 - echo $this->helper->get_url(array('page' => 'e2pdf-templates', 'status' => $this->get->get('status'), 's' => $this->get->get('s'), 'orderby' => 'id', 'order' => 'desc'));
221 + echo esc_url($this->helper->get_url(array('page' => 'e2pdf-templates', 'status' => $this->get->get('status'), 's' => $this->get->get('s'), 'orderby' => 'id', 'order' => 'desc')));
171 222 } else {
172 - echo $this->helper->get_url(array('page' => 'e2pdf-templates', 'status' => $this->get->get('status'), 's' => $this->get->get('s'), 'orderby' => 'id', 'order' => 'asc'));
223 + echo esc_url($this->helper->get_url(array('page' => 'e2pdf-templates', 'status' => $this->get->get('status'), 's' => $this->get->get('s'), 'orderby' => 'id', 'order' => 'asc')));
173 224 }
174 225 ?>">
175 - <span><?php _e('ID', 'e2pdf'); ?></span>
226 + <span>ID</span>
176 227 <span class="sorting-indicator"></span>
177 228 </a>
178 229 </th>
179 230 <th scope="col" id="title" class="manage-column column-title column-primary sortable <?php if ($this->get->get('orderby') == 'title') { ?>sorted<?php } ?> <?php if ($this->get->get('orderby') == 'title' && $this->get->get('order') == 'asc') { ?>asc<?php } else { ?>desc<?php } ?>">
@@ -178,11 +229,11 @@
178 229 </th>
179 230 <th scope="col" id="title" class="manage-column column-title column-primary sortable <?php if ($this->get->get('orderby') == 'title') { ?>sorted<?php } ?> <?php if ($this->get->get('orderby') == 'title' && $this->get->get('order') == 'asc') { ?>asc<?php } else { ?>desc<?php } ?>">
180 231 <a href="<?php
181 232 if ($this->get->get('orderby') == 'title' && $this->get->get('order') == 'asc') {
182 - echo $this->helper->get_url(array('page' => 'e2pdf-templates', 'status' => $this->get->get('status'), 's' => $this->get->get('s'), 'orderby' => 'title', 'order' => 'desc'));
233 + echo esc_url($this->helper->get_url(array('page' => 'e2pdf-templates', 'status' => $this->get->get('status'), 's' => $this->get->get('s'), 'orderby' => 'title', 'order' => 'desc')));
183 234 } else {
184 - echo $this->helper->get_url(array('page' => 'e2pdf-templates', 'status' => $this->get->get('status'), 's' => $this->get->get('s'), 'orderby' => 'title', 'order' => 'asc'));
235 + echo esc_url($this->helper->get_url(array('page' => 'e2pdf-templates', 'status' => $this->get->get('status'), 's' => $this->get->get('s'), 'orderby' => 'title', 'order' => 'asc')));
185 236 }
186 237 ?>">
187 238 <span><?php _e('Title', 'e2pdf'); ?></span>
188 239 <span class="sorting-indicator"></span>
@@ -187,16 +238,16 @@
187 238 <span><?php _e('Title', 'e2pdf'); ?></span>
188 239 <span class="sorting-indicator"></span>
189 240 </a>
190 241 </th>
191 - <th scope="col" id="item" class="manage-column column-item"><?php _e('Item', 'e2pdf'); ?></th>
242 + <th scope="col" id="item" class="manage-column column-item"><?php _e('Connection', 'e2pdf'); ?></th>
192 243 <th scope="col" id="shortcodes" class="manage-column column-shortcode"><?php _e('Shortcode', 'e2pdf'); ?></th>
193 244 <th scope="col" id="updated" class="manage-column column-updated sortable <?php if ($this->get->get('orderby') == 'updated_at') { ?>sorted<?php } ?> <?php if ($this->get->get('orderby') == 'updated_at' && $this->get->get('order') == 'asc') { ?>asc<?php } else { ?>desc<?php } ?>">
194 245 <a href="<?php
195 246 if ($this->get->get('orderby') == 'updated_at' && $this->get->get('order') == 'asc') {
196 - echo $this->helper->get_url(array('page' => 'e2pdf-templates', 'status' => $this->get->get('status'), 's' => $this->get->get('s'), 'orderby' => 'updated_at', 'order' => 'desc'));
247 + echo esc_url($this->helper->get_url(array('page' => 'e2pdf-templates', 'status' => $this->get->get('status'), 's' => $this->get->get('s'), 'orderby' => 'updated_at', 'order' => 'desc')));
197 248 } else {
198 - echo $this->helper->get_url(array('page' => 'e2pdf-templates', 'status' => $this->get->get('status'), 's' => $this->get->get('s'), 'orderby' => 'updated_at', 'order' => 'asc'));
249 + echo esc_url($this->helper->get_url(array('page' => 'e2pdf-templates', 'status' => $this->get->get('status'), 's' => $this->get->get('s'), 'orderby' => 'updated_at', 'order' => 'asc')));
199 250 }
200 251 ?>">
201 252 <span><?php _e('Updated', 'e2pdf'); ?></span>
202 253 <span class="sorting-indicator">
@@ -222,54 +273,70 @@
222 273 $this->render('blocks', 'bulk-actions', array(
223 274 'id' => 'doaction2',
224 275 'name' => 'action2',
225 276 'options' => array(
226 - 'trash' => 'Move To Trash'
277 + 'activate' => __('Activate', 'e2pdf'),
278 + 'deactivate' => __('Deactivate', 'e2pdf'),
279 + 'trash' => __('Trash', 'e2pdf'),
227 280 )
228 281 ));
229 282 }
230 283 $this->render('blocks', 'pagination', array(
231 284 'total' => $this->controller->get_templates_list($this->get->get(), true),
232 - 'limit' => get_option('e2pdf_templates_screen_per_page') && (int) get_option('e2pdf_templates_screen_per_page') > '0' ? get_option('e2pdf_templates_screen_per_page') : '20',
285 + 'limit' => (int) get_option('e2pdf_templates_screen_per_page', '20'),
233 286 'paged' => $this->get->get('paged') && (int) $this->get->get('paged') > '0' ? (int) $this->get->get('paged') : '1',
234 287 'url' => array('page' => 'e2pdf-templates', 'action' => $this->get->get('action'), 'status' => $this->get->get('status'), 's' => $this->get->get('s'), 'orderby' => $this->get->get('orderby'), 'order' => $this->get->get('order'))
235 288 ));
236 289 ?>
237 - <br class="clear">
290 + <div class="clear"></div>
238 291 </div>
239 292 </form>
240 - <br class="clear">
293 + <div class="clear"></div>
294 + <?php $this->render('blocks', 'debug-panel'); ?>
241 295 <?php } elseif ($this->get->get('action')) { ?>
242 296 <?php if ($this->get->get('action') === 'create' || ($this->get->get('action') === 'edit' && $this->view->template)) { ?>
243 - <h1><?php $this->get->get('action') === 'edit' ? _e('Edit Template', 'e2pdf') : _e('New Template', 'e2pdf'); ?>
244 - <a href="<?php echo ($this->helper->get_url(array('page' => 'e2pdf-templates', 'action' => 'create'))); ?>" class="page-title-action">
245 - <?php _e('Add new', 'e2pdf') ?>
246 - </a>
247 - </h1>
248 - <hr class="wp-header-end">
249 - <?php $this->render('blocks', 'notifications'); ?>
297 + <?php if (!get_option('e2pdf_new_edit_layout', '1')) { ?>
298 + <div id="e2pdf-form-editor-header" class="e2pdf-form-editor-header">
299 + <h1><?php echo $this->get->get('action') === 'edit' ? esc_html(sprintf(__("ID: %d | Edit Template", 'e2pdf'), (int) $this->view->template->get('ID'))) : __('New Template', 'e2pdf'); ?>
300 + <a href="<?php echo esc_url($this->helper->get_url(array('page' => 'e2pdf-templates', 'action' => 'create'))); ?>" class="page-title-action">
301 + <?php _e('Add New', 'e2pdf') ?>
302 + </a>
303 + </h1>
304 + <hr class="wp-header-end">
305 + <?php $this->render('blocks', 'notifications'); ?>
306 + </div>
307 + <?php } ?>
250 308 <div id="poststuff">
251 309 <form method="post" id="e2pdf-build-form">
252 310 <div id="post-body" class="metabox-holder columns-2">
253 - <div id="post-body-content">
311 + <div id="post-body-content" class="e2pdf-post-body-content">
254 312 <div class="e2pdf-form-builder">
255 - <input type="hidden" name="_nonce" value="<?php echo wp_create_nonce('e2pdf_post') ?>">
313 + <input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce('e2pdf_templates'); ?>">
256 314 <input type="hidden" name="sub_action" value="<?php echo $this->get->get('action') === 'create' ? 'create' : 'edit'; ?>">
257 315 <?php if ($this->view->template->get('ID')) { ?>
258 - <input type="hidden" name="ID" value="<?php echo $this->view->template->get('ID'); ?>">
259 - <input type="hidden" name="width" value="<?php echo $this->view->template->get('width'); ?>">
260 - <input type="hidden" name="height" value="<?php echo $this->view->template->get('height'); ?>">
261 - <input type="hidden" name="extension" value="<?php echo $this->view->template->get('extension'); ?>">
262 - <input type="hidden" name="item" value="<?php echo $this->view->template->get('item'); ?>">
263 - <input type="hidden" name="pdf" value="<?php echo $this->view->template->get('pdf'); ?>">
264 - <input type="hidden" name="format" value="<?php echo $this->view->template->get('format'); ?>">
265 - <input type="hidden" name="activated" value="<?php echo $this->view->template->get('activated'); ?>">
266 - <input type="hidden" name="templates_limit" value="<?php echo $this->view->license->get('templates_limit') - $this->view->license->get('active_templates'); ?>">
267 - <?php } else { ?>
268 - <input type="hidden" name="activated" value="<?php echo $this->view->license->get('templates_limit') - $this->view->license->get('active_templates') > 0 ? '1' : '0' ?>">
269 - <input type="hidden" name="templates_limit" value="<?php echo $this->view->license->get('templates_limit') - $this->view->license->get('active_templates'); ?>">
316 + <input type="hidden" name="ID" value="<?php echo (int) $this->view->template->get('ID'); ?>">
317 + <input type="hidden" name="width" value="<?php echo (float) $this->view->template->get('width'); ?>">
318 + <input type="hidden" name="height" value="<?php echo (float) $this->view->template->get('height'); ?>">
319 + <input type="hidden" name="extension" value="<?php echo esc_attr($this->view->template->get('extension')); ?>">
320 + <input type="hidden" name="item" value="<?php echo esc_attr($this->view->template->get('item')); ?>">
321 + <input type="hidden" name="item1" value="<?php echo esc_attr($this->view->template->get('item1')); ?>">
322 + <input type="hidden" name="item2" value="<?php echo esc_attr($this->view->template->get('item2')); ?>">
323 + <input type="hidden" name="pdf" value="<?php echo esc_attr($this->view->template->get('pdf')); ?>">
324 + <input type="hidden" name="format" value="<?php echo esc_attr($this->view->template->get('format')); ?>">
325 + <input type="hidden" name="hooks" value="<?php echo esc_attr($this->view->template->get('hooks')); ?>">
270 326 <?php } ?>
271 - <div id="e2pdf-build-form-wrapper">
327 + <div id="e2pdf-build-form-wrapper" class="e2pdf-build-form-wrapper">
328 + <?php if (get_option('e2pdf_new_edit_layout', '1')) { ?>
329 + <div id="e2pdf-form-editor-header" class="e2pdf-form-editor-header">
330 + <h1><?php echo $this->get->get('action') === 'edit' ? esc_html(sprintf(__("ID: %d | Edit Template", 'e2pdf'), (int) $this->view->template->get('ID'))) : __('New Template', 'e2pdf'); ?>
331 + <a href="<?php echo esc_url($this->helper->get_url(array('page' => 'e2pdf-templates', 'action' => 'create'))); ?>" class="page-title-action">
332 + <?php _e('Add New', 'e2pdf') ?>
333 + </a>
334 + </h1>
335 + <hr class="wp-header-end">
336 + <?php $this->render('blocks', 'notifications'); ?>
337 + </div>
338 + <?php } ?>
272 339 <div id="e2pdf-form-editor-container" class="e2pdf-form-editor-container">
273 340 <div id="titlediv">
274 341 <?php
275 342 $this->render('field', 'text', array(
@@ -288,30 +355,39 @@
288 355 ?>
289 356 <div class="clear"></div>
290 357 </div>
291 358 <div class="e2pdf-tpl-wrapper">
292 - <div id="e2pdf-tpl" class="e2pdf-tpl e2pdf-center" data-width="<?php echo $this->view->template->get('width'); ?>" data-height="<?php echo $this->view->template->get('height'); ?>">
293 - <div id="e2pdf-tpl-inner" class="e2pdf-tpl-inner">
359 + <div <?php echo $this->view->template->get('rtl') ? 'dir="rtl"' : ''; ?> class="e2pdf-tpl e2pdf-center" data-width="<?php echo (float) $this->view->template->get('width'); ?>" data-height="<?php echo (float) $this->view->template->get('height'); ?>">
360 + <div class="e2pdf-tpl-inner">
294 361 <?php if ($this->get->get('action') === 'edit') { ?>
295 362 <?php $fonts = $this->view->template->get('fonts'); ?>
296 363 <?php foreach ($fonts as $font_key => $font) { ?>
297 - <div class="e2pdf-load-font e2pdf-hide" path="<?php echo $font_key; ?>" name="<?php echo $font; ?>"></div>
364 + <div class="e2pdf-load-font e2pdf-hide" path="<?php echo esc_attr($font_key); ?>" name="<?php echo esc_attr($font); ?>"></div>
298 365 <?php } ?>
299 366 <?php $pages = $this->view->template->get('pages'); ?>
300 367 <?php foreach ($pages as $page_key => $page) { ?>
301 - <div data-page_id="<?php echo $page['page_id']; ?>" class="e2pdf-page ui-droppable e2pdf-load-page" data-width="<?php echo $page['properties']['width']; ?>" data-height="<?php echo $page['properties']['height']; ?>" style="width: <?php echo $page['properties']['width']; ?>px; height: <?php echo $page['properties']['height']; ?>px; <?php if ($this->view->template->get('pdf') && file_exists($this->helper->get('pdf_dir') . $this->view->template->get('pdf') . '/images/' . $page['page_id'] . '.png')) { ?>background-image: url('<?php echo $this->helper->get_upload_url('pdf/' . $this->view->template->get('pdf') . '/images/' . $page['page_id'] . '.png') ?>')<?php } ?>">
368 + <div data-page_id="<?php echo (int) $page['page_id']; ?>" class="e2pdf-page ui-droppable e2pdf-load-page" data-width="<?php echo (float) $page['properties']['width']; ?>" data-height="<?php echo (float) $page['properties']['height']; ?>" style="width: <?php echo (float) $page['properties']['width']; ?>px; height: <?php echo (float) $page['properties']['height']; ?>px; <?php if ($this->view->template->get('pdf') && file_exists($this->helper->get('pdf_dir') . $this->view->template->get('pdf') . '/images/' . $page['page_id'] . '.png')) { ?>background-image: url('<?php echo esc_url($this->helper->get_upload_url('pdf/' . $this->view->template->get('pdf') . '/images/' . $page['page_id'] . '.png')); ?>')<?php } ?>">
302 369 <div class="page-options-icons"><a href="javascript:void(0);" class="page-options-icon e2pdf-up-page e2pdf-link" <?php if ($page['page_id'] == '1' || $this->view->template->get('pdf')) { ?>disabled="disabled"<?php } ?>><i class="dashicons dashicons-arrow-up-alt2"></i></a><a href="javascript:void(0);" class="page-options-icon e2pdf-down-page e2pdf-link" <?php if ($page['page_id'] == count($pages) || $this->view->template->get('pdf')) { ?>disabled="disabled" <?php } ?>><i class="dashicons dashicons-arrow-down-alt2"></i></a><a href="javascript:void(0);" class="page-options-icon e2pdf-page-options e2pdf-modal e2pdf-link" data-modal="page-options"><i class="dashicons dashicons-admin-generic"></i></a><a href="javascript:void(0);" class="page-options-icon e2pdf-delete-page e2pdf-link"><i class="dashicons dashicons-no"></i></a></div>
303 370 <?php foreach ($page['elements'] as $key => $value) { ?>
304 - <div class="e2pdf-load-el" data-width="<?php echo $value['width']; ?>" data-height="<?php echo $value['height']; ?>" data-top="<?php echo $value['top']; ?>" data-left="<?php echo $value['left']; ?>" data-type="<?php echo $value['type'] ?>" data-element_id="<?php echo $value['element_id'] ?>"><div class="e2pdf-data-name"><?php echo htmlspecialchars($value['name']) ?></div><div class="e2pdf-data-properties"><?php echo htmlspecialchars(json_encode($value['properties'], JSON_FORCE_OBJECT)); ?></div><div class="e2pdf-data-actions"><?php echo htmlspecialchars(json_encode($value['actions'], JSON_FORCE_OBJECT)); ?></div><div class="e2pdf-data-value"><?php echo $value['type'] === 'e2pdf-html' ? $value['value'] : htmlspecialchars($value['value']) ?></div></div>
371 + <div class="e2pdf-load-el" data-width="<?php echo esc_attr($value['width']); ?>" data-height="<?php echo esc_attr($value['height']); ?>" data-top="<?php echo esc_attr($value['top']); ?>" data-left="<?php echo esc_attr($value['left']); ?>" data-type="<?php echo esc_attr($value['type']); ?>" data-element_id="<?php echo esc_attr($value['element_id']); ?>">
372 + <textarea class="e2pdf-data-name"><?php echo htmlspecialchars($value['name'], ENT_QUOTES); ?></textarea>
373 + <textarea class="e2pdf-data-properties"><?php echo htmlspecialchars(json_encode($value['properties'], JSON_FORCE_OBJECT), ENT_QUOTES); ?></textarea>
374 + <textarea class="e2pdf-data-actions"><?php echo htmlspecialchars(json_encode($value['actions'], JSON_FORCE_OBJECT), ENT_QUOTES); ?></textarea>
375 + <textarea class="e2pdf-data-value"><?php echo htmlspecialchars($value['value'], ENT_QUOTES); ?></textarea>
376 + </div>
305 377 <?php } ?>
306 - <div class="e2pdf-data-actions e2pdf-hide"><?php echo htmlspecialchars(json_encode($page['actions'], JSON_FORCE_OBJECT)); ?></div>
307 - <div class="e2pdf-data-properties e2pdf-hide"><?php echo htmlspecialchars(json_encode($page['properties'], JSON_FORCE_OBJECT)); ?></div>
378 + <textarea class="e2pdf-data-actions e2pdf-hide"><?php echo htmlspecialchars(json_encode($page['actions'], JSON_FORCE_OBJECT), ENT_QUOTES); ?></textarea>
379 + <textarea class="e2pdf-data-properties e2pdf-hide"><?php echo htmlspecialchars(json_encode($page['properties'], JSON_FORCE_OBJECT), ENT_QUOTES); ?></textarea>
308 380 <div class="e2pdf-guide e2pdf-guide-h"></div>
309 381 <div class="e2pdf-guide e2pdf-guide-v"></div>
310 - </div>
382 + </div>
311 383 <?php } ?>
312 384 <?php } ?>
313 385 </div>
386 + <div class="e2pdf-load-tpl">
387 + <textarea class="e2pdf-data-actions"><?php echo htmlspecialchars(json_encode($this->view->template->get('actions'), JSON_FORCE_OBJECT), ENT_QUOTES); ?></textarea>
388 + <textarea class="e2pdf-data-properties"><?php echo htmlspecialchars(json_encode($this->view->template->get('properties'), JSON_FORCE_OBJECT), ENT_QUOTES); ?></textarea>
389 + </div>
314 390 </div>
315 391 </div>
316 392 <?php $this->render('blocks', 'bottom-panel'); ?>
317 393 </div>
@@ -325,8 +401,9 @@
325 401 <?php
326 402 do_meta_boxes(null, 'side', null);
327 403 ?>
328 404 </div>
405 + <div class="clear"></div>
329 406 </div>
330 407 </form>
331 408 </div>
332 409 <?php } elseif ($this->get->get('action') === 'import') { ?>
@@ -334,25 +411,24 @@
334 411 <hr class="wp-header-end">
335 412 <?php $this->render('blocks', 'notifications'); ?>
336 413 <div id="poststuff" class="e2pdf-view-area">
337 414 <form enctype="multipart/form-data" method="post">
338 - <input type="hidden" name="_nonce" value="<?php echo wp_create_nonce('e2pdf_post') ?>">
415 + <input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce('e2pdf_templates'); ?>">
339 416 <ul class="e2pdf-options-list">
340 417 <li><div class="e2pdf-name"><?php _e('Template', 'e2pdf'); ?>:
341 - </div><div class="e2pdf-value"><input name="template" type="file">
342 - <div class="e2pdf-note"><?php _e('Allowed filetypes', 'e2pdf'); ?>: <strong>.xml</strong></div>
343 - <div class="e2pdf-note"><?php _e('Max upload filesize', 'e2pdf'); ?>: <strong><?php echo $this->view->upload_max_filesize; ?></strong></div>
418 + </div><div class="e2pdf-value"><input name="template" type="file" accept=".xml">
419 + <div class="e2pdf-note"><?php _e('Allowed File Types', 'e2pdf'); ?>: <strong>.xml</strong></div>
420 + <div class="e2pdf-note"><?php _e('Max Upload File Size', 'e2pdf'); ?>: <strong><?php echo esc_html($this->view->upload_max_filesize); ?></strong></div>
344 421 </div>
345 422 </li>
346 -
347 423 <?php foreach ($this->view->options as $group_key => $group) { ?>
348 424 <?php if (isset($group['name'])) { ?>
349 - <li><h4><?php echo $group['name']; ?>:</h4></li>
425 + <li><h4><?php echo esc_html($group['name']); ?>:</h4></li>
350 426 <?php } ?>
351 427 <?php foreach ($group['options'] as $option_key => $option_value) { ?>
352 - <li class="<?php echo isset($option_value['li']['class']) ? $option_value['li']['class'] : '' ?>" >
428 + <li class="<?php echo isset($option_value['li']['class']) ? esc_attr($option_value['li']['class']) : '' ?>" >
353 429 <div class="e2pdf-name">
354 - <?php echo $option_value['name']; ?>:
430 + <?php echo esc_html($option_value['name']); ?>:
355 431 </div><div class="e2pdf-value">
356 432 <?php
357 433 if ($option_value['type'] == 'checkbox') {
358 434 $this->render('field', 'checkbox', array(
@@ -389,9 +465,9 @@
389 465 } elseif ($option_value['type'] == 'select') {
390 466 $this->render('field', 'select', array(
391 467 'field' => array(
392 468 'name' => $option_value['key'],
393 - 'class' => 'e2pdf-w100'
469 + 'class' => $option_value['key'] == 'options[overwrite]' ? 'e2pdf-import-overwrite e2pdf-w100' : 'e2pdf-w100'
394 470 ),
395 471 'value' => $option_value['value'],
396 472 'options' => $option_value['options']
397 473 ));
@@ -412,42 +488,42 @@
412 488 </ul>
413 489 <p class="submit"><input type="submit" <?php if ($this->view->import_disabled) { ?>disabled="disabled"<?php } ?> name="submit" id="submit" class="button button-primary" value="<?php _e('Import', 'e2pdf'); ?>"></p>
414 490 </form>
415 491 </div>
416 - <?php } elseif ($this->get->get('action') === 'backup') { ?>
417 - <h1><?php _e('Backup', 'e2pdf'); ?></h1>
492 + <?php } elseif ($this->get->get('action') === 'download') { ?>
493 + <h1><?php _e('Download', 'e2pdf'); ?></h1>
418 494 <hr class="wp-header-end">
419 495 <?php $this->render('blocks', 'notifications'); ?>
420 496 <div id="poststuff" class="e2pdf-view-area">
421 497 <form method="post">
422 - <input type="hidden" name="_nonce" value="<?php echo wp_create_nonce('e2pdf_post') ?>">
423 - <input type="hidden" name="id" value="<?php echo $this->get->get('id'); ?>">
498 + <input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce('e2pdf_templates'); ?>">
499 + <input type="hidden" name="id" value="<?php echo (int) $this->get->get('id'); ?>">
424 500 <ul class="e2pdf-options-list">
425 501 <li><div class="e2pdf-name"><?php _e('Extension', 'e2pdf'); ?>:
426 502 </div><div class="e2pdf-value">
427 503 <?php if ($this->view->template->extension()->method('info')) { ?>
428 - <?php echo $this->view->template->extension()->info('title'); ?>
504 + <?php echo esc_html($this->view->template->extension()->info('title')); ?>
429 505 <?php } ?>
430 506 </div>
431 507 </li>
432 508 <li><div class="e2pdf-name"><?php _e('Template', 'e2pdf'); ?>:
433 509 </div><div class="e2pdf-value">
434 - <a target="_blank" href="<?php echo $this->helper->get_url(array('page' => 'e2pdf-templates', 'action' => 'edit', 'id' => $this->view->template->get('ID'))); ?>"><?php echo $this->view->template->get('title'); ?></a>
510 + <a target="_blank" href="<?php echo esc_url($this->helper->get_url(array('page' => 'e2pdf-templates', 'action' => 'edit', 'id' => $this->view->template->get('ID')))); ?>"><?php echo esc_html($this->view->template->get('title')); ?></a>
435 511 </div>
436 512 </li>
437 - <li><div class="e2pdf-name"><?php _e('Item', 'e2pdf'); ?>:
513 + <li><div class="e2pdf-name"><?php _e('Connection', 'e2pdf'); ?>:
438 514 </div><div class="e2pdf-value">
439 - <?php if ($this->view->template->extension()->method('item') && $this->view->template->get('item')) { ?><a target="_blank" href="<?php echo $this->view->template->extension()->item()->url; ?>"><?php echo $this->view->template->extension()->item()->name; ?></a><?php } else { ?>—<?php } ?>
515 + <?php if ($this->view->template->extension()->method('item') && $this->view->template->get('item')) { ?><a target="_blank" href="<?php echo esc_url($this->view->template->extension()->item()->url); ?>"><?php echo esc_html($this->view->template->extension()->item()->name); ?></a><?php } else { ?>—<?php } ?>
440 516 </div>
441 517 </li>
442 518 <?php foreach ($this->view->options as $group_key => $group) { ?>
443 519 <?php if (isset($group['name'])) { ?>
444 - <li><h4><?php echo $group['name']; ?>:</h4></li>
520 + <li><h4><?php echo esc_html($group['name']); ?>:</h4></li>
445 521 <?php } ?>
446 522 <?php foreach ($group['options'] as $option_key => $option_value) { ?>
447 523 <li>
448 524 <div class="e2pdf-name">
449 - <?php echo $option_value['name']; ?>:
525 + <?php echo esc_html($option_value['name']); ?>:
450 526 </div><div class="e2pdf-value">
451 527 <?php
452 528 if ($option_value['type'] == 'checkbox') {
453 529 $this->render('field', 'checkbox', array(
@@ -499,8 +575,7 @@
499 575 </form>
500 576 </div>
501 577 <?php } ?>
502 578 <?php } else { ?>
503 - <?php $this->error(); ?>
579 + <?php $this->handle_404(); ?>
504 580 <?php } ?>
505 -</div>
506 -<?php $this->render('blocks', 'debug-panel'); ?>
581 +</div>