当前位置: 首页>>代码示例>>PHP>>正文


PHP nxs_getPostImage函数代码示例

本文整理汇总了PHP中nxs_getPostImage函数的典型用法代码示例。如果您正苦于以下问题:PHP nxs_getPostImage函数的具体用法?PHP nxs_getPostImage怎么用?PHP nxs_getPostImage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了nxs_getPostImage函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: nxs_doPublishToGP

 function nxs_doPublishToGP($postID, $options)
 {
     $ntCd = 'GP';
     $ntCdL = 'gp';
     $ntNm = 'Google+';
     if (!function_exists('doConnectToGooglePlus2') || !function_exists('doPostToGooglePlus2')) {
         nxs_addToLogN('E', 'Error', $ntCd, '-=ERROR=- No G+ API Lib Detected', '');
         return "No G+ API Lib Detected";
     }
     $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' => '');
     if ($postID == '0') {
         echo "Testing ... <br/><br/>";
         $message['description'] = 'Test Post, Description';
         $message['title'] = 'Test Post - Title';
         $message['link'] = 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);
         // prr($msg); echo $postID;
         $extInfo = ' | PostID: ' . $postID . " - " . $post->post_title;
         if ($gpPostType == 'I') {
             $vids = nsFindVidsInPost($post, false);
             if (count($vids) > 0) {
                 $ytCode = $vids[0];
             }
             if (trim($ytCode) == '') {
                 $options['trPostType'] = 'T';
             }
         }
         if ($gpPostType == 'A') {
             $imgURL = nxs_getPostImage($postID, 'medium');
         }
         if ($gpPostType == 'I') {
             $imgURL = nxs_getPostImage($postID, 'full');
         }
         $message = array('message' => $msg, 'link' => get_permalink($postID), 'imageURL' => $imgURL, 'videoCode' => $ytCode);
     }
     //## Actual Post
     $ntToPost = new nxs_class_SNAP_GB();
     $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);
     }
 }
开发者ID:JalpMi,项目名称:v2contact,代码行数:87,代码来源:gp.php

示例2: nxs_doPublishToPK


//.........这里部分代码省略.........
         $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);
         }
         if (stripos($twMsgFormat, '%RAWTEXT%') !== false) {
             $pRawText = nsTrnc(strip_tags($pRawText), $twLim);
             $twMsgFormat = str_ireplace("%FULLTEXT%", $pRawText, $twMsgFormat);
             $twLim = $twLim - strlen($pRawText);
         }
         $msg = nsFormatMessage($twMsgFormat, $postID);
     }
     //## Post
     require_once 'apis/plurkOAuth.php';
     $consumer_key = $options['pkConsKey'];
     $consumer_secret = $options['pkConsSec'];
     $tum_oauth = new wpPlurkOAuth($consumer_key, $consumer_secret, $options['pkAccessTocken'], $options['pkAccessTockenSec']);
     $pkURL = trim(str_ireplace('http://', '', $options['pkURL']));
     if (substr($pkURL, -1) == '/') {
         $pkURL = substr($pkURL, 0, -1);
     }
     if ($options['pkCat'] == '') {
         $options['pkCat'] = ':';
     }
     if ($options['attchImg'] == '1') {
         $imgURL = nxs_getPostImage($postID);
         $msg .= " " . $imgURL;
     }
     $postDate = ($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
     $postArr = array('content' => $msg, 'qualifier' => $options['pkCat']);
     $postinfo = $tum_oauth->makeReq('http://www.plurk.com/APP/Timeline/plurkAdd', $postArr);
     // prr($postinfo);
     if (is_array($postinfo) && isset($postinfo['plurk_id'])) {
         $pkID = $postinfo['plurk_id'];
     }
     $code = $tum_oauth->http_code;
     // echo "XX".print_r($code);  prr($postinfo); // prr($msg); prr($postinfo); echo $code."VVVV"; die("|====");
     if ($code == 200) {
         if ($postID == '0') {
             nxs_addToLogN('S', 'Test', $logNT, 'OK - TEST Message Posted ');
             echo 'OK - Message Posted, please see your Plurk  Page. <br/> Result:';
         } else {
             nxs_addToLogN('S', 'Posted', $logNT, 'OK - Message Posted ', $extInfo);
             nxs_metaMarkAsPosted($postID, 'PK', $options['ii'], array('isPosted' => '1', 'pgID' => $pkID, 'pDate' => date('Y-m-d H:i:s')));
         }
     } else {
         nxs_addToLogN('E', 'Error', $logNT, '-=ERROR=- ' . print_r($postinfo, true), $extInfo);
         if ($postID == '0') {
             prr($postinfo);
         }
         $code .= " ERROR: - " . $postinfo['error_text'];
     }
     return $code;
 }
