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


PHP nsFindVidsInPost函数代码示例

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


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

示例1: nxs_doPublishToYT

 function nxs_doPublishToYT($postID, $options)
 {
     $ntCd = 'YT';
     $ntCdL = 'yt';
     $ntNm = 'YouTube';
     $post = '';
     global $nxs_gCookiesArr;
     $vUrl = '';
     if (!is_array($options)) {
         $options = maybe_unserialize(get_post_meta($postID, $options, true));
     }
     // $backtrace = debug_backtrace(); nxs_addToLogN('W', 'Enter', $ntCd, 'I am here - '.$ntCd."|".print_r($backtrace, true), '');
     //if (isset($options['timeToRun'])) wp_unschedule_event( $options['timeToRun'], 'nxs_doPublishToYT',  array($postID, $options));
     $addParams = nxs_makeURLParams(array('NTNAME' => $ntNm, 'NTCODE' => $ntCd, 'POSTID' => $postID, 'ACCNAME' => $options['nName']));
     $blogTitle = htmlspecialchars_decode(get_bloginfo('name'), ENT_QUOTES);
     if ($blogTitle == '') {
         $blogTitle = home_url();
     }
     if (empty($options['ytGPPageID'])) {
         $options['ytGPPageID'] = '';
     }
     // if (empty($options['imgSize'])) $options['imgSize'] = '';
     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">YouTube</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') {
         $options['ytMsgFormat'] = 'Test Post, Please Ignore';
     } else {
         nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPrePosted' => '1'));
         $post = get_post($postID);
         if (!$post) {
             return;
         }
         $options['ytMsgFormat'] = nsFormatMessage($options['ytMsgFormat'], $postID, $addParams);
         // prr($msg); echo $postID;
     }
     $extInfo = ' | PostID: ' . $postID . " - " . (is_object($post) ? $post->post_title : '');
     //## Message & Format
     $vids = nsFindVidsInPost($post);
     if (count($vids) > 0) {
         $vUrl = $vids[0];
     }
     $message = array('siteName' => $blogTitle, 'videoURL' => $vUrl);
     //## Actual Post
     $ntToPost = new nxs_class_SNAP_YT();
     $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:acruxray,项目名称:social-networks-auto-poster-facebook-twitter-g,代码行数:89,代码来源:yt.php

示例2: 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

示例3: 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

