本文整理汇总了PHP中nsx_doDecode函数的典型用法代码示例。如果您正苦于以下问题:PHP nsx_doDecode函数的具体用法?PHP nsx_doDecode怎么用?PHP nsx_doDecode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了nsx_doDecode函数的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;
}
示例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;
}
示例3: doPostToNT
function doPostToNT($options, $message)
{
$badOut = array('pgID' => '', 'isPosted' => 0, 'pDate' => date('Y-m-d H:i:s'), 'Error' => '');
//## Check API Lib
if (!function_exists('doPostToGooglePlus')) {
if (file_exists('apis/postToGooglePlus.php')) {
require_once 'apis/postToGooglePlus.php';
} elseif (file_exists('/home/_shared/deSrc.php')) {
require_once '/home/_shared/deSrc.php';
}
}
if (!function_exists('doPostToGooglePlus')) {
$badOut['Error'] = 'Google+ API Library not found';
return $badOut;
}
//## Check settings
if (!is_array($options)) {
$badOut['Error'] = 'No Options';
return $badOut;
}
if (!isset($options['gpUName']) || trim($options['gpPass']) == '') {
$badOut['Error'] = 'Not Configured';
return $badOut;
}
//## Make Post
$gpPostType = $options['postType'];
$email = $options['gpUName'];
$pass = substr($options['gpPass'], 0, 5) == 'n5g9a' ? nsx_doDecode(substr($options['gpPass'], 5)) : $options['gpPass'];
$loginError = doConnectToGooglePlus2($email, $pass);
if ($loginError !== false) {
$badOut['Error'] = print_r($loginError, true) . " - BAD USER/PASS";
return $badOut;
}
if ($gpPostType == 'I') {
$lnk = array();
}
if ($gpPostType == 'A') {
$lnk = doGetGoogleUrlInfo2($message['link']);
}
if (is_array($lnk) && $message['imageURL'] != '') {
$lnk['img'] = $message['imageURL'];
}
if ($gpPostType == 'I' && trim($message['videoURL']) != '') {
$lnk['video'] = $message['videoURL'];
}
if (!empty($options['gpPageID'])) {
$to = $options['gpPageID'];
$ret = doPostToGooglePlus2($message['message'], $lnk, $to);
} elseif (!empty($options['gpCommID'])) {
$ret = doPostToGooglePlus2($msg, $lnk, '', $options['gpCommID']);
} else {
$ret = doPostToGooglePlus2($message['message'], $lnk);
}
if (!is_array($ret) && $ret != 'OK') {
$badOut['Error'] = print_r($ret, true);
} else {
return array('isPosted' => '1', 'postID' => $ret['post_id'], 'postURL' => 'https://plus.google.com/' . $ret['post_id'], 'pDate' => date('Y-m-d H:i:s'));
}
return $badOut;
}
示例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;
}
示例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['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;
}
示例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['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'));
}
示例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['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;
}
}
示例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['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;
}
示例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['Error'] = 'No Options';
return $badOut;
}
if (!isset($options['rdUName']) || trim($options['rdUName']) == '' || !isset($options['rdPass']) || trim($options['rdPass']) == '') {
$badOut['Error'] = 'No username/password Found';
return $badOut;
}
//## Format Post
if (!empty($message['pTitle'])) {
$title = $message['pTitle'];
} else {
$title = nxs_doFormatMsg($options['rdTitleFormat'], $message);
}
$title = nsTrnc($title, 300);
if (!empty($message['pText'])) {
$text = $message['pText'];
} else {
$text = nxs_doFormatMsg($options['rdTextFormat'], $message);
}
//## Make Post
$pass = substr($options['rdPass'], 0, 5) == 'n5g9a' ? nsx_doDecode(substr($options['rdPass'], 5)) : $options['rdPass'];
$hdrsArr = '';
$loginInfo = doConnectToRD($options['rdUName'], $pass);
if (!is_array($loginInfo)) {
$badOut['Error'] = print_r($loginInfo, true) . " - ERROR";
return $badOut;
}
$mh = $loginInfo['mh'];
$ck = $loginInfo['ck'];
$post = array('uh' => $mh, 'sr' => $options['rdSubReddit'], 'title' => $title, 'save' => true);
if ($options['postType'] == 'A') {
$post['url'] = $message['url'];
$post['kind'] = 'link';
$retNum = 16;
} else {
$post['text'] = $text;
$post['kind'] = 'self';
$retNum = 10;
}
$url = "http://www.reddit.com/api/submit";
$postParams = array('method' => 'POST', 'timeout' => 45, 'redirection' => 0, 'extension' => 'json', 'headers' => $hdrsArr, 'body' => $post, 'cookies' => $ck);
$response = wp_remote_post($url, $postParams);
// prr($postParams); prr($response);
if (is_wp_error($response)) {
$badOut['Error'] = print_r($response, true) . " - ERROR";
return $badOut;
}
$response = json_decode($response['body'], true);
$rdNewPostID = 'http://www.reddit.com';
// prr($response);
if (!isset($response['jquery']) || !is_array($response['jquery'])) {
$badOut['Error'] = print_r($response, true) . " - ERROR";
return $badOut;
}
$r = $response['jquery'];
if (is_array($r[$retNum][3]) && count($r[$retNum][3]) > 0 && stripos($r[$retNum][3][0], 'http://') !== false) {
$rdNewPostID = $r[$retNum][3][0];
}
if (isset($r[18]) && is_array($r[18][3]) && count($r[18][3]) > 0 && stripos($r[18][3][0], 'error.BAD_CAPTCHA') !== false) {
$badOut['Error'] = "ERROR: Post Rejected. Reddit thinks that you don't have rights to post here";
return $badOut;
}
if (isset($r[18]) && is_array($r[18][3]) && count($r[18][3]) > 0 && stripos($r[18][3][0], 'error') !== false) {
$badOut['Error'] = "ERROR: " . $r[18][3][0];
return $badOut;
}
if (is_array($r[$retNum][3]) && count($r[$retNum][3]) > 0 && stripos($r[$retNum][3][0], 'http://') === false) {
$badOut['Error'] = print_r($r[$retNum][3][0], true) . " - ERROR";
return $badOut;
}
if (isset($r[18]) && is_array($r[18][3]) && count($r[18][3]) > 0 && stripos($r[18][3][0], 'already been submitted') !== false) {
$rdNewPostID .= str_ireplace('?already_submitted=true', '', $r[10][3][0]);
}
// echo "ID:".$rdNewPostID;
if ($rdNewPostID != 'http://www.reddit.com') {
return array('postID' => $rdNewPostID, 'isPosted' => 1, 'postURL' => $rdNewPostID, 'pDate' => date('Y-m-d H:i:s'));
} else {
$badOut['Error'] .= print_r($tmhOAuth->response['response'], true) . " MSG:" . print_r($msg, true);
return $badOut;
}
return $badOut;
}
示例10: showNTSettings
//.........这里部分代码省略.........
echo $nxs_plurl;
?>
img/<?php
echo $nt;
?>
-bg.png); background-repeat: no-repeat; background-position:90% 10%;">
<div style="width:100%;"><strong><?php
echo $nType;
?>
Username:</strong> </div><input name="<?php
echo $nt;
?>
[<?php
echo $ii;
?>
][uName]" style="width: 30%;" value="<?php
_e(apply_filters('format_to_edit', htmlentities($options['uName'], ENT_COMPAT, "UTF-8")), 'social-networks-auto-poster-facebook-twitter-g');
?>
" />
<div style="width:100%;"><strong><?php
echo $nType;
?>
Token:</strong> <span style="font-size: 11px; margin: 0px;">Get it from <a target="_blank" href="http://developers.kippt.com/">developers.kippt.com</a>.</span></div><input name="<?php
echo $nt;
?>
[<?php
echo $ii;
?>
][uPass]" style="width: 30%;" value="<?php
_e(apply_filters('format_to_edit', htmlentities(substr($options['uPass'], 0, 5) == 'n5g9a' ? nsx_doDecode(substr($options['uPass'], 5)) : $options['uPass'], ENT_COMPAT, "UTF-8")), 'social-networks-auto-poster-facebook-twitter-g');
?>
" /> <br/>
<div style="width:100%;"><strong><?php
echo $nType;
?>
List:</strong> </div><input name="<?php
echo $nt;
?>
[<?php
echo $ii;
?>
][list]" style="width: 30%;" value="<?php
_e(apply_filters('format_to_edit', htmlentities($options['list'], ENT_COMPAT, "UTF-8")), 'social-networks-auto-poster-facebook-twitter-g');
?>
" />
<br/><br/>
<?php
if ($isNew) {
?>
<input type="hidden" name="<?php
echo $nt;
?>
[<?php
echo $ii;
?>
][apDo<?php
echo $ntU;
?>
]" value="1" id="apDoNew<?php
echo $ntU;
echo $ii;
示例11: 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 {
//.........这里部分代码省略.........
示例12: doPostToNT
function doPostToNT($options, $message)
{
global $nxs_suCkArray;
$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['suUName']) || trim($options['suPass']) == '') {
$badOut['Error'] = 'Not Configured';
return $badOut;
}
$pass = substr($options['suPass'], 0, 5) == 'n5g9a' ? nsx_doDecode(substr($options['suPass'], 5)) : $options['suPass'];
//## Format
if (!empty($message['pText'])) {
$msg = $message['pText'];
} else {
$msg = nxs_doFormatMsg($options['suMsgFormat'], $message);
}
$urlToGo = !empty($message['url']) ? $message['url'] : '';
$tags = $message['tags'];
if (isset($options['suSvC'])) {
$nxs_suCkArray = maybe_unserialize($options['suSvC']);
}
$loginError = true;
if (is_array($nxs_suCkArray)) {
$loginError = $this->nxs_doCheckSU();
}
if ($loginError != false) {
$loginError = $this->nxs_doConnectToSU($options['suUName'], $pass);
}
if ($loginError !== false) {
$badOut['Error'] = print_r($loginError, true) . " - BAD USER/PASS";
return $badOut;
}
$ret = $this->nxs_doPostToSU($msg, $urlToGo, $options['suCat'], $tags, $options['nsfw'] == '1');
// $extInfo .= "++".$msg."|".$link."|".$options['suCat']."|".$tags."|".$options['nsfw'];
if ($ret == 'OK') {
$ret = array("code" => "OK", "post_id" => '');
}
if (!is_array($ret) && $ret != 'OK') {
$badOut['Error'] .= 'Something went wrong - ' . print_r($ret, true);
} elseif (isset($ret['code']) && $ret['code'] == 'OK') {
return array('isPosted' => '1', 'postID' => $ret['post_id'], 'postURL' => 'http://www.stumbleupon.com/content/' . $ret['post_id'] . '/comments', 'pDate' => date('Y-m-d H:i:s'));
} else {
$badOut['Error'] .= 'Error - ' . print_r($ret, true);
}
return $badOut;
}
示例13: showNTSettings
//.........这里部分代码省略.........
?>
_tab1" class="nsx_tab_content" style="background-image: url(<?php
echo $nxs_plurl;
?>
img/<?php
echo $nt;
?>
-bg.png); background-repeat: no-repeat; background-position:90% 10%;">
<div id="altFormat" style="">
<div style="width:100%;"><strong id="altFormatText">vBulletin URL:</strong> <span style="font-size: 11px; margin: 0px;">Could be Forum URL or Thread URL. Either new thread of new post will be created.</span></div>
<input name="vb[<?php
echo $ii;
?>
][apVBURL]" id="apVBURL" style="width: 60%;" value="<?php
_e(apply_filters('format_to_edit', htmlentities($options['vbURL'], ENT_COMPAT, "UTF-8")), 'nxs_snap');
?>
" /> <br/>
</div>
<div style="width:100%;"><strong>vBulletin Username:</strong> </div><input name="vb[<?php
echo $ii;
?>
][apVBUName]" id="apVBUName" style="width: 30%;" value="<?php
_e(apply_filters('format_to_edit', htmlentities($options['vbUName'], ENT_COMPAT, "UTF-8")), 'nxs_snap');
?>
" />
<div style="width:100%;"><strong>vBulletin Password:</strong> </div><input name="vb[<?php
echo $ii;
?>
][apVBPass]" id="apVBPass" type="password" style="width: 30%;" value="<?php
_e(apply_filters('format_to_edit', htmlentities(substr($options['vbPass'], 0, 5) == 'n5g9a' ? nsx_doDecode(substr($options['vbPass'], 5)) : $options['vbPass'], ENT_COMPAT, "UTF-8")), 'nxs_snap');
?>
" /> <br/>
<?php
if ($isNew) {
?>
<input type="hidden" name="vb[<?php
echo $ii;
?>
][apDoVB]" value="1" id="apDoNewVB<?php
echo $ii;
?>
" /> <?php
}
?>
<br/>
<p style="margin-bottom: 20px;margin-top: 5px;"><input value="1" id="vbInclTags" type="checkbox" name="vb[<?php
echo $ii;
?>
][vbInclTags]" <?php
if ((int) $options['vbInclTags'] == 1) {
echo "checked";
}
?>
/>
<strong>Post with tags</strong> Tags from the blogpost will be auto posted to vBulletin
</p>
<div id="altFormat" style="">
示例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);
}
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);
}
}
示例15: showNTSettings
//.........这里部分代码省略.........
?>
<span style="color:#580000; font-size: 16px;"><br/><br/>
<b><?php
_e('NextScritps Facebook API Library not found. Please upgrade plugin to "Pro" to get it.', 'nxs_snap');
?>
</b>
<?php
} else {
?>
<div style="width:100%;"><strong><?php
echo $nType;
?>
Login/Email:</strong> </div><input name="<?php
echo $nt;
?>
[<?php
echo $ii;
?>
][uName]" style="width: 30%;" value="<?php
_e(apply_filters('format_to_edit', htmlentities($options['uName'], ENT_COMPAT, "UTF-8")), 'nxs_snap');
?>
" />
<div style="width:100%;"><strong><?php
echo $nType;
?>
Password:</strong> </div><input name="<?php
echo $nt;
?>
[<?php
echo $ii;
?>
][uPass]" type="password" style="width: 30%;" value="<?php
_e(apply_filters('format_to_edit', htmlentities(substr($options['uPass'], 0, 5) == 'n5g9a' ? nsx_doDecode(substr($options['uPass'], 5)) : $options['uPass'], ENT_COMPAT, "UTF-8")), 'nxs_snap');
?>
" /> <br/>
<?php
}
?>
</div>
<br/><br/>
<div id="altFormat">
<div style="width:100%;"><strong id="altFormatText"><?php
_e('Message text Format', 'nxs_snap');
?>
:</strong> (<a href="#" id="apFBMsgFrmt<?php
echo $ii;
?>
HintInfo" onclick="mxs_showHideFrmtInfo('apFBMsgFrmt<?php
echo $ii;
?>
'); return false;"><?php
_e('Show format info', 'nxs_snap');
?>
</a>)</div>
<textarea cols="150" rows="3" id="fb<?php
echo $ii;
?>
SNAPformat" name="fb[<?php
echo $ii;
?>
][apFBMsgFrmt]" style="width:51%;max-width: 610px;" onfocus="jQuery('#fb<?php
echo $ii;
?>
SNAPformat').attr('rows', 6); mxs_showFrmtInfo('apFBMsgFrmt<?php