nxs_psCron

The NextScripts: Social Networks Auto-Poster nxs psCron function.

Description

nxs_psCron(); 

Usage

  1. if ( !function_exists( 'nxs_psCron' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'nextscripts-social-networks-auto-poster/nxs_functions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = nxs_psCron(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/nxs_functions.php  
  1. if (!function_exists("nxs_psCron")) { function nxs_psCron() { if (!is_home() && !is_front_page()) return; if (nxs_chckBrwsr()==false) return;  
  2. //if (stripos($_SERVER["REQUEST_URI"], 'admin-ajax.php')!==false || stripos($_SERVER["REQUEST_URI"], 'cf_action')!==false || stripos($_SERVER["REQUEST_URI"], 'wp-cron.php')!==false) return;  
  3. $ltc = get_option('NSX_LastTChecked'); if (empty($ltc)) { add_option("NSX_LastTChecked", time()); return; } if (time()<$ltc+300) return; $sh =_get_cron_array(); $itmsToPush = array();  
  4. if (is_array($sh)) foreach ($sh as $evTime => $evDataX) if (is_array($evDataX)) foreach ($evDataX as $evFunc=>$evData) if (strpos($evFunc, 'ns_doPublishTo')!==false) { $chkTime = rand(360, 600); //$chkTime = rand(5, 7); 
  5. if ($evTime>'1359495839' && $evTime<time()-$chkTime) $itmsToPush[] = array('time'=>$evTime); 
  6. } if (count($itmsToPush)<1) return;  
  7. /** 
  8. $snapIP = get_post_meta($toPush['args'][0], 'snap_mp_'.$toPush['func'], true);  
  9. nxs_addToLogN('S', 'Missed Scheduled Autoposts Found', '', ' - ('.$evTime."<".(time()-$chkTime).') - Trying to Post', ''); 
  10. delete_post_meta(); add_post_meta($toPush['args'][0], 'snap_mp_'.$toPush['func'], (time()+300)); 
  11. */ 
  12. update_option("NSX_LastTChecked", time()); 
  13. $cron_url = site_url('wp-cron.php?doing_wp_cron=0'); ?><script type="text/javascript" > jQuery(document).ready(function($) { jQuery.get('<?php echo $cron_url; ?>'); }); </script><?php // die(); 
  14. return true;  
  15. }}