nxs_class_SNAP_DA

The NextScripts: Social Networks Auto-Poster nxs class SNAP DA class.

Defined (1)

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

/inc-cl/da.api.php  
  1. if (!class_exists("nxs_class_SNAP_DA")) { class nxs_class_SNAP_DA { 
  2.  
  3. var $ntCode = 'DA'; 
  4. var $ntLCode = 'da'; 
  5.  
  6. function doPost($options, $message) { if (!is_array($options)) return false; $out = array(); // return false; 
  7. foreach ($options as $ii=>$ntOpts) $out[$ii] = $this->doPostToNT($ntOpts, $message); 
  8. return $out; 
  9. }  
  10.  
  11. function doPostToNT($options, $message) { global $nxs_urlLen; $badOut = array('pgID'=>'', 'isPosted'=>0, 'pDate'=>date('Y-m-d H:i:s'), 'Error'=>''); 
  12. //## Check settings 
  13. if (!is_array($options)) { $badOut = 'No Options'; return $badOut; }  
  14. if (!isset($options['daUName']) || trim($options['daUName'])=='' || !isset($options['daPass']) || trim($options['daPass'])=='') { $badOut = 'No username/password Found'; return $badOut; }  
  15. //## Format Post 
  16. if (!empty($message['pTitle'])) $title = $message['pTitle']; else $title = nxs_doFormatMsg($options['daTitleFormat'], $message); $title = nsTrnc($title, 300);  
  17. if (!empty($message['pText'])) $text = $message['pText']; else $text = nxs_doFormatMsg($options['daTextFormat'], $message);  
  18. //## Make Post  
  19. if (!empty($options['ck'])) $ck = maybe_unserialize($options['ck']); if (!empty($options['mh'])) $mh = maybe_unserialize($options['mh']);  
  20. $pass = substr($options['daPass'], 0, 5)=='n5g9a'?nsx_doDecode(substr($options['daPass'], 5)):$options['uPass']; 
  21. $nt = new nxsAPI_DA(); $nt->debug = false; if (!empty($ck)) $nt->ck = $ck; if (!empty($mh)) $nt->mh = $mh; $loginErr = $nt->connect($options['daUName'], $pass);  
  22. if (!$loginErr) { $post = array('title'=>$title, 'text'=>$text ); $ret = $nt->post($post);  
  23. if (is_array($ret)) { $ret['ck'] = $nt->ck; $ret['mh'] = $nt->mh; return $ret; } else return print_r($ret, true); 
  24. } else return print_r($loginErr, true);  
  25. }  
  26. }}