' . __('Service chosen successfully, now please fill in the details below.', 'mce') . '
' . "\n";
} else {
echo '' . __('Incorrect service selected.', 'mce') . '
';
}
} else if (!empty($_POST['mce_do_save'])) {
if ($mce_options['username'] != $_POST['username'] || (isset($_POST['api_key']) && $mce_options['api_key'] != $_POST['api_key'])) {
$verify_credentials = true;
} else {
$verify_credentials = false;
}
$old_username = $mce_options['username'];
$old_filter_own_blog = $mce_options['filter_own_blog'];
$mce_options['username'] = trim($_POST['username']);
if (isset($_POST['api_key'])) {
$mce_options['api_key'] = trim($_POST['api_key']);
}
if ($verify_credentials) {
$report = mce_verify_credentials();
} else {
$report = array('success' => 1);
}
if (!$report['success']) {
echo '' . __($report['message'], 'mce') . '
';
} else {
$mce_options['filter_own_blog'] = (int) $_POST['filter_own_blog'];
$mce_options['dofollow_links'] = (int) $_POST['dofollow_links'];
$mce_options['open_links_in_new_window'] = (int) $_POST['open_links_in_new_window'];
$mce_options['include_action_links'] = (int) $_POST['include_action_links'];
$mce_options['date_format'] = (int) $_POST['date_format'];
$mce_options['comments_per_page'] = (int) $_POST['comments_per_page'];
$mce_options['rss_feed'] = (int) $_POST['rss_feed'];
if ($mce_options['comments_per_page'] < 1) {
$mce_options['comments_per_page'] = 20;
} else if ($mce_options['comments_per_page'] > 200) {
$mce_options['comments_per_page'] = 200;
}
if ($mce_options['type'] == 'backtype') {
$mce_options['rss'] = 'http://feeds.backtype.com/' . urlencode($mce_options['username']);
} else {
$mce_options['rss'] = 'http://www.cocomment.com/myRss/' . urlencode($mce_options['username']) . '.rss';
}
$allowed_timeframes = array('hourly', 'daily', 'weekly');
$mce_options['import_frequency'] = trim($_POST['import_frequency']);
if (!in_array($mce_options['import_frequency'], $allowed_timeframes)) {
$mce_options['import_frequency'] = 'daily';
}
if ($old_username && $old_username != $mce_options['username']) {
$mce_options['initial_import'] = false;
}
if ($old_filter_own_blog != $mce_options['filter_own_blog'] && $mce_options['type'] == 'backtype') {
$mce_options['initial_import'] = false;
}
update_option('mce_options', $mce_options);
wp_clear_scheduled_hook('mce_import_cron');
if ($_POST['import_frequency'] == 'hourly') {
$time = mktime(date('H') + 1, 0, 0); //strtotime('+1 hour')
wp_schedule_event($time, 'hourly', 'mce_import_cron');
} else if ($_POST['import_frequency'] == 'daily') {
$time = mktime(0, 0, 0, date('n'), date('j') + 1, date('Y')); //strtotime('tomorrow')
wp_schedule_event($time, 'daily', 'mce_import_cron');
} else {
$days_until_monday = array(0 => 1, 1 => 7, 2 => 6, 3 => 5, 4 => 4, 5 => 3, 6 => 2);
$extra_days = $days_until_monday[date('w')];
$time = mktime(0, 0, 0, date('n'), date('j') + $extra_days, date('Y')); //strtotime('Next monday')
wp_schedule_event($time, 'weekly', 'mce_import_cron');
}
if (empty($mce_options['initial_import'])) {
if ($mce_options['last_import']) {
$message = 'You will have to reimport your comments .';
} else {
$message = 'Now please start the initial import below.';
}
} else {
$message = '';
}
echo '' . __('Settings saved successfully. ' . $message, 'mce') . '
' . "\n";
}
} else if (!empty($_POST['mce_do_import'])) {
$report = mce_import(true);
if (!$report['success']) {
echo '' . __($report['message'], 'mce') . '
';
} else {
echo '' . "\n";
}
} else if (!empty($_POST['mce_do_acknowledgements'])) {
$mce_options['itw_link'] = !empty($_POST['itw_link']);
$mce_options['service_link'] = !empty($_POST['service_link']);
update_option('mce_options', $mce_options);
if ($mce_options['itw_link'] && $mce_options['service_link']) {
echo '' . __('Thank you!', 'mce') . '
' . "\n";
} else {
echo '' . __('This plugin is sad :( Please consider giving credit.', 'mce') . '
';
}
} else if (!empty($_POST['mce_do_reset'])) {
require MCE_DIR . '/install.php';
$mce_options = mce_default_options();
update_option('mce_options', $mce_options);
} else if (!empty($_POST['mce_do_digest'])) {
if ($_POST['digest_frequency'] != 'daily' && $_POST['digest_frequency'] != 'weekly') {
$_POST['digest_frequency'] = 'never';
}
if (!trim($_POST['digest_title'])) {
$_POST['digest_title'] = 'My comments elsewhere: [date]';
}
$mce_options['digest_frequency'] = $_POST['digest_frequency'];
$mce_options['digest_title'] = strip_tags($_POST['digest_title']);
$mce_options['digest_order'] = (int) $_POST['digest_order'];
$mce_options['digest_max_comments'] = (int) $_POST['digest_max_comments'];
$mce_options['digest_min_comments'] = (int) $_POST['digest_min_comments'];
$mce_options['digest_category'] = (int) $_POST['digest_category'];
$mce_options['digest_tags'] = strip_tags($_POST['digest_tags']);
if ($mce_options['digest_max_comments'] < 0) {
$mce_options['digest_max_comments'] = 0;
}
if ($mce_options['digest_min_comments'] < 1) {
$mce_options['digest_min_comments'] = 1;
}
update_option('mce_options', $mce_options);
wp_clear_scheduled_hook('mce_digest_cron');
if ($_POST['digest_frequency'] == 'daily') {
$time = mktime(1, 0, 0, date('n'), date('j') + 1, date('Y')); //strtotime('tomorrow')
wp_schedule_event($time, 'daily', 'mce_digest_cron');
} else if ($_POST['digest_frequency'] == 'weekly') {
$days_until_monday = array(0 => 1, 1 => 7, 2 => 6, 3 => 5, 4 => 4, 5 => 3, 6 => 2);
$extra_days = $days_until_monday[date('w')];
$time = mktime(1, 0, 0, date('n'), date('j') + $extra_days, date('Y')); //strtotime('Next monday')
wp_schedule_event($time, 'weekly', 'mce_digest_cron');
}
echo '' . __('Digest options updated successfully.', 'mce') . '
' . "\n";
} else if (!empty($_POST['mce_do_css'])) {
require MCE_DIR . '/install.php';
if ($success = mce_update_css($_POST['css'], $_POST['mce_do_css'])) {
echo '' . __('CSS updated successfully.', 'mce') . '
' . "\n";
} else {
echo '' . __('Cannot write to file, make sure it is writable.', 'mce') . '
';
}
}
if (empty($mce_options['type'])) {
mce_form_choice();
} else {
mce_form_settings();
}
}
function mce_form_choice() {
?>
new page (not a post) and add the shortcode [mycomments] to display your comments aggregated from across the web.', 'mce'); ?>
.
checked="checked" /> Improving The Web', 'mce'); ?>
checked="checked" /> Backtype' : 'CoComment '), 'mce'); ?>
.
Improving The Web : RSS | Twitter
»
»