wp-cron-update-links.php

/*
Plugin Name: WP-Cron UpdateLinks
Plugin URI: http://www.skippy.net/blog/2005/05/26/plugin-wp-cron/
Description: regularly pings your WP update-links.php; requires WP-Cron.
Version: 1.1
Author: Matt Read
Author URI: http://mattread.com/
*/

add_action('wp_cron_15', 'wp_cron_update_links');

function wp_cron_update_links() {
global $wpdb;
if ( get_option('use_linksupdate') )
include_once(ABSPATH . 'wp-admin/update-links.php');
}
?>

Post to Twitter Tweet This Post

Tags: No Tags

No Comments

wp-cron-reminder.php

/*
Plugin Name: WP-Cron Reminder
Plugin URI: http://www.skippy.net/blog/plugins/
Description: sends an email (roughly) every 15 and 60 minutes; required WP-Cron.
Version: 1.1
Author: Scott Merrill
Author URI: http://www.skippy.net/
*/

/*
copyright (c) 2005 Scott Merrill (skippy@skippy.net)
Released under the terms of the GNU GPL
*/

add_action('wp_cron_15', 'wp_cron_bug_me_15');
add_action('wp_cron_hourly', 'wp_cron_bug_me_60');

/////////////////////////////////////////
function wp_cron_bug_me($when = 'fifteen') {
$user = get_userdata(1);
$headers = "From: " . $user->user_nicename . ” <" . $user->user_email . “>\r\n”;
mail($user->user_email, “$when minute reminder!”, “This is your $when minute reminder!”, $headers);
}

////////////////////////////
function wp_cron_bug_me_15() {
wp_cron_bug_me (’fifteen’);
}

////////////////////////////
function wp_cron_bug_me_60() {
wp_cron_bug_me (’sixty’);
}

?>

Post to Twitter Tweet This Post

Tags: No Tags

No Comments

wp-cron-moderation.php

/*
Plugin Name: WP-Cron Moderation
Plugin URI: http://www.skippy.net/blog/plugins/
Description: Sends hourly emails notification of pending moderation requests
Author: Scott Merrill
Version: 1.2
Author URI: http://www.skippy.net/
*/

// change "daily" to "hourly" if you want hourly notifications
add_action ('wp_cron_hourly', 'wp_cron_moderation');

