index.php 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. <?php
  2. defined('ABSPATH') || exit;
  3. require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
  4. $controls = new NewsletterControls();
  5. $module = NewsletterProfile::instance();
  6. $current_language = $module->get_current_language();
  7. $is_all_languages = $module->is_all_languages();
  8. if (!$is_all_languages) {
  9. $controls->warnings[] = 'You are configuring the language "<strong>' . $current_language . '</strong>". Switch to "all languages" to see every options.';
  10. }
  11. // Profile options are still inside the main options
  12. if ($controls->is_action()) {
  13. if ($controls->is_action('save')) {
  14. $module->save_options($controls->data, '', null, $current_language);
  15. $controls->add_message_saved();
  16. }
  17. if ($controls->is_action('reset')) {
  18. $module->reset_options();
  19. $controls->data = $module->get_options('', $current_language);
  20. $controls->add_message_reset();
  21. }
  22. } else {
  23. $controls->data = $module->get_options('', $current_language);
  24. }
  25. ?>
  26. <div class="wrap tnp-profile tnp-profile-index" id="tnp-wrap">
  27. <?php include NEWSLETTER_DIR . '/tnp-header.php'; ?>
  28. <div id="tnp-heading">
  29. <h2><?php _e('The subscriber profile page', 'newsletter') ?></h2>
  30. <?php $controls->page_help('https://www.thenewsletterplugin.com/documentation/profile-page') ?>
  31. </div>
  32. <div id="tnp-body">
  33. <form id="channel" method="post" action="">
  34. <?php $controls->init(); ?>
  35. <div id="tabs">
  36. <ul>
  37. <li><a href="#tabs-general"><?php _e('General', 'newsletter') ?></a></li>
  38. <li><a href="#tabs-export"><?php _e('Subscriber data export', 'newsletter') ?></a></li>
  39. </ul>
  40. <div id="tabs-general">
  41. <table class="form-table">
  42. <tr>
  43. <th><?php _e('Profile page', 'newsletter') ?>
  44. <br><?php $controls->help('https://www.thenewsletterplugin.com/documentation/subscription#profile') ?>
  45. </th>
  46. <td>
  47. <?php $controls->wp_editor('text'); ?>
  48. </td>
  49. </tr>
  50. <tr>
  51. <th><?php _e('Alternative profile page URL', 'newsletter') ?></th>
  52. <td>
  53. <?php $controls->text('url', 70); ?>
  54. </td>
  55. </tr>
  56. </table>
  57. <h3><?php _e('Messages', 'newsletter') ?></h3>
  58. <table class="form-table">
  59. <tr>
  60. <th><?php _e('Profile saved', 'newsletter') ?></th>
  61. <td>
  62. <?php $controls->text('saved', 80); ?>
  63. </td>
  64. </tr>
  65. <tr>
  66. <tr>
  67. <th><?php _e('Email changed alert', 'newsletter') ?></th>
  68. <td>
  69. <?php $controls->text('email_changed', 80); ?>
  70. </td>
  71. </tr>
  72. <tr>
  73. <tr>
  74. <tr>
  75. <th><?php _e('General error', 'newsletter') ?></th>
  76. <td>
  77. <?php $controls->text('error', 80); ?>
  78. </td>
  79. </tr>
  80. </table>
  81. <h3><?php _e('Labels', 'newsletter') ?></h3>
  82. <table class="form-table">
  83. <tr>
  84. <th><?php _e('"Save" label', 'newsletter') ?></th>
  85. <td>
  86. <?php $controls->text('save_label'); ?>
  87. </td>
  88. </tr>
  89. <tr>
  90. <th><?php _e('Privacy link text', 'newsletter') ?></th>
  91. <td>
  92. <?php $controls->text('privacy_label', 80); ?>
  93. <p class="description">
  94. </p>
  95. </td>
  96. </tr>
  97. </table>
  98. </div>
  99. <div id="tabs-export">
  100. <?php if ($is_all_languages) { ?>
  101. <table class="form-table">
  102. <tr>
  103. <th>
  104. <?php _e('Log of sent newsletters', 'newsletter') ?>
  105. </th>
  106. <td>
  107. <?php $controls->yesno('export_newsletters'); ?>
  108. </td>
  109. </tr>
  110. </table>
  111. <?php } else { ?>
  112. <p>Switch to "All languages" to manage these options.</p>
  113. <?php } ?>
  114. </div>
  115. </div>
  116. <p>
  117. <?php $controls->button_save() ?>
  118. <?php $controls->button_reset() ?>
  119. </p>
  120. </form>
  121. </div>
  122. <?php include NEWSLETTER_DIR . '/tnp-footer.php'; ?>
  123. </div>