File: /home/httpd/html/stoptube.com/wp-content/JUNK/post_schedule_ping_optimizer/pspo-cron.php
<?php
require('../../../wp-config.php');
pspo_ping_cron();
function pspo_ping_cron()
{
global $wpdb;
$future_ping=get_option("pspo_future_ping");
if (FALSE === $future_ping)
{
echo "Future ping array is empty";
exit;
}
$ping=0;
print_r ($future_ping);
foreach($future_ping as $i => $id)
{
$sql="SELECT post_date,post_status FROM $wpdb->posts WHERE id=$id";
$row = mysql_fetch_array(mysql_query($sql));
//if future published post later has been changed to draft or other status
//then delete it from the ping list (It will be automatically be pinged when its status changes to publish)
if ($row['post_status']!='publish')
{
unset($future_ping[$i]);
}
if($row["post_date"]<=current_time('mysql') and $row['post_status']=='publish')
{
unset($future_ping[$i]);
echo "New future post($id) is appeared <br>";
$ping=1;
}
} // for
update_option("pspo_future_ping",$future_ping);
if (1==$ping)
{
generic_ping();
echo "Pinging finished";
}
else
{
echo "No new future post found in future ping array";
}
}
?>