本文整理汇总了PHP中nxs_getImgfrOpt函数的典型用法代码示例。如果您正苦于以下问题:PHP nxs_getImgfrOpt函数的具体用法?PHP nxs_getImgfrOpt怎么用?PHP nxs_getImgfrOpt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了nxs_getImgfrOpt函数的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['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;
}
示例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['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 {
//.........这里部分代码省略.........
示例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['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;
}
示例4: 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);
}
}
示例5: 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('&#039;', "'", $msg);
$msg = str_replace(''', "'", $msg);
$msg = str_replace('#039;', "'", $msg);
$msg = str_replace('#039', "'", $msg);
$msg = str_replace('&#8217;', "'", $msg);
$msg = str_replace('’', "'", $msg);
$msg = str_replace('#8217;', "'", $msg);
$msg = str_replace('#8217', "'", $msg);
$msg = str_replace('&#8220;', '"', $msg);
$msg = str_replace('“', '"', $msg);
$msg = str_replace('#8220;', '"', $msg);
$msg = str_replace('#8220', "'", $msg);
$msg = str_replace('&#8221;', '"', $msg);
$msg = str_replace('”', '"', $msg);
$msg = str_replace('#8221;', '"', $msg);
$msg = str_replace('#8221', "'", $msg);
$msg = str_replace('&#8212;', '-', $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;
}
示例6: doPostToNT
function doPostToNT($options, $message)
{
$badOut = array('postID' => '', 'isPosted' => 0, 'pDate' => date('Y-m-d H:i:s'), 'Error' => '');
$liPostID = '';
//## Check settings
if (!is_array($options)) {
$badOut['Error'] = 'No Options';
return $badOut;
}
if ((!isset($options['ulName']) || trim($options['uPass']) == '') && empty($options['liOAuthVerifier'])) {
$badOut['Error'] = 'Not Configured';
return $badOut;
}
if (empty($options['imgSize'])) {
$options['imgSize'] = '';
}
if (empty($options['liMsgFormatT'])) {
$options['liMsgFormatT'] = '%TITLE%';
}
//## Format
if (!empty($message['pText'])) {
$msg = $message['pText'];
} else {
$msg = nxs_doFormatMsg($options['liMsgFormat'], $message);
}
if (!empty($message['pTitle'])) {
$msgT = $message['pTitle'];
} else {
$msgT = nxs_doFormatMsg($options['liMsgFormatT'], $message);
}
if (empty($options['postType'])) {
if ((int) $options['liAttch'] == 1 || $isNew) {
$options['postType'] = 'A';
}
}
if ($options['postType'] == 'A' || $options['postType'] == 'I') {
if (isset($message['imageURL'])) {
$imgURL = trim(nxs_getImgfrOpt($message['imageURL'], $options['imgSize']));
} else {
$imgURL = '';
}
if (preg_match("/noImg.\\.png/i", $imgURL)) {
$imgURL = '';
}
if (!empty($message['urlDescr'])) {
$dsc = $message['urlDescr'];
} else {
$dsc = $msg;
}
$dsc = strip_tags($dsc);
$dsc = nxs_decodeEntitiesFull($dsc);
$dsc = nxs_html_to_utf8($dsc);
$dsc = nsTrnc($dsc, 300);
}
$msg = strip_tags($msg);
$msg = nxs_html_to_utf8($msg);
$msgT = nxs_html_to_utf8($msgT);
$urlToGo = $message['url'];
if (function_exists("doConnectToLinkedIn") && $options['ulName'] != '' && $options['uPass'] != '') {
$dusername = $options['ulName'];
$pass = substr($options['uPass'], 0, 5) == 'n5g9a' ? nsx_doDecode(substr($options['uPass'], 5)) : $options['uPass'];
// ??? Do we need that??????
$auth = doConnectToLinkedIn($options['ulName'], $options['uPass'], $options['ii']);
if ($auth != false) {
$badOut['Error'] .= "|Auth Error - " . $auth;
return $badOut;
}
$to = $options['uPage'] != '' ? $options['uPage'] : 'https://www.linkedin.com/home';
$lnk = array();
$msg = str_ireplace(' ', ' ', $msg);
$msg = nsTrnc(strip_tags($msg), 700);
$lnk['postTitle'] = $msgT;
if ($options['postType'] == 'A') {
$lnk['title'] = $message['urlTitle'];
$lnk['desc'] = $message['urlDescr'];
$lnk['url'] = $urlToGo;
$lnk['img'] = $imgURL;
$lnk['postType'] = 'A';
}
if ($options['postType'] == 'I') {
$lnk['title'] = '';
$lnk['desc'] = '';
$lnk['url'] = $imgURL;
$lnk['img'] = $imgURL;
$lnk['postType'] = 'I';
$lnk['postTitle'] = $msgT;
}
if ($options['postType'] == 'T') {
$lnk['postType'] = 'T';
}
global $nxs_gCookiesArr;
$li = new nxsAPI_LI();
$li->debug = false;
if (!empty($nxs_gCookiesArr)) {
$li->ck = $nxs_gCookiesArr;
}
$ret = $li->post($msg, $lnk, $to);
if (is_array($ret) && !empty($ret['isPosted'])) {
return $ret;
}
//.........这里部分代码省略.........
示例7: doPostToNT
function doPostToNT($options, $message)
{
$badOut = array('pgID' => '', 'isPosted' => 0, 'pDate' => date('Y-m-d H:i:s'), 'Error' => '');
$lnk = '';
//## 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;
}
if (empty($options['imgSize'])) {
$options['imgSize'] = '';
}
//## Make Post
$gpPostType = $options['postType'];
if (!empty($message['pText'])) {
$msg = $message['pText'];
} else {
$msg = nxs_doFormatMsg($options['gpMsgFormat'], $message);
}
// Make "message default"
if ($gpPostType == 'I' || $gpPostType == 'A') {
if (isset($message['imageURL'])) {
$imgURL = trim(nxs_getImgfrOpt($message['imageURL'], $options['imgSize']));
} else {
$imgURL = '';
}
}
$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['url']);
}
if (is_array($lnk) && $imgURL != '') {
$lnk['img'] = $imgURL;
}
if (is_array($lnk) && $imgURL == '' && $message['noImg'] === true) {
$lnk['img'] = '';
}
// prr($lnk); prr($message); die();
if ($gpPostType == 'I' && !empty($message['videoURL'])) {
$lnk['video'] = $message['videoURL'];
}
if (!empty($options['gpPageID']) && empty($options['gpCommID'])) {
$to = $options['gpPageID'];
$ret = doPostToGooglePlus2($msg, $lnk, $to);
} elseif (!empty($options['gpCommID'])) {
$ret = doPostToGooglePlus2($msg, $lnk, $options['gpPageID'], $options['gpCommID'], $options['gpCCat']);
} else {
$ret = doPostToGooglePlus2($msg, $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;
}
示例8: doPostToNT
function doPostToNT($options, $message)
{
$badOut = array('pgID' => '', 'isPosted' => 0, 'pDate' => date('Y-m-d H:i:s'), 'Error' => '');
$lnk = '';
//## 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;
}
if (empty($options['imgSize'])) {
$options['imgSize'] = '';
}
//## Make Post
$gpPostType = $options['postType'];
if (!empty($message['pText'])) {
$msg = $message['pText'];
} else {
$msg = nxs_doFormatMsg($options['gpMsgFormat'], $message);
}
// Make "message default"
if ($gpPostType == 'I' || $gpPostType == 'A') {
if (isset($message['imageURL'])) {
$imgURL = trim(nxs_getImgfrOpt($message['imageURL'], $options['imgSize']));
} else {
$imgURL = '';
}
}
$email = $options['gpUName'];
$pass = substr($options['gpPass'], 0, 5) == 'n5g9a' ? nsx_doDecode(substr($options['gpPass'], 5)) : $options['gpPass'];
$nt = new nxsAPI_GP();
if (!empty($options['ck'])) {
$nt->ck = $options['ck'];
}
$nt->debug = false;
$loginError = $nt->connect($email, $pass);
if (!$loginError) {
if ($gpPostType == 'A') {
$lnk = $message['url'];
} elseif ($gpPostType == 'I') {
$lnk = array();
if ($imgURL != '') {
$lnk['img'] = $imgURL;
}
if ($imgURL == '' && $message['noImg'] === true) {
$lnk['img'] = '';
}
if (!empty($message['videoURL'])) {
$lnk['video'] = $message['videoURL'];
}
}
$pageID = '';
$comPgID = '';
$comPGCatID = '';
//if (!empty($options['gpPageID']) && empty($options['gpCommID'])) $pageID = $options['gpPageID'];
if (!empty($options['gpPageID'])) {
$pageID = $options['gpPageID'];
}
if (!empty($options['gpCommID'])) {
$comPgID = $options['gpCommID'];
$comPGCatID = $options['gpCCat'];
}
$result = $nt->postGP($msg, $lnk, $pageID, $comPgID, $comPGCatID);
} else {
$badOut['Error'] = "Login/Connection Error: " . print_r($loginError, true);
return $badOut;
}
if (is_array($result) && $result['isPosted'] == '1') {
nxs_save_glbNtwrks('gp', $options['ii'], $nt->ck, 'ck');
}
return $result;
}
示例9: 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('<(")', '<(")', $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']);
}
//.........这里部分代码省略.........
示例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'])) {
$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 = '';
}
$postType = $options['postType'];
if (empty($imgURL)) {
$badOut['Error'] = 'No Image. Flickr is an image-sharing network. You can\'t post to Flickr without image.';
return $badOut;
}
require_once 'apis/scOAuth.php';
$tum_oauth = new wpScoopITOAuth($options['appKey'], $options['appSec'], $options['accessToken'], $options['accessTokenSec']);
$tum_oauth->baseURL = 'https://www.flickr.com/services';
$tum_oauth->request_token_path = '/oauth/request_token';
$tum_oauth->access_token_path = '/oauth/access_token';
$tags = $message['tags'];
$postArr = array('title' => $msgT, 'description' => $text, 'tags' => $tags, 'is_public' => 1, 'safety_level' => 1, 'content_type' => 1, 'hidden' => 1);
$imgFile = $this->createFile($imgURL);
if (empty($imgFile) || is_array($imgFile)) {
$badOut['Error'] = 'Image Error - ' . print_r($imgFile, true);
return $badOut;
}
$phiID = $tum_oauth->flUploadPhoto($imgFile, $postArr);
// prr($phiID);
if (!empty($phiID) && strpos($phiID, 'Problem: ') === false) {
$params = array('format' => 'php_serial', 'method' => 'flickr.photosets.addPhoto', 'photo_id' => $phiID, 'photoset_id' => $options['setID']);
$uinfo = $tum_oauth->makeReq('https://api.flickr.com/services/rest/', $params);
if (!empty($message['latitude']) && !empty($message['longitude'])) {
$params = array('format' => 'php_serial', 'method' => 'flickr.photos.geo.setLocation', 'photo_id' => $phiID, 'lat' => $message['latitude'], 'lon' => $message['longitude']);
$uinfo = $tum_oauth->makeReq('https://api.flickr.com/services/rest/', $params);
}
}
if (!empty($phiID) && strpos($phiID, 'Problem: ') === false) {
return array('postID' => $phiID, 'isPosted' => 1, 'postURL' => str_ireplace('people', 'photos', $options['userURL']) . $phiID, 'pDate' => date('Y-m-d H:i:s'));
} else {
$badOut['Error'] .= print_r($phiID, true) . " Code:" . $tum_oauth->http_code;
return $badOut;
}
return $badOut;
}
示例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['trConsKey']) || trim($options['trConsSec']) == '' || empty($options['trAccessTocken'])) {
$badOut['Error'] = 'Not Configured';
return $badOut;
}
if (!isset($options['postType']) && isset($options['trPostType'])) {
$options['postType'] = $options['trPostType'];
}
//## Compatibility with v <3.2
if (empty($options['imgSize'])) {
$options['imgSize'] = '';
}
if (empty($message['postDate'])) {
$message['postDate'] = '';
}
if (empty($options['trMsgTFormat'])) {
$options['trMsgTFormat'] = '%TITLE%';
}
//## Format
if (!empty($message['pText'])) {
$msg = $message['pText'];
} else {
$msg = nxs_doFormatMsg($options['trMsgFormat'], $message);
}
if (!empty($message['pTitle'])) {
$msgT = $message['pTitle'];
} else {
$msgT = nxs_doFormatMsg($options['trMsgTFormat'], $message);
}
//## Post
$options['trURL'] = trim(str_ireplace('http://', '', $options['trURL']));
if (substr($options['trURL'], -1) == '/') {
$options['trURL'] = substr($options['trURL'], 0, -1);
}
require_once 'apis/trOAuth.php';
$consumer_key = $options['trConsKey'];
$consumer_secret = $options['trConsSec'];
$tum_oauth = new TumblrOAuth($consumer_key, $consumer_secret, $options['trAccessTocken']['oauth_token'], $options['trAccessTocken']['oauth_token_secret']);
//prr($options);
$postArr = array('tags' => $message['tags'], 'date' => $message['postDate']);
if ($options['fillSrcURL'] == '1') {
$postArr['source_url'] = $message['url'];
}
if (isset($message['imageURL'])) {
$imgURL = trim(nxs_getImgfrOpt($message['imageURL'], $options['imgSize']));
} else {
$imgURL = '';
}
// postType
if ($options['postType'] == 'I') {
$postArr['type'] = 'photo';
$postArr['caption'] = $msg;
$postArr['source'] = $imgURL;
if (!isset($options['cImgURL']) || $options['cImgURL'] == '' || $options['cImgURL'] == 'R') {
$postArr['link'] = $message['url'];
} elseif ($options['cImgURL'] == 'S') {
$postArr['link'] = $message['url'];
$postArr['link'] = nxs_mkShortURL($postArr['link']);
}
} elseif ($options['postType'] == 'U') {
$postArr['type'] = 'audio';
$postArr['caption'] = $msg;
$postArr['external_url'] = $aUrl;
} elseif ($options['postType'] == 'V') {
$postArr['type'] = 'video';
$postArr['caption'] = $msg;
$embedTxt = '<iframe width="560" height="315" src="http://www.youtube.com/embed/' . $message['videoURL'] . '" frameborder="0" allowfullscreen></iframe>';
$postArr['embed'] = $embedTxt;
} else {
$postArr['title'] = $msgT;
$postArr['type'] = 'text';
$postArr['source'] = $message['url'];
$postArr['body'] = $msg;
}
$postinfo = $tum_oauth->post("http://api.tumblr.com/v2/blog/" . $options['trURL'] . "/post", $postArr);
// prr("http://api.tumblr.com/v2/blog/".$options['trURL']."/post"); prr($postinfo); prr($postArr);
$code = $postinfo->meta->status;
// echo "XX".print_r($code); prr($postinfo); // prr($msg); prr($postinfo); echo $code."VVVV"; die("|====");
if ($code == 201) {
return array('postID' => $postinfo->response->id, 'isPosted' => 1, 'postURL' => 'http://' . $options['trURL'] . "/post/" . $postinfo->response->id, 'pDate' => date('Y-m-d H:i:s'));
} else {
$badOut['Error'] .= $code . " - " . $postinfo->meta->msg . (isset($postinfo->errmsg) ? $postinfo->errmsg : '') . " | " . print_r($postinfo, true);
}
return $badOut;
}
示例12: doPostToNT
function doPostToNT($options, $message)
{
global $nxs_gCookiesArr;
$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['pnUName']) || trim($options['pnPass']) == '') {
$badOut['Error'] = 'Not Configured';
return $badOut;
}
$pass = substr($options['pnPass'], 0, 5) == 'g9c1a' ? nsx_doDecode(substr($options['pnPass'], 5)) : $options['pnPass'];
if (empty($options['imgSize'])) {
$options['imgSize'] = '';
}
//## Format
if (!empty($message['pText'])) {
$msg = $message['pText'];
} else {
$msg = nxs_doFormatMsg($options['pnMsgFormat'], $message);
}
$boardID = $options['pnBoard'];
// prr($boardID); prr($_POST); die();
if (isset($message['imageURL'])) {
$imgURL = trim(nxs_getImgfrOpt($message['imageURL'], $options['imgSize']));
} else {
$imgURL = '';
}
if ($imgURL == '') {
$badOut['Error'] .= 'NO Image.';
}
$urlToGo = !empty($message['url']) ? $message['url'] : '';
//## Check for existing session
if (isset($options['ck'])) {
$nxs_gCookiesArr = maybe_unserialize($options['ck']);
}
$loginError = true;
if (is_array($nxs_gCookiesArr)) {
$loginError = doCheckPinterest();
}
if ($loginError !== false) {
$loginError = doConnectToPinterest($options['pnUName'], $pass);
}
if ($loginError !== false) {
$badOut['Error'] = print_r($loginError, true) . " - BAD USER/PASS";
return $badOut;
}
if (preg_match('/\\$(\\d+\\.\\d+)/', $msg, $matches)) {
$price = $matches[0];
} else {
$price = '';
}
if (isset($options['cImgURL']) && $options['cImgURL'] == 'S') {
$urlToGo = nxs_mkShortURL($urlToGo);
} elseif (isset($options['cImgURL']) && $options['cImgURL'] == 'N') {
$urlToGo = '';
}
$ret = doPostToPinterest($msg, $imgURL, $urlToGo, $boardID, 'TITLE WHERE IS IT?', $price, $urlToGo . "/GTH/");
if ($ret == 'OK') {
$ret = array("code" => "OK", "post_id" => '');
}
//prr($ret);
if (is_array($ret) && !empty($ret['post_id'])) {
return array('postID' => str_ireplace('/pin/', '', $ret['post_id']), 'isPosted' => 1, 'postURL' => $ret['post_url'], 'pDate' => date('Y-m-d H:i:s'));
} else {
$badOut['Error'] .= 'Something went wrong - ' . print_r($ret, true);
}
return $badOut;
}
示例13: doPostToNT
function doPostToNT($options, $message)
{
$badOut = array('pgID' => '', 'isPosted' => 0, 'pDate' => date('Y-m-d H:i:s'), 'Error' => '');
global $nxs_vkCkArray;
//## Check settings
if (!is_array($options)) {
$badOut['Error'] = 'No Options';
return $badOut;
}
if (empty($options['imgSize'])) {
$options['imgSize'] = '';
}
if ((!isset($options['uName']) || trim($options['uPass']) == '') && (!isset($options['vkAppAuthToken']) || trim($options['vkAppAuthToken']) == '')) {
$badOut['Error'] = 'Not Configured';
return $badOut;
}
$pass = substr($options['uPass'], 0, 5) == 'n5g9a' ? nsx_doDecode(substr($options['uPass'], 5)) : $options['uPass'];
//## Format
if (!empty($message['pText'])) {
$msg = $message['pText'];
} else {
$msg = nxs_doFormatMsg($options['msgFrmt'], $message);
}
$urlToGo = !empty($message['url']) ? $message['url'] : '';
$postType = $options['postType'];
//$link = urlencode($link); $desc = urlencode(substr($msg, 0, 500));
if (isset($message['imageURL'])) {
$imgURL = trim(nxs_getImgfrOpt($message['imageURL'], $options['imgSize']));
} else {
$imgURL = '';
}
$msgOpts = array();
$msgOpts['uid'] = $options['vkPgID'];
// if ($link!='') $msgOpts['link'] = $link;
if (!empty($message['videoURL']) && $postType == "I") {
$postType = 'A';
$urlToGo = $message['videoURL'];
$msgOpts['vID'] = $vids[0];
}
if ($postType == 'I' && trim($imgURL) == '') {
$postType = 'T';
}
$msgOpts['type'] = $postType;
if (function_exists('nxs_doPostToVK') && $postType == 'A' && $urlToGo != '') {
//## Login
if (isset($options['vkSvC'])) {
$nxs_vkCkArray = maybe_unserialize($options['vkSvC']);
}
$loginError = true;
if (is_array($nxs_vkCkArray)) {
$loginError = nxs_doCheckVK();
}
if ($loginError != false) {
if (!empty($options['vkPh'])) {
$replArr = explode(' ... ', $options['vkPhReq']);
$ph = $options['vkPh'];
$ln = strlen($replArr[0]);
if (substr($ph, 0, $ln) == $replArr[0]) {
$ph = substr($ph, $ln);
}
$ln = strlen($replArr[1]);
$mln = -$ln;
if (substr($ph, $mln) == $replArr[1]) {
$ph = substr($ph, $ln, $mln);
}
} else {
$ph = '';
}
$loginError = nxs_doConnectToVK($options['uName'], $pass, $ph);
}
// prr($loginError);
if ($loginError !== false) {
if (stripos($loginError, 'Phone verification required:') !== false) {
return $loginError;
} else {
return "ERROR - BAD USER/PASS - " . print_r($loginError, true);
}
}
//## Post
$msgOpts['url'] = $urlToGo;
$msgOpts['urlTitle'] = $message['urlTitle'];
$msgOpts['urlDesc'] = $message['urlDescr'];
$msgOpts['imgURL'] = $imgURL;
$ret = nxs_doPostToVK($msg, $options['url'], $msgOpts);
if (is_array($ret) && !empty($ret['code']) && $ret['code'] == 'OK') {
return array('postID' => $ret['post_id'], 'isPosted' => 1, 'postURL' => 'http://vk.com/wall' . $ret['post_id'], 'pDate' => date('Y-m-d H:i:s'));
} else {
$badOut .= 'ERROR: ' . print_r($ret, true);
}
}
//prr($postType);
if ($postType == 'I') {
$imgUpld = $this->nxs_uplImgtoVK($imgURL, $options);
if (is_object($imgUpld)) {
$imgID = $imgUpld->id;
$atts[] = $imgID;
} else {
$badOut['Error'] .= '-=ERROR=- ' . print_r($imgUpld, true);
}
}
//.........这里部分代码省略.........
示例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);
}
示例15: 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['apAppAuthToken']) || trim($options['apAppAuthToken']) == '') {
$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['apTextFormat'], $message);
}
$text = nsTrnc($text, 256);
//## Make Post
if (isset($message['imageURL'])) {
$img = trim(nxs_getImgfrOpt($message['imageURL'], $options['imgSize']));
} else {
$img = '';
}
if ($options['attchImg'] != false && $img != '') {
$remoteImg = $this->createFile($img, $options['apAppAuthToken']);
}
$ann = array();
if (is_array($remoteImg)) {
$ann[] = array("type" => "net.app.core.oembed", "value" => array("+net.app.core.file" => array("file_id" => $remoteImg['id'], "file_token" => $remoteImg['file_token'], "format" => "oembed")));
}
$url = "https://alpha-api.app.net/stream/0/posts?include_post_annotations=1&access_token=" . $options['apAppAuthToken'];
$flds = array('text' => $text, 'annotations' => $ann);
$flds = json_encode($flds);
$hdrsArr = array('Content-Type' => 'application/json');
$response = wp_remote_post($url, array('method' => 'POST', 'timeout' => 45, 'redirection' => 0, 'headers' => $hdrsArr, 'body' => $flds));
if (is_wp_error($response)) {
$badOut['Error'] = print_r($response, true) . " - ERROR";
return $badOut;
}
$response = json_decode($response['body'], true);
//prr($response); die();
//## Check Result
if (!is_array($response) || !isset($response['meta']) || $response['meta']['code'] != '200' || $response['data']['canonical_url'] == '') {
$badOut['Error'] = print_r($response, true) . " - ERROR";
return $badOut;
}
$apNewPostURL = $response['data']['canonical_url'];
$apNewPostID = $response['data']['id'];
if ($apNewPostID != '') {
return array('postID' => $apNewPostID, 'isPosted' => 1, 'postURL' => $apNewPostURL, '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;
}