function nxs_do_this_hourly() { $options = get_option('NS_SNAutoPoster'); $riPosts = get_option('NS_SNriPosts'); if (!is_array($riPosts)) { $riPosts = array(); } //## Check for Incoming Comments if nessesary. //## Facebook if (is_array($options['fb'])) { foreach ($options['fb'] as $ii => $fbo) { if ($fbo['riComments'] == '1') { $fbo['ii'] = $ii; $fbo['pType'] = 'aj'; foreach ($riPosts as $postID) { $fbpo = get_post_meta($postID, 'snapFB', true); $fbpo = maybe_unserialize($fbpo); if (is_array($fbpo) && isset($fbpo[$ii]) && is_array($fbpo[$ii])) { $ntClInst = new nxs_snapClassFB(); $fbo = $ntClInst->adjMetaOpt($fbo, $fbpo[$ii]); } nxs_getBackFBComments($postID, $fbo, $fbpo[$ii]); } } } } //## Twitter if (is_array($options['tw'])) { foreach ($options['tw'] as $ii => $fbo) { if ($fbo['riComments'] == '1') { $fbo['ii'] = $ii; $fbo['pType'] = 'aj'; foreach ($riPosts as $postID) { $fbpo = get_post_meta($postID, 'snapTW', true); $fbpo = maybe_unserialize($fbpo); if (is_array($fbpo) && isset($fbpo[$ii]) && is_array($fbpo[$ii])) { $ntClInst = new nxs_snapClassTW(); $fbo = $ntClInst->adjMetaOpt($fbo, $fbpo[$ii]); } nxs_getBackTWComments($postID, $fbo, $fbpo[$ii]); } } } } }
function nxs_rePostToFB_ajax() { check_ajax_referer('nxsSsPageWPN'); $postID = $_POST['id']; // $result = nsPublishTo($id, 'FB', true); $options = get_option('NS_SNAutoPoster'); foreach ($options['fb'] as $ii => $fbo) { if ($ii == $_POST['nid']) { $fbo['ii'] = $ii; $fbo['pType'] = 'aj'; $fbpo = get_post_meta($postID, 'snapFB', true); /* echo $postID."|"; echo $fbpo; */ $fbpo = maybe_unserialize($fbpo); // prr($fbpo); if (is_array($fbpo) && isset($fbpo[$ii]) && is_array($fbpo[$ii])) { $ntClInst = new nxs_snapClassFB(); $fbo = $ntClInst->adjMetaOpt($fbo, $fbpo[$ii]); } //prr($fbo); if (isset($_POST['ri']) && $_POST['ri'] == '1') { nxs_getBackFBComments($postID, $fbo, $fbpo[$ii]); die; } else { $result = nxs_doPublishToFB($postID, $fbo); if ($result == '200') { die("Your post has been successfully sent to FaceBook."); } else { die($result); } } } } }
function nxs_do_this_hourly() { $options = get_option('NS_SNAutoPoster'); if (isset($options['errNotifEmailCB']) && (int) $options['errNotifEmailCB'] == 1 && isset($options['errNotifEmail']) && trim($options['errNotifEmail']) != '') { $logToSend = maybe_unserialize(get_option('NSX_LogToEmail')); // echo "SSS"; // prr($logToSend); if (is_array($logToSend) && count($logToSend) > 0) { $to = $options['errNotifEmail']; $subject = "SNAP Error Log for " . $_SERVER["SERVER_NAME"]; $message = print_r($logToSend, true); $eml = get_bloginfo('admin_email'); if (trim($eml) == '') { $eml = "snap-notify@" . str_ireplace('www.', '', $_SERVER["SERVER_NAME"]); } $headers = "From: " . $eml . "\r\n"; $headers .= "Reply-To: " . $eml . "\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; $retval = wp_mail($to, $subject, $message, $headers); echo $to . "|" . $subject . "|" . $message . "|" . $headers; if ($retval == true) { nxs_addToLogN('S', 'Log sent to email ' . $options['errNotifEmail'], 'ALL', count($logToSend) . ' records sent', ''); } else { nxs_addToLogN('ER', '[FALIED] Log sent to email ' . $options['errNotifEmail'], 'ALL', count($logToSend) . ' records were NOT sent', ''); } delete_option("NSX_LogToEmail"); } } $riPosts = get_option('NS_SNriPosts'); if (!is_array($riPosts)) { $riPosts = array(); } //## Check for Incoming Comments if nessesary. if ($options['riActive'] != 1 || count($riPosts) < 1) { return; } if (isset($options['extDebug']) && $options['extDebug'] == '1') { nxs_addToLogN('S', 'Comments Import', 'ALL', 'Checking for new comments now...', print_r($riPosts, true)); } //## Facebook if (is_array($options['fb'])) { foreach ($options['fb'] as $ii => $fbo) { if ($fbo['riComments'] == '1') { $fbo['ii'] = $ii; $fbo['pType'] = 'aj'; foreach ($riPosts as $postID) { $fbpo = get_post_meta($postID, 'snapFB', true); $fbpo = maybe_unserialize($fbpo); if (is_array($fbpo) && isset($fbpo[$ii]) && is_array($fbpo[$ii]) && isset($fbpo[$ii]['pgID']) && trim($fbpo[$ii]['pgID']) != '') { $ntClInst = new nxs_snapClassFB(); $fbo = $ntClInst->adjMetaOpt($fbo, $fbpo[$ii]); nxs_getBackFBComments($postID, $fbo, $fbpo[$ii]); } } } } } //## Twitter if (is_array($options['tw'])) { foreach ($options['tw'] as $ii => $fbo) { if ($fbo['riComments'] == '1') { $fbo['ii'] = $ii; $fbo['pType'] = 'aj'; $twList = nxs_getBackTWCommentsList($fbo); foreach ($riPosts as $postID) { $fbpo = get_post_meta($postID, 'snapTW', true); $fbpo = maybe_unserialize($fbpo); if (is_array($fbpo) && isset($fbpo[$ii]) && is_array($fbpo[$ii]) && isset($fbpo[$ii]['pgID']) && trim($fbpo[$ii]['pgID']) != '') { $ntClInst = new nxs_snapClassTW(); $fbo = $ntClInst->adjMetaOpt($fbo, $fbpo[$ii]); nxs_getBackTWComments($postID, $fbo, $fbpo[$ii], $twList); } } } } } }