require_once 'includes/class-wp-email-delivery-connections.php';
// Load plugin libraries
if (is_admin()) {
    require_once 'includes/lib/class-wp-email-delivery-admin-ajax.php';
}
require_once 'includes/lib/class-wp-email-delivery-admin-api.php';
require_once 'includes/lib/class-wp-email-delivery-post-type.php';
require_once 'includes/lib/class-wp-email-delivery-taxonomy.php';
include_once ABSPATH . 'wp-admin/includes/plugin.php';
class WPED_Exception extends Exception
{
}
//functions
require_once 'includes/misc-functions.php';
define('WPED_BASENAME', plugin_basename(__FILE__));
define('WPED_IS_NETWORK', wped_is_network_activated());
/**
 * Returns the main instance of WP_Email_Delivery to prevent the need to use globals.
 *
 * @since  1.0.0
 * @return object WP_Email_Delivery
 */
function WPED()
{
    return WP_Email_Delivery::instance(__FILE__, '1.0.8');
}
WPED();
function WPED_WP_MAIL()
{
    if (function_exists('wp_mail')) {
        WPED()->wp_mail_error = __('The function wp_mail() is already in use by another plugin. WPED will not be able to send for you and has been disabled. ', 'wp-email-delivery');
 /**
  * Load settings page content
  * @return void
  */
 public function settings_page()
 {
     if (!WPED()->connections->is_setup()) {
         wped_set_option('enable_sending', false);
     }
     $button_text = esc_attr(__('Save Settings', 'wp-email-delivery'));
     // Build page HTML
     $html = '<div class="wrap" id="' . $this->parent->_token . '_settings">' . "\n";
     $html .= '<h2>' . __('WP Email Delivery', 'wp-email-delivery') . ' <small>v' . $this->parent->_version . '</small></h2>' . "\n";
     if (isset($this->parent->wp_mail_error)) {
         $html .= '</p>' . $this->parent->wp_mail_error . '</p>';
     }
     $tab = '';
     if (isset($_GET['tab']) && $_GET['tab']) {
         $tab .= $_GET['tab'];
     }
     // Show page tabs
     if (is_array($this->settings) && 1 < count($this->settings)) {
         $html .= '<h2 class="nav-tab-wrapper">' . "\n";
         $c = 0;
         foreach ($this->settings as $section => $data) {
             // Set tab class
             $class = 'nav-tab';
             if (!isset($_GET['tab'])) {
                 if (0 == $c) {
                     $class .= ' nav-tab-active';
                     $button_text = isset($data['custom_save']) ? $data['custom_save'] : esc_attr(__('Save Settings', 'wp-email-delivery'));
                 }
             } else {
                 if (isset($_GET['tab']) && $section == $_GET['tab']) {
                     $class .= ' nav-tab-active';
                     $button_text = isset($data['custom_save']) ? $data['custom_save'] : esc_attr(__('Save Settings', 'wp-email-delivery'));
                 }
             }
             // Set tab link
             $tab_link = add_query_arg(array('tab' => $section));
             if (isset($_GET['settings-updated'])) {
                 $tab_link = remove_query_arg('settings-updated', $tab_link);
             }
             // Output tab
             $html .= '<a href="' . $tab_link . '" class="' . esc_attr($class) . '">' . esc_html($data['title']) . '</a>' . "\n";
             ++$c;
         }
         $html .= '</h2>' . "\n";
     }
     $target = "options.php";
     if (wped_is_network_activated()) {
         $target = 'edit.php?action=' . $this->parent->_token . '_settings';
     }
     $html .= '<form method="post" action="' . $target . '" enctype="multipart/form-data">' . "\n";
     // Get settings fields
     ob_start();
     settings_fields($this->parent->_token . '_settings');
     do_settings_sections($this->parent->_token . '_settings');
     $html .= ob_get_clean();
     if ($button_text != 'none') {
         $html .= '<p class="submit">' . "\n";
         $html .= '<input type="hidden" name="tab" value="' . esc_attr($tab) . '" />' . "\n";
         $html .= '<input name="Submit" type="submit" class="button-primary" value="' . $button_text . '" />' . "\n";
         $html .= '</p>' . "\n";
     }
     $html .= '</form>' . "\n";
     if (!WPED()->connections->is_setup()) {
         $html .= "<div style='padding: 30px 40px; border: solid 1px #cdcdcd; background: #fff; margin-top: 5px;'><h2 style='margin-top: 0px; padding-top: 0px;'>Get WP Email Delivery for your site.</h2>";
         $html .= "<p>Try it for free with <strong>50 emails per month</strong>. Sign up at <a target='_blank' href='https://www.wpemaildelivery.com'>https://www.wpemaildelivery.com</a><br>Great for small sites and developers.</p>";
         $html .= '<p>Need more emails per month check out our monthly plans starting at <strong>$5.00 a month for 10,000 emails</strong>.<br>';
         $html .= 'We also have yearly plans starting at <strong>$18 per year for 500 monthly emails</strong>.</p>';
         $html .= "</div>";
     }
     $html .= '</div>' . "\n";
     echo $html;
     $this->templates();
 }