当前位置: 首页>>代码示例>>PHP>>正文


PHP nxs_doFormatMsg函数代码示例

本文整理汇总了PHP中nxs_doFormatMsg函数的典型用法代码示例。如果您正苦于以下问题:PHP nxs_doFormatMsg函数的具体用法?PHP nxs_doFormatMsg怎么用?PHP nxs_doFormatMsg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了nxs_doFormatMsg函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: doPostToNT

 function doPostToNT($options, $message)
 {
     $badOut = array('pgID' => '', 'isPosted' => 0, 'pDate' => date('Y-m-d H:i:s'), 'Error' => '');
     //## Check settings
     if (!is_array($options)) {
         $badOut['Error'] = 'No Options';
         return $badOut;
     }
     if (!isset($options['ytUName']) || trim($options['ytPass']) == '') {
         $badOut['Error'] = 'Not Configured';
         return $badOut;
     }
     $pass = substr($options['ytPass'], 0, 5) == 'n5g9a' ? nsx_doDecode(substr($options['ytPass'], 5)) : $options['ytPass'];
     //## Format
     if (!empty($message['pText'])) {
         $msg = $message['pText'];
     } else {
         $msg = nxs_doFormatMsg($options['ytMsgFormat'], $message);
     }
     $loginError = doConnectToGooglePlus2($options['ytUName'], $pass, 'YT');
     if ($loginError !== false) {
         return "BAD USER/PASS - " . $loginError;
     }
     $ret = doPostToYouTube($msg, $options['ytPageID'], $message['videoURL'], $options['ytGPPageID']);
     //prr($ret);
     if ($ret == 'OK') {
         $ret = array("code" => "OK", "post_id" => '');
     }
     if (!is_array($ret) && $ret != 'OK') {
         $badOut['Error'] .= 'Something went wrong - NO PID ' . print_r($ret, true);
     } else {
         return array('postID' => $ret['post_id'], 'isPosted' => 1, 'postURL' => $ret['post_id'], 'pDate' => date('Y-m-d H:i:s'));
     }
     return $badOut;
 }
开发者ID:acruxray,项目名称:social-networks-auto-poster-facebook-twitter-g,代码行数:35,代码来源:yt.api.php

示例2: doPostToNT

 function doPostToNT($options, $message)
 {
     $badOut = array('pgID' => '', 'isPosted' => 0, 'pDate' => date('Y-m-d H:i:s'), 'Error' => '');
     //## Check settings
     if (!is_array($options)) {
         $badOut['Error'] = 'No Options';
         return $badOut;
     }
     if (!isset($options['ljUName']) || trim($options['ljPass']) == '') {
         $badOut['Error'] = 'Not Configured';
         return $badOut;
     }
     $pass = substr($options['ljPass'], 0, 5) == 'n5g9a' ? nsx_doDecode(substr($options['ljPass'], 5)) : $options['ljPass'];
     //## Format
     if (!empty($message['pText'])) {
         $msg = $message['pText'];
     } else {
         $msg = nxs_doFormatMsg($options['ljMsgFormat'], $message);
     }
     if (!empty($message['pTitle'])) {
         $msgT = $message['pTitle'];
     } else {
         $msgT = nxs_doFormatMsg($options['ljMsgTFormat'], $message);
     }
     require_once 'apis/xmlrpc-client.php';
     if (!empty($options['ljSrv']) && $options['ljSrv'] == 'DW') {
         $server = 'dreamwidth.org';
     } else {
         $server = 'livejournal.com';
     }
     $nxsToLJclient = new NXS_XMLRPC_Client('http://www.' . $server . '/interface/xmlrpc');
     $nxsToLJclient->debug = false;
     $date = time();
     $year = date("Y", $date);
     $mon = date("m", $date);
     $day = date("d", $date);
     $hour = date("G", $date);
     $min = date("i", $date);
     $nxsToLJContent = array("username" => $options['ljUName'], "password" => $pass, "event" => $msg, "subject" => $msgT, "lineendings" => "unix", "year" => $year, "mon" => $mon, "day" => $day, "hour" => $hour, "min" => $min, "ver" => 2);
     if (!empty($options['commID']) && $options['commID'] != '') {
         $nxsToLJContent["usejournal"] = $options['commID'];
     }
     if (!empty($options['inclTags']) && $options['inclTags'] == '1' && !empty($message['tags'])) {
         $nxsToLJContent['props'] = array('taglist' => $message['tags']);
     }
     // prr($nxsToLJContent);
     if (!$nxsToLJclient->query('LJ.XMLRPC.postevent', $nxsToLJContent)) {
         prr($nxsToLJclient);
         $ret = 'Something went wrong - ' . $nxsToLJclient->getErrorCode() . ' : ' . $nxsToLJclient->getErrorMessage();
     } else {
         $ret = 'OK';
     }
     $pid = $nxsToLJclient->getResponse();
     if (is_array($pid) && !empty($pid['url'])) {
         return array('postID' => $pid['url'], 'isPosted' => 1, 'postURL' => $pid['url'], 'pDate' => date('Y-m-d H:i:s'));
     } else {
         $badOut['Error'] .= 'Something went wrong - NO PID ' . print_r($pid, true);
     }
     return $badOut;
 }
开发者ID:digideskio,项目名称:stammtisch,代码行数:60,代码来源:lj.api.php

