| 1 |
<?php |
| 2 |
if (!defined('ABSPATH')) { |
| 3 |
die('Access denied.'); |
| 4 |
} |
| 5 |
?> |
| 6 |
<div class="wrap"> |
| 7 |
<h1><?php _e('Settings', 'e2pdf'); ?></h1> |
| 8 |
<hr class="wp-header-end"> |
| 9 |
<?php $this->render('blocks', 'notifications'); ?> |
| 10 |
<?php if ($this->get->get('group') == 'woocommerce_group') { ?> |
| 11 |
<div id="message" class="e2pdf-notice notice notice-warning"> |
| 12 |
<p><?php _e("It's recommended to use the Integration Hooks in the E2Pdf Template settings instead", 'e2pdf'); ?></p> |
| 13 |
</div> |
| 14 |
<?php } ?> |
| 15 |
<h3 class="nav-tab-wrapper wp-clearfix"> |
| 16 |
<?php foreach ($this->view->groups as $group_key => $group) { ?> |
| 17 |
<?php if (isset($group['action']) && isset($group['group'])) { ?> |
| 18 |
<a href="<?php echo esc_url($this->helper->get_url(array('page' => 'e2pdf-settings', 'action' => $group['action'], 'group' => $group['group']))); ?>" class="nav-tab <?php if ($this->get->get('action') === $group['action'] && $this->get->get('group') === $group['group']) { ?>nav-tab-active<?php } ?>"><?php echo esc_html($group['name']); ?></a> |
| 19 |
<?php } elseif (isset($group['action'])) { ?> |
| 20 |
<a href="<?php echo esc_url($this->helper->get_url(array('page' => 'e2pdf-settings', 'action' => $group['action']))); ?>" class="nav-tab <?php if ($this->get->get('action') === $group['action']) { ?>nav-tab-active<?php } ?>"><?php echo esc_html($group['name']); ?></a> |
| 21 |
<?php } else { ?> |
| 22 |
<a href="<?php echo esc_url($this->helper->get_url(array('page' => 'e2pdf-settings'))); ?>" class="nav-tab <?php if (!$this->get->get('action')) { ?>nav-tab-active<?php } ?>"><?php echo esc_html($group['name']); ?></a> |
| 23 |
<?php } ?> |
| 24 |
<?php } ?> |
| 25 |
</h3> |
| 26 |
<div class="wrap"> |
| 27 |
<?php if ($this->get->get('action') == 'fonts') { ?> |
| 28 |
<div class="e2pdf-view-area"> |
| 29 |
<form enctype="multipart/form-data" method="post"> |
| 30 |
<input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce('e2pdf_settings'); ?>"> |
| 31 |
<ul class="e2pdf-fonts-upload"> |
| 32 |
<li><h4><?php _e('Upload Font', 'e2pdf'); ?>:</h4></li> |
| 33 |
<li> |
| 34 |
<div class="e2pdf-name"><?php _e('Font', 'e2pdf'); ?>: |
| 35 |
</div><div class="e2pdf-value"> |
| 36 |
<input name="font" type="file" accept=".<?php echo esc_attr(implode(', .', $this->view->allowed_extensions)); ?>"> |
| 37 |
<div class="e2pdf-note"><?php _e('Allowed File Types', 'e2pdf'); ?>: <strong>.<?php echo esc_html(implode(', .', $this->view->allowed_extensions)); ?></strong></div> |
| 38 |
<div class="e2pdf-note"><?php _e('Max Upload File Size', 'e2pdf'); ?>: <strong><?php echo esc_html($this->view->upload_max_filesize); ?></strong></div> |
| 39 |
</div> |
| 40 |
</li> |
| 41 |
<li> |
| 42 |
<div class="e2pdf-name"></div><div class="e2pdf-value"> |
| 43 |
<input class="button-primary button-large" type="submit" value="<?php _e('Upload', 'e2pdf'); ?>"> |
| 44 |
</div> |
| 45 |
</li> |
| 46 |
</ul> |
| 47 |
</form> |
| 48 |
<div class="e2pdf-rel"> |
| 49 |
<form> |
| 50 |
<ul class="e2pdf-fonts-list"> |
| 51 |
<li></li> |
| 52 |
<?php foreach ($this->view->fonts as $key => $value) { ?> |
| 53 |
<li> |
| 54 |
<div class="e2pdf-name"> |
| 55 |
<strong><?php echo esc_html($value); ?></strong> (<?php echo esc_html($key); ?>) |
| 56 |
</div><div class="e2pdf-value"> |
| 57 |
<?php echo in_array(md5_file($this->helper->get('fonts_dir') . $key), $this->view->cached_fonts) ? '<i class="dashicons dashicons-cloud-saved"></i>' : ''; ?> |
| 58 |
<a class="e2pdf-link" href="<?php echo esc_url($this->helper->get_upload_url('fonts/' . $key)); ?>" target="_blank"><i class="dashicons dashicons-download"></i></a> |
| 59 |
<?php if ($key === 'NotoSans-Regular.ttf') { ?> |
| 60 |
<a class="e2pdf-link" disabled="disabled" data-font="<?php echo esc_attr($key); ?>" href="javascript:void(0);"><i class="dashicons dashicons-no"></i></a> |
| 61 |
<?php } else { ?> |
| 62 |
<a class="e2pdf-link e2pdf-delete-font" data-font="<?php echo esc_attr($key); ?>" href="javascript:void(0);" _wpnonce="<?php echo wp_create_nonce('e2pdf_settings'); ?>"><i class="dashicons dashicons-no"></i></a> |
| 63 |
<?php } ?> |
| 64 |
</div> |
| 65 |
|
| 66 |
</li> |
| 67 |
<?php } ?> |
| 68 |
</ul> |
| 69 |
</form> |
| 70 |
</div> |
| 71 |
</div> |
| 72 |
<?php } elseif ($this->get->get('action') == 'permissions') { ?> |
| 73 |
<div class="e2pdf-view-area"> |
| 74 |
<form enctype="multipart/form-data" method="post"> |
| 75 |
<input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce('e2pdf_settings'); ?>"> |
| 76 |
<ul class="e2pdf-permissions-list"> |
| 77 |
<?php foreach ($this->view->roles as $role_key => $role) { ?> |
| 78 |
<li> |
| 79 |
<div class="e2pdf-name"><?php echo esc_html($role['name']); ?>: |
| 80 |
</div><div class="e2pdf-value"> |
| 81 |
<?php |
| 82 |
foreach ($this->view->caps as $cap_key => $cap) { |
| 83 |
$this->render('field', 'checkbox', array( |
| 84 |
'field' => array( |
| 85 |
'name' => 'permissions[' . $role_key . '][' . $cap_key . ']', |
| 86 |
'placeholder' => $cap['name'] |
| 87 |
), |
| 88 |
'value' => isset($role['capabilities'][$cap_key]) && $role['capabilities'][$cap_key] ? true : false, |
| 89 |
'checkbox_value' => true, |
| 90 |
'default_value' => false, |
| 91 |
)); |
| 92 |
} |
| 93 |
?> |
| 94 |
</div> |
| 95 |
</li> |
| 96 |
<?php } ?> |
| 97 |
</ul> |
| 98 |
<?php submit_button(); ?> |
| 99 |
</form> |
| 100 |
|
| 101 |
</div> |
| 102 |
<?php } elseif ($this->get->get('action') == 'maintenance') { ?> |
| 103 |
<div class="e2pdf-view-area"> |
| 104 |
<ul class="e2pdf-options-list"> |
| 105 |
<li><h2><?php _e('Maintenance', 'e2pdf') ?></h2></li> |
| 106 |
<li> |
| 107 |
<div class="e2pdf-name"> |
| 108 |
<?php _e('Optimize DB', 'e2pdf'); ?>: |
| 109 |
</div><div class="e2pdf-value"> |
| 110 |
<form onsubmit="return confirm('<?php _e('Are you sure want to continue?', 'e2pdf') ?>');" method="post" action="<?php echo esc_url($this->helper->get_url(array('page' => 'e2pdf-settings', 'action' => 'maintenance'))); ?>"> |
| 111 |
<input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce('e2pdf_settings'); ?>"> |
| 112 |
<input type="hidden" name="e2pdf_db_optimize" value="1"> |
| 113 |
<input type="submit" name="submit" id="submit" class="button button-primary" value="»"> |
| 114 |
</form> |
| 115 |
</div> |
| 116 |
</li> |
| 117 |
<li> |
| 118 |
<div class="e2pdf-name"> |
| 119 |
<?php _e('Clear Recovery Mode Limit', 'e2pdf'); ?>: |
| 120 |
</div><div class="e2pdf-value"> |
| 121 |
<form onsubmit="return confirm('<?php _e('Are you sure want to continue?', 'e2pdf') ?>');" method="post" action="<?php echo esc_url($this->helper->get_url(array('page' => 'e2pdf-settings', 'action' => 'maintenance'))); ?>"> |
| 122 |
<input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce('e2pdf_settings'); ?>"> |
| 123 |
<input type="hidden" name="e2pdf_recovery_mode_limit" value="1"> |
| 124 |
<input type="submit" name="submit" id="submit" class="button button-primary" value="»"> |
| 125 |
</form> |
| 126 |
</div> |
| 127 |
</li> |
| 128 |
<li><h2><?php _e('Cache', 'e2pdf') ?></h2></li> |
| 129 |
<li> |
| 130 |
<div class="e2pdf-name"> |
| 131 |
<?php _e('Purge Objects Cache', 'e2pdf'); ?>: |
| 132 |
</div><div class="e2pdf-value"> |
| 133 |
<form onsubmit="return confirm('<?php _e('Are you sure want to continue?', 'e2pdf') ?>');" method="post" action="<?php echo esc_url($this->helper->get_url(array('page' => 'e2pdf-settings', 'action' => 'maintenance'))); ?>"> |
| 134 |
<input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce('e2pdf_settings'); ?>"> |
| 135 |
<input type="hidden" name="e2pdf_purge_objects_cache" value="1"> |
| 136 |
<input type="submit" name="submit" id="submit" class="button button-primary" value="»"> |
| 137 |
</form> |
| 138 |
</div> |
| 139 |
</li> |
| 140 |
<li> |
| 141 |
<div class="e2pdf-name"> |
| 142 |
<?php _e('Purge Fonts Cache', 'e2pdf'); ?>: |
| 143 |
</div><div class="e2pdf-value"> |
| 144 |
<form onsubmit="return confirm('<?php _e('Are you sure want to continue?', 'e2pdf') ?>');" method="post" action="<?php echo esc_url($this->helper->get_url(array('page' => 'e2pdf-settings', 'action' => 'maintenance'))); ?>"> |
| 145 |
<input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce('e2pdf_settings'); ?>"> |
| 146 |
<input type="hidden" name="e2pdf_purge_fonts_cache" value="1"> |
| 147 |
<input type="submit" name="submit" id="submit" class="button button-primary" value="»"> |
| 148 |
</form> |
| 149 |
</div> |
| 150 |
</li> |
| 151 |
<li> |
| 152 |
<div class="e2pdf-name"> |
| 153 |
<?php _e('Purge PDFs Cache', 'e2pdf'); ?>: |
| 154 |
</div><div class="e2pdf-value"> |
| 155 |
<form onsubmit="return confirm('<?php _e('Are you sure want to continue?', 'e2pdf') ?>');" method="post" action="<?php echo esc_url($this->helper->get_url(array('page' => 'e2pdf-settings', 'action' => 'maintenance'))); ?>"> |
| 156 |
<input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce('e2pdf_settings'); ?>"> |
| 157 |
<input type="hidden" name="e2pdf_purge_pdfs_cache" value="1"> |
| 158 |
<input type="submit" name="submit" id="submit" class="button button-primary" value="»"> |
| 159 |
</form> |
| 160 |
</div> |
| 161 |
</li> |
| 162 |
<li><hr></li> |
| 163 |
<li> |
| 164 |
<div class="e2pdf-name"> |
| 165 |
<?php _e('Purge Full Cache', 'e2pdf'); ?>: |
| 166 |
</div><div class="e2pdf-value"> |
| 167 |
<form onsubmit="return confirm('<?php _e('Are you sure want to continue?', 'e2pdf') ?>');" method="post" action="<?php echo esc_url($this->helper->get_url(array('page' => 'e2pdf-settings', 'action' => 'maintenance'))); ?>"> |
| 168 |
<input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce('e2pdf_settings'); ?>"> |
| 169 |
<input type="hidden" name="e2pdf_purge_cache" value="1"> |
| 170 |
<input type="submit" name="submit" id="submit" class="button button-primary" value="»"> |
| 171 |
</form> |
| 172 |
</div> |
| 173 |
</li> |
| 174 |
</ul> |
| 175 |
</div> |
| 176 |
<?php } else { ?> |
| 177 |
<div class="e2pdf-view-area"> |
| 178 |
<?php if (isset($group['action']) && isset($group['group'])) { ?> |
| 179 |
<form method="post" action="<?php echo esc_url($this->helper->get_url(array('page' => 'e2pdf-settings', 'action' => $this->get->get('action'), 'group' => $this->get->get('group')))); ?>"> |
| 180 |
<?php } elseif (isset($group['action'])) { ?> |
| 181 |
<form method="post" action="<?php echo esc_url($this->helper->get_url(array('page' => 'e2pdf-settings', 'action' => $this->get->get('action')))); ?>"> |
| 182 |
<?php } else { ?> |
| 183 |
<form method="post" action="<?php echo esc_url($this->helper->get_url(array('page' => 'e2pdf-settings'))); ?>"> |
| 184 |
<?php } ?> |
| 185 |
<input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce('e2pdf_settings'); ?>"> |
| 186 |
<ul class="e2pdf-options-list"> |
| 187 |
<?php |
| 188 |
$this->render('field', 'group', array( |
| 189 |
'groups' => $this->view->options |
| 190 |
)); |
| 191 |
?> |
| 192 |
</ul> |
| 193 |
<?php submit_button(); ?> |
| 194 |
</form> |
| 195 |
</div> |
| 196 |
<?php } ?> |
| 197 |
|
| 198 |
</div> |
| 199 |
</div> |
| 200 |
<?php $this->render('blocks', 'debug-panel'); ?> |