PluginProbe
E2Pdf – Export Pdf Tool for WordPress / 1.32.53
E2Pdf – Export Pdf Tool for WordPress v1.32.53
1.32.53 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 All 74 releases
← All changes | classes/view/page-e2pdf-templates.php +206 -108 1.03.07 → 1.32.53 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') {
@@ -26,10 +31,10 @@
26 31 $this->render('blocks', 'bulk-actions', array(
27 32 'id' => 'doaction',
28 33 'name' => 'action',
29 34 'options' => array(
30 - 'restore' => 'Restore',
31 - 'delete' => 'Delete'
35 + 'restore' => __('Restore', 'e2pdf'),
36 + 'delete' => __('Delete', 'e2pdf')
32 37 )
33 38 ));
34 39 } else {
35 40 $this->render('blocks', 'bulk-actions', array(
@@ -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'
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,36 @@
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" 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" 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" 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" 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 - <?php if ($template->get('activated')) { ?>
154 - <a class="e2pdf-color-green" href="<?php echo $this->helper->get_url(array('page' => 'e2pdf-templates', 'action' => 'deactivate', 'id' => $template->get('ID'), 'status' => $this->get->get('status'), 's' => $this->get->get('s'), 'orderby' => $this->get->get('orderby'), 'order' => $this->get->get('order'))); ?>"><?php _e('Activated', 'e2pdf'); ?></a>
155 - <?php } else { ?>
156 - <a class="e2pdf-color-red" href="<?php echo $this->helper->get_url(array('page' => 'e2pdf-templates', 'action' => 'activate', 'id' => $template->get('ID'), 'status' => $this->get->get('status'), 's' => $this->get->get('s'), 'orderby' => $this->get->get('orderby'), 'order' => $this->get->get('order'))); ?>"><?php _e('Not Activated', 'e2pdf'); ?></a>
157 - <?php } ?>
204 + <span id="e2pdf-list-post-activation">
205 + <?php if ($template->get('activated')) { ?>
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>
207 + <?php } else { ?>
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>
209 + <?php } ?></span>
158 210 </td>
159 211 </tr>
160 212 <?php } ?>
161 213 <?php } ?>
@@ -161,18 +213,18 @@
161 213 <?php } ?>
162 214 </tbody>
163 215 <tfoot>
164 216 <tr>
165 - <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>
166 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 } ?>">
167 219 <a href="<?php
168 220 if ($this->get->get('orderby') == 'id' && $this->get->get('order') == 'asc') {
169 - 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')));
170 222 } else {
171 - 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')));
172 224 }
173 225 ?>">
174 - <span><?php _e('ID', 'e2pdf'); ?></span>
226 + <span>ID</span>
175 227 <span class="sorting-indicator"></span>
176 228 </a>
177 229 </th>
178 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 } ?>">
@@ -177,11 +229,11 @@
177 229 </th>
178 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 } ?>">
179 231 <a href="<?php
180 232 if ($this->get->get('orderby') == 'title' && $this->get->get('order') == 'asc') {
181 - 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')));
182 234 } else {
183 - 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')));
184 236 }
185 237 ?>">
186 238 <span><?php _e('Title', 'e2pdf'); ?></span>
187 239 <span class="sorting-indicator"></span>
@@ -186,16 +238,16 @@
186 238 <span><?php _e('Title', 'e2pdf'); ?></span>
187 239 <span class="sorting-indicator"></span>
188 240 </a>
189 241 </th>
190 - <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>
191 243 <th scope="col" id="shortcodes" class="manage-column column-shortcode"><?php _e('Shortcode', 'e2pdf'); ?></th>
192 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 } ?>">
193 245 <a href="<?php
194 246 if ($this->get->get('orderby') == 'updated_at' && $this->get->get('order') == 'asc') {
195 - 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')));
196 248 } else {
197 - 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')));
198 250 }
199 251 ?>">
200 252 <span><?php _e('Updated', 'e2pdf'); ?></span>
201 253 <span class="sorting-indicator">
@@ -221,54 +273,81 @@
221 273 $this->render('blocks', 'bulk-actions', array(
222 274 'id' => 'doaction2',
223 275 'name' => 'action2',
224 276 'options' => array(
225 - 'trash' => 'Move To Trash'
277 + 'activate' => __('Activate', 'e2pdf'),
278 + 'deactivate' => __('Deactivate', 'e2pdf'),
279 + 'trash' => __('Trash', 'e2pdf'),
226 280 )
227 281 ));
228 282 }
283 + $this->render('blocks', 'pagination', array(
284 + 'total' => $this->controller->get_templates_list($this->get->get(), true),
285 + 'limit' => (int) get_option('e2pdf_templates_screen_per_page', '20'),
286 + 'paged' => $this->get->get('paged') && (int) $this->get->get('paged') > '0' ? (int) $this->get->get('paged') : '1',
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'))
288 + ));
229 289 ?>
230 - <br class="clear">
290 + <div class="clear"></div>
231 291 </div>
232 292 </form>
233 - <br class="clear">
293 + <div class="clear"></div>
294 + <?php $this->render('blocks', 'debug-panel'); ?>
234 295 <?php } elseif ($this->get->get('action')) { ?>
235 296 <?php if ($this->get->get('action') === 'create' || ($this->get->get('action') === 'edit' && $this->view->template)) { ?>
236 - <h1><?php $this->get->get('action') === 'edit' ? _e('Edit Template', 'e2pdf') : _e('New Template', 'e2pdf'); ?>
237 - <a href="<?php echo ($this->helper->get_url(array('page' => 'e2pdf-templates', 'action' => 'create'))); ?>" class="page-title-action">
238 - <?php _e('Add new', 'e2pdf') ?>
239 - </a>
240 - </h1>
241 - <hr class="wp-header-end">
242 - <?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 } ?>
243 308 <div id="poststuff">
244 - <form method="post" id="e2pdf_build_form">
309 + <form method="post" id="e2pdf-build-form">
245 310 <div id="post-body" class="metabox-holder columns-2">
246 - <div id="post-body-content">
311 + <div id="post-body-content" class="e2pdf-post-body-content">
247 312 <div class="e2pdf-form-builder">
248 - <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'); ?>">
249 314 <input type="hidden" name="sub_action" value="<?php echo $this->get->get('action') === 'create' ? 'create' : 'edit'; ?>">
250 315 <?php if ($this->view->template->get('ID')) { ?>
251 - <input type="hidden" name="ID" value="<?php echo $this->view->template->get('ID'); ?>">
252 - <input type="hidden" name="width" value="<?php echo $this->view->template->get('width'); ?>">
253 - <input type="hidden" name="height" value="<?php echo $this->view->template->get('height'); ?>">
254 - <input type="hidden" name="extension" value="<?php echo $this->view->template->get('extension'); ?>">
255 - <input type="hidden" name="item" value="<?php echo $this->view->template->get('item'); ?>">
256 - <input type="hidden" name="pdf" value="<?php echo $this->view->template->get('pdf'); ?>">
257 - <input type="hidden" name="format" value="<?php echo $this->view->template->get('format'); ?>">
258 -
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')); ?>">
259 326 <?php } ?>
260 - <div id="e2pdf_build_form">
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 } ?>
261 339 <div id="e2pdf-form-editor-container" class="e2pdf-form-editor-container">
262 340 <div id="titlediv">
263 341 <?php
264 342 $this->render('field', 'text', array(
265 343 'field' => array(
344 + 'id' => 'e2pdf-title',
266 345 'name' => 'title',
267 - 'placeholder' => 'Enter title here'
346 + 'placeholder' => __('Template Title', 'e2pdf'),
347 + 'class' => 'e2pdf-w100'
268 348 ),
269 349 'value' => $this->view->template->get('title'),
270 - 'id' => 'title',
271 350 ));
272 351 ?>
273 352 </div>
274 353 <?php
@@ -276,30 +355,39 @@
276 355 ?>
277 356 <div class="clear"></div>
278 357 </div>
279 358 <div class="e2pdf-tpl-wrapper">
280 - <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'); ?>">
281 - <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">
282 361 <?php if ($this->get->get('action') === 'edit') { ?>
283 362 <?php $fonts = $this->view->template->get('fonts'); ?>
284 363 <?php foreach ($fonts as $font_key => $font) { ?>
285 - <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>
286 365 <?php } ?>
287 366 <?php $pages = $this->view->template->get('pages'); ?>
288 367 <?php foreach ($pages as $page_key => $page) { ?>
289 - <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 } ?>">
290 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>
291 370 <?php foreach ($page['elements'] as $key => $value) { ?>
292 - <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-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>
293 377 <?php } ?>
294 - <div class="e2pdf-data-actions e2pdf-hide"><?php echo htmlspecialchars(json_encode($page['actions'], JSON_FORCE_OBJECT)); ?></div>
295 - <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>
296 380 <div class="e2pdf-guide e2pdf-guide-h"></div>
297 381 <div class="e2pdf-guide e2pdf-guide-v"></div>
298 - </div>
382 + </div>
299 383 <?php } ?>
300 384 <?php } ?>
301 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>
302 390 </div>
303 391 </div>
304 392 <?php $this->render('blocks', 'bottom-panel'); ?>
305 393 </div>
@@ -313,8 +401,9 @@
313 401 <?php
314 402 do_meta_boxes(null, 'side', null);
315 403 ?>
316 404 </div>
405 + <div class="clear"></div>
317 406 </div>
318 407 </form>
319 408 </div>
320 409 <?php } elseif ($this->get->get('action') === 'import') { ?>
@@ -322,24 +411,24 @@
322 411 <hr class="wp-header-end">
323 412 <?php $this->render('blocks', 'notifications'); ?>
324 413 <div id="poststuff" class="e2pdf-view-area">
325 414 <form enctype="multipart/form-data" method="post">
326 - <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'); ?>">
327 416 <ul class="e2pdf-options-list">
328 417 <li><div class="e2pdf-name"><?php _e('Template', 'e2pdf'); ?>:
329 - </div><div class="e2pdf-value"><input name="template" type="file">
330 - <div class="e2pdf-note"><?php _e('Allowed filetypes', 'e2pdf'); ?>: <strong>.xml</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>
331 421 </div>
332 422 </li>
333 -
334 423 <?php foreach ($this->view->options as $group_key => $group) { ?>
335 424 <?php if (isset($group['name'])) { ?>
336 - <li><h4><?php echo $group['name']; ?>:</h4></li>
425 + <li><h4><?php echo esc_html($group['name']); ?>:</h4></li>
337 426 <?php } ?>
338 427 <?php foreach ($group['options'] as $option_key => $option_value) { ?>
339 - <li>
428 + <li class="<?php echo isset($option_value['li']['class']) ? esc_attr($option_value['li']['class']) : '' ?>" >
340 429 <div class="e2pdf-name">
341 - <?php echo $option_value['name']; ?>:
430 + <?php echo esc_html($option_value['name']); ?>:
342 431 </div><div class="e2pdf-value">
343 432 <?php
344 433 if ($option_value['type'] == 'checkbox') {
345 434 $this->render('field', 'checkbox', array(
@@ -345,9 +434,11 @@
345 434 $this->render('field', 'checkbox', array(
346 435 'field' => array(
347 436 'name' => $option_value['key'],
348 437 'placeholder' => $option_value['placeholder'],
349 - 'disabled' => isset($option_value['disabled']) && $option_value['disabled'] ? 'disabled' : false
438 + 'disabled' => isset($option_value['disabled']) && $option_value['disabled'] ? 'disabled' : false,
439 + 'class' => isset($option_value['class']) ? $option_value['class'] : '',
440 + 'data-collapse' => isset($option_value['data-collapse']) ? $option_value['data-collapse'] : ''
350 441 ),
351 442 'value' => $option_value['value'],
352 443 'checkbox_value' => 1,
353 444 'default_value' => $option_value['default_value'],
@@ -374,13 +465,21 @@
374 465 } elseif ($option_value['type'] == 'select') {
375 466 $this->render('field', 'select', array(
376 467 'field' => array(
377 468 'name' => $option_value['key'],
378 - 'class' => 'e2pdf-w100'
469 + 'class' => $option_value['key'] == 'options[overwrite]' ? 'e2pdf-import-overwrite e2pdf-w100' : 'e2pdf-w100'
379 470 ),
380 471 'value' => $option_value['value'],
381 472 'options' => $option_value['options']
382 473 ));
474 + } elseif ($option_value['type'] == 'radio') {
475 + $this->render('field', 'radio', array(
476 + 'field' => array(
477 + 'name' => $option_value['key'],
478 + ),
479 + 'value' => $option_value['value'],
480 + 'options' => $option_value['options']
481 + ));
383 482 }
384 483 ?>
385 484 </div>
386 485 </li>
@@ -389,42 +488,42 @@
389 488 </ul>
390 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>
391 490 </form>
392 491 </div>
393 - <?php } elseif ($this->get->get('action') === 'backup') { ?>
394 - <h1><?php _e('Backup', 'e2pdf'); ?></h1>
492 + <?php } elseif ($this->get->get('action') === 'download') { ?>
493 + <h1><?php _e('Download', 'e2pdf'); ?></h1>
395 494 <hr class="wp-header-end">
396 495 <?php $this->render('blocks', 'notifications'); ?>
397 496 <div id="poststuff" class="e2pdf-view-area">
398 497 <form method="post">
399 - <input type="hidden" name="_nonce" value="<?php echo wp_create_nonce('e2pdf_post') ?>">
400 - <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'); ?>">
401 500 <ul class="e2pdf-options-list">
402 501 <li><div class="e2pdf-name"><?php _e('Extension', 'e2pdf'); ?>:
403 502 </div><div class="e2pdf-value">
404 503 <?php if ($this->view->template->extension()->method('info')) { ?>
405 - <?php echo $this->view->template->extension()->info('title'); ?>
504 + <?php echo esc_html($this->view->template->extension()->info('title')); ?>
406 505 <?php } ?>
407 506 </div>
408 507 </li>
409 508 <li><div class="e2pdf-name"><?php _e('Template', 'e2pdf'); ?>:
410 509 </div><div class="e2pdf-value">
411 - <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>
412 511 </div>
413 512 </li>
414 - <li><div class="e2pdf-name"><?php _e('Item', 'e2pdf'); ?>:
513 + <li><div class="e2pdf-name"><?php _e('Connection', 'e2pdf'); ?>:
415 514 </div><div class="e2pdf-value">
416 - <?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 } ?>
417 516 </div>
418 517 </li>
419 518 <?php foreach ($this->view->options as $group_key => $group) { ?>
420 519 <?php if (isset($group['name'])) { ?>
421 - <li><h4><?php echo $group['name']; ?>:</h4></li>
520 + <li><h4><?php echo esc_html($group['name']); ?>:</h4></li>
422 521 <?php } ?>
423 522 <?php foreach ($group['options'] as $option_key => $option_value) { ?>
424 523 <li>
425 524 <div class="e2pdf-name">
426 - <?php echo $option_value['name']; ?>:
525 + <?php echo esc_html($option_value['name']); ?>:
427 526 </div><div class="e2pdf-value">
428 527 <?php
429 528 if ($option_value['type'] == 'checkbox') {
430 529 $this->render('field', 'checkbox', array(
@@ -476,8 +575,7 @@
476 575 </form>
477 576 </div>
478 577 <?php } ?>
479 578 <?php } else { ?>
480 - <?php $this->error(); ?>
579 + <?php $this->handle_404(); ?>
481 580 <?php } ?>
482 -</div>
483 -<?php $this->render('blocks', 'debug-panel'); ?>
581 +</div>