示例3: doPostToNT

 function doPostToNT($options, $message)
 {
     $badOut = array('pgID' => '', 'isPosted' => 0, 'pDate' => date('Y-m-d H:i:s'), 'Error' => '');
     //## Check settings
     if (!is_array($options)) {
         $badOut['Error'] = 'No Options';
         return $badOut;
     }
     if (!isset($options['ipUName']) || trim($options['ipPass']) == '') {
         $badOut['Error'] = 'Not Configured';
         return $badOut;
     }
     $dusername = $options['ipUName'];
     $pass = substr($options['ipPass'], 0, 5) == 'n5g9a' ? nsx_doDecode(substr($options['ipPass'], 5)) : $options['ipPass'];
     //## Format
     if (!empty($message['pText'])) {
         $msg = $message['pText'];
     } else {
         $msg = nxs_doFormatMsg($options['ipMsgFormat'], $message);
     }
     if (!empty($message['pTitle'])) {
         $msgT = $message['pTitle'];
     } else {
         $msgT = nxs_doFormatMsg($options['ipMsgTFormat'], $message);
     }
     $link = urlencode($message['url']);
     $desc = urlencode(substr($msgT, 0, 250));
     $ext = urlencode(substr($msg, 0, 1000));
     $tags = $message['tags'];
     $apicall = "https://www.instapaper.com/api/add?red=api&url={$link}&title={$desc}&selection={$ext}";
     // prr($apicall);
     $hdrsArr = $this->nxs_getIPHeaders($dusername . ':' . $pass);
     $cnt = wp_remote_get($apicall, array('method' => 'GET', 'timeout' => 45, 'redirection' => 0, 'headers' => $hdrsArr));
     //  prr($cnt);
     if (is_wp_error($cnt)) {
         $error_string = $cnt->get_error_message();
         if (stripos($error_string, ' timed out') !== false) {
             sleep(10);
             $cnt = wp_remote_get($apicall, array('method' => 'GET', 'timeout' => 45, 'redirection' => 0, 'headers' => $hdrsArr));
         }
     }
     if (is_wp_error($cnt)) {
         $ret = 'Something went wrong - ' . print_r($cnt, true);
     } else {
         if (is_array($cnt) && stripos($cnt['body'], '201') !== false) {
             return array('postID' => 'IP', 'isPosted' => 1, 'postURL' => 'IP', 'pDate' => date('Y-m-d H:i:s'));
         } else {
             $ret = "Error: ";
             if (is_array($cnt) && $cnt['response']['code'] == '401') {
                 $ret .= " Incorrect Username/Password ";
             } else {
                 $ret .= print_r($cnt, true);
             }
             $ret .= $cnt['response']['message'];
         }
     }
     $badOut['Error'] .= $ret;
     return $badOut;
 }
开发者ID:voquanghoa,项目名称:WebPhim,代码行数:59,代码来源:ip.api.php

示例4: doPostToNT

 function doPostToNT($options, $message)
 {
     $badOut = array('pgID' => '', 'isPosted' => 0, 'pDate' => date('Y-m-d H:i:s'), 'Error' => '');
     //## Check settings
     if (!is_array($options)) {
         $badOut['Error'] = 'No Options';
         return $badOut;
     }
     if (!isset($options['ffUName']) || trim($options['ffPass']) == '') {
         $badOut['Error'] = 'Not Configured';
         return $badOut;
     }
     $dusername = $options['ffUName'];
     $pass = substr($options['ffPass'], 0, 5) == 'n5g9a' ? nsx_doDecode(substr($options['ffPass'], 5)) : $options['ffPass'];
     if (empty($options['imgSize'])) {
         $options['imgSize'] = '';
     }
     //## Format
     if (!empty($message['pText'])) {
         $msg = $message['pText'];
     } else {
         $msg = nxs_doFormatMsg($options['ffMsgFormat'], $message);
     }
     if ($options['attchImg'] == '1') {
         if (isset($message['imageURL'])) {
             $imgURL = trim(nxs_getImgfrOpt($message['imageURL'], $options['imgSize']));
         } else {
             $imgURL = '';
         }
     } else {
         $imgURL = '';
     }
     $postArr = array('title' => $msg, 'image0_link' => '', 'room' => $options['grpID'] != '' ? strtolower($options['grpID']) : '', 'image0_url' => $imgURL != '' ? $imgURL : '');
     $apicall = "http://friendfeed.com/api/share";
     $hdrsArr = $this->nxs_getFFHeaders($dusername . ':' . $pass);
     $paramcall = array('method' => 'POST', 'timeout' => 45, 'redirection' => 0, 'body' => $postArr, 'headers' => $hdrsArr);
     $cnt = wp_remote_post($apicall, $paramcall);
     // prr(json_decode($cnt['body'], true));
     if (is_wp_error($cnt)) {
         $ret = 'Something went wrong - ' . print_r($cnt, true);
     } else {
         if (is_array($cnt)) {
             $retInfo = json_decode($cnt['body'], true);
         } else {
             $retInfo = false;
         }
         if (is_array($cnt) && $cnt['response']['code'] == '200' && is_array($retInfo)) {
             return array('postID' => $retInfo['entries'][0]['id'], 'isPosted' => 1, 'postURL' => 'http://friendfeed.com/e/' . $retInfo['entries'][0]['id'], 'pDate' => date('Y-m-d H:i:s'));
         } else {
             $ret = "Error: ";
             if ($cnt['response']['code'] == '401') {
                 $ret .= " Incorrect Username/Password ";
             }
             $ret .= $cnt['response']['message'];
         }
     }
     $badOut['Error'] .= $ret;
     return $badOut;
 }
开发者ID:voquanghoa,项目名称:WebPhim,代码行数:59,代码来源:ff.api.php