开发者ID:JalpMi,项目名称:v2contact,代码行数:101,代码来源:pk.php

示例3: 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
         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;
         }
         $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();
//.........这里部分代码省略.........
开发者ID:voquanghoa,项目名称:WebPhim,代码行数:101,代码来源:sc.php

示例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 == '') {
//.........这里部分代码省略.........
开发者ID:brettex,项目名称:pspark,代码行数:101,代码来源:vk.php

示例5: 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);
//.........这里部分代码省略.........
开发者ID:Florian-Eschenbacher,项目名称:schneeeule,代码行数:101,代码来源:li.php

示例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);
     }
 }
开发者ID:brettex,项目名称:pspark,代码行数:101,代码来源:tr.php

示例7: nxs_doPublishToPN

 function nxs_doPublishToPN($postID, $options)
 {
     global $nxs_gCookiesArr;
     $ntCd = 'PN';
     $ntCdL = 'pn';
     $ntNm = 'Pinterest';
     // $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));
     $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'];
     $isAttachVid = '1';
     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();
     }
     if ($postID == '0') {
         echo "Testing ... <br/><br/>";
         $msg = 'Test Post from ' . $blogTitle;
         $link = home_url();
         if ($options['pnDefImg'] != '') {
             $imgURL = $options['pnDefImg'];
         } else {
             $imgURL = "http://direct.gtln.us/img/nxs/NextScriptsLogoT.png";
         }
     } else {
         $post = get_post($postID);
         if (!$post) {
             return;
         }
         $pnMsgFormat = $options['pnMsgFormat'];
         $msg = nsFormatMessage($pnMsgFormat, $postID);
         $link = get_permalink($postID);
         nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPrePosted' => '1'));
         $imgURL = nxs_getPostImage($postID, 'large', $options['pnDefImg']);
         //prr($options); echo $imgURL."######"; // echo "WW".$postID."|";
         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';
             }
         }
     }
     $email = $options['pnUName'];
     $boardID = $options['pnBoard'];
     $pass = substr($options['pnPass'], 0, 5) == 'g9c1a' ? nsx_doDecode(substr($options['pnPass'], 5)) : $options['pnPass'];
     // prr($boardID); prr($_POST); die();
     if (isset($options['pnSvC'])) {
         $nxs_gCookiesArr = maybe_unserialize($options['pnSvC']);
     }
     $loginError = true;
     if (is_array($nxs_gCookiesArr)) {
         $loginError = doCheckPinterest();
     }
     $extInfo = ' | PostID: ' . $postID . " - " . $post->post_title;
     if ($loginError !== false) {
         $loginError = doConnectToPinterest($email, $pass);
     }
     if ($loginError !== false) {
         echo $loginError;
         nxs_addToLogN('E', 'Error', $logNT, '-=ERROR=- ' . print_r($loginError, true), $extInfo);
         return "BAD USER/PASS";
     }
     if (serialize($nxs_gCookiesArr) != $options['pnSvC']) {
         global $plgn_NS_SNAutoPoster;
         $gOptions = $plgn_NS_SNAutoPoster->nxs_options;
         // prr($gOptions['pn']);
         if (isset($options['ii']) && $options['ii'] !== '') {
             $gOptions['pn'][$options['ii']]['pnSvC'] = serialize($nxs_gCookiesArr);
             update_option('NS_SNAutoPoster', $gOptions);
         } else {
             foreach ($gOptions['pn'] as $ii => $gpn) {
                 $result = array_diff($options, $gpn);
                 if (!is_array($result) || count($result) < 1) {
                     $gOptions['pn'][$ii]['pnSvC'] = serialize($nxs_gCookiesArr);
                     update_option('NS_SNAutoPoster', $gOptions);
                     break;
                 }
             }
         }
     }
     // echo "PN SET:".$msg."|".$imgURL."|".$link."|".$boardID;
     if (preg_match('/\\$(\\d+\\.\\d+)/', $msg, $matches)) {
//.........这里部分代码省略.........
开发者ID:JalpMi,项目名称:v2contact,代码行数:101,代码来源:pn.php

示例8: 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);
     }
 }
