Example #1
0
function mailmanager_email_stats_output()
{
    global $mm;
    ym_box_top(__('MailManager Email Stats', 'ym_mailmanager'));
    mailmanager_email_stats();
    echo '<p style="text-align: right;"><a href="' . $mm->page_root . '">' . __('MailManager', 'ym_mailmanager') . '</a></p>';
    ym_box_bottom();
}
Example #2
0
function mailmanager_admin($other_action)
{
    global $mm, $wpdb;
    $current_settings = get_option('ym_other_mm_settings');
    if ($other_action == 'mailmanager') {
        $mm_action = ym_get('mm_action');
        echo '<div class="wrap" id="poststuff" style="width: 98%;">';
        if (!$current_settings->first_run_done) {
            $mm_action = 'gateways';
        }
        do_action('mailmanager_precontent');
        switch ($mm_action) {
            case 'gateways':
            case 'settings':
            case 'broadcast':
            case 'create':
            case 'emails':
            case 'preview':
            case 'series':
            case 'welcome':
            case 'invoice':
                include YM_MM_PAGES_DIR . $mm_action . '.php';
                wp_tiny_mce(false, array('editor_selector' => 'editorContent'));
                break;
            case 'gateway':
                $file = $current_settings->mail_gateway;
                $break = FALSE;
                // just in case it should be already loaded from the generation of the settings menu
                require_once YM_MM_GATEWAY_DIR . $file . '/' . $file . '.php';
                // invoke settings page
                global $mailgateway;
                if ($mailgateway->settings) {
                    $mailgateway->settings($break);
                }
                wp_tiny_mce(false, array('editor_selector' => 'editorContent'));
                if ($break) {
                    break;
                }
            case 'runnow':
                if ($mm_action == 'runnow') {
                    ym_box_top(__('MailManger: Cron', 'ym_mailmanager'));
                    echo '<p>';
                    do_action('mailmanager_cron_check');
                    echo '</p>';
                    echo '<p>' . __('The run of the cron is complete', 'ym_mailmanager') . '</p>';
                    ym_box_bottom();
                }
            default:
                echo '<div style="width: 49%; float: left;">';
                ym_box_top(__('MailManger', 'ym_mailmanager'));
                mailmanager_email_stats();
                $sch_using = wp_get_schedule('mailmanager_cron_check');
                $next = wp_next_scheduled('mailmanager_cron_check');
                if (!$sch_using) {
                    $now = time();
                    if ($current_settings->series_hour < date('H', $now)) {
                        // the hour has passed schedule for tomorrow
                        $now = $now + 86400;
                    }
                    $next = mktime($current_settings->series_hour, $current_settings->series_min, 59, date('n', $now), date('j', $now), date('Y', $now));
                    wp_schedule_event($next, 'daily', 'mailmanager_cron_check');
                } else {
                    echo '<p>' . sprintf(__('The Cron is set to check %s and will next run at %s', 'ym_mailmanager'), $sch_using, date('r', $next)) . '</p>';
                }
                echo '<p>' . sprintf(__('Run the <a href="%s&mm_action=runnow">cron now</a>', 'ym_mailmanager'), $mm->page_root) . '</p>';
                do_action('mailmanager_homepage');
                ym_box_bottom();
                echo '</div>';
                echo '<div style="width: 49%; float: right">';
                mailmanager_list_stats();
                echo '</div>';
        }
        echo '</div>';
    }
}