示例5: doPostToNT

 function doPostToNT($options, $message)
 {
     $badOut = array('pgID' => '', 'isPosted' => 0, 'pDate' => date('Y-m-d H:i:s'), 'Error' => '');
     //## Check settings
     if (!is_array($options)) {
         $badOut['Error'] = 'No Options';
         return $badOut;
     }
     if (!isset($options['dlUName']) || trim($options['dlPass']) == '') {
         $badOut['Error'] = 'Not Configured';
         return $badOut;
     }
     $email = $options['dlUName'];
     $pass = substr($options['dlPass'], 0, 5) == 'n5g9a' ? nsx_doDecode(substr($options['dlPass'], 5)) : $options['dlPass'];
     //## Format
     if (!empty($message['pText'])) {
         $msg = $message['pText'];
     } else {
         $msg = nxs_doFormatMsg($options['dlMsgFormat'], $message);
     }
     if (!empty($message['pTitle'])) {
         $msgT = $message['pTitle'];
     } else {
         $msgT = nxs_doFormatMsg($options['dlMsgTFormat'], $message);
     }
     $tags = nsTrnc($message['tags'], 195, ',', '');
     $link = $message['url'];
     $desc = substr($msgT, 0, 250);
     $ext = substr($msg, 0, 1000);
     $hdrsArr = $this->getHeaders('https://delicious.com', 'https://delicious.com', true);
     $flds = array('username' => $email, 'password' => base64_encode(strrev($pass)));
     $cnt = wp_remote_post('https://avosapi.delicious.com/api/v1/account/login', array('method' => 'POST', 'timeout' => 45, 'redirection' => 0, 'body' => $flds, 'headers' => $hdrsArr));
     if (is_nxs_error($cnt)) {
         $badOut = "ERROR (Login Form): " . print_r($rep, true);
         return $badOut;
     }
     $rep = json_decode($cnt['body'], true);
     if ($rep['status'] != 'success') {
         $badOut = "ERROR (Login): " . print_r($rep, true);
         return $badOut;
     }
     $ck = $cnt['cookies'];
     $flds = array('url' => $link, 'description' => $desc, 'tags' => $tags, 'note' => $ext, 'replace' => 'true', 'private' => 'false', 'share' => '');
     $advSts = array('method' => 'POST', 'timeout' => 45, 'redirection' => 0, 'body' => $flds, 'cookies' => $ck, 'headers' => $hdrsArr);
     //prr($advSts);
     $cnt = wp_remote_post('https://avosapi.delicious.com/api/v1/posts/addoredit', $advSts);
     if (is_nxs_error($cnt)) {
         $badOut = "ERROR (Login Form): " . print_r($rep, true);
         return $badOut;
     }
     $rep = json_decode($cnt['body'], true);
     if ($rep['status'] != 'success') {
         $badOut = "ERROR (Login): " . print_r($rep, true);
         return $badOut;
     }
     return array('postID' => md5($message['url']), 'isPosted' => 1, 'postURL' => 'https://delicious.com/link/' . md5($message['url']), 'pDate' => date('Y-m-d H:i:s'));
 }
开发者ID:digideskio,项目名称:stammtisch,代码行数:57,代码来源:dl.api.php

示例6: doPostToNT

 function doPostToNT($options, $message)
 {
     $badOut = array('pgID' => '', 'isPosted' => 0, 'pDate' => date('Y-m-d H:i:s'), 'Error' => '');
     //## Check settings
     if (!is_array($options)) {
         $badOut['Error'] = 'No Options';
         return $badOut;
     }
     if (!isset($options['diUName']) || trim($options['diPass']) == '') {
         $badOut['Error'] = 'Not Configured';
         return $badOut;
     }
     $email = $options['diUName'];
     $pass = substr($options['diPass'], 0, 5) == 'n5g9a' ? nsx_doDecode(substr($options['diPass'], 5)) : $options['diPass3'];
     //## Format
     if (!empty($message['pText'])) {
         $msg = $message['pText'];
     } else {
         $msg = nxs_doFormatMsg($options['diMsgFormat'], $message);
     }
     if (!empty($message['pTitle'])) {
         $msgT = $message['pTitle'];
     } else {
         $msgT = nxs_doFormatMsg($options['diMsgTFormat'], $message);
     }
     $flds = array();
     $flds['key'] = $options['diAPIKey'];
     $flds['url'] = $message['url'];
     $flds['title'] = nsTrnc($msgT, 250);
     $flds['desc'] = nsTrnc($msg, 250);
     $flds['tags'] = $message['tags'];
     $flds['shared'] = 'yes';
     //   prr($flds); die();
     $hdrsArr = $this->nxs_getDIHeaders('https://secure.diigo.com/api/v2/bookmarks', $email, $pass, true);
     $cnt = wp_remote_post('https://secure.diigo.com/api/v2/bookmarks', array('method' => 'POST', 'timeout' => 45, 'redirection' => 0, 'headers' => $hdrsArr, 'body' => $flds));
     //## Return
     if (is_array($cnt) && stripos($cnt['body'], '"code":1') !== false) {
         return array('postID' => 'DI', 'isPosted' => 1, 'postURL' => 'DI', 'pDate' => date('Y-m-d H:i:s'));
     } else {
         $badOut['Error'] .= print_r($cnt, true);
         return $badOut;
     }
 }
开发者ID:voquanghoa,项目名称:WebPhim,代码行数:43,代码来源:di.api.php