开发者ID:voquanghoa,项目名称:WebPhim,代码行数:90,代码来源:ap.php

示例9: 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('&nbsp;', ' ', $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);
//.........这里部分代码省略.........
开发者ID:JalpMi,项目名称:v2contact,代码行数:101,代码来源:li.php

示例10: 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);
     }
 }
开发者ID:voquanghoa,项目名称:WebPhim,代码行数:86,代码来源:ff.php

示例11: nxs_doPublishToPK


//.........这里部分代码省略.........
         $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);
         }
         if (stripos($twMsgFormat, '%RAWTEXT%') !== false) {
             $pRawText = nsTrnc(strip_tags($pRawText), $twLim);
             $twMsgFormat = str_ireplace("%FULLTEXT%", $pRawText, $twMsgFormat);
             $twLim = $twLim - strlen($pRawText);
         }
         $options['pkMsgFormat'] = nsFormatMessage($twMsgFormat, $postID, $addParams);
     }
     if (isset($options['attchImg']) && $options['attchImg'] == '1') {
         if (!empty($options['imgToUse'])) {
             $imgURL = $options['imgToUse'];
         } else {
             $imgURL = nxs_getPostImage($postID, 'full');
         }
     } else {
         $imgURL = '';
     }
     if (preg_match("/noImg.\\.png/i", $imgURL)) {
         $imgURL = '';
     }
     //## Post
     $message = array('siteName' => $blogTitle, 'tags' => '', 'imageURL' => $imgURL);
     // prr($message);
     //## Actual Post
     $ntToPost = new nxs_class_SNAP_PK();
     $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);
     }
 }
开发者ID:brettex,项目名称:pspark,代码行数:101,代码来源:pk.php

示例12: 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') {
//.........这里部分代码省略.........
开发者ID:jguzmanf88,项目名称:social-networks-auto-poster-facebook-twitter-g,代码行数:101,代码来源:gp.php

