本文整理汇总了PHP中nxs_getURL函数的典型用法代码示例。如果您正苦于以下问题:PHP nxs_getURL函数的具体用法?PHP nxs_getURL怎么用?PHP nxs_getURL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了nxs_getURL函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
//.........这里部分代码省略.........
示例2: nxs_doPublishToLI
function nxs_doPublishToLI($postID, $options)
{
global $nxs_gCookiesArr;
$ntCd = 'LI';
$ntCdL = 'li';
$ntNm = 'LinkedIn';
$urlDescr = '';
$myurl = '';
if (!is_array($options)) {
$options = maybe_unserialize(get_post_meta($postID, $options, true));
}
//if (isset($options['timeToRun'])) wp_unschedule_event( $options['timeToRun'], 'nxs_doPublishToLI', 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'] = '';
}
$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();
}
$imgURL = '';
// prr($options);
if ($postID == '0') {
echo "Testing ... <br/><br/>";
$options['liMsgFormatT'] = 'Test Post from ' . $blogTitle;
$urlToGo = home_url();
$options['liMsgFormat'] = 'Test Post from ' . $blogTitle . " " . $urlToGo;
$title = $blogTitle;
} else {
$post = get_post($postID);
if (!$post) {
return;
}
$options['liMsgFormat'] = nsFormatMessage($options['liMsgFormat'], $postID, $addParams);
$options['liMsgFormatT'] = nsTrnc(nsFormatMessage($options['liMsgFormatT'], $postID, $addParams), 200);
//## MyURL - URLToGo code
$options = nxs_getURL($options, $postID, $addParams);
$urlToGo = $options['urlToUse'];
$title = nsTrnc($post->post_title, 200);
nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPrePosted' => '1'));
if (empty($options['postType'])) {
if ((int) $options['liAttch'] == 1 || $isNew) {
$options['postType'] = 'A';
}
}
if ($options['postType'] == 'A' || $options['postType'] == 'I') {
if (trim($options['liMsgAFrmt']) != '') {
$urlDescr = nsFormatMessage($options['liMsgAFrmt'], $postID, $addParams);
} else {
$urlDescr = trim(apply_filters('the_content', $post->post_excerpt));
if ($urlDescr == '') {
$urlDescr = apply_filters('the_content', $post->post_content);
}
}
if (trim($options['imgToUse']) != '') {
$imgURL = $options['imgToUse'];
} else {
$imgURL = nxs_getPostImage($postID, 'full');
}
if (preg_match("/noImg.\\.png/i", $imgURL)) {
$imgURL = '';
}
$urlDescr = strip_tags($urlDescr);
$urlDescr = nxs_decodeEntitiesFull($urlDescr);
$urlDescr = nxs_html_to_utf8($urlDescr);
$urlDescr = nsTrnc($urlDescr, 300);
}
}
$extInfo = ' | PostID: ' . $postID . " - " . (isset($post) && is_object($post) ? $post->post_title : '');
//$images = array(nxs_getPostImage($postID, 'thumb'), nxs_getPostImage($postID, 'medium'), nxs_getPostImage($postID, 'full'), nxs_getPostImage($postID, 'original'));
$message = array('url' => $urlToGo, 'surl' => $urlToGo, 'urlDescr' => $urlDescr, 'urlTitle' => $title, 'title' => $title, 'imageURL' => $imgURL, 'videoCode' => '', 'videoURL' => '', 'siteName' => $blogTitle, 'cats' => '', 'authorName' => '');
//## Actual Post
$ntToPost = new nxs_class_SNAP_LI();
$ret = $ntToPost->doPostToNT($options, $message);
//## Process Results
if (!is_array($ret) || $ret['isPosted'] != '1') {
//## Error
if ($postID == '0') {
prr($ret);
//.........这里部分代码省略.........
示例3: nxs_doPublishToDL
function nxs_doPublishToDL($postID, $options)
{
$ntCd = 'DL';
$ntCdL = 'dl';
$ntNm = 'Delicious';
global $plgn_NS_SNAutoPoster;
if (!is_array($options)) {
$options = maybe_unserialize(get_post_meta($postID, $options, true));
}
// if (isset($options['timeToRun'])) wp_unschedule_event( $options['timeToRun'], 'nxs_doPublishToDL', 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">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/>";
$urlToGo = home_url();
$msgT = 'Test Link from ' . $urlToGo;
} else {
$post = get_post($postID);
if (!$post) {
return;
}
$options['dlMsgTFormat'] = nsFormatMessage($options['dlMsgTFormat'], $postID);
$options['dlMsgFormat'] = nsFormatMessage($options['dlMsgFormat'], $postID);
nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPrePosted' => '1'));
//## MyURL - URLToGo code
$options = nxs_getURL($options, $postID, $addParams);
$urlToGo = $options['urlToUse'];
}
$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' => $urlToGo, 'surl' => $urlToGo, 'siteName' => $blogTitle, 'tags' => $tags);
//## Actual Post
$ntToPost = new nxs_class_SNAP_DL();
$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'], 'pDate' => date('Y-m-d H:i:s')));
nxs_addToLogN('S', 'Posted', $logNT, 'OK - Message Posted ', $extInfo);
}
}
//## Return Result
if (!empty($ret['isPosted']) && $ret['isPosted'] == '1') {
return 200;
} else {
return print_r($ret, true);
}
}
示例4: 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 == '') {
//.........这里部分代码省略.........
示例5: nxs_doPublishToRD
function nxs_doPublishToRD($postID, $options)
{
$ntCd = 'RD';
$ntCdL = 'rd';
$ntNm = 'Reddit';
if (!is_array($options)) {
$options = maybe_unserialize(get_post_meta($postID, $options, true));
}
$ii = $options['ii'];
if (!isset($options['pType'])) {
$options['pType'] = 'im';
}
if ($options['pType'] == 'sh') {
sleep(rand(1, 10));
}
$logNT = '<span style="color:#800000">Reddit</span> - ' . $options['nName'];
$snap_ap = get_post_meta($postID, 'snap' . $ntCd, true);
$snap_ap = maybe_unserialize($snap_ap);
$addParams = nxs_makeURLParams(array('NTNAME' => $ntNm, 'NTCODE' => $ntCd, 'POSTID' => $postID, 'ACCNAME' => $options['nName']));
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' => '');
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;
}
$rdPostType = $options['postType'];
$options['rdTitleFormat'] = nsFormatMessage($options['rdTitleFormat'], $postID);
$options['rdTextFormat'] = nsFormatMessage($options['rdTextFormat'], $postID);
// prr($msg); echo $postID;
$extInfo = ' | PostID: ' . $postID . " - " . $post->post_title;
$options = nxs_getURL($options, $postID, $addParams);
$urlToGo = $options['urlToUse'];
$message = array('message' => $options['rdTextFormat'], 'url' => $urlToGo, 'title' => $options['rdTitleFormat']);
}
//## Actual Post
$ntToPost = new nxs_class_SNAP_RD();
$ret = $ntToPost->doPostToNT($options, $message);
// echo "~~~"; prr($ret); echo "+++";
//## 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'], '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);
}
}
示例6: nxs_doPublishToTR
//.........这里部分代码省略.........
$options['trMsgFormat'] = 'Test Post from ' . $blogTitle;
$msgT = 'Test Post from ' . $blogTitle;
$options['trPostType'] = 'T';
$postDate = gmdate("Y-m-d H:i:s") . " GMT";
$tags = '';
$urlToGo = '';
} else {
$post = get_post($postID);
if (!$post) {
return;
}
$options['trMsgFormat'] = nsFormatMessage($options['trMsgFormat'], $postID, $addParams);
$options['trMsgTFormat'] = nsFormatMessage($options['trMsgTFormat'], $postID, $addParams);
nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPrePosted' => '1'));
$tggs = array();
if ($options['trInclTags'] == '1') {
$t = wp_get_post_tags($postID);
$tggs = array();
foreach ($t as $tagA) {
$tggs[] = $tagA->name;
}
$tags = implode(',', $tggs);
}
if ($options['trInclCats'] == '1') {
$t = wp_get_post_categories($postID);
foreach ($t as $c) {
$cat = get_category($c);
$tggs[] = $cat->name;
}
$tags = implode(',', $tggs);
}
$postDate = ($options['useOrDate'] == '1' && $post->post_date_gmt != '0000-00-00 00:00:00' ? $post->post_date_gmt : gmdate("Y-m-d H:i:s", strtotime($post->post_date))) . " GMT";
//## Adds date to Tumblr post. Thanks to Kenneth Lecky
if ($options['trPostType'] == 'V') {
$vids = nsFindVidsInPost($post);
if (count($vids) > 0) {
$ytUrl = $vids[0];
}
if (trim($ytUrl) == '') {
$options['trPostType'] = 'T';
}
}
if ($options['trPostType'] == 'U') {
$aud = nsFindAudioInPost($post);
if (count($aud) > 0) {
$aUrl = $aud[0];
}
if (trim($aUrl) == '') {
$options['trPostType'] = 'T';
}
}
if ($options['trPostType'] == 'I') {
if (trim($options['imgToUse']) != '') {
$imgURL = $options['imgToUse'];
} else {
$imgURL = nxs_getPostImage($postID, 'large', $options['trDefImg']);
}
if (preg_match("/noImg.\\.png/i", $imgURL)) {
$imgURL = '';
}
if (trim($imgURL) == '') {
$options['trPostType'] = 'T';
}
}
//## MyURL - URLToGo code
$options = nxs_getURL($options, $postID, $addParams);
$urlToGo = $options['urlToUse'];
}
$extInfo = ' | PostID: ' . $postID . " - " . (isset($post) && is_object($post) ? $post->post_title : '') . ' |' . $options['pType'];
//## Post
$message = array('siteName' => $blogTitle, 'imageURL' => $imgURL, 'tags' => $tags, 'url' => $urlToGo, 'postDate' => $postDate, 'videoURL' => $ytUrl);
// prr($message); prr($options); die();
//## Actual Post
$ntToPost = new nxs_class_SNAP_TR();
$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')));
nxs_addToLogN('S', 'Posted', $logNT, 'OK - Message Posted ', $extInfo);
}
}
//prr($ret);
//## Return Result
if ($ret['isPosted'] == '1') {
return 200;
} else {
return print_r($ret, true);
}
}
示例7: nxs_doPublishToFB
//.........这里部分代码省略.........
if (count($vids) > 0) {
if (strlen($vids[0]) == 11) {
$options['urlToUse'] = 'http://youtu.be/' . $vids[0];
}
if (strlen($vids[0]) == 8 || strlen($vids[0]) == 9) {
$options['urlToUse'] = 'https://vimeo.com/' . $vids[0];
}
if (strlen($vids[0]) == 15) {
$options['urlToUse'] = 'https://www.facebook.com/video.php?v=' . $vids[0];
}
}
}
if ($isAttachVidFB == 'A') {
$vids = nsFindVidsInPost($post, false);
if (count($vids) > 0) {
if (strlen($vids[0]) == 11) {
$vidURL = 'http://www.youtube.com/v/' . $vids[0];
$imgURL = nsGetYTThumb($vids[0]);
}
if (strlen($vids[0]) == 8 || strlen($vids[0]) == 9) {
// $vidURL = 'https://secure.vimeo.com/moogaloop.swf?clip_id='.$vids[0].'&autoplay=1';
$vidURL = 'https://f.vimeocdn.com/p/flash/moogaloop/6.0.37/moogaloop.swf?autoplay=1&clip_id=' . $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('/**/', '', $json);
$json = str_replace('showThumb(', '', $json);
$json = str_replace('])', ']', $json);
$json = json_decode($json, true);
$imgURL = $json[0]['thumbnail_large'];
}
}
if (strlen($vids[0]) == 15) {
// $vidURL = 'https://secure.vimeo.com/moogaloop.swf?clip_id='.$vids[0].'&autoplay=1';
$vidURL = 'https://www.facebook.com/video.php?v=' . $vids[0];
$apiURL = "https://graph.facebook.com/" . $vids[0];
$json = wp_remote_get($apiURL);
if (!is_wp_error($json)) {
$json = $json['body'];
$json = json_decode($json, true);
$frmts = $json['format'];
$imgURL = array_pop($frmts);
$imgURL = $imgURL['picture'];
}
}
}
}
if (!empty($options['imgToUse'])) {
$imgURL = $options['imgToUse'];
}
if (preg_match("/noImg.\\.png/i", $imgURL)) {
$imgURL = 'http://www.noimage.faketld';
}
//$imgURL = 'http://cdn.gtln.us/img/t1x1.gif';
$options = nxs_getURL($options, $postID, $addParams);
$urlToGo = $options['urlToUse'];
$options['fbMsgFormat'] = $msg;
if (!empty($urlTitle)) {
$urlTitle = strip_tags(strip_shortcodes($urlTitle));
}
}
$message = array('url' => $urlToGo, 'urlTitle' => $urlTitle, 'urlDescr' => $dsc, 'imageURL' => $imgURL, 'videoURL' => $vidURL, 'siteName' => $blogTitle);
// prr($message); die();
if (isset($ShownAds)) {
$ShownAds = $ShownAdsL;
}
// FIX for the quick-adsense plugin
//## Actual Post
$ntToPost = new nxs_class_SNAP_FB();
$ret = $ntToPost->doPostToNT($options, $message);
//## Process Results
if (!is_array($ret) || !isset($ret['isPosted']) || $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_addToRI($postID);
nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPosted' => '1', 'pgID' => $ret['postID'], '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);
if (!empty($ret['log']) && !empty($ret['log']['Warning'])) {
nxs_addToLogN('W', 'Warning', $logNT, $ret['log']['Warning'], $extInfo);
}
}
}
//## Return Result
if (!empty($ret['isPosted']) && $ret['isPosted'] == '1') {
return 200;
} else {
return print_r($ret, true);
}
}
示例8: 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));
}
if (empty($options['ck'])) {
$options['ck'] = '';
}
// $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
$options = nxs_getURL($options, $postID, $addParams);
$urlToGo = $options['urlToUse'];
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.
//## Post
$message = array('siteName' => $blogTitle, 'tags' => '', 'url' => $urlToGo, 'imageURL' => $imgURL);
// prr($message);
//## Actual Post
$ntToPost = new nxs_class_SNAP_PN();
$ret = $ntToPost->doPostToNT($options, $message);
//## Save Session
if (serialize($nxs_gCookiesArr) != $options['ck']) {
global $plgn_NS_SNAutoPoster;
$gOptions = $plgn_NS_SNAutoPoster->nxs_options;
//.........这里部分代码省略.........
示例9: nxs_doPublishToSC
function nxs_doPublishToSC($postID, $options)
{
global $plgn_NS_SNAutoPoster;
$ntCd = 'SC';
$ntCdL = 'sc';
$ntNm = 'Scoop.It';
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">Scoop.It</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;
}
$postType = $options['postType'];
$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 = $tggs;
}
if ($postType == 'A') {
if (trim($options['imgToUse']) != '') {
$imgURL = $options['imgToUse'];
} else {
$imgURL = nxs_getPostImage($postID, 'medium');
}
}
if ($postType == '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, 'noImg' => $isNoImg, 'tags' => $tags);
$extInfo = ' | PostID: ' . $postID . " - " . (isset($post) && is_object($post) ? $post->post_title : '');
}
//## Actual Post
$ntToPost = new nxs_class_SNAP_SC();
$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. ', 'social-networks-auto-poster-facebook-twitter-g');
} else {
//.........这里部分代码省略.........
示例10: 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') {
//.........这里部分代码省略.........
示例11: nxs_doPublishToSU
function nxs_doPublishToSU($postID, $options)
{
global $nxs_suCkArray;
$ntCd = 'SU';
$ntCdL = 'su';
$ntNm = 'StumbleUpon';
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_doPublishToSU', 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">StumbleUpon</span> - ' . $options['nName'];
$snap_ap = get_post_meta($postID, 'snap' . $ntCd, true);
$snap_ap = maybe_unserialize($snap_ap);
/* Check is still nessesary or redo
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];}
if ($postID == '0') {
echo "Testing ... <br/><br/>";
$urlToGo = home_url();
$options['suMsgFormat'] = 'Test Link from ' . $urlToGo;
} else {
$post = get_post($postID);
if (!$post) {
return;
}
$options['suMsgFormat'] = nsFormatMessage($options['suMsgFormat'], $postID, $addParams);
nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPrePosted' => '1'));
//## MyURL - URLToGo code
$options = nxs_getURL($options, $postID, $addParams);
$urlToGo = $options['urlToUse'];
}
$dusername = $options['suUName'];
//$link = urlencode($link); $desc = urlencode(substr($msg, 0, 500));
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 = '';
}
$extInfo = ' | PostID: ' . $postID . " - " . (isset($post) && is_object($post) ? $post->post_title : '');
//## Post
$message = array('siteName' => $blogTitle, 'tags' => $tags, 'url' => $urlToGo);
//## Actual Post
$ntToPost = new nxs_class_SNAP_SU();
$ret = $ntToPost->doPostToNT($options, $message);
//## Save Session
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;
}
}
}
}
//## 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 {
//.........这里部分代码省略.........