示例7: doPostToNT

 function doPostToNT($options, $message)
 {
     $badOut = array('pgID' => '', 'isPosted' => 0, 'pDate' => date('Y-m-d H:i:s'), 'Error' => '');
     //## Check settings
     if (!is_array($options)) {
         $badOut['Error'] = 'No Options';
         return $badOut;
     }
     if (!isset($options['ytUName']) || trim($options['ytPass']) == '') {
         $badOut['Error'] = 'Not Configured';
         return $badOut;
     }
     $email = $options['ytUName'];
     $pass = substr($options['ytPass'], 0, 5) == 'n5g9a' ? nsx_doDecode(substr($options['ytPass'], 5)) : $options['ytPass'];
     //## Format
     if (!empty($message['pText'])) {
         $msg = $message['pText'];
     } else {
         $msg = nxs_doFormatMsg($options['ytMsgFormat'], $message);
     }
     $nt = new nxsAPI_GP();
     if (!empty($options['ck'])) {
         $nt->ck = $options['ck'];
     }
     $nt->debug = false;
     $loginError = $nt->connect($email, $pass, 'YT');
     if (!$loginError) {
         $result = $nt->postYT($msg, $options['ytPageID'], $message['videoURL'], $options['ytGPPageID']);
     } else {
         $badOut['Error'] = "Login/Connection Error: " . print_r($loginError, true);
         return $badOut;
     }
     if (is_array($result) && $result['isPosted'] == '1') {
         nxs_save_glbNtwrks('yt', $options['ii'], $nt->ck, 'ck');
     }
     return $result;
 }
开发者ID:digideskio,项目名称:stammtisch,代码行数:37,代码来源:yt.api.php

示例8: doPostToNT

 function doPostToNT($options, $message)
 {
     $badOut = array('pgID' => '', 'isPosted' => 0, 'pDate' => date('Y-m-d H:i:s'), 'Error' => '');
     //## Check settings
     if (!is_array($options)) {
         $badOut['Error'] = 'No Options';
         return $badOut;
     }
     if (!isset($options['pkConsKey']) || trim($options['pkConsSec']) == '' || empty($options['pkAccessTocken'])) {
         $badOut['Error'] = 'Not Configured';
         return $badOut;
     }
     if (empty($options['imgSize'])) {
         $options['imgSize'] = '';
     }
     //## Format
     if (!empty($message['pText'])) {
         $msg = $message['pText'];
     } else {
         $msg = nxs_doFormatMsg($options['pkMsgFormat'], $message);
     }
     //## Post
     require_once 'apis/plurkOAuth.php';
     $consumer_key = $options['pkConsKey'];
     $consumer_secret = $options['pkConsSec'];
     $tum_oauth = new wpPlurkOAuth($consumer_key, $consumer_secret, $options['pkAccessTocken'], $options['pkAccessTockenSec']);
     $pkURL = trim(str_ireplace('http://', '', $options['pkURL']));
     if (substr($pkURL, -1) == '/') {
         $pkURL = substr($pkURL, 0, -1);
     }
     if ($options['pkCat'] == '') {
         $options['pkCat'] = ':';
     }
     if ($options['attchImg'] == '1') {
         if (isset($message['imageURL'])) {
             $imgURL = trim(nxs_getImgfrOpt($message['imageURL'], $options['imgSize']));
         } else {
             $imgURL = '';
         }
         if ($imgURL != '') {
             $msg .= " " . $imgURL;
         }
     }
     $postArr = array('content' => $msg, 'qualifier' => $options['pkCat']);
     $postinfo = $tum_oauth->makeReq('http://www.plurk.com/APP/Timeline/plurkAdd', $postArr);
     //  prr($postinfo);
     if (is_array($postinfo) && isset($postinfo['plurk_id'])) {
         $pkID = $postinfo['plurk_id'];
     }
     $code = $tum_oauth->http_code;
     // echo "XX".print_r($code);  prr($postinfo); // prr($msg); prr($postinfo); echo $code."VVVV"; die("|====");
     if ($code == 200 && $pkID != '') {
         $alphabet = str_split("0123456789abcdefghijklmnopqrstuvwxyz");
         $shorten = '';
         $plurk_id = $pkID;
         while ($plurk_id != 0) {
             $i = $plurk_id % 36;
             $plurk_id = intval($plurk_id / 36);
             $shorten = $alphabet[$i] . $shorten;
         }
         $link = 'http://www.plurk.com/p/' . $shorten;
         return array('postID' => $pkID, 'isPosted' => 1, 'postURL' => $link, 'pDate' => date('Y-m-d H:i:s'));
     } else {
         $badOut['Error'] .= " ERROR: - " . $postinfo['error_text'];
     }
     return $badOut;
 }
开发者ID:voquanghoa,项目名称:WebPhim,代码行数:67,代码来源:pk.api.php

示例9: doPostToNT

 function doPostToNT($options, $message)
 {
     global $nxs_urlLen;
     $badOut = array('pgID' => '', 'isPosted' => 0, 'pDate' => date('Y-m-d H:i:s'), 'Error' => '');
     //## Check settings
     if (!is_array($options)) {
         $badOut = 'No Options';
         return $badOut;
     }
     if (!isset($options['daUName']) || trim($options['daUName']) == '' || !isset($options['daPass']) || trim($options['daPass']) == '') {
         $badOut = 'No username/password Found';
         return $badOut;
     }
     //## Format Post
     if (!empty($message['pTitle'])) {
         $title = $message['pTitle'];
     } else {
         $title = nxs_doFormatMsg($options['daTitleFormat'], $message);
     }
     $title = nsTrnc($title, 300);
     if (!empty($message['pText'])) {
         $text = $message['pText'];
     } else {
         $text = nxs_doFormatMsg($options['daTextFormat'], $message);
     }
     //## Make Post
     if (!empty($options['ck'])) {
         $ck = maybe_unserialize($options['ck']);
     }
     if (!empty($options['mh'])) {
         $mh = maybe_unserialize($options['mh']);
     }
     $pass = substr($options['daPass'], 0, 5) == 'n5g9a' ? nsx_doDecode(substr($options['daPass'], 5)) : $options['uPass'];
     $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);
     if (!$loginErr) {
         $post = array('title' => $title, 'text' => $text);
         $ret = $nt->post($post);
         if (is_array($ret)) {
             $ret['ck'] = $nt->ck;
             $ret['mh'] = $nt->mh;
             return $ret;
         } else {
             return print_r($ret, true);
         }
     } else {
         return print_r($loginErr, true);
     }
 }