///////////////////////////
function wp_cron_moderation () {
global $wpdb;

$old_post_ID = 0;

// get all the unmoderated comments, organized by post
$queue = $wpdb->get_results(”SELECT comment_ID, comment_post_ID FROM $wpdb->comments WHERE comment_approved = ‘0′ ORDER BY comment_post_ID ASC”, OBJECT);

$comment_count = count($queue);
if (0 == $comment_count) return;

if (count($queue) > 1) {
$comment_count_posts = $wpdb->get_var(”SELECT count(distinct(comment_post_ID)) FROM $wpdb->comments WHERE comment_approved = ‘0′”);
} else {
// no sense making a SQL query if only one comment
$comment_count_posts = 1;
}

// now check if any of these are new comments
// no sense sending a reminder every hour if nothing’s new
$last_known_comment_id = get_option(’moderation_last_known’);
if ($last_known_comment_id == $queue[$comment_count -1]->comment_ID) return;

$notify_message = “$comment_count comment”;
if (1 < $comment_count) {
$notify_message .= "s";
$is_are = "are";
} else {
$is_are = "is";
}
$notify_message .= " on $comment_count_posts post";
if (1 < $comment_count_posts) {
$notify_message .= "s";
}

$notify_message .= " $is_are currently awaiting moderation:\r\n";
$notify_message .= get_settings('siteurl') . "/wp-admin/moderation.php\r\n\r\n";

// loop over them
foreach ($queue as $q) {
if ($q->comment_post_ID != $old_post_ID) {
$old_post_ID = $q->comment_post_ID;
// we’re on a new post now, so get the post title
$post_title = $wpdb->get_var(”SELECT post_title FROM $wpdb->posts WHERE ID=’$q->comment_post_ID’ LIMIT 1″);

$notify_message .= “==========\r\n”;
$notify_message .= sprintf( __(’post #%1$s: “%2$s” ‘), $q->comment_post_ID, $post_title ) . “\r\n”;
$notify_message .= get_permalink($q->comment_post_ID) . “\r\n==========\r\n”;
}

$comment = $wpdb->get_row(”SELECT comment_author, comment_author_email, comment_author_url, comment_author_IP, comment_content FROM $wpdb->comments WHERE comment_ID=’$q->comment_ID’ LIMIT 1″);
$comment_author_domain = gethostbyaddr($comment->comment_author_IP);

$notify_message .= sprintf( __(’Author : %1$s ‘), $comment->comment_author) . “\r\n”;
$notify_message .= sprintf( __(’E-mail : %s’), $comment->comment_author_email ) . “\r\n”;
$notify_message .= sprintf( __(’ URI : %s’), $comment->comment_author_url ) . “\r\n”;
$notify_message .= sprintf( __(’ IP : %s’), $comment->comment_author_IP ) . “\r\n”;
$notify_message .= __(’Comment: ‘) . $comment->comment_content. “\r\n\r\n”;
}

$notify_message .= “=-=-=-=-=-=-=-=\r\n”;
$notify_message .= get_settings(’siteurl’) . “/wp-admin/moderation.php\r\n”;

$title = “$comment_count item”;
if (1 < $comment_count) {
$title .= 's';
}
$title .= ' pending moderation';
$headers = 'From: ' . get_settings('blogname') . '<' . get_settings('admin_email') . '>‘;

mail(get_settings(’admin_email’), $title, $notify_message, $headers);

update_option(’moderation_last_known’, $q->comment_ID, false);

return;

} // end wp_cron_moderation

?>

Post to Twitter Tweet This Post

Tags: No Tags

1 Comment

wp-cron-mail.php.bak

/*
Plugin Name: WP-Cron-Mail
Plugin URI: http://www.skippy.net/blog/plugins/
Description: Does blog-by-email stuff, in conjunction with WP-Cron
Version: 1.2
Author: Scott Merrill
Author URI: http://www.skippy.net/

based on core wp-mail.php
released under the terms of the GNU GPL
*/

add_action('wp_cron_15', 'wp_cron_mail');

function wp_cron_mail() {

if (get_settings('mailserver_url')=='') return;

// change this to 1 if you want to always get a notification
// even if nothing happened.
$always_notify = 0;

global $wpdb;

$logfile = '';
require_once(ABSPATH.WPINC.'/class-pop3.php');

// I don't think we want to display errors, so let's use whatever
// the webserver uses by default. Remove the slashes below to override.
// error_reporting(2037);

$time_difference = get_settings('gmt_offset') * 3600;

$phone_delim = '::';

$pop3 = new POP3();

if (!$pop3->connect(get_settings(’mailserver_url’), get_settings(’mailserver_port’))) :
$admin = get_userdata(1);
mail ($admin->user_email, ‘wp-mail error’, “Ooops $pop3->ERROR \r\n”);
return;
endif;

$count = $pop3->login(get_settings(’mailserver_login’), get_settings(’mailserver_pass’));
if (0 == $count) {
if (1 == $always_notify) {
$admin = get_userdata(1);
mail ($admin->user_email, ‘wp-mail status’, __(’There doesn’t seem to be any new mail.’));
}
return;
}

for ($i=1; $i <= $count; $i++) :

$message = $pop3->get($i);

$content = ”;
$content_type = ”;
$boundary = ”;
$bodysignal = 0;
$dmonths = array(’Jan’, ‘Feb’, ‘Mar’, ‘Apr’, ‘May’, ‘Jun’,
‘Jul’, ‘Aug’, ‘Sep’, ‘Oct’, ‘Nov’, ‘Dec’);
foreach ($message as $line) :
if (strlen($line) < 3) $bodysignal = 1;

if ($bodysignal) {
$content .= $line;
} else {
if (preg_match('/Content-Type: /i', $line)) {
$content_type = trim($line);
$content_type = substr($content_type, 14, strlen($content_type)-14);
$content_type = explode(';', $content_type);
$content_type = $content_type[0];
}
if (($content_type == 'multipart/alternative') && (preg_match('/boundary="/', $line)) && ($boundary == '')) {
$boundary = trim($line);
$boundary = explode('"', $boundary);
$boundary = $boundary[1];
}
if (preg_match('/Subject: /i', $line)) {
$subject = trim($line);
$subject = substr($subject, 9, strlen($subject)-9);
if (!preg_match('#\=\?(.+)\?Q\?(.+)\?\=#i', $subject)) {
$subject = wp_iso_descrambler($subject);
}
// Captures any text in the subject before $phone_delim as the subject
$subject = explode($phone_delim, $subject);
$subject = $subject[0];
}

// Set the author using the email address (To or Reply-To, the last used)
// otherwise use the site admin
// SDM: added slash to beginning to 2nd preg_match
if (preg_match('/From: /', $line) | preg_match('/Reply-To: /', $line)) {
$author=trim($line);
if ( ereg("([a-zA-Z0-9\_\-\.]+@[\a-zA-z0-9\_\-\.]+)", $author , $regs) ) {
$logfile .= "Author = {$regs[1]} \r\n";
$result = $wpdb->get_row(”SELECT ID FROM $wpdb->users WHERE user_email=’$regs[1]‘ ORDER BY ID DESC LIMIT 1″);
if (!$result)
$post_author = 1;
else
$post_author = $result->ID;
} else
$post_author = 1;
}

if (preg_match(’/Date: /i’, $line)) { // of the form ‘20 Mar 2002 20:32:37′
$ddate = trim($line);
$ddate = str_replace(’Date: ‘, ”, $ddate);
if (strpos($ddate, ‘,’)) {
$ddate = trim(substr($ddate, strpos($ddate, ‘,’)+1, strlen($ddate)));
}
$date_arr = explode(’ ‘, $ddate);
$date_time = explode(’:', $date_arr[3]);

$ddate_H = $date_time[0];
$ddate_i = $date_time[1];
$ddate_s = $date_time[2];

$ddate_m = $date_arr[1];
$ddate_d = $date_arr[0];
$ddate_Y = $date_arr[2];
for ($j=0; $j<12; $j++) {
if ($ddate_m == $dmonths[$j]) {
$ddate_m = $j+1;
}
}

$time_zn = intval($date_arr[4]) * 36;
$ddate_U = gmmktime($ddate_H, $ddate_i, $ddate_s, $ddate_m, $ddate_d, $ddate_Y);
$ddate_U = $ddate_U - $time_zn;
$post_date = gmdate('Y-m-d H:i:s', $ddate_U + $time_difference);
$post_date_gmt = gmdate('Y-m-d H:i:s', $ddate_U);
}
}
endforeach;

$subject = addslashes(trim(str_replace(get_settings('subjectprefix'), '', $subject)));

if ($content_type == 'multipart/alternative') {
$content = explode('--'.$boundary, $content);
$content = $content[2];
$content = explode('Content-Transfer-Encoding: quoted-printable', $content);
$content = strip_tags($content[1], '

‘);
}
$content = trim($content);
// Captures any text in the body after $phone_delim as the body
$content = explode($phone_delim, $content);
$content[1] ? $content = $content[1] : $content = $content[0];

$logfile .= “Content-type: $content_type, boundary: $boundary\r\n”;
$logfile .= “Raw content:\r\n$content\r\n”;

$content = trim(addslashes($content));

$post_content = apply_filters(’phone_content’, $content);

$post_title = xmlrpc_getposttitle($content);

if ($post_title == ”) $post_title = $subject;

if (empty($post_categories)) $post_categories[] = get_settings(’default_email_category’);

$post_category = $post_categories;

// or maybe we should leave the choice to email drafts? propose a way
$post_status = ‘publish’;

$post_data = compact(’post_content’,'post_title’,'post_date’,'post_date_gmt’,'post_author’,'post_category’, ‘post_status’);

$post_ID = wp_insert_post($post_data);

if (!$post_ID) {
// we couldn’t post, for whatever reason. better move forward to the next email
continue;
}

do_action(’publish_phone’, $post_ID);

$logfile .= “Author: $post_author\r\n”;
$logfile .= “Posted title: $post_title\r\n”;
$logfile .= “Posted content:\r\n$content\r\n”;

if (!$post_categories) $post_categories[] = 1;
foreach ($post_categories as $post_category) :
$post_category = intval($post_category);

// Double check it’s not there already
$exists = $wpdb->get_row(”SELECT * FROM $wpdb->post2cat WHERE post_id = $post_ID AND category_id = $post_category”);

if (!$exists && $result) {
$wpdb->query(”
INSERT INTO $wpdb->post2cat
(post_id, category_id)
VALUES
($post_ID, $post_category)
“);
}
endforeach;

if(!$pop3->delete($i)) {
$logfile .= ‘Oops ‘.$pop3->ERROR.”\r\n”;
$pop3->reset();
$admin = get_userdata(1);
mail($admin->user_email, ‘wp-mail error’, $logfile);
return;
} else {
$logfile .= “Mission complete, message $i deleted.\r\n”;
}

endfor;

$admin = get_userdata(1);
mail($admin->user_email, ‘wp-mail complete’, $logfile);
$pop3->quit();
}
?>

Post to Twitter Tweet This Post

Tags: No Tags

No Comments

wp-cron-mail.php

/*
Plugin Name: WP-Cron-Mail
Plugin URI: http://www.skippy.net/blog/plugins/
Description: Does blog-by-email stuff, in conjunction with WP-Cron
Version: 1.2
Author: Scott Merrill
Author URI: http://www.skippy.net/

based on core wp-mail.php
released under the terms of the GNU GPL
*/

add_action('wp_cron_15', 'wp_cron_mail');

function wp_cron_mail() {

if (get_settings('mailserver_url')=='') return;

// change this to 1 if you want to always get a notification
// even if nothing happened.
$always_notify = 0;

global $wpdb;

$logfile = '';
require_once(ABSPATH.WPINC.'/class-pop3.php');

// I don't think we want to display errors, so let's use whatever
// the webserver uses by default. Remove the slashes below to override.
// error_reporting(2037);

$time_difference = get_settings('gmt_offset') * 3600;

$phone_delim = '::';

$pop3 = new POP3();

if (!$pop3->connect(get_settings(’mailserver_url’), get_settings(’mailserver_port’))) :
$admin = get_userdata(1);
mail ($admin->user_email, ‘wp-mail error’, “Ooops $pop3->ERROR \r\n”);
return;
endif;

$count = $pop3->login(get_settings(’mailserver_login’), get_settings(’mailserver_pass’));
if (0 == $count) {
if (1 == $always_notify) {
$admin = get_userdata(1);
mail ($admin->user_email, ‘wp-mail status’, __(’There doesn’t seem to be any new mail.’));
}
return;
}

for ($i=1; $i <= $count; $i++) :

$message = $pop3->get($i);

$content = ”;
$content_type = ”;
$boundary = ”;
$bodysignal = 0;
$dmonths = array(’Jan’, ‘Feb’, ‘Mar’, ‘Apr’, ‘May’, ‘Jun’,
‘Jul’, ‘Aug’, ‘Sep’, ‘Oct’, ‘Nov’, ‘Dec’);
foreach ($message as $line) :
if (strlen($line) < 3) $bodysignal = 1;

if ($bodysignal) {
$content .= $line;
} else {
if (preg_match('/Content-Type: /i', $line)) {
$content_type = trim($line);
$content_type = substr($content_type, 14, strlen($content_type)-14);
$content_type = explode(';', $content_type);
$content_type = $content_type[0];
}
if (($content_type == 'multipart/alternative') && (preg_match('/boundary="/', $line)) && ($boundary == '')) {
$boundary = trim($line);
$boundary = explode('"', $boundary);
$boundary = $boundary[1];
}
if (preg_match('/Subject: /i', $line)) {
$subject = trim($line);
$subject = substr($subject, 9, strlen($subject)-9);
if (!preg_match('#\=\?(.+)\?Q\?(.+)\?\=#i', $subject)) {
$subject = wp_iso_descrambler($subject);
}
// Captures any text in the subject before $phone_delim as the subject
$subject = explode($phone_delim, $subject);
$subject = $subject[0];
}

// Set the author using the email address (To or Reply-To, the last used)
// otherwise use the site admin
// SDM: added slash to beginning to 2nd preg_match
if (preg_match('/From: /', $line) | preg_match('/Reply-To: /', $line)) {
$author=trim($line);
if ( ereg("([a-zA-Z0-9\_\-\.]+@[\a-zA-z0-9\_\-\.]+)", $author , $regs) ) {
$logfile .= "Author = {$regs[1]} \r\n";
$result = $wpdb->get_row(”SELECT ID FROM $wpdb->users WHERE user_email=’$regs[1]‘ ORDER BY ID DESC LIMIT 1″);
if (!$result)
$post_author = 1;
else
$post_author = $result->ID;
} else
$post_author = 1;
}

if (preg_match(’/Date: /i’, $line)) { // of the form ‘20 Mar 2002 20:32:37′
$ddate = trim($line);
$ddate = str_replace(’Date: ‘, ”, $ddate);
if (strpos($ddate, ‘,’)) {
$ddate = trim(substr($ddate, strpos($ddate, ‘,’)+1, strlen($ddate)));
}
$date_arr = explode(’ ‘, $ddate);
$date_time = explode(’:', $date_arr[3]);

$ddate_H = $date_time[0];
$ddate_i = $date_time[1];
$ddate_s = $date_time[2];

$ddate_m = $date_arr[1];
$ddate_d = $date_arr[0];
$ddate_Y = $date_arr[2];
for ($j=0; $j<12; $j++) {
if ($ddate_m == $dmonths[$j]) {
$ddate_m = $j+1;
}
}

$time_zn = intval($date_arr[4]) * 36;
$ddate_U = gmmktime($ddate_H, $ddate_i, $ddate_s, $ddate_m, $ddate_d, $ddate_Y);
$ddate_U = $ddate_U - $time_zn;
$post_date = gmdate('Y-m-d H:i:s', $ddate_U + $time_difference);
$post_date_gmt = gmdate('Y-m-d H:i:s', $ddate_U);
}
}
endforeach;

$subject = addslashes(trim(str_replace(get_settings('subjectprefix'), '', $subject)));

if ($content_type == 'multipart/alternative') {
$content = explode('--'.$boundary, $content);
$content = $content[2];
$content = explode('Content-Transfer-Encoding: quoted-printable', $content);
$content = strip_tags($content[1], '

‘);
}
$content = trim($content);
// Captures any text in the body after $phone_delim as the body
$content = explode($phone_delim, $content);
$content[1] ? $content = $content[1] : $content = $content[0];

$logfile .= “Content-type: $content_type, boundary: $boundary\r\n”;
$logfile .= “Raw content:\r\n$content\r\n”;

$content = trim(addslashes($content));

$post_content = apply_filters(’phone_content’, $content);

$post_title = xmlrpc_getposttitle($content);

if ($post_title == ”) $post_title = $subject;

if (empty($post_categories)) $post_categories[] = get_settings(’default_email_category’);

$post_category = $post_categories;

// or maybe we should leave the choice to email drafts? propose a way
$post_status = ‘publish’;

$post_data = compact(’post_content’,'post_title’,'post_date’,'post_date_gmt’,'post_author’,'post_category’, ‘post_status’);

$post_ID = wp_insert_post($post_data);

if (!$post_ID) {
// we couldn’t post, for whatever reason. better move forward to the next email
continue;
}

do_action(’publish_phone’, $post_ID);

$logfile .= “Author: $post_author\r\n”;
$logfile .= “Posted title: $post_title\r\n”;
$logfile .= “Posted content:\r\n$content\r\n”;

if (!$post_categories) $post_categories[] = 1;
foreach ($post_categories as $post_category) :
$post_category = intval($post_category);

// Double check it’s not there already
$exists = $wpdb->get_row(”SELECT * FROM $wpdb->post2cat WHERE post_id = $post_ID AND category_id = $post_category”);

if (!$exists && $result) {
$wpdb->query(”
INSERT INTO $wpdb->post2cat
(post_id, category_id)
VALUES
($post_ID, $post_category)
“);
}
endforeach;

if(!$pop3->delete($i)) {
$logfile .= ‘Oops ‘.$pop3->ERROR.”\r\n”;
$pop3->reset();
$admin = get_userdata(1);
//mail($admin->user_email, ‘wp-mail error’, $logfile);
return;
} else {
$logfile .= “Mission complete, message $i deleted.\r\n”;
}

endfor;

$admin = get_userdata(1);
//mail($admin->user_email, ‘wp-mail complete’, $logfile);
$pop3->quit();
}
?>

Post to Twitter Tweet This Post

Tags: No Tags

No Comments

wp-cron-gravcache.php

/*
Plugin Name: WP-Cron Gravatar Cache
Plugin URI: http://www.skippy.net/blog/plugins/
Description: Periodically refreshes the cached gravatar images
Version: 1.0
Author: Scott Merrill
Author URI: http://www.skippy.net/
*/

/// MAIN PROGRAM
add_action ('wp_cron_daily', 'wp_cron_gravcache');

/// FUNCTIONS
///////////////////////////////////
function wp_cron_gravcache () {

// use globals to hopefully speed up subsequent iterations
global $grav_options, $gravatar_expire;

$now = time();

if ( is_array( $gravatar_expire ) ) {
foreach ($gravatar_expire as $who => $expire) {
$cached = FALSE;
// check the time stamp
if ($expire < ($now - $grav_options['gravatar_expire'])) {
// it's past the expiration time, so grab the latest version
$cached = gravatar_cache(md5($who));
if ($cached) {
$gravatar_expire[$who] = $now;
}
}
}
}
update_option('gravatar_expire', $gravatar_expire);
} // wp_cron_gravcache

?>

Post to Twitter Tweet This Post

Tags: No Tags

No Comments

wp-cron-future-pings.php

/*
Plugin Name: WP-Cron Future Pings
Plugin URI: http://www.skippy.net/blog/plugins/
Description: pings updated services forfuture-dated posts. Requires WP-Cron.
Version: 1.2
Author: Scott Merrill
Author URI: http://www.skippy.net/

copyright (c) 2005 Scott Merrill (skippy@skippy.net)
Released under the terms of the GNU GPL

With thanks to Lionfire (http://the.lostrealm.com/) for troubleshooting
*/

add_action('publish_post', 'future_ping', 1);
add_action('delete_post', 'future_ping_delete');
add_action('wp_cron_15', 'wp_cron_future_ping');

/////////////////////////////
function future_ping($the_ID) {
global $cache_settings, $post_pingback, $wpdb;
// is this post future-dated?

// we can't use the $post_cache because it will tell us this is a draft post
// dated right now.
$query = "SELECT post_date FROM $wpdb->posts WHERE ID=$the_ID”;
$post_date = $wpdb->get_var($query);
if ( $post_date < current_time('mysql') )
{
// nope; carry on with regular post processing
return $the_ID;
}

// we got this far, so the post is future-dated
// cache the list of generic ping sites
$ping_sites = get_settings('ping_sites');

// empty the list of generic ping sites
$cache_settings->ping_sites = ”;
if (0 !== get_option(’default_pingback_flag’))
{
// disable automatic pingbacks
$cache_settings->default_pingback_flag = 0;
}

// disable pingbacks for this post
$post_pingback = 0;

// get all the URLs to ping
// we hit the DB directly to copy the values from `to_ping` to `pinged`
$to_ping = $wpdb->get_var(”SELECT to_ping FROM $wpdb->posts WHERE ID=$the_ID”);

// now blank the list of sites to ping
$result = $wpdb->query(”UPDATE $wpdb->posts SET to_ping = ” WHERE ID=$the_ID”);

$to_ping = trim($to_ping);
$to_ping = preg_split(’/\s/’, $to_ping);
$pinged = implode(”\n”, $to_ping);

// stuff all the sites to ping into the `pinged` field
$result = $wpdb->query(”UPDATE $wpdb->posts SET pinged = ‘$pinged’ WHERE ID=$the_ID”);

$future_pings = get_option(’future_pings’);
if (FALSE === $future_pings)
{
add_option(’future_pings’, ”, ‘Array of future post IDs and dates’, ‘no’);
$future_pings = array();
}
$future_pings[$the_ID] = $post_date;
update_option(’future_pings’, $future_pings);

return $the_ID;
}

////////////////////////////////////
function future_ping_delete($the_ID) {
$future_pings = get_option(’future_pings’);
if ( ( is_object( $the_ID ) ) || ( is_array( $the_ID ) ) ) {
if ( (count($future_pings) == 0) || (! array_key_exists($future_pings, $the_ID)) ) {
return $the_ID;
}
else return $the_ID;
}

unset($future_pings[$the_ID]);
update_option(’future_pings’, $future_pings);
return $the_ID;
}

//////////////////////////////
function wp_cron_future_ping() {
$future_pings = get_option(’future_pings’);
if (FALSE === $future_pings)
{
// for some reason our option isn’t set, so let’s set it
add_option(’future_pings’, ”, ‘Array of post IDs and dates.’, ‘no’);
// and since it wasn’t set, we can assume we have no future-dated
// post to worry about, so carry on with normal processing
return;
}

// do we have any future-dated posts?
if (0 == count($future_pings)) return;

global $wpdb;
// lets do pings for any future-dated posts which are now visible
$counter = 0; // to determine if anything changed
if ( is_array( $future_pings ) ) {
foreach ($future_pings as $ID => $date)
{
if ($date < current_time('mysql'))
{
$counter++;
$post = get_post($ID);
if (! $post)
{
// post isn't there. Let's remove it from our list
unset($future_pings[$ID]);
continue;
}
$pings = $wpdb->get_var(”SELECT pinged FROM $wpdb->posts WHERE ID=$ID”);
$pings = trim($pings);
$pings = preg_split(’/\s/’, $pings, -1, PREG_SPLIT_NO_EMPTY);
$new_pings = implode(”\n”, $pings);

// set this post’s trackback URIs back to the to_ping field
$result = $wpdb->query(”UPDATE $wpdb->posts SET pinged=” WHERE ID=$ID”);
$result = $wpdb->query(”UPDATE $wpdb->posts SET to_ping = ‘$new_pings’ WHERE ID=$ID”);
generic_ping($ID);
if (0 !== get_option(’default_pingback_flag’))
{
pingback($post->content, $ID);
}
do_trackbacks($ID);
unset ($future_pings[$ID]);
}
}
}
if (0 != $counter)
{
update_option(’future_pings’, $future_pings);
}
} // end wp_cron_future_ping

?>

Post to Twitter Tweet This Post

Tags: No Tags

No Comments

wp-cron-dashboard.php

/*
Plugin Name: WP-Cron Dashboard
Plugin URI: http://www.skippy.net/blog/plugins/
Description: regularly updates the WP dashboard; requires WP-Cron.
Version: 1.1
Author: Scott Merrill
Author URI: http://www.skippy.net/

Copyright (c) 2005 Scott Merrill (skippy@skippy.net)
Released under the terms of the GNU GPL
*/

add_action('wp_cron_hourly', 'wp_cron_dashboard');

////////////////////////////
function wp_cron_dashboard() {
$rss = @fetch_rss('http://feeds.technorati.com/cosmos/rss/?url='. trailingslashit(get_option('home')) .'&partner=wordpress');
$rss = @fetch_rss('http://wordpress.org/development/feed/');
$rss = @fetch_rss('http://planet.wordpress.org/feed/');
}

?>

Post to Twitter Tweet This Post

Tags: No Tags

No Comments

target_blank.php

Post to Twitter Tweet This Post

Tags: No Tags

No Comments

socialize_adb.php

/*
Plugin Name: Socializer Plugin
Version: 1.00
Plugin URI: http://marketing.digital-landscaping.ca/wordpress-tools/wordpress-socializer-plugin
Description:

Add socializer to your Wordpress Posts. Socializer is way to submit your post to all of
the social bookmark networks at once. It include 37 social bookmark networks (digg,
de.licio.us, furl, reddit, backflip, kinja... just to name a few).

Author: Anders Bergman
Author URI: http://marketing.digital-landscaping.ca/wordpress-tools/wordpress-socializer-plugin
*/

/* Copyright 2006 Anders Bergman

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/

// add socializer link
function socialize_adb($text_adb) {

// default
if ($text_adb == '') {
$text_adb = "Social bookmark this page";
}

$link_adb = "“.$text_adb.”“;

// display link
echo ($link_adb);

}

?>

Post to Twitter Tweet This Post

Tags: No Tags

No Comments