示例4: nxs_doPublishToPN

 function nxs_doPublishToPN($postID, $options)
 {
     global $nxs_gCookiesArr, $plgn_NS_SNAutoPoster;
     $ntCd = 'PN';
     $ntCdL = 'pn';
     $ntNm = 'Pinterest';
     $price = '';
     if (!is_array($options)) {
         $options = maybe_unserialize(get_post_meta($postID, $options, true));
     }
     // $backtrace = debug_backtrace(); nxs_addToLogN('W', 'Enter', $ntCd, 'I am here - '.$ntCd."|".print_r($backtrace, true), '');
     //if (isset($options['timeToRun'])) wp_unschedule_event( $options['timeToRun'], 'nxs_doPublishToPN',  array($postID, $options));
     $addParams = nxs_makeURLParams(array('NTNAME' => $ntNm, 'NTCODE' => $ntCd, 'POSTID' => $postID, 'ACCNAME' => $options['nName']));
     $blogTitle = htmlspecialchars_decode(get_bloginfo('name'), ENT_QUOTES);
     if ($blogTitle == '') {
         $blogTitle = home_url();
     }
     if (empty($options['imgToUse'])) {
         $options['imgToUse'] = '';
     }
     if (empty($options['imgSize'])) {
         $options['imgSize'] = '';
     }
     if (empty($options['cImgURL'])) {
         $options['cImgURL'] = 'R';
     }
     $ii = $options['ii'];
     if (!isset($options['pType'])) {
         $options['pType'] = 'im';
     }
     if ($options['pType'] == 'sh') {
         sleep(rand(1, 10));
     }
     $logNT = '<span style="color:#FA5069">Pinterest</span> - ' . $options['nName'];
     $snap_ap = get_post_meta($postID, 'snap' . $ntCd, true);
     $snap_ap = maybe_unserialize($snap_ap);
     $isAttachVid = $options['isAttachVid'];
     if ($options['pType'] != 'aj' && is_array($snap_ap) && (nxs_chArrVar($snap_ap[$ii], 'isPosted', '1') || nxs_chArrVar($snap_ap[$ii], 'isPrePosted', '1'))) {
         $snap_isAutoPosted = get_post_meta($postID, 'snap_isAutoPosted', true);
         if ($snap_isAutoPosted != '2') {
             sleep(5);
             nxs_addToLogN('W', 'Notice', $logNT, '-=Duplicate=- Post ID:' . $postID, 'Already posted. No reason for posting duplicate |' . $uqID);
             return;
         }
     }
     if ($postID == '0') {
         echo "Testing ... <br/><br/>";
         $options['pnMsgFormat'] = 'Test Post from ' . $blogTitle;
         $urlToGo = home_url();
         if ($options['pnDefImg'] != '') {
             $imgURL = $options['pnDefImg'];
         } else {
             $imgURL = "http://direct.gtln.us/img/nxs/NXS-Lama.jpg";
         }
     } else {
         $post = get_post($postID);
         if (!$post) {
             return;
         }
         $options['pnMsgFormat'] = nsFormatMessage($options['pnMsgFormat'], $postID, $addParams);
         //## MyURL - URLToGo code
         if (!isset($options['urlToUse']) || trim($options['urlToUse']) == '') {
             $myurl = trim(get_post_meta($postID, 'snap_MYURL', true));
         }
         if ($myurl != '') {
             $options['urlToUse'] = $myurl;
         }
         if (isset($options['urlToUse']) && trim($options['urlToUse']) != '') {
             $urlToGo = $options['urlToUse'];
             $options['useFBGURLInfo'] = true;
         } else {
             $urlToGo = get_permalink($postID);
         }
         if ($addParams != '') {
             $urlToGo .= (strpos($urlToGo, '?') !== false ? '&' : '?') . $addParams;
         }
         if (is_object($post)) {
             $urlToGo = apply_filters('nxs_adjust_ex_url', $urlToGo, $post->post_content);
         }
         if (!empty($options['imgToUse'])) {
             $imgURL = $options['imgToUse'];
         } else {
             $imgURL = nxs_getPostImage($postID, 'full', $options['pnDefImg']);
         }
         if (preg_match("/noImg.\\.png/i", $imgURL)) {
             $imgURL = '';
         }
         if ($isAttachVid == '1') {
             $vids = nsFindVidsInPost($post);
             if (count($vids) > 0) {
                 $vidURL = 'http://www.youtube.com/v/' . $vids[0];
                 $imgURL = 'http://img.youtube.com/vi/' . $vids[0] . '/0.jpg';
             }
         }
         $extInfo = ' | PostID: ' . $postID . " - " . is_object($post) ? $post->post_title : '';
     }
     if ($options['cImgURL'] == 'S') {
         $options['cImgURL'] = 'R';
     }
     //## Pinterest no longer allows shorthened URLs.
//.........这里部分代码省略.........
开发者ID:voquanghoa,项目名称:WebPhim,代码行数:101,代码来源:pn.php

示例5: nxs_doPublishToTR

 function nxs_doPublishToTR($postID, $options)
 {
     $ntCd = 'TR';
     $ntCdL = 'tr';
     $ntNm = 'Tumblr';
     global $plgn_NS_SNAutoPoster;
     $ytUrl = '';
     $imgURL = '';
     if (!is_array($options)) {
         $options = maybe_unserialize(get_post_meta($postID, $options, true));
     }
     //if (isset($options['timeToRun'])) wp_unschedule_event( $options['timeToRun'], 'nxs_doPublishToTR',  array($postID, $options));
     if (empty($options['imgToUse'])) {
         $options['imgToUse'] = '';
     }
     if (empty($options['urlToUse'])) {
         $options['urlToUse'] = '';
     }
     if (empty($options['trMsgTFormat'])) {
         $options['trMsgTFormat'] = '';
     }
     if (empty($options['imgSize'])) {
         $options['imgSize'] = '';
     }
     $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:#014A76">Tumblr</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;
         }
     }
     //## Format
     if ($postID == '0') {
         echo "Testing ... <br/><br/>";
         $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';
             }
         }