开发者ID:digideskio,项目名称:stammtisch,代码行数:56,代码来源:da.api.php

示例10: doPostToNT

 function doPostToNT($options, $message)
 {
     global $nxs_urlLen;
     $badOut = array('pgID' => '', 'isPosted' => 0, 'pDate' => date('Y-m-d H:i:s'), 'Error' => '');
     //## Check settings
     if (!is_array($options)) {
         $badOut['Error'] = 'No Options';
         return $badOut;
     }
     if (!isset($options['accessToken']) || trim($options['accessToken']) == '') {
         $badOut['Error'] = 'Not Authorized';
         return $badOut;
     }
     if (empty($options['imgSize'])) {
         $options['imgSize'] = '';
     }
     //## Format Post
     if (!empty($message['pText'])) {
         $msg = $message['pText'];
     } else {
         $msg = nxs_doFormatMsg($options['msgFrmt'], $message);
     }
     //## Make Post
     if (isset($message['imageURL'])) {
         $imgURL = trim(nxs_getImgfrOpt($message['imageURL'], $options['imgSize']));
     } else {
         $imgURL = '';
     }
     $postType = $options['postType'];
     require_once 'apis/scOAuth.php';
     $tum_oauth = new wpScoopITOAuth($options['appKey'], $options['appSec'], $options['accessToken'], $options['accessTokenSec']);
     $tum_oauth->baseURL = 'https://api.xing.com';
     $msg = str_replace(''', "'", $msg);
     $msg = str_replace(''', "'", $msg);
     $msg = str_replace('#039;', "'", $msg);
     $msg = str_replace('#039', "'", $msg);
     $msg = str_replace('’', "'", $msg);
     $msg = str_replace('’', "'", $msg);
     $msg = str_replace('#8217;', "'", $msg);
     $msg = str_replace('#8217', "'", $msg);
     $msg = str_replace('“', '"', $msg);
     $msg = str_replace('“', '"', $msg);
     $msg = str_replace('#8220;', '"', $msg);
     $msg = str_replace('#8220', "'", $msg);
     $msg = str_replace('”', '"', $msg);
     $msg = str_replace('”', '"', $msg);
     $msg = str_replace('#8221;', '"', $msg);
     $msg = str_replace('#8221', "'", $msg);
     $msg = str_replace('—', '-', $msg);
     $msg = str_replace('—', '-', $msg);
     $msg = str_replace('#8212;', '-', $msg);
     $msg = str_replace('#8212', "-", $msg);
     if ($postType == 'A') {
         $postArr = array('uri' => urlencode($message['url']), 'text' => nsTrnc($msg, 420));
         $postinfo = $tum_oauth->makeReq('https://api.xing.com/v1/users/me/share/link', $postArr, 'POST');
     } else {
         $postArr = array('message' => nsTrnc($msg, 420), 'id' => $options['appAppUserID']);
         $postinfo = $tum_oauth->makeReq('https://api.xing.com/v1/users/' . $options['appAppUserID'] . '/status_message', $postArr, 'POST');
         // prr($postinfo);
     }
     $code = $tum_oauth->http_code;
     if ($code == '201') {
         if (!empty($postinfo) && is_array($postinfo) && !empty($postinfo['ids']) && !empty($postinfo['ids'][0])) {
             $apNewPostID = $postinfo['ids'][0];
         }
         $np = explode('_', $apNewPostID);
         $apNewPostURL = 'https://www.xing.com/feedy/stories/' . $np[0];
     } else {
         $apNewPostID = '';
         $apNewPostURL = 'https://www.xing.com/profile/' . $options['appPGUserName'] . '/activities';
     }
     if (!empty($apNewPostID) || $code == '201') {
         return array('postID' => $apNewPostID, 'isPosted' => 1, 'postURL' => $apNewPostURL, 'pDate' => date('Y-m-d H:i:s'));
     } else {
         $badOut['Error'] .= print_r($postinfo, true) . " Code:" . $tum_oauth->http_code;
         return $badOut;
     }
     return $badOut;
 }
开发者ID:digideskio,项目名称:stammtisch,代码行数:79,代码来源:xi.api.php

示例11: doPostToNT

 function doPostToNT($options, $message)
 {
     global $nxs_urlLen;
     $badOut = array('pgID' => '', 'isPosted' => 0, 'pDate' => date('Y-m-d H:i:s'), 'Error' => '');
     //## Check settings
     if (!is_array($options)) {
         $badOut['Error'] = 'No Options';
         return $badOut;
     }
     if (!isset($options['uPass']) || trim($options['uPass']) == '') {
         $badOut['Error'] = 'Not Authorized';
         return $badOut;
     }
     if (empty($options['imgSize'])) {
         $options['imgSize'] = '';
     }
     //## Format Post
     if (!empty($message['pText'])) {
         $text = $message['pText'];
     } else {
         $text = nxs_doFormatMsg($options['msgFrmt'], $message);
     }
     if (!empty($message['pTitle'])) {
         $msgT = $message['pTitle'];
     } else {
         $msgT = nxs_doFormatMsg($options['msgTFrmt'], $message);
     }
     //## Make Post
     if (isset($message['imageURL'])) {
         $imgURL = trim(nxs_getImgfrOpt($message['imageURL'], $options['imgSize']));
     } else {
         $imgURL = '';
     }
     //## Make Post
     if (!empty($options['ck'])) {
         $ck = maybe_unserialize($options['ck']);
     }
     $pass = substr($options['uPass'], 0, 5) == 'n5g9a' ? nsx_doDecode(substr($options['uPass'], 5)) : $options['uPass'];
     $nt = new nxsAPI_ST();
     $nt->debug = false;
     if (!empty($ck)) {
         $nt->ck = $ck;
     }
     $loginErr = $nt->connect($options['uName'], $pass);
     if (!$loginErr) {
         $post = array('url' => $message['url'], 'toURL' => $options['mgzURL'], 'imgURL' => $imgURL, 'title' => $msgT, 'text' => $text);
         $ret = $nt->post($post);
         if (is_array($ret)) {
             $ret['ck'] = $nt->ck;
             return $ret;
         } else {
             return print_r($ret, true);
         }
     } else {
         return print_r($loginErr, true);
     }
 }
