PluginProbe ʕ •ᴥ•ʔ
Duplicate Page / 4.5
Duplicate Page v4.5
trunk 1.1 2.5 4.4.9 4.5
duplicate-page / inc / admin-settings.php
duplicate-page / inc Last commit date
admin-settings.php 3 years ago
admin-settings.php
91 lines
1 <?php if (!defined('ABSPATH') && !current_user_can('manage_options')) {
2 exit;
3 }
4 $this->custom_assets();
5 ?>
6 <div class="wrap duplicate_page_settings">
7 <?php
8 $this->load_help_desk(); ?>
9 <h1><?php _e('Duplicate Page Settings ', 'duplicate-page'); ?><a href="https://duplicatepro.com/pro/" target="_blank" class="button button-primary"><?php _e('Buy PRO', 'duplicate-page'); ?></a></h1>
10 <?php
11 $msg = isset($_GET['msg']) ? intval($_GET['msg']) : '';
12 if (current_user_can('manage_options') && isset($_POST['submit_duplicate_page']) && wp_verify_nonce(sanitize_text_field($_POST['duplicatepage_nonce_field']), 'duplicatepage_action')):
13 _e('<div class="saving-txt"><strong>Saving Please wait...</strong></div>','duplicate-page');
14 $duplicatepageoptions = array(
15 "duplicate_post_editor" => sanitize_text_field(htmlentities($_POST["duplicate_post_editor"])),
16 "duplicate_post_status" => sanitize_text_field(htmlentities($_POST["duplicate_post_status"])),
17 "duplicate_post_redirect" => sanitize_text_field(htmlentities($_POST["duplicate_post_redirect"])),
18 "duplicate_post_suffix" => sanitize_text_field(htmlentities($_POST["duplicate_post_suffix"]))
19 );
20
21 $saveSettings = update_option('duplicate_page_options', $duplicatepageoptions);
22 if ($saveSettings) {
23 duplicate_page::dp_redirect('options-general.php?page=duplicate_page_settings&msg=1');
24 } else {
25 duplicate_page::dp_redirect('options-general.php?page=duplicate_page_settings&msg=2');
26 }
27 endif;
28
29 $opt = get_option('duplicate_page_options');
30 if (!empty($msg) && $msg == 1):
31 _e('<div class="updated settings-error notice is-dismissible" id="setting-error-settings_updated">
32 <p><strong>Settings saved.</strong></p><button class="notice-dismiss button-custom-dismiss" type="button"><span class="screen-reader-text">Dismiss this notice</span></button></div>','duplicate-page');
33 elseif (!empty($msg) && $msg == 2):
34 _e('<div class="error settings-error notice is-dismissible" id="setting-error-settings_updated">
35 <p><strong>Settings not saved.</strong></p><button class="notice-dismiss button-custom-dismiss" type="button"><span class="screen-reader-text">Dismiss this notice</span></button></div>','duplicate-page');
36 endif;
37 ?>
38 <div id="poststuff">
39 <div id="post-body" class="metabox-holder columns-2">
40 <div id="post-body-content" style="position: relative;">
41 <form action="" method="post" name="duplicate_page_form">
42 <?php wp_nonce_field('duplicatepage_action', 'duplicatepage_nonce_field'); ?>
43 <table class="form-table">
44 <tbody>
45 <tr>
46 <th scope="row"><label for="duplicate_post_editor"><?php _e('Choose Editor', 'duplicate-page'); ?></label></th>
47 <td>
48 <select id="duplicate_post_editor" name="duplicate_post_editor">
49 <option value="all" <?php echo (isset($opt['duplicate_post_editor']) && $opt['duplicate_post_editor'] == 'all') ? "selected = 'selected'" : ''; ?>><?php _e('All Editors', 'duplicate-page'); ?></option>
50 <option value="classic" <?php echo (isset($opt['duplicate_post_editor']) && $opt['duplicate_post_editor'] == 'classic') ? "selected = 'selected'" : ''; ?>><?php _e('Classic Editor', 'duplicate-page'); ?></option>
51 <option value="gutenberg" <?php echo (isset($opt['duplicate_post_editor']) && $opt['duplicate_post_editor'] == 'gutenberg') ? "selected = 'selected'" : ''; ?>><?php _e('Gutenberg Editor', 'duplicate-page'); ?></option>
52 </select>
53 <p><?php _e('Please select which editor you are using.<strong> Default: </strong> Classic Editor', 'duplicate-page'); ?></p>
54 </td>
55 </tr>
56 <tr>
57 <th scope="row"><label for="duplicate_post_status"><?php _e('Duplicate Post Status', 'duplicate-page'); ?></label></th>
58 <td>
59 <select id="duplicate_post_status" name="duplicate_post_status">
60 <option value="draft" <?php echo($opt['duplicate_post_status'] == 'draft') ? "selected = 'selected'" : ''; ?>><?php _e('Draft', 'duplicate-page'); ?></option>
61 <option value="publish" <?php echo($opt['duplicate_post_status'] == 'publish') ? "selected = 'selected'" : ''; ?>><?php _e('Publish', 'duplicate-page'); ?></option>
62 <option value="private" <?php echo($opt['duplicate_post_status'] == 'private') ? "selected = 'selected'" : ''; ?>><?php _e('Private', 'duplicate-page'); ?></option>
63 <option value="pending" <?php echo($opt['duplicate_post_status'] == 'pending') ? "selected = 'selected'" : ''; ?>><?php _e('Pending', 'duplicate-page'); ?></option>
64 </select>
65 <p><?php _e('Please select any post status you want to assign for duplicate post.<strong> Default: </strong> Draft','duplicate-page'); ?></p>
66 </td>
67 </tr>
68 <tr>
69 <th scope="row"><label for="duplicate_post_redirect"><?php _e('Redirect to after click on <strong>Duplicate This Link</strong>', 'duplicate-page'); ?></label></th>
70 <td><select id="duplicate_post_redirect" name="duplicate_post_redirect">
71 <option value="to_list" <?php echo($opt['duplicate_post_redirect'] == 'to_list') ? "selected = 'selected'" : ''; ?>><?php _e('To All Posts List', 'duplicate-page'); ?></option>
72 <option value="to_page" <?php echo($opt['duplicate_post_redirect'] == 'to_page') ? "selected = 'selected'" : ''; ?>><?php _e('To Duplicate Edit Screen', 'duplicate-page'); ?></option>
73 </select>
74 <p><?php _e('Please select any post redirection, redirect you to selected after click on duplicate this link.<strong> Default: </strong>To All Posts List','duplicate-page'); ?></p>
75 </td>
76 </tr>
77 <tr>
78 <th scope="row"><label for="duplicate_post_suffix"><?php _e('Duplicate Post Suffix', 'duplicate-page'); ?></label></th>
79 <td>
80 <input type="text" class="regular-text" value="<?php echo !empty($opt['duplicate_post_suffix']) ? esc_attr($opt['duplicate_post_suffix']) : ''; ?>" id="duplicate_post_suffix" name="duplicate_post_suffix">
81 <p><?php _e('Add a suffix for duplicate or clone post as Copy, Clone etc. It will show after title.', 'duplicate-page'); ?></p>
82 </td>
83 </tr>
84 </tbody></table>
85 <p class="submit"><input type="submit" value="<?php _e('Save Changes','duplicate-page'); ?>" class="button button-primary" id="submit" name="submit_duplicate_page"></p>
86 </form>
87 </div>
88 </div>
89 </div>
90 </div>
91