//.........这里部分代码省略.........
开发者ID:brettex,项目名称:pspark,代码行数:101,代码来源:tr.php

示例6: 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

示例7: nxs_doPublishToFB


//.........这里部分代码省略.........
                 }
                 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', '&lt;3', $msg);
         $msg = str_ireplace('<(', '&lt;(', $msg);
         //## FB Smiles FIX.
         $msg = strip_tags($msg);
         $msg = nxs_decodeEntitiesFull($msg);
         $msg = str_ireplace('&#039;', "'", $msg);
         $msg = str_ireplace('&039;', "'", $msg);
         $msg = str_ireplace('&#39;', "'", $msg);
         $msg = str_ireplace('<3', '&lt;3', $msg);
         $msg = str_ireplace('<(', '&lt;(', $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);
                         $imgURL = $json[0]['thumbnail_large'];
                     }
                 }
             }
         }
         if (trim($options['imgToUse']) != '') {
             $imgURL = $options['imgToUse'];
         }
         if (preg_match("/noImg.\\.png/i", $imgURL)) {
             $imgURL = 'http://www.noimage.faketld';
         }
         //$imgURL = 'http://cdn.gtln.us/img/t1x1.gif';
         //## MyURL - URLToGo code
         if (!isset($options['urlToUse']) || trim($options['urlToUse']) == '') {
             $myurl = trim(get_post_meta($postID, 'snap_MYURL', true));
         }
         if ($myurl != '') {
             $options['urlToUse'] = $myurl;
开发者ID:voquanghoa,项目名称:WebPhim,代码行数:67,代码来源:fb.php

示例8: nxs_doPublishToTR

 function nxs_doPublishToTR($postID, $options)
 {
     $ntCd = 'TR';
     $ntCdL = 'tr';
     $ntNm = 'Tumblr';
     //if (isset($options['timeToRun'])) wp_unschedule_event( $options['timeToRun'], 'nxs_doPublishToTR',  array($postID, $options));
     $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:#014A76">Tumblr</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;
         }
     }
     //## Format
     if ($postID == '0') {
         echo "Testing ... <br/><br/>";
         $msg = 'Test Post from ' . $blogTitle;
         $msgT = 'Test Post from ' . $blogTitle;
         $options['trPostType'] == 'T';
     } else {
         $post = get_post($postID);
         if (!$post) {
             return;
         }
         $trMsgFormat = $options['trMsgFormat'];
         $msg = nsFormatMessage($trMsgFormat, $postID);
         $trMsgTFormat = $options['trMsgTFormat'];
         $msgT = nsFormatMessage($trMsgTFormat, $postID);
         nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPrePosted' => '1'));
     }
     //prr($options); die();
     //## Post
     require_once 'apis/trOAuth.php';
     $consumer_key = $options['trConsKey'];
     $consumer_secret = $options['trConsSec'];
     $tum_oauth = new TumblrOAuth($consumer_key, $consumer_secret, $options['trAccessTocken']['oauth_token'], $options['trAccessTocken']['oauth_token_secret']);
     //prr($options);
     $trURL = trim(str_ireplace('http://', '', $options['trURL']));
     if (substr($trURL, -1) == '/') {
         $trURL = substr($trURL, 0, -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 = ($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
     $extInfo = ' | PostID: ' . $postID . " - " . $post->post_title . ' |' . $options['pType'];
     $postArr = array('tags' => $tags, 'date' => $postDate);
     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') {
         $imgURL = nxs_getPostImage($postID, 'large', $options['trDefImg']);
         if (trim($imgURL) == '') {
             $options['trPostType'] = 'T';
         }
     }
//.........这里部分代码省略.........
开发者ID:JalpMi,项目名称:v2contact,代码行数:101,代码来源:tr.php

示例9: nsFindImgsInPost

 function nsFindImgsInPost($post, $advImgFnd = false)
 {
     global $ShownAds;
     if (isset($ShownAds)) {
         $ShownAdsL = $ShownAds;
     }
     if ($advImgFnd) {
         $postCnt = apply_filters('the_content', $post->post_content);
     } else {
         $postCnt = $post->post_content;
     }
     $postImgs = array();
     //$output = preg_match_all( '/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $postCnt, $matches ); if ($output === false){return false;}
     //$postCnt = str_replace("'",'"',$postCnt); $output = preg_match_all( '/src="([^"]*)"/', $postCnt, $matches ); if ($output === false){return false;}
     $postCnt = str_replace("'", '"', $postCnt);
     $output = preg_match_all('/< *img[^>]*src *= *["\']?([^"\']*)/i', $postCnt, $matches);
     // prr($matches);
     if ($output === false || $output == 0) {
         $vids = nsFindVidsInPost($post, $advImgFnd == false);
         if (count($vids) > 0) {
             $postImgs[] = 'http://img.youtube.com/vi/' . $vids[0] . '/0.jpg';
         } else {
             return false;
         }
     } else {
         foreach ($matches[1] as $match) {
             if (!preg_match('/^https?:\\/\\//', $match)) {
                 $match = site_url('/') . ltrim($match, '/');
             }
             $postImgs[] = $match;
         }
         if (isset($ShownAds)) {
             $ShownAds = $ShownAdsL;
         }
     }
     return $postImgs;
 }
开发者ID:JalpMi,项目名称:v2contact,代码行数:37,代码来源:nxs_functions.php

示例10: nxs_doPublishToGP

 function nxs_doPublishToGP($postID, $options)
 {
     $ntCd = 'GP';
     $ntCdL = 'gp';
     $ntNm = 'Google+';
     global $plgn_NS_SNAutoPoster;
     $ytCode = '';
     $imgURL = '';
     if (!is_array($options)) {
         $options = maybe_unserialize(get_post_meta($postID, $options, true));
     }
     if (!class_exists('nxsAPI_GP') || defined('d1') && d1 == 1) {
         nxs_addToLogN('E', 'Error', $ntCd, '-=ERROR=- No G+ API Lib Detected', '');
         return "No G+ API Lib Detected";
     }
     $addParams = nxs_makeURLParams(array('NTNAME' => $ntNm, 'NTCODE' => $ntCd, 'POSTID' => $postID, 'ACCNAME' => $options['nName']));
     if (empty($options['imgToUse'])) {
         $options['imgToUse'] = '';
     }
     if (empty($options['imgSize'])) {
         $options['imgSize'] = '';
     }
     $ii = $options['ii'];
     if (!isset($options['pType'])) {
         $options['pType'] = 'im';
     }
     if ($options['pType'] == 'sh') {
         sleep(rand(1, 10));
     }
     $logNT = '<span style="color:#800000">Google+</span> - ' . $options['nName'];
     $snap_ap = get_post_meta($postID, 'snap' . $ntCd, true);
     $snap_ap = maybe_unserialize($snap_ap);
     if ($options['pType'] != 'aj' && is_array($snap_ap) && (nxs_chArrVar($snap_ap[$ii], 'isPosted', '1') || nxs_chArrVar($snap_ap[$ii], 'isPrePosted', '1'))) {
         $snap_isAutoPosted = get_post_meta($postID, 'snap_isAutoPosted', true);
         if ($snap_isAutoPosted != '2') {
             nxs_addToLogN('W', 'Notice', $logNT, '-=Duplicate=- Post ID:' . $postID, 'Already posted. No reason for posting duplicate' . ' |' . $uqID);
             return;
         }
     }
     $message = array('message' => '', 'link' => '', 'imageURL' => '', 'videoURL' => '', 'noImg' => false);
     $isNoImg = false;
     if ($postID == '0') {
         echo "Testing ... <br/><br/>";
         $options['gpMsgFormat'] = "Test Post from " . htmlspecialchars_decode(get_bloginfo('name'), ENT_QUOTES) . " - " . home_url();
         $message['url'] = home_url();
     } else {
         nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPrePosted' => '1'));
         $post = get_post($postID);
         if (!$post) {
             return;
         }
         $gpMsgFormat = $options['gpMsgFormat'];
         $gpPostType = $options['postType'];
         $msg = nsFormatMessage($gpMsgFormat, $postID, $addParams);
         $options['gpMsgFormat'] = $msg;
         $extInfo = ' | PostID: ' . $postID . " - " . (isset($post) && is_object($post) ? $post->post_title : '');
         if ($gpPostType == 'I') {
             $vids = nsFindVidsInPost($post, false);
             if (count($vids) > 0) {
                 $ytCode = $vids[0];
             }
             /* if (trim($ytCode)=='') $options['trPostType']='T'; /* What is it? */
         }
         if ($gpPostType == 'A') {
             if (trim($options['imgToUse']) != '') {
                 $imgURL = $options['imgToUse'];
             } else {
                 $imgURL = nxs_getPostImage($postID, 'medium');
             }
         }
         if ($gpPostType == 'I') {
             if (trim($options['imgToUse']) != '') {
                 $imgURL = $options['imgToUse'];
             } else {
                 $imgURL = nxs_getPostImage($postID, 'full');
             }
         }
         if (preg_match("/noImg.\\.png/i", $imgURL)) {
             $imgURL = '';
             $isNoImg = true;
         }
         //## MyURL - URLToGo code
         $options = nxs_getURL($options, $postID, $addParams);
         $urlToGo = $options['urlToUse'];
         $message = array('url' => $urlToGo, 'imageURL' => $imgURL, 'videoCode' => $ytCode, 'noImg' => $isNoImg);
         //prr($message); die();
     }
     //## Actual Post
     $ntToPost = new nxs_class_SNAP_GP();
     $ret = $ntToPost->doPostToNT($options, $message);
     //## Process Results
     if (!is_array($ret) || $ret['isPosted'] != '1') {
         //## Error
         if ($postID == '0') {
             prr($ret);
         }
         nxs_addToLogN('E', 'Error', $logNT, '-=ERROR=- ' . print_r($ret, true), $extInfo);
     } else {
         // ## All Good - log it.
         if ($postID == '0') {
//.........这里部分代码省略.........
开发者ID:jguzmanf88,项目名称:social-networks-auto-poster-facebook-twitter-g,代码行数:101,代码来源:gp.php

示例11: 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

示例12: nxs_doPublishToYT

 function nxs_doPublishToYT($postID, $options)
 {
     $ntCd = 'YT';
     $ntCdL = 'yt';
     $ntNm = 'YouTube';
     global $nxs_gCookiesArr;
     // $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_doPublishToYT',  array($postID, $options));
     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">YouTube</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/>";
     } else {
         nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPrePosted' => '1'));
         $post = get_post($postID);
         if (!$post) {
             return;
         }
     }
     $ytMsgFormat = $options['ytMsgFormat'];
     $msg = nsFormatMessage($ytMsgFormat, $postID);
     // prr($msg); echo $postID;
     $extInfo = ' | PostID: ' . $postID . " - " . $post->post_title;
     $email = $options['ytUName'];
     $pass = substr($options['ytPass'], 0, 5) == 'n5g9a' ? nsx_doDecode(substr($options['ytPass'], 5)) : $options['ytPass'];
     $loginError = doConnectToGooglePlus2($email, $pass, 'YT');
     if ($loginError !== false) {
         if ($postID == '0') {
             echo $loginError;
         }
         nxs_addToLogN('E', 'Error', $logNT, '-=ERROR=- ' . print_r($loginError, true) . " - BAD USER/PASS", $extInfo);
         return "BAD USER/PASS";
     }
     $url = get_permalink($postID);
     if (trim($url) == '') {
         $url = home_url();
     }
     $vids = nsFindVidsInPost($post);
     if (count($vids) > 0) {
         $vUrl = $vids[0];
     }
     $ret = doPostToYouTube($msg, $options['ytPageID'], $vUrl);
     //prr($ret);
     if ($ret == 'OK') {
         $ret = array("code" => "OK", "post_id" => '');
     }
     if (!is_array($ret) && $ret != 'OK') {
         if ($postID == '0') {
             prr($ret);
         }
         nxs_addToLogN('E', 'Error', $logNT, '-=ERROR=- ' . print_r($ret, true), $extInfo);
     } else {
         if ($postID == '0') {
             nxs_addToLogN('S', 'Test', $logNT, 'OK - TEST Message Posted ');
             echo _e('OK - Message Posted, please see your YouTube Page', 'nxs_snap');
         } else {
             nxs_metaMarkAsPosted($postID, 'YT', $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);
         }
     }
     if ($ret['code'] == 'OK') {
         return 200;
     } else {
         return $ret;
     }
 }
开发者ID:JalpMi,项目名称:v2contact,代码行数:86,代码来源:yt.php


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