admin-settings.php 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <?php if (!defined('ABSPATH')) {
  2. exit;
  3. } ?>
  4. <script>
  5. var dp_ajax_url = "<?php echo admin_url( 'admin-ajax.php' );?>";
  6. </script>
  7. <?php $this->custom_assets();
  8. ?>
  9. <div class="wrap duplicate_page_settings">
  10. <?php $this->load_help_desk(); ?>
  11. <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>
  12. <?php $duplicatepageoptions = array();
  13. $opt = get_option('duplicate_page_options');
  14. $msg = isset($_GET['msg']) ? $_GET['msg'] : '';
  15. if (isset($_POST['submit_duplicate_page']) && wp_verify_nonce($_POST['duplicatepage_nonce_field'], 'duplicatepage_action')):
  16. _e('<strong>Saving Please wait...</strong>', 'duplicate-page');
  17. $needToUnset = array('submit_duplicate_page'); //no need to save in Database
  18. foreach ($needToUnset as $noneed):
  19. unset($_POST[$noneed]);
  20. endforeach;
  21. foreach ($_POST as $key => $val):
  22. $duplicatepageoptions[$key] = $val;
  23. endforeach;
  24. $saveSettings = update_option('duplicate_page_options', $duplicatepageoptions);
  25. if ($saveSettings) {
  26. duplicate_page::dp_redirect('options-general.php?page=duplicate_page_settings&msg=1');
  27. } else {
  28. duplicate_page::dp_redirect('options-general.php?page=duplicate_page_settings&msg=2');
  29. }
  30. endif;
  31. if (!empty($msg) && $msg == 1):
  32. _e('<div class="updated settings-error notice is-dismissible" id="setting-error-settings_updated">
  33. <p><strong>Settings saved.</strong></p><button class="notice-dismiss" type="button"><span class="screen-reader-text">Dismiss this notice.</span></button></div>', 'duplicate-page');
  34. elseif (!empty($msg) && $msg == 2):
  35. _e('<div class="error settings-error notice is-dismissible" id="setting-error-settings_updated">
  36. <p><strong>Settings not saved.</strong></p><button class="notice-dismiss" type="button"><span class="screen-reader-text">Dismiss this notice.</span></button></div>', 'duplicate-page');
  37. endif;
  38. ?>
  39. <div id="poststuff">
  40. <div id="post-body" class="metabox-holder columns-2">
  41. <div id="post-body-content" style="position: relative;">
  42. <form action="" method="post" name="duplicate_page_form">
  43. <?php wp_nonce_field('duplicatepage_action', 'duplicatepage_nonce_field'); ?>
  44. <table class="form-table">
  45. <tbody>
  46. <tr>
  47. <th scope="row"><label for="duplicate_post_editor"><?php _e('Choose Editor', 'duplicate-page'); ?></label></th>
  48. <td>
  49. <select id="duplicate_post_editor" name="duplicate_post_editor">
  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 your 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 current 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']) ? $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="Save Changes" class="button button-primary" id="submit" name="submit_duplicate_page"></p>
  86. </form>
  87. </div>
  88. <div id="postbox-container-1" class="postbox-container">
  89. <div id="side-sortables" class="meta-box-sortables ui-sortable">
  90. <div id="submitdiv" class="postbox" style="padding: 6px;">
  91. <p><strong style="color:#F00"><?php _e('Contribute some donation, to make plugin more stable. You can pay amount of your choice.', 'duplicate-page'); ?></strong></p>
  92. <form name="_xclick" action="https://www.paypal.com/yt/cgi-bin/webscr" method="post">
  93. <input type="hidden" name="cmd" value="_xclick">
  94. <input type="hidden" name="business" value="yogesh72564@gmail.com">
  95. <input type="hidden" name="item_name" value="Duplicate Page Plugin - Donation">
  96. <input type="hidden" name="currency_code" value="USD">
  97. <code>$</code> <input type="text" name="amount" value="" required="required" placeholder="Enter amount">
  98. <input type="image" src="http://www.paypal.com/en_US/i/btn/x-click-butcc-donate.gif" border="0" name="submit" alt="Make Donations with Paypal">
  99. </form>
  100. <hr />
  101. </div>
  102. </div>
  103. </div>
  104. </div>
  105. </div>
  106. </div>