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 +208 -119 1.01.01 → 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,69 +101,113 @@
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->ID; ?>" class="iedit author-self level-0 post-<?php echo $template->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->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->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->ID)); ?>"><?php echo $template->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->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->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->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->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->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->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->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->item) { ?><a target="_blank" href="<?php echo $template->item_url; ?>"><?php echo $template->item_name; ?></a><?php } else { ?>—<?php } ?></div>
127 - <div class="e2pdf-small"><?php echo $template->extension; ?></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 -
130 177 <td class="shortcode column-shortcode" data-colname="Shortcode">
131 178 <div class="e2pdf-rel e2pdf-closed">
132 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>
133 180 <div class="e2pdf-hidden-dropdown-content">
134 181 <div class="misc-pub-section misc-pub-e2pdf-shortcode">
135 - <input placeholder="<?php _e('Shortcode', 'e2pdf') ?>" class="e2pdf-center e2pdf-copy-field" type="text" readonly="readonly" value='[e2pdf-attachment id="<?php echo $template->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'); ?>"]'>
136 183 </div>
137 184 <div class="misc-pub-section misc-pub-e2pdf-shortcode">
138 - <input placeholder="<?php _e('Shortcode', 'e2pdf') ?>" class="e2pdf-center e2pdf-copy-field" type="text" readonly="readonly" value='[e2pdf-download id="<?php echo $template->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'); ?>"]'>
139 186 </div>
140 187 <div class="misc-pub-section misc-pub-e2pdf-shortcode">
141 - <input placeholder="<?php _e('Shortcode', 'e2pdf') ?>" class="e2pdf-center e2pdf-copy-field" type="text" readonly="readonly" value='[e2pdf-save id="<?php echo $template->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'); ?>"]'>
142 189 </div>
143 190 <div class="misc-pub-section misc-pub-e2pdf-shortcode">
144 - <input placeholder="<?php _e('Shortcode', 'e2pdf') ?>" class="e2pdf-center e2pdf-copy-field" type="text" readonly="readonly" value='[e2pdf-view id="<?php echo $template->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'); ?>"]'>
145 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>
146 196 </div>
147 197 </div>
148 198 </td>
149 199 <td class="updated column-updated" data-colname="<?php _e('Updated', 'e2pdf') ?>">
150 - <abbr title="<?php echo $template->updated_at; ?>"><?php echo $template->updated_at; ?></abbr>
151 - <div class="e2pdf-small">by <strong><?php echo get_userdata($template->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>
152 202 </td>
153 203 <td class="author column-activation" data-colname="Activation">
154 - <?php if ($template->activated) { ?>
155 - <a class="e2pdf-color-green" href="<?php echo $this->helper->get_url(array('page' => 'e2pdf-templates', 'action' => 'deactivate', 'id' => $template->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>
156 - <?php } else { ?>
157 - <a class="e2pdf-color-red" href="<?php echo $this->helper->get_url(array('page' => 'e2pdf-templates', 'action' => 'activate', 'id' => $template->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>
158 - <?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>
159 210 </td>
160 211 </tr>
161 212 <?php } ?>
162 213 <?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,81 @@
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 }
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 + ));
230 289 ?>
231 - <br class="clear">
290 + <div class="clear"></div>
232 291 </div>
233 292 </form>
234 - <br class="clear">
293 + <div class="clear"></div>
294 + <?php $this->render('blocks', 'debug-panel'); ?>
235 295 <?php } elseif ($this->get->get('action')) { ?>
236 296 <?php if ($this->get->get('action') === 'create' || ($this->get->get('action') === 'edit' && $this->view->template)) { ?>
237 - <h1><?php $this->get->get('action') === 'edit' ? _e('Edit Template', 'e2pdf') : _e('New Template', 'e2pdf'); ?>
238 - <a href="<?php echo ($this->helper->get_url(array('page' => 'e2pdf-templates', 'action' => 'create'))); ?>" class="page-title-action">
239 - <?php _e('Add new', 'e2pdf') ?>
240 - </a>
241 - </h1>
242 - <hr class="wp-header-end">
243 - <?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 } ?>
244 308 <div id="poststuff">
245 - <form method="post" id="e2pdf_build_form">
309 + <form method="post" id="e2pdf-build-form">
246 310 <div id="post-body" class="metabox-holder columns-2">
247 - <div id="post-body-content">
311 + <div id="post-body-content" class="e2pdf-post-body-content">
248 312 <div class="e2pdf-form-builder">
249 - <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'); ?>">
250 314 <input type="hidden" name="sub_action" value="<?php echo $this->get->get('action') === 'create' ? 'create' : 'edit'; ?>">
251 315 <?php if ($this->view->template->get('ID')) { ?>
252 - <input type="hidden" name="ID" value="<?php echo $this->view->template->get('ID'); ?>">
253 - <input type="hidden" name="width" value="<?php echo $this->view->template->get('width'); ?>">
254 - <input type="hidden" name="height" value="<?php echo $this->view->template->get('height'); ?>">
255 - <input type="hidden" name="extension" value="<?php echo $this->view->template->get('extension'); ?>">
256 - <input type="hidden" name="item" value="<?php echo $this->view->template->get('item'); ?>">
257 - <input type="hidden" name="pdf" value="<?php echo $this->view->template->get('pdf'); ?>">
258 - <input type="hidden" name="format" value="<?php echo $this->view->template->get('format'); ?>">
259 -
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')); ?>">
260 326 <?php } ?>
261 - <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 } ?>
262 339 <div id="e2pdf-form-editor-container" class="e2pdf-form-editor-container">
263 340 <div id="titlediv">
264 341 <?php
265 342 $this->render('field', 'text', array(
266 343 'field' => array(
344 + 'id' => 'e2pdf-title',
267 345 'name' => 'title',
268 - 'placeholder' => 'Enter title here'
346 + 'placeholder' => __('Template Title', 'e2pdf'),
347 + 'class' => 'e2pdf-w100'
269 348 ),
270 349 'value' => $this->view->template->get('title'),
271 - 'id' => 'title',
272 350 ));
273 351 ?>
274 352 </div>
275 353 <?php
@@ -276,43 +354,45 @@
276 354 $this->render('blocks', 'wysiwyg');
277 355 ?>
278 356 <div class="clear"></div>
279 357 </div>
280 -
281 -
282 358 <div class="e2pdf-tpl-wrapper">
283 - <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'); ?>">
284 - <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">
285 361 <?php if ($this->get->get('action') === 'edit') { ?>
286 362 <?php $fonts = $this->view->template->get('fonts'); ?>
287 363 <?php foreach ($fonts as $font_key => $font) { ?>
288 - <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>
289 365 <?php } ?>
290 366 <?php $pages = $this->view->template->get('pages'); ?>
291 367 <?php foreach ($pages as $page_key => $page) { ?>
292 - <div data-page_id="<?php echo $page['page_id']; ?>" class="e2pdf-page ui-droppable e2pdf-load-page" 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 } ?>">
293 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>
294 370 <?php foreach ($page['elements'] as $key => $value) { ?>
295 - <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>
296 377 <?php } ?>
297 - <div class="e2pdf-data-actions e2pdf-hide"><?php echo htmlspecialchars(json_encode($page['actions'], JSON_FORCE_OBJECT)); ?></div>
298 - <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>
299 380 <div class="e2pdf-guide e2pdf-guide-h"></div>
300 381 <div class="e2pdf-guide e2pdf-guide-v"></div>
301 - </div>
382 + </div>
302 383 <?php } ?>
303 384 <?php } ?>
304 -
305 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>
306 390 </div>
307 -
308 391 </div>
309 392 <?php $this->render('blocks', 'bottom-panel'); ?>
310 393 </div>
311 -
312 394 </div>
313 -
314 -
315 395 </div>
316 396 <div id="postbox-container-1" class="postbox-container e2pdf-templates-meta-boxes">
317 397 <?php
318 398 wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false);
@@ -321,8 +401,9 @@
321 401 <?php
322 402 do_meta_boxes(null, 'side', null);
323 403 ?>
324 404 </div>
405 + <div class="clear"></div>
325 406 </div>
326 407 </form>
327 408 </div>
328 409 <?php } elseif ($this->get->get('action') === 'import') { ?>
@@ -330,24 +411,24 @@
330 411 <hr class="wp-header-end">
331 412 <?php $this->render('blocks', 'notifications'); ?>
332 413 <div id="poststuff" class="e2pdf-view-area">
333 414 <form enctype="multipart/form-data" method="post">
334 - <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'); ?>">
335 416 <ul class="e2pdf-options-list">
336 417 <li><div class="e2pdf-name"><?php _e('Template', 'e2pdf'); ?>:
337 - </div><div class="e2pdf-value"><input name="template" type="file">
338 - <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>
339 421 </div>
340 422 </li>
341 -
342 423 <?php foreach ($this->view->options as $group_key => $group) { ?>
343 424 <?php if (isset($group['name'])) { ?>
344 - <li><h4><?php echo $group['name']; ?>:</h4></li>
425 + <li><h4><?php echo esc_html($group['name']); ?>:</h4></li>
345 426 <?php } ?>
346 427 <?php foreach ($group['options'] as $option_key => $option_value) { ?>
347 - <li>
428 + <li class="<?php echo isset($option_value['li']['class']) ? esc_attr($option_value['li']['class']) : '' ?>" >
348 429 <div class="e2pdf-name">
349 - <?php echo $option_value['name']; ?>:
430 + <?php echo esc_html($option_value['name']); ?>:
350 431 </div><div class="e2pdf-value">
351 432 <?php
352 433 if ($option_value['type'] == 'checkbox') {
353 434 $this->render('field', 'checkbox', array(
@@ -353,9 +434,11 @@
353 434 $this->render('field', 'checkbox', array(
354 435 'field' => array(
355 436 'name' => $option_value['key'],
356 437 'placeholder' => $option_value['placeholder'],
357 - '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'] : ''
358 441 ),
359 442 'value' => $option_value['value'],
360 443 'checkbox_value' => 1,
361 444 'default_value' => $option_value['default_value'],
@@ -382,13 +465,21 @@
382 465 } elseif ($option_value['type'] == 'select') {
383 466 $this->render('field', 'select', array(
384 467 'field' => array(
385 468 'name' => $option_value['key'],
386 - 'class' => 'e2pdf-w100'
469 + 'class' => $option_value['key'] == 'options[overwrite]' ? 'e2pdf-import-overwrite e2pdf-w100' : 'e2pdf-w100'
387 470 ),
388 471 'value' => $option_value['value'],
389 472 'options' => $option_value['options']
390 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 + ));
391 482 }
392 483 ?>
393 484 </div>
394 485 </li>
@@ -397,43 +488,42 @@
397 488 </ul>
398 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>
399 490 </form>
400 491 </div>
401 - <?php } elseif ($this->get->get('action') === 'backup') { ?>
402 - <h1><?php _e('Backup', 'e2pdf'); ?></h1>
492 + <?php } elseif ($this->get->get('action') === 'download') { ?>
493 + <h1><?php _e('Download', 'e2pdf'); ?></h1>
403 494 <hr class="wp-header-end">
404 495 <?php $this->render('blocks', 'notifications'); ?>
405 496 <div id="poststuff" class="e2pdf-view-area">
406 497 <form method="post">
407 - <input type="hidden" name="_nonce" value="<?php echo wp_create_nonce('e2pdf_post') ?>">
408 - <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'); ?>">
409 500 <ul class="e2pdf-options-list">
410 501 <li><div class="e2pdf-name"><?php _e('Extension', 'e2pdf'); ?>:
411 502 </div><div class="e2pdf-value">
412 - <?php echo $this->view->template->get('extension'); ?>
503 + <?php if ($this->view->template->extension()->method('info')) { ?>
504 + <?php echo esc_html($this->view->template->extension()->info('title')); ?>
505 + <?php } ?>
413 506 </div>
414 507 </li>
415 508 <li><div class="e2pdf-name"><?php _e('Template', 'e2pdf'); ?>:
416 509 </div><div class="e2pdf-value">
417 - <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>
418 511 </div>
419 512 </li>
420 - <li><div class="e2pdf-name"><?php _e('Item', 'e2pdf'); ?>:
513 + <li><div class="e2pdf-name"><?php _e('Connection', 'e2pdf'); ?>:
421 514 </div><div class="e2pdf-value">
422 - <a target="_blank" href="<?php echo $this->view->template->get('item_url'); ?>"><?php echo $this->view->template->get('item_name'); ?></a>
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 } ?>
423 516 </div>
424 517 </li>
425 -
426 -
427 -
428 518 <?php foreach ($this->view->options as $group_key => $group) { ?>
429 519 <?php if (isset($group['name'])) { ?>
430 - <li><h4><?php echo $group['name']; ?>:</h4></li>
520 + <li><h4><?php echo esc_html($group['name']); ?>:</h4></li>
431 521 <?php } ?>
432 522 <?php foreach ($group['options'] as $option_key => $option_value) { ?>
433 523 <li>
434 524 <div class="e2pdf-name">
435 - <?php echo $option_value['name']; ?>:
525 + <?php echo esc_html($option_value['name']); ?>:
436 526 </div><div class="e2pdf-value">
437 527 <?php
438 528 if ($option_value['type'] == 'checkbox') {
439 529 $this->render('field', 'checkbox', array(
@@ -485,8 +575,7 @@
485 575 </form>
486 576 </div>
487 577 <?php } ?>
488 578 <?php } else { ?>
489 - <?php $this->error(); ?>
579 + <?php $this->handle_404(); ?>
490 580 <?php } ?>
491 -</div>
492 -<?php $this->render('blocks', 'debug-panel'); ?>
581 +</div>