示例13: nxs_doPublishToFF

 function nxs_doPublishToFF($postID, $options)
 {
     $ntCd = 'FF';
     $ntCdL = 'ff';
     $ntNm = 'FriendFeed';
     //if (isset($options['timeToRun'])) wp_unschedule_event( $options['timeToRun'], 'nxs_doPublishToFF',  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">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();
         $msg = 'Test Link from ' . $link;
     } else {
         $post = get_post($postID);
         if (!$post) {
             return;
         }
         $link = get_permalink($postID);
         $msgFormat = $options['ffMsgFormat'];
         $msgTFormat = $options['ffMsgTFormat'];
         $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['ffUName'];
     $pass = substr($options['ffPass'], 0, 5) == 'n5g9a' ? nsx_doDecode(substr($options['ffPass'], 5)) : $options['ffPass'];
     $link = urlencode($link);
     $ext = urlencode(substr($msg, 0, 1000));
     // API/V2 if we ever switch -  $postArr = array('body'=>$msg, 'link'=>'', 'to'=>($options['grpID']!=''?$options['grpID']:'me'), 'image_url'=>($imgURL!=''?$imgURL:'me'), 'short'=>0); prr($postArr);
     if ($options['attchImg'] == '1') {
         $imgURL = nxs_getPostImage($postID, 'full');
     } else {
         $imgURL = '';
     }
     $postArr = array('title' => $msg, 'image0_link' => '', 'room' => $options['grpID'] != '' ? $options['grpID'] : '', 'image0_url' => $imgURL != '' ? $imgURL : '');
     $apicall = "http://friendfeed.com/api/share";
     $hdrsArr = nxs_getFFHeaders($dusername . ':' . $pass);
     $paramcall = array('method' => 'POST', 'timeout' => 45, 'redirection' => 0, 'body' => $postArr, 'headers' => $hdrsArr);
     $cnt = wp_remote_post($apicall, $paramcall);
     // prr(json_decode($cnt['body'], true));
     if (is_wp_error($cnt)) {
         $ret = 'Something went wrong - ' . "";
         nxs_addToLogN('E', 'Error', $logNT, '-=ERROR=- ' . $ret . "ERR: " . print_r($cnt, true), $extInfo);
     } else {
         if (is_array($cnt) && $cnt['response']['code'] == '200' && is_array(json_decode($cnt['body'], true))) {
             $ret = 'OK';
             $retInfo = json_decode($cnt['body'], true);
             nxs_metaMarkAsPosted($postID, 'FF', $options['ii'], array('isPosted' => '1', 'pgID' => $retInfo['entries'][0]['id'], 'pDate' => date('Y-m-d H:i:s')));
             nxs_addToLogN('S', 'Posted', $logNT, 'OK - Message Posted ', $extInfo);
         } else {
             $ret = "Error: ";
             if ($cnt['response']['code'] == '401') {
                 $ret .= " Incorrect Username/Password ";
             }
             $ret .= $cnt['response']['message'];
             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 FriendFeed Page. ';
             nxs_addToLogN('S', 'Test', $logNT, 'OK - TEST Message Posted ');
         }
     }
     if ($ret == 'OK') {
         return 200;
     } else {
         return $ret;
     }
 }
开发者ID:JalpMi,项目名称:v2contact,代码行数:91,代码来源:ff.php

