本文整理汇总了PHP中nxs_decodeEntitiesFull函数的典型用法代码示例。如果您正苦于以下问题:PHP nxs_decodeEntitiesFull函数的具体用法?PHP nxs_decodeEntitiesFull怎么用?PHP nxs_decodeEntitiesFull使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了nxs_decodeEntitiesFull函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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 == '') {
//.........这里部分代码省略.........
示例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_doPublishToDI
function nxs_doPublishToDI($postID, $options)
{
global $nxs_diCkArray;
$ntCd = 'DI';
$ntCdL = 'di';
$ntNm = 'Diigo';
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">Diigo</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 (empty($postID)) {
echo "Testing ... <br/><br/>";
$urlToGo = home_url();
$options['diMsgFormat'] = 'Test Message from ' . $urlToGo;
$options['diMsgTFormat'] = 'Test Link from ' . $urlToGo;
} else {
$post = get_post($postID);
$options = nxs_getURL($options, $postID, $addParams);
$urlToGo = $options['urlToUse'];
$options['diMsgFormat'] = nxs_decodeEntitiesFull(nsFormatMessage($options['diMsgFormat'], $postID, $addParams));
$options['diMsgTFormat'] = nxs_decodeEntitiesFull(nsFormatMessage($options['diMsgTFormat'], $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' => $urlToGo, 'surl' => $urlToGo, 'siteName' => $blogTitle, 'tags' => $tags);
//## Actual Post
$ntToPost = new nxs_class_SNAP_DI();
$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 (!empty($ret['isPosted']) && $ret['isPosted'] == '1') {
return 200;
} else {
return print_r($ret, true);
}
}
示例4: nxs_doPublishToFB
//.........这里部分代码省略.........
}
// prr($options); echo "PP - ".$postID; prr($src);
if ($fbPostType == 'A' || $fbPostType == 'S') {
//## AUTO - Get Post Descr from SEO Plugins or make it.
if (trim($options['fbMsgAFrmt']) != '') {
$dsc = nsFormatMessage($options['fbMsgAFrmt'], $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 == '') {
$dsc = trim(get_post_meta($postID, '_yoast_wpseo_opengraph-description', true));
}
if (function_exists('wpseo_admin_init') && $dsc == '') {
$dsc = trim(get_post_meta($postID, '_yoast_wpseo_metadesc', true));
}
if ($dsc == '') {
$dsc = trim(apply_filters('the_content', nxs_doQTrans($post->post_excerpt, $lng)));
}
if ($dsc == '') {
$dsc = trim(nxs_doQTrans($post->post_excerpt, $lng));
}
if ($dsc == '') {
$dsc = trim(apply_filters('the_content', nxs_doQTrans($post->post_content, $lng)));
}
if ($dsc == '') {
$dsc = trim(nxs_doQTrans($post->post_content, $lng));
}
if ($dsc == '') {
$dsc = get_bloginfo('description');
}
}
$dsc = strip_tags(strip_shortcodes($dsc));
$dsc = nxs_decodeEntitiesFull($dsc);
$dsc = nsTrnc($dsc, 900, ' ');
}
$msg = str_replace('<br>', "\n", $msg);
$msg = str_replace('<br/>', "\n", $msg);
$msg = str_replace('<br />', "\n", $msg);
$msg = str_ireplace('<3', '<3', $msg);
$msg = str_ireplace('<(', '<(', $msg);
//## FB Smiles FIX.
$msg = strip_tags($msg);
$msg = nxs_decodeEntitiesFull($msg);
$msg = str_ireplace(''', "'", $msg);
$msg = str_ireplace('&039;', "'", $msg);
$msg = str_ireplace(''', "'", $msg);
$msg = str_ireplace('<3', '<3', $msg);
$msg = str_ireplace('<(', '<(', $msg);
//## FB Smiles FIX 2.
if ($isAttachVidFB == '1') {
$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) {
$vidURL = 'https://secure.vimeo.com/moogaloop.swf?clip_id=' . $vids[0] . '&autoplay=1';
$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);
示例5: nxs_doPublishToTW
//.........这里部分代码省略.........
if (stripos($twMsgFormat, '%TEXT%') !== false) {
$pText = nsTrnc(strip_tags(strip_shortcodes($pText)), 140, " ", "...");
$pText = nsTrnc($pText, $twLim);
$twMsgFormat = str_ireplace("%TEXT%", $pText, $twMsgFormat);
$twLim = $twLim - nxs_strLen($pText);
}
if (stripos($twMsgFormat, '%EXCERPT%') !== false) {
$pText = nsTrnc(strip_tags(strip_shortcodes($pText)), 140, " ", "...");
$pText = nsTrnc($pText, $twLim);
$twMsgFormat = str_ireplace("%EXCERPT%", $pText, $twMsgFormat);
$twLim = $twLim - nxs_strLen($pText);
}
if (stripos($twMsgFormat, '%ANNOUNCE%') !== false) {
$pText = nsTrnc(strip_tags(strip_shortcodes($pText)), 140, " ", "...");
$pText = nsTrnc($pText, $twLim);
$twMsgFormat = str_ireplace("%ANNOUNCE%", $pText, $twMsgFormat);
$twLim = $twLim - nxs_strLen($pText);
}
if (stripos($twMsgFormat, '%RAWEXCERPT%') !== false) {
$exrText = nsTrnc(strip_tags(strip_shortcodes($exrText)), 140, " ", "...");
$exrText = nsTrnc($exrText, $twLim);
$twMsgFormat = str_ireplace("%RAWEXCERPT%", $exrText, $twMsgFormat);
$twLim = $twLim - nxs_strLen($exrText);
}
if (stripos($twMsgFormat, '%FULLTEXT%') !== false) {
$pFullText = nsTrnc(strip_tags($pFullText), $twLim);
$twMsgFormat = str_ireplace("%FULLTEXT%", $pFullText, $twMsgFormat);
$twLim = $twLim - nxs_strLen($pFullText);
}
if (stripos($twMsgFormat, '%RAWTEXT%') !== false) {
$pRawText = nsTrnc(strip_tags($pRawText), $twLim);
$twMsgFormat = str_ireplace("%RAWTEXT%", $pRawText, $twMsgFormat);
$twLim = $twLim - nxs_strLen($pRawText);
}
$msg = nsFormatMessage($twMsgFormat, $postID, $addParams);
}
$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);
$msg = nxs_decodeEntitiesFull($msg);
$message = array('message' => $msg, 'img' => $imgData, 'urlLength' => $nxs_urlLen);
$options['twMsgFormat'] = $msg;
//## This meta field is created by the indieweb taxonomy plugin - by David Peach
$response = get_post_meta($postID, 'response', true);
if (!empty($response)) {
$reply_url = $response['url'];
if (!empty($reply_url) && strpos($reply_url, 'twitter.com')) {
$explode_at_domain = explode('twitter.com/', $reply_url);
$twitter_path = end($explode_at_domain);
$exploded_path = explode('/', $twitter_path);
$options['in_reply_to_id'] = end($exploded_path);
}
}
//prr($options);
//## Actual Post
$ntToPost = new nxs_class_SNAP_TW();
$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_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);
}
}
//## Return Result
if ($ret['isPosted'] == '1') {
return 200;
} else {
return print_r($ret, true);
}
}
示例6: doPostToGooglePlus2
function doPostToGooglePlus2($msg, $lnk = '', $pageID = '') {
$rnds = rndString ( 13 );
$pageID = trim ( $pageID );
if (function_exists ( 'nxs_decodeEntitiesFull' ))
$msg = nxs_decodeEntitiesFull ( $msg );
if (function_exists ( 'nxs_html_to_utf8' ))
$msg = nxs_html_to_utf8 ( $msg );
$msg = str_replace ( '<br>', "_NXSZZNXS_5Cn", $msg );
$msg = str_replace ( '<br/>', "_NXSZZNXS_5Cn", $msg );
$msg = str_replace ( '<br />', "_NXSZZNXS_5Cn", $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", "_NXSZZNXS_5Cn", $msg );
$msg = urlencode ( strip_tags ( $msg ) );
$msg = str_replace ( "_NXSZZNXS_5Cn", "%5Cn", $msg );
$msg = str_replace ( '+', '%20', $msg );
$msg = str_replace ( '%0A%0A', '%20', $msg );
$msg = str_replace ( '%0A', '', $msg );
$msg = str_replace ( '%0D', '%5C', $msg );
if (trim ( $lnk ['img'] ) != '') {
$img = getCurlPageX ( $lnk ['img'], '', false );
if ($img ['http_code'] == '200')
$lnk ['imgType'] = urlencode ( $img ['content_type'] );
else
$lnk ['img'] = '';
}
$lnk ['img'] = urlencode ( $lnk ['img'] );
$lnk ['link'] = urlencode ( $lnk ['link'] );
$lnk ['fav'] = urlencode ( $lnk ['fav'] );
$lnk ['domain'] = urlencode ( $lnk ['domain'] );
$lnk ['title'] = (str_replace ( Array (
"\n",
"\r"
), ' ', $lnk ['title'] ));
// $lnk['title'] = mysql_real_escape_string($lnk['title']); $lnk['title'] = mysql_real_escape_string($lnk['title']); $lnk['title'] = mysql_real_escape_string($lnk['title']);
$lnk ['title'] = rawurlencode ( addslashes ( $lnk ['title'] ) ); // ## Yes mysql_real_escape_string has to be called 3 times. The message should have 7 escape slashes /. Why G? Why?
$lnk ['txt'] = (str_replace ( Array (
"\n",
"\r"
), ' ', $lnk ['txt'] ));
// $lnk['txt'] = mysql_real_escape_string($lnk['txt']); $lnk['txt'] = mysql_real_escape_string($lnk['txt']); $lnk['txt'] = mysql_real_escape_string($lnk['txt']);
$lnk ['txt'] = rawurlencode ( addslashes ( $lnk ['txt'] ) ); // ## Yes mysql_real_escape_string has to be called 3 times. The message should have 7 escape slashes /. Why G? Why?
$refPage = 'https://plus.google.com/b/' . $pageID . '/'; // prr($lnk);
if ($pageID != '') { // ## Posting to Page
$gpp = 'https://plus.google.com/b/' . $pageID . '/_/sharebox/post/?spam=20&_reqid=647379&rt=j';
$contents = getCurlPageX ( $refPage, '', false ); // prr($contents); die();
} else { // ## Posting to Profile
$gpp = 'https://plus.google.com/_/sharebox/post/?spam=20&_reqid=1203718&rt=j';
$contents = getCurlPageX ( 'https://plus.google.com/', '', false );
$pageID = CutFromTo ( $contents ['content'], "key: '2'", "]" );
$pageID = CutFromTo ( $pageID, 'https://plus.google.com/', '"' );
} // echo $lnk['txt'];
if ($contents ['http_code'] == '400')
return "Invalid Sharebox Page. Something is wrong, please contact support";
$at = CutFromTo ( $contents ['content'], 'csi.gstatic.com/csi","', '",' ); // prr($lnk);
// ## URL
if (trim ( $lnk ['link'] ) != '')
$spar = "f.req=%5B%22" . $msg . "%22%2C%22oz%" . $pageID . "." . $rnds . ".0%22%2Cnull%2Cnull%2Cnull%2Cnull%2C%22%5B%5C%22%5Bnull%2Cnull%2Cnull%2C%5C%5C%5C%22" . $lnk ['title'] . "%5C%5C%5C%22%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2C%5B%5Bnull%2C%5C%5C%5C%22NextScripts%5C%5C%5C%22%2C%5C%5C%5C%22owner%5C%5C%5C%22%5D%5D%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2C%5C%5C%5C%22" . str_replace ( '%5C', '%5C%5C%5C%5C%5C%5C%5C', $lnk ['txt'] ) . "%5C%5C%5C%22%2Cnull%2Cnull%2C%5Bnull%2C%5C%5C%5C%22" . $lnk ['link'] . "%5C%5C%5C%22%2Cnull%2C%5C%5C%5C%22text%2Fhtml%5C%5C%5C%22%2C%5C%5C%5C%22document%5C%5C%5C%22%5D%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2C%5B%5Bnull%2C%5C%5C%5C%22" . $lnk ['fav'] . "%5C%5C%5C%22%2Cnull%2Cnull%5D%2C%5Bnull%2C%5C%5C%5C%22" . $lnk ['fav'] . "%5C%5C%5C%22%2Cnull%2Cnull%5D%5D%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2C%5B%5Bnull%2C%5C%5C%5C%22%5C%5C%5C%22%2C%5C%5C%5C%22http%3A%2F%2Fgoogle.com%2Fprofiles%2Fmedia%2Fprovider%5C%5C%5C%22%2C%5C%5C%5C%22%5C%5C%5C%22%5D%5D%5D%5C%22%2C%5C%22%5Bnull%2Cnull%2Cnull%2Cnull%2Cnull%2C%5Bnull%2C%5C%5C%5C%22" . $lnk ['img'] . "%5C%5C%5C%22%5D%2Cnull%2Cnull%2Cnull%2C%5B%5D%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2C%5Bnull%2C%5C%5C%5C%22" . $lnk ['link'] . "%5C%5C%5C%22%2Cnull%2C%5C%5C%5C%22" . $lnk ['imgType'] . "%5C%5C%5C%22%2C%5C%5C%5C%22photo%5C%5C%5C%22%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2C200%2C150%5D%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2C%5B%5Bnull%2C%5C%5C%5C%22" . $lnk ['img'] . "%5C%5C%5C%22%2Cnull%2Cnull%5D%2C%5Bnull%2C%5C%5C%5C%22" . $lnk ['img'] . "%5C%5C%5C%22%2Cnull%2Cnull%5D%5D%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2C%5B%5Bnull%2C%5C%5C%5C%22images%5C%5C%5C%22%2C%5C%5C%5C%22http%3A%2F%2Fgoogle.com%2Fprofiles%2Fmedia%2Fprovider%5C%5C%5C%22%2C%5C%5C%5C%22%5C%5C%5C%22%5D%5D%5D%5C%22%5D%22%2Cnull%2Cnull%2Ctrue%2C%5B%5D%2Cfalse%2Cfalse%2Cnull%2C%5B%5D%2Cnull%2Cfalse%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cfalse%2Cfalse%2Cfalse%2Cnull%2Cnull%2Cnull%2Cnull%2C%5B%5B35%2C1%2C0%5D%2C%22" . $lnk ['link'] . "%22%2Cnull%2C%7B%2229646191%22%3A%5B%22" . $lnk ['link'] . "%22%2C%22" . $lnk ['img'] . "%22%2C%22" . $lnk ['title'] . "%22%2C%22" . $lnk ['txt'] . "%22%2Cnull%2C%5B%22%2F%2Fimages1-focus-opensocial.googleusercontent.com%2Fgadgets%2Fproxy%3Furl%3D" . $lnk ['img'] . "%26container%3Dfocus%26gadget%3Da%26rewriteMime%3Dimage%2F*%26refresh%3D31536000%26resize_h%3D150%26resize_w%3D150%26no_expand%3D1%22%2C150%2C150%5D%2C%22" . $lnk ['fav'] . "%22%2C%5B%5B%5B5%2C0%5D%2Cnull%2Cnull%2C%7B%2227219582%22%3A%5Bnull%2Cnull%2Cnull%2C%22NextScripts%22%5D%7D%5D%5D%5D%7D%5D%2Cnull%2C%5B%5D%2C%5B%5B%5Bnull%2Cnull%2C1%5D%5D%5D%5D&at=" . $at . "&";
// ## Image
elseif (trim ( $lnk ['img'] ) != '') {
$remImgURL = urldecode ( $lnk ['img'] );
$urlParced = pathinfo ( $remImgURL );
$remImgURLFilename = $urlParced ['basename'];
$imgData = getCurlPageX ( $remImgURL, '', false );
$imgdSize = $imgData ['download_content_length'];
$imgData = $imgData ['content'];
$iflds = '{"protocolVersion":"0.8","createSessionRequest":{"fields":[{"external":{"name":"file","filename":"' . $remImgURLFilename . '","put":{},"size":' . $imgdSize . '}},{"inlined":{"name":"batchid","content":"1350593121640","contentType":"text/plain"}},{"inlined":{"name":"client","content":"sharebox","contentType":"text/plain"}},{"inlined":{"name":"disable_asbe_notification","content":"true","contentType":"text/plain"}},{"inlined":{"name":"streamid","content":"updates","contentType":"text/plain"}},{"inlined":{"name":"use_upload_size_pref","content":"true","contentType":"text/plain"}},{"inlined":{"name":"album_abs_position","content":"0","contentType":"text/plain"}}]}}';
$imgReqCnt = getCurlPageX ( 'https://plus.google.com/_/upload/photos/resumable?authuser=0', '', false, $iflds );
$gUplURL = str_replace ( '\u0026', '&', CutFromTo ( $imgReqCnt ['content'], 'putInfo":{"url":"', '"' ) );
$gUplID = CutFromTo ( $imgReqCnt ['content'], 'upload_id":"', '"' );
$imgUplCnt = getCurlPageX ( $gUplURL, '', true, $imgData );
$imgUplCnt = json_decode ( $imgUplCnt, true );
$infoArray = $imgUplCnt ['sessionStatus'] ['additionalInfo'] ['uploader_service.GoogleRupioAdditionalInfo'] ['completionInfo'] ['customerSpecificInfo'];
$albumID = $infoArray ['albumid'];
$photoid = $infoArray ['photoid'];
$imgUrl = urlencode ( $infoArray ['url'] );
$imgTitie = $infoArray ['title'];
$width = $infoArray ['width'];
$height = $infoArray ['height'];
$userID = $infoArray ['username'];
$intID = $infoArray ['albumPageUrl'];
$intID = str_replace ( 'https://picasaweb.google.com/', '', $intID );
$intID = str_replace ( $userID, '', $intID );
$intID = str_replace ( '/', '', $intID );
$spar = "f.req=%5B%22" . $msg . "%22%2C%22oz%3A" . $pageID . "." . $rnds . "%22%2Cnull%2C%22" . $albumID . "%22%2Cnull%2Cnull%2C%22%5B%5C%22%5Bnull%2Cnull%2Cnull%2C%5C%5C%5C%22%5C%5C%5C%22%2Cnull%2C%5Bnull%2C%5C%5C%5C%22" . $imgUrl . "%5C%5C%5C%22%2C" . $height . "%2C" . $width . "%5D%2Cnull%2Cnull%2Cnull%2C%5B%5D%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2C%5C%5C%5C%22" . $imgTitie . "%5C%5C%5C%22%2Cnull%2Cnull%2C%5Bnull%2C%5C%5C%5C%22https%3A%2F%2Fpicasaweb.google.com%2F" . $userID . "%2F" . $intID . "%23" . $photoid . "%5C%5C%5C%22%2Cnull%2C%5C%5C%5C%22image%2Fjpeg%5C%5C%5C%22%2C%5C%5C%5C%22image%5C%5C%5C%22%5D%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2C%5B%5Bnull%2C%5C%5C%5C%22" . $imgUrl . "%5C%5C%5C%22%2C120%2C165.51724137931035%5D%2C%5Bnull%2C%5C%5C%5C%22" . $imgUrl . "%5C%5C%5C%22%2C120%2C165.51724137931035%5D%5D%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2C%5B%5Bnull%2C%5C%5C%5C%22picasa%5C%5C%5C%22%2C%5C%5C%5C%22http%3A%2F%2Fgoogle.com%2Fprofiles%2Fmedia%2Fprovider%5C%5C%5C%22%2C%5C%5C%5C%22%5C%5C%5C%22%5D%2C%5Bnull%2C%5C%5C%5C%22albumid%3D" . $albumID . "%26photoid%3D" . $photoid . "%5C%5C%5C%22%2C%5C%5C%5C%22http%3A%2F%2Fgoogle.com%2Fprofiles%2Fmedia%2Fonepick_media_id%5C%5C%5C%22%2C%5C%5C%5C%22%5C%5C%5C%22%5D%5D%5D%5C%22%5D%22%2Cnull%2Cnull%2Ctrue%2C%5B%5D%2Cfalse%2Cnull%2Cnull%2C%5B%5D%2Cnull%2Cfalse%2Cnull%2Cnull%2C%22" . $userID . "%22%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cfalse%2Cfalse%2Ctrue%2Cnull%2Cnull%2Cnull%2Cnull%2C%5B%5B249%2C18%2C1%2C0%5D%2Cnull%2Cnull%2Cnull%2C%7B%2227639957%22%3A%5B%5B%22https%3A%2F%2Fpicasaweb.google.com%2F" . $userID . "%2F" . $intID . "%23" . $photoid . "%22%2C%22" . $imgTitie . "%22%2C%22%22%2C%22" . $imgUrl . "%22%2Cnull%2C%5B%22" . $imgUrl . "%22%2C497%2C373%2Cnull%2Cnull%2Cnull%2Cnull%2C145%2C%5B1%2C%22" . $imgUrl . "%22%5D%5D%2Cnull%2C%22200%22%2C%22" . $height . "%22%2C" . $width . "%2C145%2Cnull%2C%22picasaweb.google.com%22%5D%2C%22" . $userID . "%22%2Cnull%2C%22" . $photoid . "%22%2Cnull%2Cnull%2C%22" . $imgUrl . "%22%2Cnull%2Cnull%2C%22https%3A%2F%2Fpicasaweb.google.com%2F" . $userID . "%2F" . $intID . "%23" . $photoid . "%22%2Cnull%2C%22albumid%3D" . $albumID . "%26photoid%3D" . $photoid . "%22%5D%7D%5D%2Cnull%2C%5B%5D%2C%5B%5B%5Bnull%2Cnull%2C1%5D%5D%2Cnull%5D%5D&at=" . $at . "&"; // echo $spar;
}
// ## Just Message
else
$spar = "f.req=%5B%22" . $msg . "%22%2C%22oz%3A" . $pageID . "." . $rnds . "%22%2Cnull%2Cnull%2Cnull%2Cnull%2C%22%5B%5D%22%2Cnull%2C%22%7B%5C%22aclEntries%5C%22%3A%5B%7B%5C%22scope%5C%22%3A%7B%5C%22scopeType%5C%22%3A%5C%22anyone%5C%22%2C%5C%22name%5C%22%3A%5C%22Anyone%5C%22%2C%5C%22id%5C%22%3A%5C%22anyone%5C%22%2C%5C%22me%5C%22%3Atrue%2C%5C%22requiresKey%5C%22%3Afalse%7D%2C%5C%22role%5C%22%3A20%7D%2C%7B%5C%22scope%5C%22%3A%7B%5C%22scopeType%5C%22%3A%5C%22anyone%5C%22%2C%5C%22name%5C%22%3A%5C%22Anyone%5C%22%2C%5C%22id%5C%22%3A%5C%22anyone%5C%22%2C%5C%22me%5C%22%3Atrue%2C%5C%22requiresKey%5C%22%3Afalse%7D%2C%5C%22role%5C%22%3A60%7D%5D%7D%22%2Ctrue%2C%5B%5D%2Cfalse%2Cfalse%2Cnull%2C%5B%5D%2Cnull%2Cfalse%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cfalse%2Cfalse%2Cfalse%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2C%5B%5D%5D&at=" . $at . "&";
$spar = str_ireplace ( '+', '%20', $spar );
$spar = str_ireplace ( ':', '%3A', $spar );
//.........这里部分代码省略.........
示例7: 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);
//.........这里部分代码省略.........
示例8: 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;
}
//.........这里部分代码省略.........
示例9: postShare
function postShare($msg, $title = '', $url = '', $imgURL = '', $dsc = '')
{
$status_url = $this->base_url . "/v1/people/~/shares";
$dsc = nxs_decodeEntitiesFull(strip_tags($dsc));
$msg = strip_tags(nxs_decodeEntitiesFull($msg));
$title = nxs_decodeEntitiesFull(strip_tags($title));
$xml = '<?xml version="1.0" encoding="UTF-8"?><share><comment>' . htmlspecialchars($msg, ENT_NOQUOTES, "UTF-8") . '</comment>' . ($url != '' ? '<content><title>' . htmlspecialchars($title, ENT_NOQUOTES, "UTF-8") . '</title><submitted-url>' . $url . '</submitted-url>' . (!empty($imgURL) ? '<submitted-image-url>' . $imgURL . '</submitted-image-url>' : '') . '<description>' . htmlspecialchars($dsc, ENT_NOQUOTES, "UTF-8") . '</description></content>' : '') . '<visibility><code>anyone</code></visibility></share>';
$request = nsx_trOAuthRequest::from_consumer_and_token($this->consumer, $this->access_token, "POST", $status_url);
$request->sign_request($this->signature_method, $this->consumer, $this->access_token);
$auth_header = $request->to_header("https://api.linkedin.com");
//if ($debug) echo $auth_header . "\n";
$response = $this->httpRequest($status_url, $auth_header, "POST", $xml);
return $response;
}
示例10: post
function post($msg, $imgURL, $lnk, $boardID, $title = '', $price='', $via=''){
$tk = $this->tk; $ck = $this->ck; $apVer = $this->apVer; if ($this->debug) echo "[PN] Posting to ...".$boardID."<br/>\r\n";
foreach ($ck as $c) if ( is_object($c) && $c->name=='csrftoken') $tk = $c->value; $msg = strip_tags($msg); $msg = substr($msg, 0, 480); $tgs = ''; $this->tk = $tk;
if ($msg=='') $msg = ' '; if (trim($boardID)=='') return "Board is not Set"; if (trim($imgURL)=='') return "Image is not Set"; $msg = str_ireplace(array("\r\n", "\n", "\r"), " ", $msg);
$msg = strip_tags($msg); if (function_exists('nxs_decodeEntitiesFull')) $msg = nxs_decodeEntitiesFull($msg, ENT_QUOTES);
$mgsOut = urlencode($msg); $mgsOut = str_ireplace(array('%28', '%29', '%27', '%21', '%22', '%09'), array("(", ")", "'", "!", "%5C%22", '%5Ct'), $mgsOut);
$fldsTxt = 'source_url=%2Fpin%2Ffind%2F%3Furl%3D'.urlencode(urlencode($lnk)).'&data=%7B%22options%22%3A%7B%22board_id%22%3A%22'.$boardID.'%22%2C%22description%22%3A%22'.$mgsOut.'%22%2C%22link%22%3A%22'.urlencode($lnk).'%22%2C%22share_twitter%22%3Afalse%2C%22image_url%22%3A%22'.urlencode($imgURL).'%22%2C%22method%22%3A%22scraped%22%7D%2C%22context%22%3A%7B%7D%7D';
$hdrsArr = $this->headers('https://www.pinterest.com/resource/PinResource/create/ ', 'https://www.pinterest.com', 'POST', true);
$hdrsArr['X-NEW-APP']='1'; $hdrsArr['X-APP-VERSION']=$apVer; $hdrsArr['X-CSRFToken']=$tk; $hdrsArr['X-Pinterest-AppState']='active'; $hdrsArr['Accept'] = 'application/json, text/javascript, */*; q=0.01';
$advSet = array('headers' => $hdrsArr, 'httpversion' => '1.1', 'timeout' => 45, 'redirection' => 0, 'cookies' => $ck, 'body' => $fldsTxt);
$rep = nxs_remote_post('https://www.pinterest.com/resource/PinResource/create/', $advSet); if (is_nxs_error($rep)) { $badOut = print_r($rep, true)." - ERROR"; return $badOut; }
$contents = $rep['body']; $resp = json_decode($contents, true); // prr($advSet); prr($resp); prr($fldsTxt); // prr($contents);
if (is_array($resp)) {
if (isset($resp['resource_response']) && isset($resp['resource_response']['error']) && $resp['resource_response']['error']!='' ) return print_r($resp['resource_response']['error'], true);
elseif (isset($resp['resource_response']) && isset($resp['resource_response']['data']) && $resp['resource_response']['data']['id']!=''){ // gor JSON
if (isset($resp['resource_response']) && isset($resp['resource_response']['error']) && $resp['resource_response']['error']!='') return print_r($resp['resource_response']['error'], true);
else return array("isPosted"=>"1", "postID"=>$resp['resource_response']['data']['id'], 'pDate'=>date('Y-m-d H:i:s'), "postURL"=>"http://www.pinterest.com/pin/".$resp['resource_response']['data']['id']);
}
}elseif (stripos($contents, 'blocked this')!==false) { $retText = trim(str_replace(array("\r\n", "\r", "\n"), " | ", strip_tags(CutFromTo($contents, '</head>', '</body>'))));
return "Pinterest ERROR: 'The Source is blocked'. Please see https://support.pinterest.com/entries/21436306-why-is-my-pin-or-site-blocked-for-spam-or-inappropriate-content/ for more info | Pinterest Message:".$retText;
}
elseif (stripos($contents, 'image you tried to pin is too small')!==false) { $retText = trim(str_replace(array("\r\n", "\r", "\n"), " | ", strip_tags(CutFromTo($contents, '</head>', '</body>'))));
return "Image you tried to pin is too small | Pinterest Message:".$retText;
}
elseif (stripos($contents, 'CSRF verification failed')!==false) { $retText = trim(str_replace(array("\r\n", "\r", "\n"), " | ", strip_tags(CutFromTo($contents, '</head>', '</body>'))));
return "CSRF verification failed - Please contact NextScripts Support | Pinterest Message:".$retText;
}
elseif (stripos($contents, 'Oops')!==false && stripos($contents, '<body>')!==false ) return 'Pinterest ERROR MESSAGE : '.trim(str_replace(array("\r\n", "\r", "\n"), " | ", strip_tags(CutFromTo($contents, '</head>', '</body>'))));
else return "Somethig is Wrong - Pinterest Returned Error 502";
}
示例11: postToGroup
function postToGroup($msg, $title, $groupID, $url = '', $imgURL = '', $dsc = '')
{
$status_url = $this->base_url . "/v1/groups/" . $groupID . "/posts";
//$debug = true;
$dsc = nxs_decodeEntitiesFull(strip_tags($dsc));
$msg = strip_tags(nxs_decodeEntitiesFull($msg));
$title = nxs_decodeEntitiesFull(strip_tags($title));
$xml = '<?xml version="1.0" encoding="UTF-8"?><post><title>' . htmlspecialchars($title, ENT_NOQUOTES, "UTF-8") . '</title>' . "\n" . '<summary>' . htmlspecialchars($msg, ENT_NOQUOTES, "UTF-8") . '</summary>' . "\n" . '
' . ($url != '' ? '<content><title>' . htmlspecialchars($title, ENT_NOQUOTES, "UTF-8") . '</title>' . "\n" . '<submitted-url>' . $url . '</submitted-url>' . "\n" . (!empty($imgURL) ? '<submitted-image-url>' . $imgURL . '</submitted-image-url>' : '') . "\n" . '<description>' . htmlspecialchars($dsc, ENT_NOQUOTES, "UTF-8") . '</description></content>' : '') . '</post>';
// prr($xml);
$request = nsx_trOAuthRequest::from_consumer_and_token($this->consumer, $this->access_token, "POST", $status_url);
$request->sign_request($this->signature_method, $this->consumer, $this->access_token);
$auth_header = $request->to_header("https://api.linkedin.com");
//if ($debug)
//echo $auth_header . "\n";
$response = $this->httpRequest($status_url, $auth_header, "POST", $xml);
//prr($response);
return $response;
}
示例12: nxs_doPublishToVK
//.........这里部分代码省略.........
$gOptions['vk'][$options['ii']]['vkSvC'] = serialize($nxs_vkCkArray);
update_option('NS_SNAutoPoster', $gOptions);
} else {
foreach ($gOptions['vk'] as $ii => $gpn) {
$result = array_diff($options, $gpn);
if (!is_array($result) || count($result) < 1) {
$gOptions['vk'][$ii]['vkSvC'] = serialize($nxs_vkCkArray);
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 =- ";
}
//## Post
if (trim($fbMsgAFormat) != '') {
$dsc = nsFormatMessage($fbMsgAFormat, $postID);
} 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 == '') {
$dsc = trim(get_post_meta($postID, '_yoast_wpseo_opengraph-description', true));
}
if (function_exists('wpseo_admin_init') && $dsc == '') {
$dsc = trim(get_post_meta($postID, '_yoast_wpseo_metadesc', true));
}
if ($dsc == '') {
$dsc = trim(apply_filters('the_content', nxs_doQTrans($post->post_excerpt, $lng)));
}
if ($dsc == '') {
$dsc = trim(nxs_doQTrans($post->post_excerpt, $lng));
}
if ($dsc == '') {
$dsc = trim(apply_filters('the_content', nxs_doQTrans($post->post_content, $lng)));
}
if ($dsc == '') {
$dsc = trim(nxs_doQTrans($post->post_content, $lng));
}
if ($dsc == '') {
$dsc = get_bloginfo('description');
}
}
$dsc = strip_tags($dsc);
$dsc = nxs_decodeEntitiesFull($dsc);
$dsc = nsTrnc($dsc, 900, ' ');
$msgOpts['url'] = $link;
$msgOpts['urlTitle'] = nxs_doQTrans($post->post_title, $lng);
$msgOpts['urlDesc'] = $dsc;
$msgOpts['imgURL'] = $imgURL;
$ret = nxs_doPostToVK($msg, $options['url'], $msgOpts);
// prr($ret);
}
//prr($postType);
if ($postType == 'I') {
$imgUpld = nxs_uplImgtoVK($imgURL, $options);
if (is_object($imgUpld)) {
$imgID = $imgUpld->id;
$atts[] = $imgID;
}
}
if ($postType != 'A') {
if ($options['addBackLink'] == '1') {
$atts[] = $link;
}
if (is_array($atts)) {
$atts = implode(',', $atts);
}
$postUrl = 'https://api.vkontakte.ru/method/wall.post?owner_id=' . $options['pgIntID'] . '&access_token=' . $options['vkAppAuthToken'] . '&from_group=1&message=' . urlencode($msg) . '&attachment=' . urlencode($atts);
$response = wp_remote_get($postUrl);
// prr($atts); prr($postUrl);
if (is_wp_error($response) || is_object($response) && isset($response->errors) || is_array($response) && stripos($response['body'], '"error":') !== false) {
$ret = $response['body'];
} else {
$respJ = json_decode($response['body'], true);
$ret = array("code" => "OK", "post_id" => $options['pgIntID'] . '_' . $respJ['response']['post_id']);
}
}
if (is_array($ret) && $ret['code'] == 'OK') {
if ($postID == '0') {
nxs_addToLogN('S', 'Test', $logNT, 'OK - TEST Message Posted ');
echo ' OK - Message Posted, please see your VK Page ';
} else {
nxs_metaMarkAsPosted($postID, 'VK', $options['ii'], array('isPosted' => '1', 'pgID' => $ret['post_id'], 'pDate' => date('Y-m-d H:i:s')));
nxs_addToLogN('S', 'Posted', $logNT, 'OK - Message Posted ', $extInfo);
return 200;
}
} else {
if ($postID == '0') {
prr($ret);
}
nxs_addToLogN('E', 'Error', $logNT, '-=ERROR=- ' . print_r($ret, true), $extInfo);
}
}