开发者ID:digideskio,项目名称:stammtisch,代码行数:57,代码来源:st.api.php

示例12: doPostToNT

 function doPostToNT($options, $message)
 {
     $badOut = array('pgID' => '', 'isPosted' => 0, 'pDate' => date('Y-m-d H:i:s'), 'Error' => '');
     //## Check settings
     if (!is_array($options)) {
         $badOut['Error'] = 'No Options';
         return $badOut;
     }
     if (!isset($options['wpUName']) || trim($options['wpPass']) == '') {
         $badOut['Error'] = 'Not Configured';
         return $badOut;
     }
     $pass = substr($options['wpPass'], 0, 5) == 'n5g9a' ? nsx_doDecode(substr($options['wpPass'], 5)) : $options['wpPass'];
     if (empty($options['imgSize'])) {
         $options['imgSize'] = '';
     }
     //## Format
     if (!empty($message['pText'])) {
         $msg = $message['pText'];
     } else {
         $msg = nxs_doFormatMsg($options['wpMsgFormat'], $message);
     }
     if (!empty($message['pTitle'])) {
         $msgT = $message['pTitle'];
     } else {
         $msgT = nxs_doFormatMsg($options['wpMsgTFormat'], $message);
     }
     if (isset($message['imageURL'])) {
         $imgURL = trim(nxs_getImgfrOpt($message['imageURL'], $options['imgSize']));
     } else {
         $imgURL = '';
     }
     $link = urlencode($message['url']);
     $ext = substr($msg, 0, 1000);
     //## Fix missing xmlrpc.php
     if (substr($options['wpURL'], -1) == '/') {
         $options['wpURL'] = substr($options['wpURL'], 0, -1);
     }
     if (substr($options['wpURL'], -10) != 'xmlrpc.php') {
         $options['wpURL'] .= "/xmlrpc.php";
     }
     //## Post
     require_once 'apis/xmlrpc-client.php';
     $nxsToWPclient = new NXS_XMLRPC_Client($options['wpURL']);
     $nxsToWPclient->debug = false;
     if ($imgURL !== '' && stripos($imgURL, 'http') !== false) {
         // $handle = fopen($imgURL, "rb"); $filedata = ''; while (!feof($handle)) {$filedata .= fread($handle, 8192);} fclose($handle);
         $filedata = wp_remote_get($imgURL);
         if (!is_wp_error($filedata)) {
             $filedata = $filedata['body'];
         }
         // echo "AWC?";
         $data = array('name' => 'image-' . $message['orID'] . '.jpg', 'type' => 'image/jpg', 'bits' => new NXS_XMLRPC_Base64($filedata), true);
         $status = $nxsToWPclient->query('metaWeblog.newMediaObject', $message['orID'], $options['wpUName'], $pass, $data);
         $imgResp = $nxsToWPclient->getResponse();
         $gid = $imgResp['id'];
     } else {
         $gid = '';
     }
     $params = array(0, $options['wpUName'], $pass, array('software_version'));
     if (!$nxsToWPclient->query('wp.getOptions', $params)) {
         $ret = 'Something went wrong - ' . $nxsToWPclient->getErrorCode() . ' : ' . $nxsToWPclient->getErrorMessage();
     } else {
         $ret = 'OK';
     }
     $rwpOpt = $nxsToWPclient->getResponse();
     if (!empty($rwpOpt['software_version'])) {
         $rwpOpt = $rwpOpt['software_version']['value'];
         $rwpOpt = floatval($rwpOpt);
     } else {
         $rwpOpt = 0;
     }
     //prr($rwpOpt);prr($nxsToWPclient);
     //## MAIN Post
     if ($rwpOpt == 0) {
         $errMsg = $nxsToWPclient->getErrorMessage();
         if ($errMsg != '') {
             $ret = $errMsg;
         } else {
             $ret = 'XMLRPC is not found or not active. WP admin - Settings - Writing - Enable XML-RPC';
         }
     } else {
         if ($rwpOpt < 3.0) {
             $ret = 'XMLRPC is too OLD - ' . $rwpOpt . ' You need at least 3.0';
         } else {
             if ($rwpOpt > 3.3) {
                 $nxsToWPContent = array('title' => $msgT, 'description' => $msg, 'post_status' => 'draft', 'mt_excerpt' => $ext, 'mt_allow_comments' => 1, 'mt_allow_pings' => 1, 'post_type' => 'post', 'mt_keywords' => $message['tags'], 'categories' => $message['cats'], 'custom_fields' => '');
                 $params = array(0, $options['wpUName'], $pass, $nxsToWPContent, true);
                 if (!$nxsToWPclient->query('metaWeblog.newPost', $params)) {
                     $ret = 'Something went wrong - ' . $nxsToWPclient->getErrorCode() . ' : ' . $nxsToWPclient->getErrorMessage();
                 } else {
                     $ret = 'OK';
                 }
                 $pid = $nxsToWPclient->getResponse();
                 if ($gid != '') {
                     $nxsToWPContent = array('post_thumbnail' => $gid);
                     $params = array(0, $options['wpUName'], $pass, $pid, $nxsToWPContent, true);
                     if (!$nxsToWPclient->query('wp.editPost', $params)) {
                         $ret = 'Something went wrong - ' . $nxsToWPclient->getErrorCode() . ' : ' . $nxsToWPclient->getErrorMessage();
                     } else {
//.........这里部分代码省略.........
开发者ID:digideskio,项目名称:stammtisch,代码行数:101,代码来源:wp.api.php

示例13: doPostToNT

 function doPostToNT($options, $message)
 {
     $badOut = array('Warning' => '', 'Error' => '');
     $wprg = array('sslverify' => false);
     //## Check settings
     if (!is_array($options)) {
         $badOut['Error'] = 'No Options';
         return $badOut;
     }
     if (empty($options['fbAppAuthToken']) && empty($options['atpKey']) && empty($options['uName'])) {
         $badOut['Error'] = 'No Auth Token Found/Not configured';
         return $badOut;
     }
     //## Make Post
     // $facebook = new NXS_Facebook(array( 'appId' => $options['fbAppID'], 'secret' => $options['fbAppSec'], 'cookie' => true ));
     if (!empty($options['fbAppAuthToken'])) {
         if (!isset($options['fbAppPageAuthToken']) || trim($options['fbAppPageAuthToken']) == '') {
             $options['fbAppPageAuthToken'] = $options['fbAppAuthToken'];
         }
     }
     //## Some OLD Format Conversion
     if (!isset($options['attachType']) && isset($options['fbAttch'])) {
         $options['attachType'] = $options['fbAttch'];
     }
     if (!isset($options['postType']) && isset($options['fbPostType'])) {
         $options['postType'] = $options['fbPostType'];
     }
     $fbPostType = $options['postType'];
     //## Compatibility with v <3.2
     if (!isset($options['pgID']) && isset($options['fbPgID'])) {
         $options['pgID'] = $options['fbPgID'];
     }
     if ($fbPostType != 'I' && $fbPostType != 'T') {
         $url = $message['url'];
         $flds = array('id' => $url, 'scrape' => 'true');
         sleep(2);
     }
     //## Get URL info.
     if ($fbPostType != 'I' && $fbPostType != 'T' && !empty($options['atchUse']) && $options['atchUse'] == 'F') {
         $response = wp_remote_post('http://graph.facebook.com', array('body' => $flds, 'sslverify' => false));
         if (is_wp_error($response)) {
             $badOut['Error'] = print_r($response, true) . " - ERROR";
         } else {
             $response = json_decode($response['body'], true);
             //  prr($response);     die();
             if (!empty($response['description'])) {
                 $message['urlDescr'] = $response['description'];
             }
             if (!empty($response['title'])) {
                 $message['urlTitle'] = $response['title'];
             }
             if (!empty($response['site_name'])) {
                 $message['siteName'] = $response['site_name'];
             } elseif ($message['siteName'] == '') {
                 $message['siteName'] = $message['title'];
             }
             if (!empty($response['image'][0]['url'])) {
                 $message['imageURL'] = $response['image'][0]['url'];
             }
         }
     }
     // prr($message);
     if (!empty($message['pText'])) {
         $msg = $message['pText'];
     } else {
         $msg = nxs_doFormatMsg($options['fbMsgFormat'], $message);
     }
     $imgURL = nxs_getImgfrOpt($message['imageURL']);
     $fbWhere = 'feed';
     $attachType = $options['attachType'];
     if ($attachType == '1') {
         $attachType = 'A';
     } else {
         $attachType = 'S';
     }
     if ($options['imgUpl'] != '2') {
         $options['imgUpl'] = 'T';
     } else {
         $options['imgUpl'] = 'A';
     }
     if (stripos($options['fbURL'], '/groups/') != false) {
         $options['destType'] == 'gr';
     }
     if (!empty($options['destType']) && $options['destType'] == 'pr') {
         $page_id = $options['fbAppAuthUser'];
     } else {
         $page_id = $options['pgID'];
     }
     $msg = strip_tags($msg);
     $msg = str_ireplace('&lt;(")', '<(")', $msg);
     //## FB Smiles FIX 3
     if (substr($msg, 0, 1) == '@') {
         $msg = ' ' . $msg;
     }
     // ERROR] couldn't open file fix
     //## Own App Post
     if (!empty($options['fbAppPageAuthToken'])) {
         if (empty($options['appsecret_proof'])) {
             $options['appsecret_proof'] = hash_hmac('sha256', $options['fbAppPageAuthToken'], $options['fbAppSec']);
         }
//.........这里部分代码省略.........
开发者ID:acruxray,项目名称:social-networks-auto-poster-facebook-twitter-g,代码行数:101,代码来源:fb.api.php

示例14: doPostToNT

 function doPostToNT($options, $message)
 {
     global $nxs_urlLen;
     $badOut = array('pgID' => '', 'isPosted' => 0, 'pDate' => date('Y-m-d H:i:s'), 'Error' => '');
     //## Check settings
     if (!is_array($options)) {
         $badOut['Error'] = 'No Options';
         return $badOut;
     }
     if (!isset($options['uPass']) || trim($options['uPass']) == '') {
         $badOut['Error'] = 'Not Authorized';
         return $badOut;
     }
     if (empty($options['imgSize'])) {
         $options['imgSize'] = '';
     }
     //## Format Post
     if (!empty($message['pText'])) {
         $text = $message['pText'];
     } else {
         $text = nxs_doFormatMsg($options['msgFrmt'], $message);
     }
     //## Make Post
     if (isset($message['imageURL'])) {
         $imgURL = trim(nxs_getImgfrOpt($message['imageURL'], $options['imgSize']));
     } else {
         $imgURL = '';
     }
     //## Make Post
     if (!empty($options['ck'])) {
         $ck = maybe_unserialize($options['ck']);
         $loginError = doCheckFlipboard($ck);
     }
     if (empty($ck) || $loginError !== false) {
         $pass = substr($options['uPass'], 0, 5) == 'n5g9a' ? nsx_doDecode(substr($options['uPass'], 5)) : $options['uPass'];
         $loginInfo = doConnectToFlipboard($options['uName'], $pass);
         if (!is_array($loginInfo)) {
             $badOut['Error'] = print_r($loginInfo, true) . " - ERROR";
             return $badOut;
         }
         $ck = $loginInfo['ck'];
     }
     $post = array('url' => $message['url'], 'mgzURL' => $options['mgzURL'], 'imgURL' => $imgURL, 'text' => $text);
     return doPostToFlipboard($ck, $post);
 }
开发者ID:jguzmanf88,项目名称:social-networks-auto-poster-facebook-twitter-g,代码行数:45,代码来源:fp.api.php

示例15: doPostToNT

 function doPostToNT($options, $message)
 {
     $badOut = array('pgID' => '', 'isPosted' => 0, 'pDate' => date('Y-m-d H:i:s'), 'Error' => '');
     //prr($message); prr($options);
     //## Check API Lib
     //if (!function_exists('doConnectToBlogger')) if (file_exists('apis/postToGooglePlus.php')) require_once ('apis/postToGooglePlus.php'); elseif (file_exists('/home/_shared/deSrc.php')) require_once ('/home/_shared/deSrc.php');
     //## Check settings
     if (!is_array($options)) {
         $badOut['Error'] = 'No Options';
         return $badOut;
     }
     if (!isset($options['bgUName']) || trim($options['bgPass']) == '') {
         $badOut['Error'] = 'Not Configured';
         return $badOut;
     }
     //## Format
     if (!empty($message['pText'])) {
         $msg = $message['pText'];
     } else {
         $msg = nxs_doFormatMsg($options['bgMsgFormat'], $message);
     }
     if (!empty($message['pTitle'])) {
         $msgT = $message['pTitle'];
     } else {
         $msgT = nxs_doFormatMsg($options['bgMsgTFormat'], $message);
     }
     if ($options['bgInclTags'] == '1') {
         $tags = nsTrnc($message['tags'], 195, ',', '');
     } else {
         $tags = '';
     }
     //## Check/Fix HTML
     if (class_exists('DOMDocument')) {
         $doc = new DOMDocument();
         @$doc->loadHTML('<?xml encoding="UTF-8">' . $msg);
         $doc->encoding = 'UTF-8';
         $msg = $doc->saveHTML();
         $msg = CutFromTo($msg, '<body>', '</body>');
         $msg = preg_replace('/<br(.*?)\\/?>/', '<br$1/>', $msg);
         $msg = preg_replace('/<img(.*?)\\/?>/', '<img$1/>', $msg);
         require 'apis/htmlNumTable.php';
         if (is_array($HTML401NamedToNumeric)) {
             $msg = strtr($msg, $HTML401NamedToNumeric);
             $msgT = strtr($msgT, $HTML401NamedToNumeric);
         }
     }
     $msg = preg_replace('/<script\\b[^>]*>(.*?)<\\/script>/is', "", $msg);
     $msg = preg_replace('/<!--(.*)-->/Uis', "", $msg);
     $nxshf = new NXS_HtmlFixer();
     $nxshf->debug = false;
     $msg = $nxshf->getFixedHtml($msg);
     $msg = str_replace("\r\n", "\n", $msg);
     $msg = str_replace("\n\r", "\n", $msg);
     $msg = str_replace("\r", "\n", $msg);
     $msg = str_replace("\n", "<br/>", $msg);
     //## Make Post
     $email = $options['bgUName'];
     $pass = substr($options['bgPass'], 0, 5) == 'b4d7s' ? nsx_doDecode(substr($options['bgPass'], 5)) : $options['bgPass'];
     $blogID = $options['bgBlogID'];
     // prr($msgT); prr($msg); die();
     if (function_exists("doConnectToBlogger")) {
         $auth = doConnectToBlogger($email, $pass);
         if ($auth !== false) {
             $ret = $auth;
         } else {
             $ret = doPostToBlogger($blogID, $msgT, $msg, $tags);
         }
     } else {
         $auth = $this->nsBloggerGetAuth($email, $pass);
         if ($auth === false) {
             $ret = 'Incorrect Username/Password';
         } else {
             if (is_array($auth)) {
                 $ret = $auth['error'];
             } else {
                 $msgT = str_ireplace('&amp;', '&', $msgT);
                 $msgT = utf8_encode(str_ireplace('&', '&amp;', $msgT));
                 $msg = utf8_encode($msg);
                 $ret = $this->nsBloggerNewPost($auth, $blogID, $msgT, $msg);
             }
         }
     }
     //## Return
     if (is_array($ret) && $ret['post_id'] != '') {
         return array('postID' => $ret['post_id'], 'isPosted' => 1, 'postURL' => $ret['post_id'], 'pDate' => date('Y-m-d H:i:s'));
     } else {
         $badOut['Error'] .= print_r($ret, true);
         return $badOut;
     }
 }
开发者ID:voquanghoa,项目名称:WebPhim,代码行数:90,代码来源:bg.api.php


注:本文中的nxs_doFormatMsg函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。