示例14: nxs_doPublishToVK

 function nxs_doPublishToVK($postID, $options)
 {
     global $ShownAds, $nxs_vkCkArray;
     $ntCd = 'VK';
     $ntCdL = 'vk';
     $ntNm = 'vKontakte(VK)';
     //if (isset($options['timeToRun'])) wp_unschedule_event( $options['timeToRun'], 'nxs_doPublishToVK',  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">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;
         }
     }
     $email = $options['uName'];
     $pass = substr($options['uPass'], 0, 5) == 'n5g9a' ? nsx_doDecode(substr($options['uPass'], 5)) : $options['uPass'];
     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['msgFrmt'];
         $msg = strip_tags(nsFormatMessage($msgFormat, $postID));
         $link = get_permalink($postID);
         nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPrePosted' => '1'));
     }
     $dusername = $options['uName'];
     $postType = $options['postType'];
     //$link = urlencode($link); $desc = urlencode(substr($msg, 0, 500));
     $extInfo = ' | PostID: ' . $postID . " - " . $post->post_title . ' |' . $options['pType'];
     $imgURL = nxs_getPostImage($postID);
     $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);
                 $imgURL = $json[0]['thumbnail_large'];
             }
         }
     }
     $msgOpts = array();
     $msgOpts['uid'] = $options['vkPgID'];
     // if ($link!='') $msgOpts['link'] = $link;
     if ($vidURL != '' && $postType == "I") {
         $postType = 'A';
         $link = $vidURL;
         $msgOpts['vID'] = $vids[0];
     }
     if ($postType == 'I' && trim($imgURL) == '') {
         $postType = 'T';
     }
     $msgOpts['type'] = $postType;
     if ($postType == 'A' && $link != '') {
         //## Login
         if (isset($options['vkSvC'])) {
             $nxs_vkCkArray = maybe_unserialize($options['vkSvC']);
         }
         $loginError = true;
         if (is_array($nxs_vkCkArray)) {
             $loginError = nxs_doCheckVK();
         }
         if ($loginError != false) {
             $loginError = nxs_doConnectToVK($email, $pass);
         }
         if (serialize($nxs_vkCkArray) != $options['vkSvC']) {
             global $plgn_NS_SNAutoPoster;
             $gOptions = $plgn_NS_SNAutoPoster->nxs_options;
             if (isset($options['ii']) && $options['ii'] !== '') {
                 $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);
//.........这里部分代码省略.........
开发者ID:JalpMi,项目名称:v2contact,代码行数:101,代码来源:vk.php

示例15: nxs_doPublishToFB

 function nxs_doPublishToFB($postID, $options)
 {
     global $ShownAds;
     $ntCd = 'FB';
     $ntCdL = 'fb';
     $ntNm = 'Facebook';
     $dsc = '';
     $vidURL = '';
     if (!is_array($options)) {
         $options = maybe_unserialize(get_post_meta($postID, $options, true));
     }
     if (!class_exists('nxs_class_SNAP_FB')) {
         nxs_addToLogN('E', 'Error', $ntCd, '-=ERROR=- No Facebook API Lib Detected', '');
         return "No Facebook API Lib Detected";
     }
     $fbWhere = 'feed';
     $page_id = $options['fbPgID'];
     if (isset($ShownAds)) {
         $ShownAdsL = $ShownAds;
     }
     $addParams = nxs_makeURLParams(array('NTNAME' => $ntNm, 'NTCODE' => $ntCd, 'POSTID' => $postID, 'ACCNAME' => $options['nName']));
     //## Some Common stuff
     if (empty($options['postType']) && !empty($options['fbPostType'])) {
         $options['postType'] = $options['fbPostType'];
         unset($options['fbPostType']);
     }
     //## Compatibility with v <3.2
     if (empty($options['postType']) && !empty($options['PostType'])) {
         $pt = $options['PostType'];
         unset($options['PostType']);
         $options['postType'] = $pt;
     }
     //## Compatibility with v <3.2
     $ii = $options['ii'];
     if (!isset($options['pType'])) {
         $options['pType'] = 'im';
     }
     if ($options['pType'] == 'sh') {
         sleep(rand(1, 10));
     }
     $logNT = '<span style="color:#0000FF">Facebook</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;
         }
     }
     //## Make the post
     if (isset($options['qTLng'])) {
         $lng = $options['qTLng'];
     } else {
         $lng = '';
     }
     if (!isset($options['fbAppPageAuthToken'])) {
         $options['fbAppPageAuthToken'] = '';
     }
     $blogTitle = htmlspecialchars_decode(get_bloginfo('name'), ENT_QUOTES);
     if ($blogTitle == '') {
         $blogTitle = home_url();
     }
     //## Initiate Posting Array
     $message = array('message' => '', 'link' => '', 'title' => '', 'description' => '', 'imageURL' => '', 'videoURL' => '', 'siteName' => $blogTitle);
     $imgURL = '';
     if ($postID == '0') {
         $options['fbMsgFormat'] = 'Test Post, Please Ignore';
         $dsc = 'Test Post, Description';
         $urlTitle = 'Test Post - Title';
         $urlToGo = home_url();
     } else {
         $post = get_post($postID);
         if (!$post) {
             return;
         }
         $msg = nsFormatMessage($options['fbMsgFormat'], $postID, $addParams);
         $fbPostType = $options['postType'];
         if ($fbPostType == 'A') {
             $fbPostType = (int) $options['fbAttch'] == 2 ? 'S' : 'A';
         }
         $isAttachVidFB = $options['fbAttchAsVid'];
         nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPrePosted' => '1'));
         $extInfo = ' | PostID: ' . $postID . " - " . (isset($post) && is_object($post) ? nxs_doQTrans($post->post_title, $lng) : '') . ' |' . $options['pType'];
         if ($fbPostType == 'A') {
             $imgURL = nxs_getPostImage($postID, 'medium');
         }
         // prr($options); echo "PP - ".$postID; prr($src);
         if ($fbPostType == 'I' || $fbPostType == 'S') {
             $imgURL = nxs_getPostImage($postID, 'full');
         }
         // 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));
                 }
//.........这里部分代码省略.........
开发者ID:voquanghoa,项目名称:WebPhim,代码行数:101,代码来源:fb.php


注:本文中的nxs_getPostImage函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。