index.php 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <?php
  2. defined('ABSPATH') || exit;
  3. $list = NewsletterEmails::instance()->get_blocks();
  4. $blocks = array();
  5. foreach ($list as $key => $data) {
  6. if (!isset($blocks[$data['section']]))
  7. $blocks[$data['section']] = array();
  8. $blocks[$data['section']][$key]['name'] = $data['name'];
  9. $blocks[$data['section']][$key]['filename'] = $key;
  10. $blocks[$data['section']][$key]['icon'] = $data['icon'];
  11. }
  12. // order the sections
  13. $blocks = array_merge(array_flip(array('header', 'content', 'footer')), $blocks);
  14. // prepare the options for the default blocks
  15. $block_options = get_option('newsletter_main');
  16. /* @var $this NewsletterControls */
  17. ?>
  18. <style>
  19. .placeholder {
  20. border: 3px dashed #ddd!important;
  21. background-color: #eee!important;
  22. height: 50px;
  23. margin: 0;
  24. width: 100%;
  25. box-sizing: border-box!important;
  26. }
  27. #newsletter-builder-area-center-frame-content {
  28. min-height: 300px!important;
  29. }
  30. </style>
  31. <style>
  32. <?php echo NewsletterEmails::instance()->get_composer_css(); ?>
  33. </style>
  34. <div id="newsletter-builder">
  35. <div id="newsletter-builder-area" class="tnp-builder-column">
  36. <?php if ($tnpc_show_subject) { ?>
  37. <p>
  38. <?php $this->text('title', 60, 'Newsletter subject'); ?>
  39. <a href="#" class="tnp-suggest-button" onclick="tnp_suggest_subject(); return false;"><?php _e('Get ideas', 'newsletter') ?></a>
  40. </p>
  41. <?php } ?>
  42. <div id="newsletter-builder-area-center-frame-content">
  43. <!-- Composer content -->
  44. </div>
  45. </div>
  46. <div id="newsletter-builder-sidebar" class="tnp-builder-column">
  47. <div class="tnpc-tabs">
  48. <button class="tablinks" onclick="openTab(event, 'tnpc-blocks')" id="defaultOpen"><?php _e('Blocks', 'newsletter') ?></button>
  49. <?php /* <button class="tablinks" onclick="openTab(event, 'tnpc-general-options')"><?php _e('General Options', 'newsletter') ?></button> */ ?>
  50. <button class="tablinks" onclick="openTab(event, 'tnpc-mobile-tab')"><i class="fa fa-mobile"></i> <?php _e('Mobile Preview', 'newsletter') ?></button>
  51. <?php if ($show_test) { ?>
  52. <button class="tablinks" onclick="openTab(event, 'tnpc-test-tab')"><i class="fa fa-paper-plane"></i> <?php _e('Test', 'newsletter') ?></button>
  53. <?php } ?>
  54. </div>
  55. <div id="tnpc-blocks" class="tabcontent">
  56. <?php foreach ($blocks as $k => $section) { ?>
  57. <div class="newsletter-sidebar-add-buttons" id="sidebar-add-<?php echo $k ?>">
  58. <h4><span><?php echo ucfirst($k) ?></span></h4>
  59. <?php foreach ($section AS $key => $block) { ?>
  60. <div class="newsletter-sidebar-buttons-content-tab" data-id="<?php echo $key ?>" data-name="<?php echo esc_attr($block['name']) ?>">
  61. <img src="<?php echo $block['icon'] ?>" title="<?php echo esc_attr($block['name']) ?>">
  62. </div>
  63. <?php } ?>
  64. </div>
  65. <?php } ?>
  66. </div>
  67. <?php /* <div id="tnpc-general-options" class="tabcontent">
  68. <h4 class="tnpc-general-options-title"><?php _e('Background color', 'newsletter') ?></h4><?php $this->color('general-bgcolor') ?>
  69. <h4 class="tnpc-general-options-title"><?php _e('Title font', 'newsletter') ?></h4><?php $this->css_font('general-text-font') ?>
  70. <h4 class="tnpc-general-options-title"><?php _e('Text font', 'newsletter') ?></h4><?php $this->css_font('general-title-font') ?>
  71. <!-- Width? -->
  72. </div>*/ ?>
  73. <div id="tnpc-mobile-tab" class="tabcontent">
  74. <iframe id="tnpc-mobile-preview"></iframe>
  75. </div>
  76. <div id="tnpc-test-tab" class="tabcontent">
  77. <p><?php _e("Test subscribers:") ?></p>
  78. <ul>
  79. <?php foreach (NewsletterUsers::instance()->get_test_users() AS $user) { ?>
  80. <li><?php echo $user->email ?></li>
  81. <?php } ?>
  82. </ul>
  83. <button class="button-secondary" onclick="tnpc_test()"><?php _e("Send a test", 'newsletter') ?></button>
  84. <p>
  85. <a href="https://www.thenewsletterplugin.com/documentation/subscribers#test" target="_blank">
  86. <?php _e('Read more about test subscribers', 'newsletter') ?></a>
  87. </p>
  88. </div>
  89. <!-- Block options container (dynamically loaded -->
  90. <div id="tnpc-block-options">
  91. <div id="tnpc-block-options-buttons">
  92. <span id="tnpc-block-options-cancel" class="button-secondary"><?php _e("Cancel", "newsletter") ?></span>
  93. <span id="tnpc-block-options-save" class="button-primary"><?php _e("Apply", "newsletter") ?></span>
  94. </div>
  95. <form id="tnpc-block-options-form" onsubmit="return false;"></form>
  96. </div>
  97. </div>
  98. <div style="clear: both"></div>
  99. </div>
  100. <div style="display: none">
  101. <div id="newsletter-preloaded-export"></div>
  102. <div id="draggable-helper" style="width: 500px; border: 3px dashed #ddd; opacity: .7; background-color: #fff; text-align: center; text-transform: uppercase; font-size: 14px; color: #aaa; padding: 20px;"></div>
  103. <div id="sortable-helper" style="width: 700px; height: 75px;border: 3px dashed #ddd; opacity: .7; background-color: #fff; text-align: center; text-transform: uppercase; font-size: 14px; color: #aaa; padding: 20px;"></div>
  104. </div>
  105. <script type="text/javascript">
  106. TNP_PLUGIN_URL = "<?php echo NEWSLETTER_URL ?>";
  107. TNP_HOME_URL = "<?php echo home_url('/', is_ssl() ? 'https' : 'http') ?>";
  108. tnp_context_type = "<?php echo $context_type?>";
  109. </script>
  110. <script type="text/javascript" src="<?php echo plugins_url('newsletter'); ?>/emails/tnp-composer/_scripts/newsletter-builder.js?ver=<?php echo time() ?>"></script>
  111. <?php include NEWSLETTER_DIR . '/emails/subjects.php'; ?>
  112. <!--<script src="<?php echo plugins_url('newsletter') ?>/vendor/tinymce/tinymce.min.js"></script>-->
  113. <?php if (function_exists('wp_enqueue_editor')) wp_enqueue_editor(); ?>