本文整理汇总了PHP中nxs_chArrVar函数的典型用法代码示例。如果您正苦于以下问题:PHP nxs_chArrVar函数的具体用法?PHP nxs_chArrVar怎么用?PHP nxs_chArrVar使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了nxs_chArrVar函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: nxs_doPublishToLJ
function nxs_doPublishToLJ($postID, $options)
{
$ntCd = 'LJ';
$ntCdL = 'lj';
$ntNm = 'LJ Based Blog';
if (!is_array($options)) {
$options = maybe_unserialize(get_post_meta($postID, $options, true));
}
//if (isset($options['timeToRun'])) wp_unschedule_event( $options['timeToRun'], 'nxs_doPublishToLJ', array($postID, $options));
$blogTitle = htmlspecialchars_decode(get_bloginfo('name'), ENT_QUOTES);
if ($blogTitle == '') {
$blogTitle = home_url();
}
$addParams = nxs_makeURLParams(array('NTNAME' => $ntNm, 'NTCODE' => $ntCd, 'ACCNAME' => $options['nName'], 'POSTID' => $postID));
$ii = $options['ii'];
if (!isset($options['pType'])) {
$options['pType'] = 'im';
}
if ($options['pType'] == 'sh') {
sleep(rand(1, 10));
}
$logNT = '<span style="color:#2097EE">LJ</span> - ' . $options['nName'];
$snap_ap = get_post_meta($postID, 'snap' . $ntCd, true);
$snap_ap = maybe_unserialize($snap_ap);
if ($options['pType'] != 'aj' && is_array($snap_ap) && (nxs_chArrVar($snap_ap[$ii], 'isPosted', '1') || nxs_chArrVar($snap_ap[$ii], 'isPrePosted', '1'))) {
$snap_isAutoPosted = get_post_meta($postID, 'snap_isAutoPosted', true);
if ($snap_isAutoPosted != '2') {
nxs_addToLogN('W', 'Notice', $logNT, '-=Duplicate=- Post ID:' . $postID, 'Already posted. No reason for posting duplicate' . ' |' . $uqID);
return;
}
}
//$imgURL = nxs_getPostImage($postID);
$email = $options['ljUName'];
$pass = substr($options['ljPass'], 0, 5) == 'n5g9a' ? nsx_doDecode(substr($options['ljPass'], 5)) : $options['ljPass'];
if ($postID == '0') {
echo "Testing ... <br/><br/>";
$options['ljMsgTFormat'] = 'Test Link from ' . home_url();
$options['ljMsgFormat'] = 'Test post please ignore';
} else {
$post = get_post($postID);
if (!$post) {
return;
}
$options['ljMsgFormat'] = nsFormatMessage($options['ljMsgFormat'], $postID, $addParams);
$options['ljMsgTFormat'] = nsFormatMessage($options['ljMsgTFormat'], $postID, $addParams);
nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPrePosted' => '1'));
}
//prr($msg); prr($msgFormat);
$extInfo = ' | PostID: ' . $postID . " - " . (isset($post) && is_object($post) ? $post->post_title : '');
//## Post
$t = wp_get_post_tags($postID);
$tggs = array();
foreach ($t as $tagA) {
$tggs[] = $tagA->name;
}
$tags = implode(',', $tggs);
$message = array('siteName' => $blogTitle, 'tags' => $tags);
// prr($message);
//## Actual Post
$ntToPost = new nxs_class_SNAP_LJ();
$ret = $ntToPost->doPostToNT($options, $message);
//## Process Results
if (!is_array($ret) || $ret['isPosted'] != '1') {
//## Error
if ($postID == '0') {
prr($ret);
}
nxs_addToLogN('E', 'Error', $logNT, '-=ERROR=- ' . print_r($ret, true), $extInfo);
} else {
// ## All Good - log it.
if ($postID == '0') {
nxs_addToLogN('S', 'Test', $logNT, 'OK - TEST Message Posted ');
echo _e('OK - Message Posted, please see your ' . $logNT . ' Page. ', 'nxs_snap');
} else {
nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPosted' => '1', 'pgID' => $ret['postID'], 'pDate' => date('Y-m-d H:i:s')));
nxs_addToLogN('S', 'Posted', $logNT, 'OK - Message Posted ', $extInfo);
}
}
//## Return Result
if ($ret['isPosted'] == '1') {
return 200;
} else {
return print_r($ret, true);
}
}
示例2: nxs_doPublishToKT
function nxs_doPublishToKT($postID, $options)
{
global $nxs_ktCkArray;
$ntCd = 'KT';
$ntCdL = 'kt';
$ntNm = 'Kippt';
if (!is_array($options)) {
$options = maybe_unserialize(get_post_meta($postID, $options, true));
}
// if (isset($options['timeToRun'])) wp_unschedule_event( $options['timeToRun'], 'nxs_doPublishToDI', array($postID, $options));
$addParams = nxs_makeURLParams(array('NTNAME' => $ntNm, 'NTCODE' => $ntCd, 'POSTID' => $postID, 'ACCNAME' => $options['nName']));
$blogTitle = htmlspecialchars_decode(get_bloginfo('name'), ENT_QUOTES);
if ($blogTitle == '') {
$blogTitle = home_url();
}
$ii = $options['ii'];
if (!isset($options['pType'])) {
$options['pType'] = 'im';
}
if ($options['pType'] == 'sh') {
sleep(rand(1, 10));
}
$logNT = '<span style="color:#000080">Kippt</span> - ' . $options['nName'];
$snap_ap = get_post_meta($postID, 'snap' . $ntCd, true);
$snap_ap = maybe_unserialize($snap_ap);
if ($options['pType'] != 'aj' && is_array($snap_ap) && (nxs_chArrVar($snap_ap[$ii], 'isPosted', '1') || nxs_chArrVar($snap_ap[$ii], 'isPrePosted', '1'))) {
$snap_isAutoPosted = get_post_meta($postID, 'snap_isAutoPosted', true);
if ($snap_isAutoPosted != '2') {
sleep(5);
nxs_addToLogN('W', 'Notice', $logNT, '-=Duplicate=- Post ID:' . $postID, 'Already posted. No reason for posting duplicate');
return;
}
}
if ($postID == '0') {
echo "Testing ... <br/><br/>";
$link = home_url();
$options['msgFormat'] = 'Test Message from ' . $link;
} else {
$post = get_post($postID);
if (!$post) {
return;
}
$link = get_permalink($postID);
$options['msgFrmt'] = nsFormatMessage($options['msgFrmt'], $postID, $addParams);
$options['msgTFrmt'] = nsFormatMessage($options['msgTFrmt'], $postID, $addParams);
nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPrePosted' => '1'));
}
$extInfo = ' | PostID: ' . $postID . " - " . (isset($post) && is_object($post) ? $post->post_title : '');
//## Create and Format message
$t = wp_get_post_tags($postID);
$tggs = array();
foreach ($t as $tagA) {
$tggs[] = $tagA->name;
}
$tags = implode(',', $tggs);
$tags = str_replace(' ', '+', $tags);
$message = array('url' => $link, 'surl' => $link, 'siteName' => $blogTitle, 'tags' => $tags);
//## Actual Post
$ntToPost = new nxs_class_SNAP_KT();
$ret = $ntToPost->doPostToNT($options, $message);
//## Process Results
if (!is_array($ret) || $ret['isPosted'] != '1') {
//## Error
if ($postID == '0') {
prr($ret);
}
nxs_addToLogN('E', 'Error', $logNT, '-=ERROR=- ' . print_r($ret, true), $extInfo);
} else {
// ## All Good - log it.
if ($postID == '0') {
nxs_addToLogN('S', 'Test', $logNT, 'OK - TEST Message Posted ');
echo _e('OK - Message Posted, please see your ' . $logNT . ' Page. ', 'social-networks-auto-poster-facebook-twitter-g');
} else {
nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPosted' => '1', 'pgID' => $ret['postID'], 'postURL' => $ret['postURL'], 'pDate' => date('Y-m-d H:i:s')));
nxs_addToLogN('S', 'Posted', $logNT, 'OK - Message Posted ', $extInfo);
}
}
//## Return Result
if ($ret['isPosted'] == '1') {
return 200;
} else {
return print_r($ret, true);
}
}
示例3: nxs_doPublishToFL
function nxs_doPublishToFL($postID, $options)
{
$ntCd = 'FL';
$ntCdL = 'fl';
$ntNm = 'Flickr';
if (!is_array($options)) {
$options = maybe_unserialize(get_post_meta($postID, $options, true));
}
$addParams = nxs_makeURLParams(array('NTNAME' => $ntNm, 'NTCODE' => $ntCd, 'POSTID' => $postID, 'ACCNAME' => $options['nName']));
if (empty($options['imgToUse'])) {
$options['imgToUse'] = '';
}
if (empty($options['imgSize'])) {
$options['imgSize'] = '';
}
$ii = $options['ii'];
if (!isset($options['pType'])) {
$options['pType'] = 'im';
}
if ($options['pType'] == 'sh') {
sleep(rand(1, 10));
}
$logNT = '<span style="color:#800000">Flickr</span> - ' . $options['nName'];
$snap_ap = get_post_meta($postID, 'snap' . $ntCd, true);
$snap_ap = maybe_unserialize($snap_ap);
if ($options['pType'] != 'aj' && is_array($snap_ap) && (nxs_chArrVar($snap_ap[$ii], 'isPosted', '1') || nxs_chArrVar($snap_ap[$ii], 'isPrePosted', '1'))) {
$snap_isAutoPosted = get_post_meta($postID, 'snap_isAutoPosted', true);
if ($snap_isAutoPosted != '2') {
nxs_addToLogN('W', 'Notice', $logNT, '-=Duplicate=- Post ID:' . $postID, 'Already posted. No reason for posting duplicate' . ' |');
return;
}
}
$message = array('message' => '', 'link' => '', 'imageURL' => '', 'videoURL' => '', 'announce' => '');
if ($postID == '0') {
echo "Testing ... <br/><br/>";
$message['description'] = 'Test Post, Description';
$message['title'] = 'Test Post - Title';
$message['url'] = home_url();
$message['tags'] = '';
if ($options['defImg'] != '') {
$imgURL = $options['defImg'];
} else {
$imgURL = "http://direct.gtln.us/img/nxs/NXS-Lama.jpg";
}
$message['imageURL'] = $imgURL;
} else {
nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPrePosted' => '1'));
$post = get_post($postID);
if (!$post) {
return;
}
$isNoImg = false;
$tags = '';
$options['msgFrmt'] = nsFormatMessage($options['msgFrmt'], $postID, $addParams);
$options['msgTFrmt'] = nsFormatMessage($options['msgTFrmt'], $postID, $addParams);
$tggs = array();
if ($options['inclTags'] == '1') {
$t = wp_get_post_tags($postID);
$tggs = array();
foreach ($t as $tagA) {
$tggs[] = $tagA->name;
}
$tags = '"' . implode('" "', $tggs) . '"';
}
$imgURL = nxs_getPostImage($postID, 'full');
if (preg_match("/noImg.\\.png/i", $imgURL)) {
$imgURL = '';
$isNoImg = true;
}
$options = nxs_getURL($options, $postID);
$urlToGo = $options['urlToUse'];
$message = array('url' => $urlToGo, 'imageURL' => $imgURL, 'noImg' => $isNoImg, 'tags' => $tags);
$lat = get_post_meta($postID, 'geo_latitude', true);
$long = get_post_meta($postID, 'geo_longitude', true);
if (!empty($lat) && !empty($long)) {
$message['latitude'] = $lat;
$message['longitude'] = $long;
}
$extInfo = ' | PostID: ' . $postID . " - " . (isset($post) && is_object($post) ? $post->post_title : '');
}
//## Actual Post
$ntToPost = new nxs_class_SNAP_FL();
$ret = $ntToPost->doPostToNT($options, $message);
//prr($ret);
//## Process Results
if (!is_array($ret) || $ret['isPosted'] != '1') {
//## Error
if ($postID == '0') {
prr($ret);
}
nxs_addToLogN('E', 'Error', $logNT, '-=ERROR=- ' . print_r($ret, true), $extInfo);
} else {
// ## All Good - log it.
if ($postID == '0') {
nxs_addToLogN('S', 'Test', $logNT, 'OK - TEST Message Posted ');
echo _e('OK - Message Posted, please see your ' . $logNT . ' Page. ', 'nxs_snap');
} else {
nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPosted' => '1', 'pgID' => $ret['postID'], 'postURL' => $ret['postURL'], 'pDate' => date('Y-m-d H:i:s')));
$extInfo .= ' | <a href="' . $ret['postURL'] . '" target="_blank">Post Link</a>';
nxs_addToLogN('S', 'Posted', $logNT, 'OK - Message Posted ', $extInfo);
//.........这里部分代码省略.........
示例4: nxs_doPublishToVB
function nxs_doPublishToVB($postID, $options)
{
global $nxs_vbCkArray, $plgn_NS_SNAutoPoster;
$ntCd = 'VB';
$ntCdL = 'vb';
$ntNm = 'vBulletin';
if (!is_array($options)) {
$options = maybe_unserialize(get_post_meta($postID, $options, true));
}
//if (isset($options['timeToRun'])) wp_unschedule_event( $options['timeToRun'], 'nxs_doPublishToVB', array($postID, $options));
$blogTitle = htmlspecialchars_decode(get_bloginfo('name'), ENT_QUOTES);
if ($blogTitle == '') {
$blogTitle = home_url();
}
$addParams = nxs_makeURLParams(array('NTNAME' => $ntNm, 'NTCODE' => $ntCd, 'POSTID' => $postID, 'ACCNAME' => $options['nName']));
$ii = $options['ii'];
if (!isset($options['pType'])) {
$options['pType'] = 'im';
}
if ($options['pType'] == 'sh') {
sleep(rand(1, 10));
}
$logNT = '<span style="color:#000080">vBulletin</span> - ' . $options['nName'];
$snap_ap = get_post_meta($postID, 'snap' . $ntCd, true);
$snap_ap = maybe_unserialize($snap_ap);
if ($options['pType'] != 'aj' && is_array($snap_ap) && (nxs_chArrVar($snap_ap[$ii], 'isPosted', '1') || nxs_chArrVar($snap_ap[$ii], 'isPrePosted', '1'))) {
$snap_isAutoPosted = get_post_meta($postID, 'snap_isAutoPosted', true);
if ($snap_isAutoPosted != '2') {
sleep(5);
nxs_addToLogN('W', 'Notice', $logNT, '-=Duplicate=- Post ID:' . $postID, 'Already posted. No reason for posting duplicate' . ' |' . $uqID);
return;
}
}
if ($postID == '0') {
echo "Testing ... <br/><br/>";
$urlToGo = home_url();
$options['vbMsgFormat'] = 'Test Message from ' . $urlToGo;
$options['vbMsgTFormat'] = 'Test Link from ' . $urlToGo;
} else {
$post = get_post($postID);
nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPrePosted' => '1'));
$options['vbMsgFormat'] = nsFormatMessage($options['vbMsgFormat'], $postID, $addParams);
$options['vbMsgTFormat'] = nsFormatMessage($options['vbMsgTFormat'], $postID, $addParams);
//## MyURL - URLToGo code
if (!isset($options['urlToUse']) || trim($options['urlToUse']) == '') {
$myurl = trim(get_post_meta($postID, 'snap_MYURL', true));
}
if ($myurl != '') {
$options['urlToUse'] = $myurl;
}
if (isset($options['urlToUse']) && trim($options['urlToUse']) != '') {
$urlToGo = $options['urlToUse'];
$options['useFBGURLInfo'] = true;
} else {
$urlToGo = get_permalink($postID);
}
$gOptions = $plgn_NS_SNAutoPoster->nxs_options;
$addURLParams = trim($gOptions['addURLParams']);
if ($addURLParams != '') {
$urlToGo .= (strpos($urlToGo, '?') !== false ? '&' : '?') . $addURLParams;
}
}
$dusername = $options['vbUName'];
//$link = urlencode($link); $desc = urlencode(substr($msg, 0, 500));
$extInfo = ' | PostID: ' . $postID . " - " . (!empty($post) && is_object($post) ? $post->post_title : '');
//## Message & Format
if ($options['vbInclTags'] == '1') {
$t = wp_get_post_tags($postID);
$tggs = array();
foreach ($t as $tagA) {
$tggs[] = $tagA->name;
}
$tags = implode(', ', $tggs);
/* $tags = str_replace(' ','+',$tags); */
} else {
$tags = '';
}
$message = array('siteName' => $blogTitle, 'tags' => $tags);
//## Actual Post
$ntToPost = new nxs_class_SNAP_VB();
$ret = $ntToPost->doPostToNT($options, $message);
//## Save Session
if (empty($options['vkSvC']) || serialize($nxs_vbCkArray) != $options['vbSvC']) {
global $plgn_NS_SNAutoPoster;
$gOptions = $plgn_NS_SNAutoPoster->nxs_options;
if (isset($options['ii']) && $options['ii'] !== '') {
$gOptions['vb'][$options['ii']]['vbSvC'] = serialize($nxs_vbCkArray);
update_option('NS_SNAutoPoster', $gOptions);
} else {
foreach ($gOptions['vb'] as $ii => $gpn) {
$result = array_diff($options, $gpn);
if (!is_array($result) || count($result) < 1) {
$gOptions['vb'][$ii]['vbSvC'] = serialize($nxs_vbCkArray);
update_option('NS_SNAutoPoster', $gOptions);
break;
}
}
}
}
//## Process Results
//.........这里部分代码省略.........
示例5: nxs_doPublishToVK
function nxs_doPublishToVK($postID, $options)
{
global $ShownAds, $nxs_vkCkArray;
$ntCd = 'VK';
$ntCdL = 'vk';
$ntNm = 'vKontakte(VK)';
$vidURL = '';
$imgVURL = '';
$dsc = '';
$lng = '';
if (!is_array($options)) {
$options = maybe_unserialize(get_post_meta($postID, $options, true));
}
//if (isset($options['timeToRun'])) wp_unschedule_event( $options['timeToRun'], 'nxs_doPublishToVK', array($postID, $options));
$addParams = nxs_makeURLParams(array('NTNAME' => $ntNm, 'NTCODE' => $ntCd, 'POSTID' => $postID, 'ACCNAME' => $options['nName']));
if (empty($options['imgToUse'])) {
$options['imgToUse'] = '';
}
if (empty($options['imgSize'])) {
$options['imgSize'] = '';
}
$blogTitle = htmlspecialchars_decode(get_bloginfo('name'), ENT_QUOTES);
if ($blogTitle == '') {
$blogTitle = home_url();
}
$ii = $options['ii'];
if (!isset($options['pType'])) {
$options['pType'] = 'im';
}
if ($options['pType'] == 'sh') {
sleep(rand(1, 10));
}
$logNT = '<span style="color:#000080">vKontakte</span> - ' . $options['nName'];
$snap_ap = get_post_meta($postID, 'snap' . $ntCd, true);
$snap_ap = maybe_unserialize($snap_ap);
if ($options['pType'] != 'aj' && is_array($snap_ap) && (nxs_chArrVar($snap_ap[$ii], 'isPosted', '1') || nxs_chArrVar($snap_ap[$ii], 'isPrePosted', '1'))) {
$snap_isAutoPosted = get_post_meta($postID, 'snap_isAutoPosted', true);
if ($snap_isAutoPosted != '2') {
nxs_addToLogN('W', 'Notice', $logNT, '-=Duplicate=- Post ID:' . $postID, 'Already posted. No reason for posting duplicate' . ' |' . $options['pType']);
return;
}
}
if ($postID == '0') {
echo "Testing ... <br/><br/>";
$urlToGo = home_url();
$msg = 'Test Link from ' . $urlToGo;
} else {
$post = get_post($postID);
if (!$post) {
return;
}
$options['msgFrmt'] = nxs_decodeEntitiesFull(strip_tags(nsFormatMessage($options['msgFrmt'], $postID, $addParams)));
//## MyURL - URLToGo code
$options = nxs_getURL($options, $postID, $addParams);
$urlToGo = $options['urlToUse'];
nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPrePosted' => '1'));
}
$extInfo = ' | PostID: ' . $postID . " - " . (is_object($post) ? $post->post_title : '') . ' |' . $options['pType'];
//## Message & Format
if (trim($options['imgToUse']) != '') {
$imgURL = $options['imgToUse'];
} else {
$imgURL = nxs_getPostImage($postID, 'full');
}
if (preg_match("/noImg.\\.png/i", $imgURL)) {
$imgURL = '';
}
if (function_exists('nxs_doPostToVK')) {
$vids = nsFindVidsInPost($post);
if (count($vids) > 0) {
if (strlen($vids[0]) == 11) {
$vidURL = 'http://www.youtube.com/watch?v=' . $vids[0];
$imgURL = 'http://img.youtube.com/vi/' . $vids[0] . '/maxresdefault.jpg';
}
if (strlen($vids[0]) == 8) {
$vidURL = 'https://secure.vimeo.com/moogaloop.swf?clip_id=' . $vids[0] . '&autoplay=1';
//$mssg['source'] = 'http://player.vimeo.com/video/'.$vids[0];
$apiURL = "http://vimeo.com/api/v2/video/" . $vids[0] . ".json?callback=showThumb";
$json = wp_remote_get($apiURL);
if (!is_wp_error($json)) {
$json = $json['body'];
$json = str_replace('showThumb(', '', $json);
$json = str_replace('])', ']', $json);
$json = json_decode($json, true);
$imgVURL = $json[0]['thumbnail_large'];
}
}
}
}
if (!empty($options['attchAsVid']) && $options['attchAsVid'] == '1' && trim($imgVURL) != '') {
$imgURL = $imgVURL;
}
if ($options['postType'] == 'A') {
if (trim($options['msgAFormat']) != '') {
$dsc = nsFormatMessage($options['msgAFormat'], $postID, $addParams);
} else {
if (function_exists('aioseop_mrt_fix_meta') && $dsc == '') {
$dsc = trim(get_post_meta($postID, '_aioseop_description', true));
}
if (function_exists('wpseo_admin_init') && $dsc == '') {
//.........这里部分代码省略.........
示例6: nxs_doPublishToDL
function nxs_doPublishToDL($postID, $options)
{
$ntCd = 'DL';
$ntCdL = 'dl';
$ntNm = 'Delicious';
// if (isset($options['timeToRun'])) wp_unschedule_event( $options['timeToRun'], 'nxs_doPublishToDL', array($postID, $options));
$ii = $options['ii'];
if (!isset($options['pType'])) {
$options['pType'] = 'im';
}
if ($options['pType'] == 'sh') {
sleep(rand(1, 10));
}
$logNT = '<span style="color:#000080">Delicious</span> - ' . $options['nName'];
$snap_ap = get_post_meta($postID, 'snap' . $ntCd, true);
$snap_ap = maybe_unserialize($snap_ap);
if ($options['pType'] != 'aj' && is_array($snap_ap) && (nxs_chArrVar($snap_ap[$ii], 'isPosted', '1') || nxs_chArrVar($snap_ap[$ii], 'isPrePosted', '1'))) {
$snap_isAutoPosted = get_post_meta($postID, 'snap_isAutoPosted', true);
if ($snap_isAutoPosted != '2') {
sleep(5);
nxs_addToLogN('W', 'Notice', $logNT, '-=Duplicate=- Post ID:' . $postID, 'Already posted. No reason for posting duplicate');
return;
}
}
if ($postID == '0') {
echo "Testing ... <br/><br/>";
$link = home_url();
$msgT = 'Test Link from ' . $link;
} else {
$post = get_post($postID);
if (!$post) {
return;
}
$link = get_permalink($postID);
$msgFormat = $options['dlMsgFormat'];
$msgTFormat = $options['dlMsgTFormat'];
$msgT = nsFormatMessage($msgTFormat, $postID);
$msg = nsFormatMessage($msgFormat, $postID);
nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPrePosted' => '1'));
}
$extInfo = ' | PostID: ' . $postID . " - " . $post->post_title;
$dusername = $options['dlUName'];
$pass = substr($options['dlPass'], 0, 5) == 'n5g9a' ? nsx_doDecode(substr($options['dlPass'], 5)) : $options['dlPass'];
$api = "api.del.icio.us/v1";
$link = urlencode($link);
$desc = urlencode(substr($msgT, 0, 250));
$ext = urlencode(substr($msg, 0, 1000));
$t = wp_get_post_tags($postID);
$tggs = array();
foreach ($t as $tagA) {
$tggs[] = $tagA->name;
}
$tags = urlencode(implode(',', $tggs));
$tags = str_replace(' ', '+', $tags);
$apicall = "https://{$api}/posts/add?red=api&url={$link}&description={$desc}&extended={$ext}&tags={$tags}";
$hdrsArr = nxs_getDLHeaders($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 - ' . "http://{$dusername}:*********@{$api}/posts/add?&url={$link}&description={$desc}&extended={$ext}&tags={$tags}";
nxs_addToLogN('E', 'Error', $logNT, '-=ERROR=- ' . $ret . "ERR: " . print_r($cnt, true), $extInfo);
} else {
if (is_array($cnt) && stripos($cnt['body'], 'code="done"') !== false) {
$ret = 'OK';
nxs_metaMarkAsPosted($postID, 'DL', $options['ii'], array('isPosted' => '1', 'pgID' => 'DL', 'pDate' => date('Y-m-d H:i:s')));
nxs_addToLogN('S', 'Posted', $logNT, 'OK - Message Posted ', $extInfo);
} elseif (is_array($cnt) && $cnt['body'] == '<?xml version="1.0" encoding="UTF-8"?>') {
$ret = 'It looks like Delicious API is Down';
nxs_addToLogN('E', 'Error', $logNT, 'It looks like Delicious API is Down', $extInfo);
} elseif (is_array($cnt) && stripos($cnt['body'], 'item already exists') !== false) {
$ret = '..All good, but this link has already been bookmarked..';
nxs_addToLogN('S', 'Skipped', $logNT, 'All good, but this link has already been bookmarked', $extInfo);
} else {
if ($cnt['response']['code'] == '401') {
$ret = " Incorrect Username/Password ";
} else {
$ret = 'Something went wrong - ' . "https://{$dusername}:*********@{$api}/posts/add?&url={$link}&description={$desc}&extended={$ext}&tags={$tags}";
}
nxs_addToLogN('E', 'Error', $logNT, '-=ERROR=- ' . $ret . "ERR: " . print_r($cnt, true), $extInfo);
}
}
if ($ret != 'OK') {
if ($postID == '0') {
echo $ret;
}
} else {
if ($postID == '0') {
echo 'OK - Message Posted, please see your Delicious Page';
nxs_addToLogN('S', 'Test', $logNT, 'OK - TEST Message Posted ');
}
}
if ($ret == 'OK') {
return 200;
//.........这里部分代码省略.........
示例7: nxs_doPublishToBG
function nxs_doPublishToBG($postID, $options)
{
$ntCd = 'BG';
$ntCdL = 'bg';
$ntNm = 'Blogger';
// $uqID = uniqid('BG_');
//$backtrace = debug_backtrace(); nxs_addToLogN('W', 'Enter', $ntCd, 'I am here - '.$ntCd."|".print_r($backtrace, true), '');
// if (isset($options['timeToRun'])) wp_unschedule_event( $options['timeToRun'], 'nxs_doPublishToBG', array($postID, $options));
$blogTitle = htmlspecialchars_decode(get_bloginfo('name'), ENT_QUOTES);
if ($blogTitle == '') {
$blogTitle = home_url();
}
$addParams = nxs_makeURLParams(array('NTNAME' => $ntNm, 'NTCODE' => $ntCd, 'ACCNAME' => $options['nName'], 'POSTID' => $postID));
$ii = $options['ii'];
if (!isset($options['pType'])) {
$options['pType'] = 'im';
}
if ($options['pType'] == 'sh') {
sleep(rand(1, 10));
}
$logNT = '<span style="color:#F87907">' . $ntNm . '</span> - ' . $options['nName'];
$snap_ap = get_post_meta($postID, 'snap' . $ntCd, true);
$snap_ap = maybe_unserialize($snap_ap);
if ($options['pType'] != 'aj' && is_array($snap_ap) && (nxs_chArrVar($snap_ap[$ii], 'isPosted', '1') || nxs_chArrVar($snap_ap[$ii], 'isPrePosted', '1'))) {
$snap_isAutoPosted = get_post_meta($postID, 'snap_isAutoPosted', true);
if ($snap_isAutoPosted != '2') {
nxs_addToLogN('W', 'Notice', $logNT, '-=Duplicate=- Post ID:' . $postID, 'Already posted. No reason for posting duplicate');
return;
}
}
if ($postID == '0') {
echo "Testing ... <br/><br/>";
$msgT = 'Test Post from ' . htmlentities($blogTitle);
$link = home_url();
$msg = 'Test Post from ' . $blogTitle . " " . $link;
} else {
$post = get_post($postID);
if (!$post) {
return;
}
$msgFormat = $options['bgMsgFormat'];
$msg = nsFormatMessage($msgFormat, $postID, $addParams);
$link = get_permalink($postID);
$msgTFormat = $options['bgMsgTFormat'];
$msgT = nsFormatMessage($msgTFormat, $postID, $addParams);
nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPrePosted' => '1'));
}
$extInfo = ' | PostID: ' . $postID . " - " . nxs_doQTrans($post->post_title, $lng);
//## Actual POST Code
$email = $options['bgUName'];
$pass = substr($options['bgPass'], 0, 5) == 'b4d7s' ? nsx_doDecode(substr($options['bgPass'], 5)) : $options['bgPass'];
$blogID = $options['bgBlogID'];
//echo "###".$auth."|".$blogID."|".$msgT."|".$msg;
if ($options['bgInclTags'] == '1') {
$t = wp_get_post_tags($postID);
$tggs = array();
foreach ($t as $tagA) {
$tggs[] = $tagA->name;
}
$tags = implode('","', $tggs);
$tags = nsTrnc($tags, 195, ',', '');
}
if (substr($tags, -1) == '"') {
$tags = substr($tags, 0, -1);
}
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_once 'apis/htmlNumTable.php';
if (is_array($HTML401NamedToNumeric)) {
$msg = strtr($msg, $HTML401NamedToNumeric);
$msgT = strtr($msgT, $HTML401NamedToNumeric);
}
}
// prr($text);
// prr($msg); echo " =HT= ";
$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);
// 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 = nsBloggerGetAuth($email, $pass);
//.........这里部分代码省略.........
示例8: nxs_doPublishToLI
function nxs_doPublishToLI($postID, $options)
{
global $nxs_gCookiesArr;
$ntCd = 'LI';
$ntCdL = 'li';
$ntNm = 'LinkedIn';
//if (isset($options['timeToRun'])) wp_unschedule_event( $options['timeToRun'], 'nxs_doPublishToLI', array($postID, $options));
$ii = $options['ii'];
if (!isset($options['pType'])) {
$options['pType'] = 'im';
}
if ($options['pType'] == 'sh') {
sleep(rand(1, 10));
}
$logNT = '<span style="color:#000058">LinkedIn</span> - ' . $options['nName'];
$snap_ap = get_post_meta($postID, 'snap' . $ntCd, true);
$snap_ap = maybe_unserialize($snap_ap);
if ($options['pType'] != 'aj' && is_array($snap_ap) && (nxs_chArrVar($snap_ap[$ii], 'isPosted', '1') || nxs_chArrVar($snap_ap[$ii], 'isPrePosted', '1'))) {
$snap_isAutoPosted = get_post_meta($postID, 'snap_isAutoPosted', true);
if ($snap_isAutoPosted != '2') {
sleep(5);
nxs_addToLogN('W', 'Notice', $logNT, '-=Duplicate=- Post ID:' . $postID, 'Already posted. No reason for posting duplicate' . ' |' . $uqID);
return;
}
}
$blogTitle = htmlspecialchars_decode(get_bloginfo('name'), ENT_QUOTES);
if ($blogTitle == '') {
$blogTitle = home_url();
}
// prr($options);
if ($postID == '0') {
echo "Testing ... <br/><br/>";
$msgT = 'Test Post from ' . $blogTitle;
$link = home_url();
$msg = 'Test Post from ' . $blogTitle . " " . $link;
$isAttachLI = '';
$title = $blogTitle;
} else {
$post = get_post($postID);
if (!$post) {
return;
}
$liMsgFormat = $options['liMsgFormat'];
$msg = nsFormatMessage($liMsgFormat, $postID);
$msgT = nsFormatMessage($options['liMsgFormatT'], $postID);
$link = get_permalink($postID);
$isAttachLI = $options['liAttch'];
$title = nsTrnc($post->post_title, 200);
nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPrePosted' => '1'));
}
$extInfo = ' | PostID: ' . $postID . " - " . $post->post_title;
$msgT = nsTrnc($msgT, 200);
if ($isAttachLI == '1') {
$src = nxs_getPostImage($postID);
$dsc = trim(apply_filters('the_content', $post->post_excerpt));
if ($dsc == '') {
$dsc = apply_filters('the_content', $post->post_content);
}
$dsc = strip_tags($dsc);
$dsc = nxs_decodeEntitiesFull($dsc);
$dsc = nxs_html_to_utf8($dsc);
$dsc = nsTrnc($dsc, 300);
}
$msg = nxs_html_to_utf8($msg);
$msgT = nxs_html_to_utf8($msgT);
if (function_exists("doConnectToLinkedIn") && $options['ulName'] != '' && $options['uPass'] != '') {
$auth = doConnectToLinkedIn($options['ulName'], $options['uPass'], $options['ii']);
if ($auth !== false) {
die($auth);
}
$to = $options['uPage'] != '' ? $options['uPage'] : 'http://www.linkedin.com/home';
$lnk = array();
$msg = str_ireplace(' ', ' ', $msg);
$msg = nsTrnc(strip_tags($msg), 700);
if ($postID == '0') {
$lnk['title'] = get_bloginfo('name');
$lnk['desc'] = get_bloginfo('description');
$lnk['url'] = home_url();
} else {
if ($isAttachLI == '1') {
$lnk['title'] = nsTrnc(strip_tags($post->post_title), 200);
$lnk['postTitle'] = $msgT;
$lnk['desc'] = $dsc;
$lnk['url'] = get_permalink($postID);
$lnk['img'] = $src;
}
}
//prr($msg);
$ret = doPostToLinkedIn($msg, $lnk, $to);
$liPostID = $options['uPage'];
} else {
require_once 'apis/liOAuth.php';
$linkedin = new nsx_LinkedIn($options['liAPIKey'], $options['liAPISec']);
$linkedin->oauth_verifier = $options['liOAuthVerifier'];
$linkedin->request_token = new nsx_trOAuthConsumer($options['liOAuthToken'], $options['liOAuthTokenSecret'], 1);
$linkedin->access_token = new nsx_trOAuthConsumer($options['liAccessToken'], $options['liAccessTokenSecret'], 1);
$msg = nsTrnc($msg, 700);
if ($options['grpID'] != '') {
try {
// prr($msgT); prr($msg); prr($options['grpID']); prr($src); prr($dsc); $purl = get_permalink($postID); prr($purl);
//.........这里部分代码省略.........
示例9: nxs_doPublishToWP
function nxs_doPublishToWP($postID, $options)
{
$ntCd = 'WP';
$ntCdL = 'wp';
$ntNm = 'WP Based Blog';
//if (isset($options['timeToRun'])) wp_unschedule_event( $options['timeToRun'], 'nxs_doPublishToWP', array($postID, $options));
$ii = $options['ii'];
if (!isset($options['pType'])) {
$options['pType'] = 'im';
}
if ($options['pType'] == 'sh') {
sleep(rand(1, 10));
}
$logNT = '<span style="color:#1A9EE6">WP</span> - ' . $options['nName'];
$snap_ap = get_post_meta($postID, 'snap' . $ntCd, true);
$snap_ap = maybe_unserialize($snap_ap);
if ($options['pType'] != 'aj' && is_array($snap_ap) && (nxs_chArrVar($snap_ap[$ii], 'isPosted', '1') || nxs_chArrVar($snap_ap[$ii], 'isPrePosted', '1'))) {
$snap_isAutoPosted = get_post_meta($postID, 'snap_isAutoPosted', true);
if ($snap_isAutoPosted != '2') {
sleep(5);
nxs_addToLogN('W', 'Notice', $logNT, '-=Duplicate=- Post ID:' . $postID, 'Already posted. No reason for posting duplicate' . ' |' . $uqID);
return;
}
}
$imgURL = nxs_getPostImage($postID);
$email = $options['wpUName'];
$pass = substr($options['wpPass'], 0, 5) == 'n5g9a' ? nsx_doDecode(substr($options['wpPass'], 5)) : $options['wpPass'];
if ($postID == '0') {
echo "Testing ... <br/><br/>";
$link = home_url();
$msgT = 'Test Link from ' . $link;
$msg = 'Test post please ignore';
} else {
$post = get_post($postID);
if (!$post) {
return;
}
$link = get_permalink($postID);
$msgFormat = $options['wpMsgFormat'];
$msg = nsFormatMessage($msgFormat, $postID);
$msgTFormat = $options['wpMsgTFormat'];
$msgT = nsFormatMessage($msgTFormat, $postID);
nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPrePosted' => '1'));
}
$dusername = $options['wpUName'];
$link = urlencode($link);
$desc = urlencode(substr($msgT, 0, 250));
$ext = urlencode(substr($msg, 0, 1000));
$t = wp_get_post_tags($postID);
$tggs = array();
foreach ($t as $tagA) {
$tggs[] = $tagA->name;
}
$tags = implode(',', $tggs);
$postCats = wp_get_post_categories($postID);
$cats = array();
foreach ($postCats as $c) {
$cat = get_category($c);
$cats[] = str_ireplace('&', '&', $cat->name);
}
// $cats = implode(',',$catsA);
//## 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-' . $postID . '.jpg', 'type' => 'image/jpg', 'bits' => new NXS_XMLRPC_Base64($filedata), true);
$status = $nxsToWPclient->query('metaWeblog.newMediaObject', $postID, $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();
$rwpOpt = $rwpOpt['software_version']['value'];
$rwpOpt = floatval($rwpOpt);
//prr($rwpOpt);prr($nxsToWPclient);
$extInfo = ' | PostID: ' . $postID . " - " . $post->post_title;
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';
//.........这里部分代码省略.........
示例10: nxs_doPublishToSU
function nxs_doPublishToSU($postID, $options)
{
global $nxs_suCkArray;
$ntCd = 'SU';
$ntCdL = 'su';
$ntNm = 'StumbleUpon';
//$backtrace = debug_backtrace(); nxs_addToLogN('W', 'Enter', $ntCd, 'I am here - '.$ntCd."|".print_r($backtrace, true), '');
//if (isset($options['timeToRun'])) wp_unschedule_event( $options['timeToRun'], 'nxs_doPublishToSU', array($postID, $options));
$ii = $options['ii'];
if (!isset($options['pType'])) {
$options['pType'] = 'im';
}
if ($options['pType'] == 'sh') {
sleep(rand(1, 10));
}
$logNT = '<span style="color:#000080">StumbleUpon</span> - ' . $options['nName'];
$snap_ap = get_post_meta($postID, 'snap' . $ntCd, true);
$snap_ap = maybe_unserialize($snap_ap);
if ($options['reset'] != '1' && $options['pType'] != 'aj' && is_array($snap_ap) && (nxs_chArrVar($snap_ap[$ii], 'isPosted', '1') || nxs_chArrVar($snap_ap[$ii], 'isPrePosted', '1'))) {
$snap_isAutoPosted = get_post_meta($postID, 'snap_isAutoPosted', true);
if ($snap_isAutoPosted != '2') {
sleep(5);
nxs_addToLogN('W', 'Notice', $logNT, '-=Duplicate=- Post ID:' . $postID, 'Already posted. No reason for posting duplicate' . ' |' . $uqID);
return;
}
}
$suCat = $options['suCat'];
// if (function_exists("get_post_thumbnail_id") ){ $src = wp_get_attachment_image_src(get_post_thumbnail_id($postID), 'thumbnail'); $src = $src[0];}
$email = $options['suUName'];
$pass = substr($options['suPass'], 0, 5) == 'n5g9a' ? nsx_doDecode(substr($options['suPass'], 5)) : $options['suPass'];
if ($postID == '0') {
echo "Testing ... <br/><br/>";
$link = home_url();
$msg = 'Test Link from ' . $link;
} else {
$post = get_post($postID);
if (!$post) {
return;
}
$msgFormat = $options['suMsgFormat'];
$msg = nsFormatMessage($msgFormat, $postID);
$link = get_permalink($postID);
nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPrePosted' => '1'));
}
$dusername = $options['suUName'];
//$link = urlencode($link); $desc = urlencode(substr($msg, 0, 500));
$extInfo = ' | PostID: ' . $postID . " - " . $post->post_title;
if ($options['suInclTags'] == '1') {
$t = wp_get_post_tags($postID);
$tggs = array();
foreach ($t as $tagA) {
$tggs[] = $tagA->name;
}
$tags = urlencode(implode(',', $tggs));
$tags = str_replace(' ', '+', $tags);
} else {
$tags = '';
}
if (isset($options['suSvC'])) {
$nxs_suCkArray = maybe_unserialize($options['suSvC']);
}
$loginError = true;
if (is_array($nxs_suCkArray)) {
$loginError = nxs_doCheckSU();
}
if ($loginError != false) {
$loginError = nxs_doConnectToSU($email, $pass);
}
if (serialize($nxs_suCkArray) != $options['suSvC']) {
global $plgn_NS_SNAutoPoster;
$gOptions = $plgn_NS_SNAutoPoster->nxs_options;
if (isset($options['ii']) && $options['ii'] !== '') {
$gOptions['su'][$options['ii']]['suSvC'] = serialize($nxs_suCkArray);
update_option('NS_SNAutoPoster', $gOptions);
} else {
foreach ($gOptions['su'] as $ii => $gpn) {
$result = array_diff($options, $gpn);
if (!is_array($result) || count($result) < 1) {
$gOptions['su'][$ii]['suSvC'] = serialize($nxs_suCkArray);
update_option('NS_SNAutoPoster', $gOptions);
break;
}
}
}
}
if ($loginError !== false) {
if ($postID == '0') {
prr($loginError);
}
nxs_addToLogN('E', 'Error', $logNT, '-=ERROR=- ' . print_r($loginError, true) . " - BAD USER/PASS", $extInfo);
return " -= BAD USER/PASS =- ";
}
$ret = nxs_doPostToSU($msg, $link, $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') {
if ($postID == '0') {
prr($ret);
//.........这里部分代码省略.........
示例11: nxs_doPublishToAP
function nxs_doPublishToAP($postID, $options)
{
$ntCd = 'AP';
$ntCdL = 'ap';
$ntNm = 'App.Net';
if (!is_array($options)) {
$options = maybe_unserialize(get_post_meta($postID, $options, true));
}
$addParams = nxs_makeURLParams(array('NTNAME' => $ntNm, 'NTCODE' => $ntCd, 'POSTID' => $postID, 'ACCNAME' => $options['nName']));
if (empty($options['imgToUse'])) {
$options['imgToUse'] = '';
}
if (empty($options['imgSize'])) {
$options['imgSize'] = '';
}
$ii = $options['ii'];
if (!isset($options['pType'])) {
$options['pType'] = 'im';
}
if ($options['pType'] == 'sh') {
sleep(rand(1, 10));
}
$logNT = '<span style="color:#800000">App.Net</span> - ' . $options['nName'];
$snap_ap = get_post_meta($postID, 'snap' . $ntCd, true);
$snap_ap = maybe_unserialize($snap_ap);
if ($options['pType'] != 'aj' && is_array($snap_ap) && (nxs_chArrVar($snap_ap[$ii], 'isPosted', '1') || nxs_chArrVar($snap_ap[$ii], 'isPrePosted', '1'))) {
$snap_isAutoPosted = get_post_meta($postID, 'snap_isAutoPosted', true);
if ($snap_isAutoPosted != '2') {
nxs_addToLogN('W', 'Notice', $logNT, '-=Duplicate=- Post ID:' . $postID, 'Already posted. No reason for posting duplicate' . ' |' . $uqID);
return;
}
}
$message = array('message' => '', 'link' => '', 'imageURL' => '', 'videoURL' => '');
if ($postID == '0') {
echo "Testing ... <br/><br/>";
$message['description'] = 'Test Post, Description';
$message['title'] = 'Test Post - Title';
$message['url'] = home_url();
} else {
nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPrePosted' => '1'));
$post = get_post($postID);
if (!$post) {
return;
}
$apAttchImg = $options['attchImg'];
$options['apTextFormat'] = nsFormatMessage($options['apTextFormat'], $postID, $addParams);
$extInfo = ' | PostID: ' . $postID . " - " . (isset($post) && is_object($post) ? $post->post_title : '');
if ($options['attchImg'] == '1') {
if (trim($options['imgToUse']) != '') {
$imgURL = $options['imgToUse'];
} else {
$imgURL = nxs_getPostImage($postID);
}
if (preg_match("/noImg.\\.png/i", $imgURL)) {
$imgURL = '';
}
if (trim($imgURL) == '') {
$options['attchImg'] = 0;
}
}
$message = array('imageURL' => $imgURL);
}
//## Actual Post
$ntToPost = new nxs_class_SNAP_AP();
$ret = $ntToPost->doPostToNT($options, $message);
//## Process Results
if (!is_array($ret) || $ret['isPosted'] != '1') {
//## Error
if ($postID == '0') {
prr($ret);
}
nxs_addToLogN('E', 'Error', $logNT, '-=ERROR=- ' . print_r($ret, true), $extInfo);
} else {
// ## All Good - log it.
if ($postID == '0') {
nxs_addToLogN('S', 'Test', $logNT, 'OK - TEST Message Posted ');
echo _e('OK - Message Posted, please see your ' . $logNT . ' Page. ', 'nxs_snap');
} else {
nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPosted' => '1', 'pgID' => $ret['postID'], 'postURL' => $ret['postURL'], 'pDate' => date('Y-m-d H:i:s')));
$extInfo .= ' | <a href="' . $ret['postURL'] . '" target="_blank">Post Link</a>';
nxs_addToLogN('S', 'Posted', $logNT, 'OK - Message Posted ', $extInfo);
}
}
//## Return Result
if ($ret['isPosted'] == '1') {
return 200;
} else {
return print_r($ret, true);
}
}
示例12: nxs_doPublishToPK
function nxs_doPublishToPK($postID, $options)
{
$ntCd = 'PK';
$ntCdL = 'pk';
$ntNm = 'Plurk';
if (!is_array($options)) {
$options = maybe_unserialize(get_post_meta($postID, $options, true));
}
//if (isset($options['timeToRun'])) wp_unschedule_event( $options['timeToRun'], 'nxs_doPublishToPK', array($postID, $options));
$blogTitle = htmlspecialchars_decode(get_bloginfo('name'), ENT_QUOTES);
if ($blogTitle == '') {
$blogTitle = home_url();
}
$addParams = nxs_makeURLParams(array('NTNAME' => $ntNm, 'NTCODE' => $ntCd, 'POSTID' => $postID, 'ACCNAME' => $options['nName']));
if (empty($options['imgToUse'])) {
$options['imgToUse'] = '';
}
if (empty($options['imgSize'])) {
$options['imgSize'] = '';
}
$ii = $options['ii'];
if (!isset($options['pType'])) {
$options['pType'] = 'im';
}
if ($options['pType'] == 'sh') {
sleep(rand(1, 10));
}
$logNT = '<span style="color:#014A76">Plurk</span> - ' . $options['nName'];
$snap_ap = get_post_meta($postID, 'snap' . $ntCd, true);
$snap_ap = maybe_unserialize($snap_ap);
if ($options['pType'] != 'aj' && is_array($snap_ap) && (nxs_chArrVar($snap_ap[$ii], 'isPosted', '1') || nxs_chArrVar($snap_ap[$ii], 'isPrePosted', '1'))) {
$snap_isAutoPosted = get_post_meta($postID, 'snap_isAutoPosted', true);
if ($snap_isAutoPosted != '2') {
sleep(5);
nxs_addToLogN('W', 'Notice', $logNT, '-=Duplicate=- Post ID:' . $postID, 'Already posted. No reason for posting duplicate' . ' |' . $uqID);
return;
}
}
//## Format
if ($postID == '0') {
echo "Testing ... <br/><br/>";
$msg = 'Test Post from ' . $blogTitle;
$msgT = 'Test Post from ' . $blogTitle;
} else {
$post = get_post($postID);
if (!$post) {
return;
}
$twMsgFormat = $options['pkMsgFormat'];
nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPrePosted' => '1'));
$twLim = 180;
$extInfo = ' | PostID: ' . $postID . " - " . $post->post_title;
if (stripos($twMsgFormat, '%URL%') !== false || stripos($twMsgFormat, '%SURL%') !== false) {
$twLim = $twLim - 5;
}
if (stripos($twMsgFormat, '%AUTHORNAME%') !== false) {
$aun = $post->post_author;
$aun = get_the_author_meta('display_name', $aun);
$twLim = $twLim - strlen($aun);
}
$noRepl = str_ireplace("%TITLE%", "", $twMsgFormat);
$noRepl = str_ireplace("%SITENAME%", "", $noRepl);
$noRepl = str_ireplace("%URL%", "", $noRepl);
$noRepl = str_ireplace("%RAWEXCERPT%", "", $noRepl);
$noRepl = str_ireplace("%SURL%", "", $noRepl);
$noRepl = str_ireplace("%TEXT%", "", $noRepl);
$noRepl = str_ireplace("%FULLTEXT%", "", $noRepl);
$noRepl = str_ireplace("%EXCERPT%", "", $noRepl);
$noRepl = str_ireplace("%ANNOUNCE%", "", $noRepl);
$noRepl = str_ireplace("%AUTHORNAME%", "", $noRepl);
$twLim = $twLim - strlen($noRepl);
$pTitle = $title = $post->post_title;
if ($post->post_excerpt != "") {
$pText = apply_filters('the_content', $post->post_excerpt);
} else {
$pText = apply_filters('the_content', $post->post_content);
}
$pFullText = apply_filters('the_content', $post->post_content);
$pRawText = $post->post_content;
if (stripos($twMsgFormat, '%TITLE%') !== false) {
$pTitle = nsTrnc($pTitle, $twLim);
$twMsgFormat = str_ireplace("%TITLE%", $pTitle, $twMsgFormat);
$twLim = $twLim - strlen($pTitle);
}
if (stripos($twMsgFormat, '%SITENAME%') !== false) {
$siteTitle = htmlspecialchars_decode(get_bloginfo('name'), ENT_QUOTES);
$siteTitle = nsTrnc($siteTitle, $twLim);
$twMsgFormat = str_ireplace("%SITENAME%", $siteTitle, $twMsgFormat);
$twLim = $twLim - strlen($siteTitle);
}
if (stripos($twMsgFormat, '%EXCERPT%') !== false) {
$pText = nsTrnc(strip_tags(strip_shortcodes($pText)), 300, " ", "...");
$pText = nsTrnc($pText, $twLim);
$twMsgFormat = str_ireplace("%EXCERPT%", $pText, $twMsgFormat);
$twLim = $twLim - strlen($pText);
}
if (stripos($twMsgFormat, '%FULLTEXT%') !== false) {
$pFullText = nsTrnc(strip_tags($pFullText), $twLim);
$twMsgFormat = str_ireplace("%FULLTEXT%", $pFullText, $twMsgFormat);
$twLim = $twLim - strlen($pFullText);
//.........这里部分代码省略.........
示例13: nxs_doPublishToFF
function nxs_doPublishToFF($postID, $options)
{
$ntCd = 'FF';
$ntCdL = 'ff';
$ntNm = 'FriendFeed';
if (!is_array($options)) {
$options = maybe_unserialize(get_post_meta($postID, $options, true));
}
//if (isset($options['timeToRun'])) wp_unschedule_event( $options['timeToRun'], 'nxs_doPublishToFF', array($postID, $options));
$addParams = nxs_makeURLParams(array('NTNAME' => $ntNm, 'NTCODE' => $ntCd, 'POSTID' => $postID, 'ACCNAME' => $options['nName']));
if (empty($options['imgToUse'])) {
$options['imgToUse'] = '';
}
if (empty($options['imgSize'])) {
$options['imgSize'] = '';
}
$blogTitle = htmlspecialchars_decode(get_bloginfo('name'), ENT_QUOTES);
if ($blogTitle == '') {
$blogTitle = home_url();
}
$ii = $options['ii'];
if (!isset($options['pType'])) {
$options['pType'] = 'im';
}
if ($options['pType'] == 'sh') {
sleep(rand(1, 10));
}
$logNT = '<span style="color:#000080">FriendFeed</span> - ' . $options['nName'];
$snap_ap = get_post_meta($postID, 'snap' . $ntCd, true);
$snap_ap = maybe_unserialize($snap_ap);
if ($options['pType'] != 'aj' && is_array($snap_ap) && (nxs_chArrVar($snap_ap[$ii], 'isPosted', '1') || nxs_chArrVar($snap_ap[$ii], 'isPrePosted', '1'))) {
$snap_isAutoPosted = get_post_meta($postID, 'snap_isAutoPosted', true);
if ($snap_isAutoPosted != '2') {
sleep(5);
nxs_addToLogN('W', 'Notice', $logNT, '-=Duplicate=- Post ID:' . $postID, 'Already posted. No reason for posting duplicate' . ' |' . $uqID);
return;
}
}
if ($postID == '0') {
echo "Testing ... <br/><br/>";
$link = home_url();
$options['ffMsgFormat'] = 'Test Link from ' . $link;
} else {
$post = get_post($postID);
if (!$post) {
return;
}
$link = get_permalink($postID);
$options['ffMsgFormat'] = nsFormatMessage($options['ffMsgFormat'], $postID, $addParams);
$extInfo = ' | PostID: ' . $postID . " - " . $post->post_title;
nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPrePosted' => '1'));
}
//## Message & Format
if (trim($options['imgToUse']) != '') {
$imgURL = $options['imgToUse'];
} else {
$imgURL = nxs_getPostImage($postID, 'full');
}
$message = array('siteName' => $blogTitle, 'imageURL' => $imgURL);
//## Actual Post
$ntToPost = new nxs_class_SNAP_FF();
$ret = $ntToPost->doPostToNT($options, $message);
//## Process Results
if (!is_array($ret) || $ret['isPosted'] != '1') {
//## Error
if ($postID == '0') {
prr($ret);
}
nxs_addToLogN('E', 'Error', $logNT, '-=ERROR=- ' . print_r($ret, true), $extInfo);
} else {
// ## All Good - log it.
if ($postID == '0') {
nxs_addToLogN('S', 'Test', $logNT, 'OK - TEST Message Posted ');
echo _e('OK - Message Posted, please see your ' . $logNT . ' Page. ', 'nxs_snap');
} else {
nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPosted' => '1', 'pgID' => $ret['postID'], 'pDate' => date('Y-m-d H:i:s')));
nxs_addToLogN('S', 'Posted', $logNT, 'OK - Message Posted ', $extInfo);
}
}
//## Return Result
if ($ret['isPosted'] == '1') {
return 200;
} else {
return print_r($ret, true);
}
}
示例14: nxs_doPublishToGP
function nxs_doPublishToGP($postID, $options)
{
$ntCd = 'GP';
$ntCdL = 'gp';
$ntNm = 'Google+';
global $plgn_NS_SNAutoPoster;
$ytCode = '';
$imgURL = '';
if (!is_array($options)) {
$options = maybe_unserialize(get_post_meta($postID, $options, true));
}
if (!class_exists('nxsAPI_GP') || defined('d1') && d1 == 1) {
nxs_addToLogN('E', 'Error', $ntCd, '-=ERROR=- No G+ API Lib Detected', '');
return "No G+ API Lib Detected";
}
$addParams = nxs_makeURLParams(array('NTNAME' => $ntNm, 'NTCODE' => $ntCd, 'POSTID' => $postID, 'ACCNAME' => $options['nName']));
if (empty($options['imgToUse'])) {
$options['imgToUse'] = '';
}
if (empty($options['imgSize'])) {
$options['imgSize'] = '';
}
$ii = $options['ii'];
if (!isset($options['pType'])) {
$options['pType'] = 'im';
}
if ($options['pType'] == 'sh') {
sleep(rand(1, 10));
}
$logNT = '<span style="color:#800000">Google+</span> - ' . $options['nName'];
$snap_ap = get_post_meta($postID, 'snap' . $ntCd, true);
$snap_ap = maybe_unserialize($snap_ap);
if ($options['pType'] != 'aj' && is_array($snap_ap) && (nxs_chArrVar($snap_ap[$ii], 'isPosted', '1') || nxs_chArrVar($snap_ap[$ii], 'isPrePosted', '1'))) {
$snap_isAutoPosted = get_post_meta($postID, 'snap_isAutoPosted', true);
if ($snap_isAutoPosted != '2') {
nxs_addToLogN('W', 'Notice', $logNT, '-=Duplicate=- Post ID:' . $postID, 'Already posted. No reason for posting duplicate' . ' |' . $uqID);
return;
}
}
$message = array('message' => '', 'link' => '', 'imageURL' => '', 'videoURL' => '', 'noImg' => false);
$isNoImg = false;
if ($postID == '0') {
echo "Testing ... <br/><br/>";
$options['gpMsgFormat'] = "Test Post from " . htmlspecialchars_decode(get_bloginfo('name'), ENT_QUOTES) . " - " . home_url();
$message['url'] = home_url();
} else {
nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPrePosted' => '1'));
$post = get_post($postID);
if (!$post) {
return;
}
$gpMsgFormat = $options['gpMsgFormat'];
$gpPostType = $options['postType'];
$msg = nsFormatMessage($gpMsgFormat, $postID, $addParams);
$options['gpMsgFormat'] = $msg;
$extInfo = ' | PostID: ' . $postID . " - " . (isset($post) && is_object($post) ? $post->post_title : '');
if ($gpPostType == 'I') {
$vids = nsFindVidsInPost($post, false);
if (count($vids) > 0) {
$ytCode = $vids[0];
}
/* if (trim($ytCode)=='') $options['trPostType']='T'; /* What is it? */
}
if ($gpPostType == 'A') {
if (trim($options['imgToUse']) != '') {
$imgURL = $options['imgToUse'];
} else {
$imgURL = nxs_getPostImage($postID, 'medium');
}
}
if ($gpPostType == 'I') {
if (trim($options['imgToUse']) != '') {
$imgURL = $options['imgToUse'];
} else {
$imgURL = nxs_getPostImage($postID, 'full');
}
}
if (preg_match("/noImg.\\.png/i", $imgURL)) {
$imgURL = '';
$isNoImg = true;
}
//## MyURL - URLToGo code
$options = nxs_getURL($options, $postID, $addParams);
$urlToGo = $options['urlToUse'];
$message = array('url' => $urlToGo, 'imageURL' => $imgURL, 'videoCode' => $ytCode, 'noImg' => $isNoImg);
//prr($message); die();
}
//## Actual Post
$ntToPost = new nxs_class_SNAP_GP();
$ret = $ntToPost->doPostToNT($options, $message);
//## Process Results
if (!is_array($ret) || $ret['isPosted'] != '1') {
//## Error
if ($postID == '0') {
prr($ret);
}
nxs_addToLogN('E', 'Error', $logNT, '-=ERROR=- ' . print_r($ret, true), $extInfo);
} else {
// ## All Good - log it.
if ($postID == '0') {
//.........这里部分代码省略.........
示例15: nxs_doPublishToPN
function nxs_doPublishToPN($postID, $options)
{
global $nxs_gCookiesArr, $plgn_NS_SNAutoPoster;
$ntCd = 'PN';
$ntCdL = 'pn';
$ntNm = 'Pinterest';
$price = '';
if (!is_array($options)) {
$options = maybe_unserialize(get_post_meta($postID, $options, true));
}
// $backtrace = debug_backtrace(); nxs_addToLogN('W', 'Enter', $ntCd, 'I am here - '.$ntCd."|".print_r($backtrace, true), '');
//if (isset($options['timeToRun'])) wp_unschedule_event( $options['timeToRun'], 'nxs_doPublishToPN', array($postID, $options));
$addParams = nxs_makeURLParams(array('NTNAME' => $ntNm, 'NTCODE' => $ntCd, 'POSTID' => $postID, 'ACCNAME' => $options['nName']));
$blogTitle = htmlspecialchars_decode(get_bloginfo('name'), ENT_QUOTES);
if ($blogTitle == '') {
$blogTitle = home_url();
}
if (empty($options['imgToUse'])) {
$options['imgToUse'] = '';
}
if (empty($options['imgSize'])) {
$options['imgSize'] = '';
}
if (empty($options['cImgURL'])) {
$options['cImgURL'] = 'R';
}
$ii = $options['ii'];
if (!isset($options['pType'])) {
$options['pType'] = 'im';
}
if ($options['pType'] == 'sh') {
sleep(rand(1, 10));
}
$logNT = '<span style="color:#FA5069">Pinterest</span> - ' . $options['nName'];
$snap_ap = get_post_meta($postID, 'snap' . $ntCd, true);
$snap_ap = maybe_unserialize($snap_ap);
$isAttachVid = $options['isAttachVid'];
if ($options['pType'] != 'aj' && is_array($snap_ap) && (nxs_chArrVar($snap_ap[$ii], 'isPosted', '1') || nxs_chArrVar($snap_ap[$ii], 'isPrePosted', '1'))) {
$snap_isAutoPosted = get_post_meta($postID, 'snap_isAutoPosted', true);
if ($snap_isAutoPosted != '2') {
sleep(5);
nxs_addToLogN('W', 'Notice', $logNT, '-=Duplicate=- Post ID:' . $postID, 'Already posted. No reason for posting duplicate |' . $uqID);
return;
}
}
if ($postID == '0') {
echo "Testing ... <br/><br/>";
$options['pnMsgFormat'] = 'Test Post from ' . $blogTitle;
$urlToGo = home_url();
if ($options['pnDefImg'] != '') {
$imgURL = $options['pnDefImg'];
} else {
$imgURL = "http://direct.gtln.us/img/nxs/NXS-Lama.jpg";
}
} else {
$post = get_post($postID);
if (!$post) {
return;
}
$options['pnMsgFormat'] = nsFormatMessage($options['pnMsgFormat'], $postID, $addParams);
//## MyURL - URLToGo code
if (!isset($options['urlToUse']) || trim($options['urlToUse']) == '') {
$myurl = trim(get_post_meta($postID, 'snap_MYURL', true));
}
if ($myurl != '') {
$options['urlToUse'] = $myurl;
}
if (isset($options['urlToUse']) && trim($options['urlToUse']) != '') {
$urlToGo = $options['urlToUse'];
$options['useFBGURLInfo'] = true;
} else {
$urlToGo = get_permalink($postID);
}
if ($addParams != '') {
$urlToGo .= (strpos($urlToGo, '?') !== false ? '&' : '?') . $addParams;
}
if (is_object($post)) {
$urlToGo = apply_filters('nxs_adjust_ex_url', $urlToGo, $post->post_content);
}
if (!empty($options['imgToUse'])) {
$imgURL = $options['imgToUse'];
} else {
$imgURL = nxs_getPostImage($postID, 'full', $options['pnDefImg']);
}
if (preg_match("/noImg.\\.png/i", $imgURL)) {
$imgURL = '';
}
if ($isAttachVid == '1') {
$vids = nsFindVidsInPost($post);
if (count($vids) > 0) {
$vidURL = 'http://www.youtube.com/v/' . $vids[0];
$imgURL = 'http://img.youtube.com/vi/' . $vids[0] . '/0.jpg';
}
}
$extInfo = ' | PostID: ' . $postID . " - " . is_object($post) ? $post->post_title : '';
}
if ($options['cImgURL'] == 'S') {
$options['cImgURL'] = 'R';
}
//## Pinterest no longer allows shorthened URLs.
//.........这里部分代码省略.........