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


PHP nxs_addToLogN函数代码示例

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


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

示例1: nxs_snapPublishTo

 function nxs_snapPublishTo($postArr, $type = '', $aj = false)
 {
     global $plgn_NS_SNAutoPoster, $nxs_snapAvNts, $blog_id, $nxs_tpWMPU;
     //  echo " | nxs_doSMAS2 | "; prr($postArr);
     if (is_object($postArr)) {
         $postID = $postArr->ID;
     } else {
         $postID = $postArr;
     }
     $isPost = isset($_POST["snapEdIT"]);
     if ($isPost) {
         $plgn_NS_SNAutoPoster->NS_SNAP_SavePostMetaTags($postID);
     }
     if (function_exists('nxs_doSMAS2')) {
         nxs_doSMAS2($postArr, $type, $aj);
         return;
     } else {
         if (!isset($plgn_NS_SNAutoPoster)) {
             return;
         }
         $options = $plgn_NS_SNAutoPoster->nxs_options;
         $ltype = strtolower($type);
         if ($nxs_tpWMPU == 'S') {
             switch_to_blog(1);
             $plgn_NS_SNAutoPoster = new NS_SNAutoPoster();
             $options = $plgn_NS_SNAutoPoster->nxs_options;
             restore_current_blog();
         }
         if (!isset($options['nxsHTDP']) || $options['nxsHTDP'] == 'S') {
             if (isset($_POST["snapEdIT"]) && $_POST["snapEdIT"] == '1') {
                 $publtype = 'S';
                 $delay = rand(2, 10);
             } else {
                 $publtype = 'A';
             }
         } else {
             $publtype = 'I';
         }
         nxs_addToLogN('BG', 'Start =- ', '', '------=========#### NEW AUTO-POST REQUEST ' . ($blog_id > 1 ? 'BlogID:' . $blog_id : '') . ' PostID:(' . $postID . ') ' . ($publtype == 'S' ? 'Scheduled +' . $delay : ($publtype == 'A' ? 'Non Human' : 'Immediate')) . ' ####=========------');
         $post = get_post($postID);
         $args = array('public' => true, '_builtin' => false);
         $output = 'names';
         $operator = 'and';
         $post_types = array();
         if (function_exists('get_post_types')) {
             $post_types = get_post_types($args, $output, $operator);
         }
         $snap_isAutoPosted = get_post_meta($postID, 'snap_isAutoPosted', true);
         if ($snap_isAutoPosted == '1') {
             nxs_addToLogN('W', 'Skipped', '', 'Already Autoposted - Post ID:(' . $postID . ')');
             return;
         }
         $snap_isEdIT = get_post_meta($postID, 'snapEdIT', true);
         if ($snap_isEdIT != '1') {
             $doPost = true;
             $exclCats = maybe_unserialize($options['exclCats']);
             $postCats = wp_get_post_categories($postID);
             foreach ($postCats as $pCat) {
                 if (is_array($exclCats) && in_array($pCat, $exclCats)) {
                     $doPost = false;
                 } else {
                     $doPost = true;
                     break;
                 }
             }
             if (!$doPost) {
                 nxs_addToLogN('I', 'Skipped', '', 'Non-Human Post - Category Excluded - Post ID:(' . $postID . ')');
                 return;
             }
         }
         if ($options['nxsCPTSeld'] != '') {
             $nxsCPTSeld = unserialize($options['nxsCPTSeld']);
         } else {
             $nxsCPTSeld = array_keys($post_types);
         }
         //prr($nxsCPTSeld);
         if ($post->post_type == 'post' || $options['useForPages'] == '1' && $post->post_type == 'page' || in_array($post->post_type, $post_types) && in_array($post->post_type, $nxsCPTSeld)) {
             foreach ($nxs_snapAvNts as $avNt) {
                 if (count($options[$avNt['lcode']]) > 0) {
                     $clName = 'nxs_snapClass' . $avNt['code'];
                     if ($isPost && isset($_POST[$avNt['lcode']])) {
                         $po = $_POST[$avNt['lcode']];
                     } else {
                         $po = get_post_meta($postID, 'snap' . $avNt['code'], true);
                         $po = maybe_unserialize($po);
                     }
                     if (isset($po) && is_array($po)) {
                         $isPostMeta = true;
                     } else {
                         $isPostMeta = false;
                         $po = $options[$avNt['lcode']];
                     }
                     delete_post_meta($postID, 'snap_isAutoPosted');
                     add_post_meta($postID, 'snap_isAutoPosted', '1');
                     $optMt = $options[$avNt['lcode']][0];
                     if ($isPostMeta) {
                         $ntClInst = new $clName();
                         $optMt = $ntClInst->adjMetaOpt($optMt, $po[0]);
                     }
                     if ($snap_isEdIT != '1') {
//.........这里部分代码省略.........
开发者ID:JalpMi,项目名称:v2contact,代码行数:101,代码来源:NextScripts_SNAP.php

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

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

示例4: nxs_doConnectToSU

 function nxs_doConnectToSU($u, $p)
 {
     global $nxs_suCkArray;
     $hdrsArr = $this->nxs_getSUHeaders('https://www.stumbleupon.com/', false, false);
     //   echo "LOGGIN";
     $response = wp_remote_get('https://www.stumbleupon.com/login', array('headers' => $hdrsArr));
     $p = substr($p, 0, 16);
     if (is_wp_error($response)) {
         nxs_addToLogN('E', 'Error', $logNT, '-=ERROR=- ' . print_r($response, true), '');
         return "Connection ERROR. Please see log";
     }
     $contents = $response['body'];
     $ckArr = $response['cookies'];
     //$response['body'] = htmlentities($response['body']);  prr($response);    die();
     $frmTxt = CutFromTo($contents, '<form id="login-form"', '</form>');
     $md = array();
     $flds = array();
     $mids = '';
     // prr($frmTxt);
     while (stripos($frmTxt, '<input') !== false) {
         $inpField = trim(CutFromTo($frmTxt, '<input', '>'));
         $name = trim(CutFromTo($inpField, 'name="', '"'));
         if (stripos($inpField, '"hidden"') !== false && $name != '' && !in_array($name, $md)) {
             $md[] = $name;
             $val = trim(CutFromTo($inpField, 'value="', '"'));
             $flds[$name] = $val;
             $mids .= "&" . $name . "=" . $val;
         }
         $frmTxt = substr($frmTxt, stripos($frmTxt, '<input') + 8);
     }
     $flds['user'] = $u;
     $flds['pass'] = $p;
     $flds['remember'] = 'true';
     $flds['nativeSubmit'] = '0';
     $flds['_method'] = 'create';
     $flds['_output'] = 'Json';
     $hdrsArr = $this->nxs_getSUHeaders('https://www.stumbleupon.com/login', true, true);
     $r2 = wp_remote_post('https://www.stumbleupon.com/login?_nospa=true', array('method' => 'POST', 'timeout' => 45, 'redirection' => 0, 'headers' => $hdrsArr, 'body' => $flds, 'cookies' => $ckArr));
     if (is_wp_error($r2)) {
         nxs_addToLogN('E', 'Error', $logNT, '-=ERROR=- ' . print_r($r2, true), '');
         return "Connection ERROR. Please see log";
     }
     $ckArr = nxsMergeArraysOV($ckArr, $r2['cookies']);
     //prr($flds); prr($ckArr); prr($r2); prr($ckArr);
     if (is_array($r2) && !empty($r2['response']['code']) && $r2['response']['code'] == '302') {
         $hdrsArr = $this->nxs_getSUHeaders('https://www.stumbleupon.com/login', false, false);
         $r2 = wp_remote_get('https://www.stumbleupon.com/settings/profile/', array('timeout' => 45, 'redirection' => 0, 'headers' => $hdrsArr, 'cookies' => $ckArr));
         if (is_wp_error($r2)) {
             nxs_addToLogN('E', 'Error', $logNT, '-=ERROR=- ' . print_r($r2, true), '');
             return "Connection ERROR. Please see log";
         }
         //prr($r2);
         if (stripos($r2['body'], '<a href="#" class="logout ') !== false) {
             $nxs_suCkArray = $ckArr;
             return false;
         }
     }
     $resp = json_decode($r2['body'], true);
     if ($resp['_success'] == '1') {
         $ckArr = nxsMergeArraysOV($ckArr, $r2['cookies']);
         $nxs_suCkArray = $ckArr;
         return false;
     } elseif (isset($resp['_reason'])) {
         return $resp['_reason'];
     } else {
         return "ERROR";
     }
 }
开发者ID:voquanghoa,项目名称:WebPhim,代码行数:68,代码来源:su.api.php

示例5: nxs_doPublishToBG

 function nxs_doPublishToBG($postID, $options)
 {
     $ntCd = 'BG';
     $ntCdL = 'bg';
     $ntNm = 'Blogger';
     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_doPublishToBG',  array($postID, $options));
     $blogTitle = htmlspecialchars_decode(get_bloginfo('name'), ENT_QUOTES);
     if ($blogTitle == '') {
         $blogTitle = home_url();
     }
     $addParams = nxs_makeURLParams(array('NTNAME' => $ntNm, 'NTCODE' => $ntCd, 'ACCNAME' => $options['nName'], 'POSTID' => $postID));
     $ii = $options['ii'];
     if (!isset($options['pType'])) {
         $options['pType'] = 'im';
     }
     if ($options['pType'] == 'sh') {
         sleep(rand(1, 10));
     }
     $logNT = '<span style="color:#F87907">' . $ntNm . '</span> - ' . $options['nName'];
     $snap_ap = get_post_meta($postID, 'snap' . $ntCd, true);
     $snap_ap = maybe_unserialize($snap_ap);
     if ($options['pType'] != 'aj' && is_array($snap_ap) && (nxs_chArrVar($snap_ap[$ii], 'isPosted', '1') || nxs_chArrVar($snap_ap[$ii], 'isPrePosted', '1'))) {
         $snap_isAutoPosted = get_post_meta($postID, 'snap_isAutoPosted', true);
         if ($snap_isAutoPosted != '2') {
             nxs_addToLogN('W', 'Notice', $logNT, '-=Duplicate=- Post ID:' . $postID, 'Already posted. No reason for posting duplicate');
             return;
         }
     }
     if ($postID == '0') {
         echo "Testing ... <br/><br/>";
         $options['bgMsgTFormat'] = 'Test Post from ' . htmlentities($blogTitle);
         $link = home_url();
         $options['bgMsgFormat'] = 'Test Post from ' . $blogTitle . " " . $link;
     } else {
         $post = get_post($postID);
         if (!$post) {
             return;
         }
         $options['bgMsgFormat'] = nsFormatMessage($options['bgMsgFormat'], $postID, $addParams);
         $options['bgMsgTFormat'] = nsFormatMessage($options['bgMsgTFormat'], $postID, $addParams);
         nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPrePosted' => '1'));
     }
     $extInfo = ' | PostID: ' . $postID . " - " . (isset($post) && is_object($post) ? $post->post_title : '');
     //## Actual POST Code
     if ($options['bgInclTags'] == '1') {
         $t = wp_get_post_tags($postID);
         $tggs = array();
         foreach ($t as $tagA) {
             $tggs[] = $tagA->name;
         }
         $tags = implode('","', $tggs);
         $tags = nsTrnc($tags, 195, ',', '');
     }
     if (substr($tags, -1) == '"') {
         $tags = substr($tags, 0, -1);
     }
     if (substr($tags, -1) == ',') {
         $tags = substr($tags, 0, -1);
     }
     if (substr($tags, -1) == '"') {
         $tags = substr($tags, 0, -1);
     }
     //## Set Message
     $message = array('title' => '', 'announce' => '', 'text' => '', 'url' => '', 'surl' => '', 'urlDescr' => '', 'urlTitle' => '', 'imageURL' => array(), 'videoCode' => '', 'videoURL' => '', 'siteName' => $blogTitle, 'tags' => $tags, 'cats' => '', 'authorName' => '');
     //## Actual Post
     $ntToPost = new nxs_class_SNAP_BG();
     $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')));
             $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:acruxray,项目名称:social-networks-auto-poster-facebook-twitter-g,代码行数:96,代码来源:bg.php

示例6: nxs_doPublishToBG

 function nxs_doPublishToBG($postID, $options)
 {
     $ntCd = 'BG';
     $ntCdL = 'bg';
     $ntNm = 'Blogger';
     //  $uqID = uniqid('BG_');
     //$backtrace = debug_backtrace(); nxs_addToLogN('W', 'Enter', $ntCd, 'I am here - '.$ntCd."|".print_r($backtrace, true), '');
     // if (isset($options['timeToRun'])) wp_unschedule_event( $options['timeToRun'], 'nxs_doPublishToBG',  array($postID, $options));
     $blogTitle = htmlspecialchars_decode(get_bloginfo('name'), ENT_QUOTES);
     if ($blogTitle == '') {
         $blogTitle = home_url();
     }
     $addParams = nxs_makeURLParams(array('NTNAME' => $ntNm, 'NTCODE' => $ntCd, 'ACCNAME' => $options['nName'], 'POSTID' => $postID));
     $ii = $options['ii'];
     if (!isset($options['pType'])) {
         $options['pType'] = 'im';
     }
     if ($options['pType'] == 'sh') {
         sleep(rand(1, 10));
     }
     $logNT = '<span style="color:#F87907">' . $ntNm . '</span> - ' . $options['nName'];
     $snap_ap = get_post_meta($postID, 'snap' . $ntCd, true);
     $snap_ap = maybe_unserialize($snap_ap);
     if ($options['pType'] != 'aj' && is_array($snap_ap) && (nxs_chArrVar($snap_ap[$ii], 'isPosted', '1') || nxs_chArrVar($snap_ap[$ii], 'isPrePosted', '1'))) {
         $snap_isAutoPosted = get_post_meta($postID, 'snap_isAutoPosted', true);
         if ($snap_isAutoPosted != '2') {
             nxs_addToLogN('W', 'Notice', $logNT, '-=Duplicate=- Post ID:' . $postID, 'Already posted. No reason for posting duplicate');
             return;
         }
     }
     if ($postID == '0') {
         echo "Testing ... <br/><br/>";
         $msgT = 'Test Post from ' . htmlentities($blogTitle);
         $link = home_url();
         $msg = 'Test Post from ' . $blogTitle . " " . $link;
     } else {
         $post = get_post($postID);
         if (!$post) {
             return;
         }
         $msgFormat = $options['bgMsgFormat'];
         $msg = nsFormatMessage($msgFormat, $postID, $addParams);
         $link = get_permalink($postID);
         $msgTFormat = $options['bgMsgTFormat'];
         $msgT = nsFormatMessage($msgTFormat, $postID, $addParams);
         nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPrePosted' => '1'));
     }
     $extInfo = ' | PostID: ' . $postID . " - " . nxs_doQTrans($post->post_title, $lng);
     //## Actual POST Code
     $email = $options['bgUName'];
     $pass = substr($options['bgPass'], 0, 5) == 'b4d7s' ? nsx_doDecode(substr($options['bgPass'], 5)) : $options['bgPass'];
     $blogID = $options['bgBlogID'];
     //echo "###".$auth."|".$blogID."|".$msgT."|".$msg;
     if ($options['bgInclTags'] == '1') {
         $t = wp_get_post_tags($postID);
         $tggs = array();
         foreach ($t as $tagA) {
             $tggs[] = $tagA->name;
         }
         $tags = implode('","', $tggs);
         $tags = nsTrnc($tags, 195, ',', '');
     }
     if (substr($tags, -1) == '"') {
         $tags = substr($tags, 0, -1);
     }
     if (class_exists('DOMDocument')) {
         $doc = new DOMDocument();
         @$doc->loadHTML('<?xml encoding="UTF-8">' . $msg);
         $doc->encoding = 'UTF-8';
         $msg = $doc->saveHTML();
         $msg = CutFromTo($msg, '<body>', '</body>');
         $msg = preg_replace('/<br(.*?)\\/?>/', '<br$1/>', $msg);
         $msg = preg_replace('/<img(.*?)\\/?>/', '<img$1/>', $msg);
         require_once 'apis/htmlNumTable.php';
         if (is_array($HTML401NamedToNumeric)) {
             $msg = strtr($msg, $HTML401NamedToNumeric);
             $msgT = strtr($msgT, $HTML401NamedToNumeric);
         }
     }
     //  prr($text);
     // prr($msg); echo " =HT= ";
     $msg = preg_replace('/<script\\b[^>]*>(.*?)<\\/script>/is', "", $msg);
     $msg = preg_replace('/<!--(.*)-->/Uis', "", $msg);
     $nxshf = new NXS_HtmlFixer();
     $nxshf->debug = false;
     $msg = $nxshf->getFixedHtml($msg);
     $msg = str_replace("\r\n", "\n", $msg);
     $msg = str_replace("\n\r", "\n", $msg);
     $msg = str_replace("\r", "\n", $msg);
     $msg = str_replace("\n", "<br/>", $msg);
     //  prr($msg); die();
     if (function_exists("doConnectToBlogger")) {
         $auth = doConnectToBlogger($email, $pass);
         if ($auth !== false) {
             $ret = $auth;
         } else {
             $ret = doPostToBlogger($blogID, $msgT, $msg, $tags);
         }
     } else {
         $auth = nsBloggerGetAuth($email, $pass);
//.........这里部分代码省略.........
开发者ID:JalpMi,项目名称:v2contact,代码行数:101,代码来源:bg.php

示例7: nxs_doPublishToVB

 function nxs_doPublishToVB($postID, $options)
 {
     global $nxs_vbCkArray, $plgn_NS_SNAutoPoster;
     $ntCd = 'VB';
     $ntCdL = 'vb';
     $ntNm = 'vBulletin';
     if (!is_array($options)) {
         $options = maybe_unserialize(get_post_meta($postID, $options, true));
     }
     //if (isset($options['timeToRun'])) wp_unschedule_event( $options['timeToRun'], 'nxs_doPublishToVB',  array($postID, $options));
     $blogTitle = htmlspecialchars_decode(get_bloginfo('name'), ENT_QUOTES);
     if ($blogTitle == '') {
         $blogTitle = home_url();
     }
     $addParams = nxs_makeURLParams(array('NTNAME' => $ntNm, 'NTCODE' => $ntCd, 'POSTID' => $postID, 'ACCNAME' => $options['nName']));
     $ii = $options['ii'];
     if (!isset($options['pType'])) {
         $options['pType'] = 'im';
     }
     if ($options['pType'] == 'sh') {
         sleep(rand(1, 10));
     }
     $logNT = '<span style="color:#000080">vBulletin</span> - ' . $options['nName'];
     $snap_ap = get_post_meta($postID, 'snap' . $ntCd, true);
     $snap_ap = maybe_unserialize($snap_ap);
     if ($options['pType'] != 'aj' && is_array($snap_ap) && (nxs_chArrVar($snap_ap[$ii], 'isPosted', '1') || nxs_chArrVar($snap_ap[$ii], 'isPrePosted', '1'))) {
         $snap_isAutoPosted = get_post_meta($postID, 'snap_isAutoPosted', true);
         if ($snap_isAutoPosted != '2') {
             sleep(5);
             nxs_addToLogN('W', 'Notice', $logNT, '-=Duplicate=- Post ID:' . $postID, 'Already posted. No reason for posting duplicate' . ' |' . $uqID);
             return;
         }
     }
     if ($postID == '0') {
         echo "Testing ... <br/><br/>";
         $urlToGo = home_url();
         $options['vbMsgFormat'] = 'Test Message from ' . $urlToGo;
         $options['vbMsgTFormat'] = 'Test Link from ' . $urlToGo;
     } else {
         $post = get_post($postID);
         nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPrePosted' => '1'));
         $options['vbMsgFormat'] = nsFormatMessage($options['vbMsgFormat'], $postID, $addParams);
         $options['vbMsgTFormat'] = nsFormatMessage($options['vbMsgTFormat'], $postID, $addParams);
         //## MyURL - URLToGo code
         if (!isset($options['urlToUse']) || trim($options['urlToUse']) == '') {
             $myurl = trim(get_post_meta($postID, 'snap_MYURL', true));
         }
         if ($myurl != '') {
             $options['urlToUse'] = $myurl;
         }
         if (isset($options['urlToUse']) && trim($options['urlToUse']) != '') {
             $urlToGo = $options['urlToUse'];
             $options['useFBGURLInfo'] = true;
         } else {
             $urlToGo = get_permalink($postID);
         }
         $gOptions = $plgn_NS_SNAutoPoster->nxs_options;
         $addURLParams = trim($gOptions['addURLParams']);
         if ($addURLParams != '') {
             $urlToGo .= (strpos($urlToGo, '?') !== false ? '&' : '?') . $addURLParams;
         }
     }
     $dusername = $options['vbUName'];
     //$link = urlencode($link); $desc = urlencode(substr($msg, 0, 500));
     $extInfo = ' | PostID: ' . $postID . " - " . (!empty($post) && is_object($post) ? $post->post_title : '');
     //## Message & Format
     if ($options['vbInclTags'] == '1') {
         $t = wp_get_post_tags($postID);
         $tggs = array();
         foreach ($t as $tagA) {
             $tggs[] = $tagA->name;
         }
         $tags = implode(', ', $tggs);
         /* $tags = str_replace(' ','+',$tags); */
     } else {
         $tags = '';
     }
     $message = array('siteName' => $blogTitle, 'tags' => $tags);
     //## Actual Post
     $ntToPost = new nxs_class_SNAP_VB();
     $ret = $ntToPost->doPostToNT($options, $message);
     //## Save Session
     if (empty($options['vkSvC']) || serialize($nxs_vbCkArray) != $options['vbSvC']) {
         global $plgn_NS_SNAutoPoster;
         $gOptions = $plgn_NS_SNAutoPoster->nxs_options;
         if (isset($options['ii']) && $options['ii'] !== '') {
             $gOptions['vb'][$options['ii']]['vbSvC'] = serialize($nxs_vbCkArray);
             update_option('NS_SNAutoPoster', $gOptions);
         } else {
             foreach ($gOptions['vb'] as $ii => $gpn) {
                 $result = array_diff($options, $gpn);
                 if (!is_array($result) || count($result) < 1) {
                     $gOptions['vb'][$ii]['vbSvC'] = serialize($nxs_vbCkArray);
                     update_option('NS_SNAutoPoster', $gOptions);
                     break;
                 }
             }
         }
     }
     //## Process Results
//.........这里部分代码省略.........
开发者ID:jguzmanf88,项目名称:social-networks-auto-poster-facebook-twitter-g,代码行数:101,代码来源:vb.php

示例8: nxs_doPublishToTW

 function nxs_doPublishToTW($postID, $options)
 {
     $ntCd = 'TW';
     $ntCdL = 'tw';
     $ntNm = 'Twitter';
     $imgData = '';
     $imgURL = '';
     global $plgn_NS_SNAutoPoster, $nxs_urlLen;
     $nxs_urlLen = 0;
     if (!is_array($options)) {
         $options = maybe_unserialize(get_post_meta($postID, $options, true));
     }
     //$backtrace = debug_backtrace(); nxs_addToLogN('W', 'Error', $logNT, 'I am here - '.$ntCd."|".print_r($backtrace, true), '');
     //if (isset($options['timeToRun'])) wp_unschedule_event( $options['timeToRun'], 'nxs_doPublishToTW',  array($postID, $options));
     $gOptions = $plgn_NS_SNAutoPoster->nxs_options;
     if (!empty($gOptions['nxsHTSpace'])) {
         $htS = $gOptions['nxsHTSpace'];
     } else {
         $htS = '';
     }
     $addParams = nxs_makeURLParams(array('NTNAME' => $ntNm, 'NTCODE' => $ntCd, 'POSTID' => $postID, 'ACCNAME' => $options['nName']));
     $ii = $options['ii'];
     if (!isset($options['pType'])) {
         $options['pType'] = 'im';
     }
     if ($options['pType'] == 'sh') {
         sleep(rand(1, 10));
     }
     $logNT = '<span style="color:#00FFFF">Twitter</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;
         }
     }
     $blogTitle = htmlspecialchars_decode(get_bloginfo('name'), ENT_QUOTES);
     if ($blogTitle == '') {
         $blogTitle = home_url();
     }
     $uln = 0;
     $extInfo = ' | PostID: ' . $postID;
     if ($options['attchImg'] == '1') {
         if (!empty($options['imgToUse'])) {
             $imgURL = $options['imgToUse'];
         } else {
             $imgURL = nxs_getPostImage($postID);
         }
         if (preg_match("/noImg.\\.png/i", $imgURL)) {
             $imgURL = '';
         }
         if (trim($imgURL) == '') {
             $options['attchImg'] = 0;
         } else {
             $imgURL = str_replace(' ', '%20', $imgURL);
             $hdrsArr['User-Agent'] = 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:32.0) Gecko/20100101 Firefox/32.0';
             $advSet = array('headers' => $hdrsArr, 'httpversion' => '1.1', 'timeout' => 45, 'sslverify' => false);
             $imgData = wp_remote_get($imgURL, $advSet);
             if (is_wp_error($imgData) || empty($imgData['body']) || !empty($imgData['headers']['content-length']) && (int) $imgData['headers']['content-length'] < 200) {
                 $options['attchImg'] = 0;
                 nxs_addToLogN('E', 'Error', $logNT, 'Could not get image (' . $imgURL . '), will post without it - Error:' . print_r($imgData, true), $extInfo);
             } else {
                 $imgData = $imgData['body'];
             }
         }
     }
     if ($options['attchImg'] == '1' && $imgData != '') {
         $twLim = 117;
     } else {
         $twLim = 140;
     }
     if ($postID == '0') {
         echo "Testing ... <br/><br/>";
         $msg = 'Test Post from ' . nsTrnc($blogTitle, $twLim - 24) . " - " . rand(1, 155);
         $uln = nxs_strLen($msg);
     } else {
         $post = get_post($postID);
         if (!$post) {
             return;
         }
         $twMsgFormat = $options['twMsgFormat'];
         nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPrePosted' => '1'));
         $extInfo = ' | PostID: ' . $postID . " - " . $post->post_title . ' |' . $options['pType'];
         if (stripos($twMsgFormat, '%URL%') !== false || stripos($twMsgFormat, '%SURL%') !== false) {
             $twLim = $twLim - 22;
         }
         if (stripos($twMsgFormat, '%AUTHORNAME%') !== false) {
             $aun = $post->post_author;
             $aun = get_the_author_meta('display_name', $aun);
             $twLim = $twLim - nxs_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);
//.........这里部分代码省略.........
开发者ID:jguzmanf88,项目名称:social-networks-auto-poster-facebook-twitter-g,代码行数:101,代码来源:tw.php

示例9: nxs_doPublishToSC

 function nxs_doPublishToSC($postID, $options)
 {
     global $plgn_NS_SNAutoPoster;
     $ntCd = 'SC';
     $ntCdL = 'sc';
     $ntNm = 'Scoop.It';
     if (!is_array($options)) {
         $options = maybe_unserialize(get_post_meta($postID, $options, true));
     }
     $addParams = nxs_makeURLParams(array('NTNAME' => $ntNm, 'NTCODE' => $ntCd, 'POSTID' => $postID, 'ACCNAME' => $options['nName']));
     if (empty($options['imgToUse'])) {
         $options['imgToUse'] = '';
     }
     if (empty($options['imgSize'])) {
         $options['imgSize'] = '';
     }
     $ii = $options['ii'];
     if (!isset($options['pType'])) {
         $options['pType'] = 'im';
     }
     if ($options['pType'] == 'sh') {
         sleep(rand(1, 10));
     }
     $logNT = '<span style="color:#800000">Scoop.It</span> - ' . $options['nName'];
     $snap_ap = get_post_meta($postID, 'snap' . $ntCd, true);
     $snap_ap = maybe_unserialize($snap_ap);
     if ($options['pType'] != 'aj' && is_array($snap_ap) && (nxs_chArrVar($snap_ap[$ii], 'isPosted', '1') || nxs_chArrVar($snap_ap[$ii], 'isPrePosted', '1'))) {
         $snap_isAutoPosted = get_post_meta($postID, 'snap_isAutoPosted', true);
         if ($snap_isAutoPosted != '2') {
             nxs_addToLogN('W', 'Notice', $logNT, '-=Duplicate=- Post ID:' . $postID, 'Already posted. No reason for posting duplicate' . ' |' . $uqID);
             return;
         }
     }
     $message = array('message' => '', 'link' => '', 'imageURL' => '', 'videoURL' => '');
     if ($postID == '0') {
         echo "Testing ... <br/><br/>";
         $message['description'] = 'Test Post, Description';
         $message['title'] = 'Test Post - Title';
         $message['url'] = home_url();
     } else {
         nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPrePosted' => '1'));
         $post = get_post($postID);
         if (!$post) {
             return;
         }
         $postType = $options['postType'];
         $isNoImg = false;
         $tags = '';
         $options['msgFrmt'] = nsFormatMessage($options['msgFrmt'], $postID, $addParams);
         $options['msgTFrmt'] = nsFormatMessage($options['msgTFrmt'], $postID, $addParams);
         $tggs = array();
         if ($options['inclTags'] == '1') {
             $t = wp_get_post_tags($postID);
             $tggs = array();
             foreach ($t as $tagA) {
                 $tggs[] = $tagA->name;
             }
             $tags = $tggs;
         }
         if ($postType == 'A') {
             if (trim($options['imgToUse']) != '') {
                 $imgURL = $options['imgToUse'];
             } else {
                 $imgURL = nxs_getPostImage($postID, 'medium');
             }
         }
         if ($postType == 'I') {
             if (trim($options['imgToUse']) != '') {
                 $imgURL = $options['imgToUse'];
             } else {
                 $imgURL = nxs_getPostImage($postID, 'full');
             }
         }
         if (preg_match("/noImg.\\.png/i", $imgURL)) {
             $imgURL = '';
             $isNoImg = true;
         }
         //## MyURL - URLToGo code
         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

示例10: nxs_addToLog

 function nxs_addToLog($nt, $type, $msg, $extInfo = '')
 {
     nxs_addToLogN($nt, $type, $msg, $extInfo);
 }
开发者ID:JalpMi,项目名称:v2contact,代码行数:4,代码来源:nxs_functions.php

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

示例12: nxs_doPublishToWP

 function nxs_doPublishToWP($postID, $options)
 {
     $ntCd = 'WP';
     $ntCdL = 'wp';
     $ntNm = 'WP Based Blog';
     global $plgn_NS_SNAutoPoster;
     if (!is_array($options)) {
         $options = maybe_unserialize(get_post_meta($postID, $options, true));
     }
     //if (isset($options['timeToRun'])) wp_unschedule_event( $options['timeToRun'], 'nxs_doPublishToWP',  array($postID, $options));
     $blogTitle = htmlspecialchars_decode(get_bloginfo('name'), ENT_QUOTES);
     if ($blogTitle == '') {
         $blogTitle = home_url();
     }
     $addParams = nxs_makeURLParams(array('NTNAME' => $ntNm, 'NTCODE' => $ntCd, 'POSTID' => $postID, 'ACCNAME' => $options['nName']));
     if (empty($options['imgToUse'])) {
         $options['imgToUse'] = '';
     }
     if (empty($options['imgSize'])) {
         $options['imgSize'] = '';
     }
     $ii = $options['ii'];
     if (!isset($options['pType'])) {
         $options['pType'] = 'im';
     }
     if ($options['pType'] == 'sh') {
         sleep(rand(1, 10));
     }
     $logNT = '<span style="color:#1A9EE6">WP</span> - ' . $options['nName'];
     $snap_ap = get_post_meta($postID, 'snap' . $ntCd, true);
     $snap_ap = maybe_unserialize($snap_ap);
     if ($options['pType'] != 'aj' && is_array($snap_ap) && (nxs_chArrVar($snap_ap[$ii], 'isPosted', '1') || nxs_chArrVar($snap_ap[$ii], 'isPrePosted', '1'))) {
         $snap_isAutoPosted = get_post_meta($postID, 'snap_isAutoPosted', true);
         if ($snap_isAutoPosted != '2') {
             sleep(5);
             nxs_addToLogN('W', 'Notice', $logNT, '-=Duplicate=- Post ID:' . $postID, 'Already posted. No reason for posting duplicate' . ' |' . $uqID);
             return;
         }
     }
     if ($postID == '0') {
         echo "Testing ... <br/><br/>";
         $urlToGo = home_url();
         $options['wpMsgTFormat'] = 'Test Link from ' . $urlToGo;
         $options['wpMsgFormat'] = 'Test post please ignore';
     } else {
         $post = get_post($postID);
         if (!$post) {
             return;
         }
         $link = get_permalink($postID);
         $options['wpMsgFormat'] = nsFormatMessage($options['wpMsgFormat'], $postID);
         $options['wpMsgTFormat'] = nsFormatMessage($options['wpMsgTFormat'], $postID);
         //## 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;
         }
         nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPrePosted' => '1'));
     }
     $t = wp_get_post_tags($postID);
     $tggs = array();
     foreach ($t as $tagA) {
         $tggs[] = $tagA->name;
     }
     $tags = implode(',', $tggs);
     $postCats = wp_get_post_categories($postID);
     $cats = array();
     foreach ($postCats as $c) {
         $cat = get_category($c);
         $cats[] = str_ireplace('&', '&amp;', $cat->name);
     }
     // $cats = implode(',',$catsA);
     $extInfo = ' | PostID: ' . $postID . " - " . (!empty($post) && is_object($post) ? $post->post_title : '');
     //## Message & Format
     if (trim($options['imgToUse']) != '') {
         $imgURL = $options['imgToUse'];
     } else {
         $imgURL = nxs_getPostImage($postID, 'full');
     }
     $message = array('siteName' => $blogTitle, 'url' => $urlToGo, 'imageURL' => $imgURL, 'tags' => $tags, 'cats' => $cats, 'authorName' => '', 'orID' => $postID);
     //## Actual Post
     $ntToPost = new nxs_class_SNAP_WP();
     $ret = $ntToPost->doPostToNT($options, $message);
     //## Process Results
     if (!is_array($ret) || $ret['isPosted'] != '1') {
         //## Error
         if ($postID == '0') {
//.........这里部分代码省略.........
开发者ID:Florian-Eschenbacher,项目名称:schneeeule,代码行数:101,代码来源:wp.php

示例13: nxs_do_post_from_query

function nxs_do_post_from_query()
{
    nxs_cron_check();
    // nxs_addToLogN('A', 'Debug info only. - Cron Time', 'X', '', $extInfo);
    if (stripos($_SERVER["REQUEST_URI"], 'wp-cron.php') !== false) {
        nxs_rePoster();
    }
    //## Run Reposter.
    $options = get_option('NS_SNAutoPoster');
    $quPosts = maybe_unserialize(get_option('NSX_PostsQuery'));
    if (!is_array($quPosts)) {
        $quPosts = array();
    }
    if ($options['quLimit'] != '1' || count($quPosts) < 1) {
        return;
    }
    $currTime = time() + get_option('gmt_offset') * HOUR_IN_SECONDS;
    $hasChanged = false;
    $postToPost = array_shift($quPosts);
    $pstEvrySec = $options['quDays'] * 86400 + $options['quHrs'] * 3600 + $options['quMins'] * 60;
    $rndSec = $options['quLimitRndMins'] * 60;
    $nxTime = !empty($options['quNxTime']) ? $options['quNxTime'] : $currTime + $pstEvrySec;
    $extInfo = 'Query Time:' . date_i18n('Y-m-d H:i:s', $options['quNxTime']) . "|Previous Time:" . date_i18n('Y-m-d H:i:s', $options['quLastShTime']);
    if (empty($options['quNxTime']) || $nxTime < $currTime) {
        $hasChanged = true;
    }
    // Do Post
    if ($hasChanged) {
        //## Do Post
        nxs_addToLogN('A', '**POST STARTED** NXSPoster - WP CRON - Post from Query - Post ID: ' . $postToPost, '', 'Curr Time: ' . date_i18n('Y-m-d H:i:s', $currTime) . '~', $extInfo);
        $options['quLastShTime'] = $currTime;
        $rndTime = rand(0 - $rndSec, $rndSec);
        $options['quNxTime'] = $currTime + $pstEvrySec + $rndTime;
        if ($options['nxsOverLimit'] == 'D') {
            $dateC = date("d");
            $dayN = date("d", $nxTime);
            if ($dayN != $dateC) {
                $quPosts = array();
            }
        }
        update_option('NSX_PostsQuery', $quPosts);
        update_option('NS_SNAutoPoster', $options);
        nxs_snapPublishTo($postToPost, '', true);
        nxs_addToLogN('A', '**POST FINISHED** NXSPoster - WP CRON - Post from Query - Post ID: ' . $postToPost, '', '-=Time=- ' . $currTime, $extInfo);
    }
}
开发者ID:acruxray,项目名称:social-networks-auto-poster-facebook-twitter-g,代码行数:46,代码来源:nxs_functions.php

示例14: nxs_doPublishToWP

 function nxs_doPublishToWP($postID, $options)
 {
     $ntCd = 'WP';
     $ntCdL = 'wp';
     $ntNm = 'WP Based Blog';
     //if (isset($options['timeToRun'])) wp_unschedule_event( $options['timeToRun'], 'nxs_doPublishToWP',  array($postID, $options));
     $ii = $options['ii'];
     if (!isset($options['pType'])) {
         $options['pType'] = 'im';
     }
     if ($options['pType'] == 'sh') {
         sleep(rand(1, 10));
     }
     $logNT = '<span style="color:#1A9EE6">WP</span> - ' . $options['nName'];
     $snap_ap = get_post_meta($postID, 'snap' . $ntCd, true);
     $snap_ap = maybe_unserialize($snap_ap);
     if ($options['pType'] != 'aj' && is_array($snap_ap) && (nxs_chArrVar($snap_ap[$ii], 'isPosted', '1') || nxs_chArrVar($snap_ap[$ii], 'isPrePosted', '1'))) {
         $snap_isAutoPosted = get_post_meta($postID, 'snap_isAutoPosted', true);
         if ($snap_isAutoPosted != '2') {
             sleep(5);
             nxs_addToLogN('W', 'Notice', $logNT, '-=Duplicate=- Post ID:' . $postID, 'Already posted. No reason for posting duplicate' . ' |' . $uqID);
             return;
         }
     }
     $imgURL = nxs_getPostImage($postID);
     $email = $options['wpUName'];
     $pass = substr($options['wpPass'], 0, 5) == 'n5g9a' ? nsx_doDecode(substr($options['wpPass'], 5)) : $options['wpPass'];
     if ($postID == '0') {
         echo "Testing ... <br/><br/>";
         $link = home_url();
         $msgT = 'Test Link from ' . $link;
         $msg = 'Test post please ignore';
     } else {
         $post = get_post($postID);
         if (!$post) {
             return;
         }
         $link = get_permalink($postID);
         $msgFormat = $options['wpMsgFormat'];
         $msg = nsFormatMessage($msgFormat, $postID);
         $msgTFormat = $options['wpMsgTFormat'];
         $msgT = nsFormatMessage($msgTFormat, $postID);
         nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPrePosted' => '1'));
     }
     $dusername = $options['wpUName'];
     $link = urlencode($link);
     $desc = urlencode(substr($msgT, 0, 250));
     $ext = urlencode(substr($msg, 0, 1000));
     $t = wp_get_post_tags($postID);
     $tggs = array();
     foreach ($t as $tagA) {
         $tggs[] = $tagA->name;
     }
     $tags = implode(',', $tggs);
     $postCats = wp_get_post_categories($postID);
     $cats = array();
     foreach ($postCats as $c) {
         $cat = get_category($c);
         $cats[] = str_ireplace('&', '&amp;', $cat->name);
     }
     // $cats = implode(',',$catsA);
     //## Post
     require_once 'apis/xmlrpc-client.php';
     $nxsToWPclient = new NXS_XMLRPC_Client($options['wpURL']);
     $nxsToWPclient->debug = false;
     if ($imgURL !== '' && stripos($imgURL, 'http') !== false) {
         // $handle = fopen($imgURL, "rb"); $filedata = ''; while (!feof($handle)) {$filedata .= fread($handle, 8192);} fclose($handle);
         $filedata = wp_remote_get($imgURL);
         if (!is_wp_error($filedata)) {
             $filedata = $filedata['body'];
         }
         // echo "AWC?";
         $data = array('name' => 'image-' . $postID . '.jpg', 'type' => 'image/jpg', 'bits' => new NXS_XMLRPC_Base64($filedata), true);
         $status = $nxsToWPclient->query('metaWeblog.newMediaObject', $postID, $options['wpUName'], $pass, $data);
         $imgResp = $nxsToWPclient->getResponse();
         $gid = $imgResp['id'];
     } else {
         $gid = '';
     }
     $params = array(0, $options['wpUName'], $pass, array('software_version'));
     if (!$nxsToWPclient->query('wp.getOptions', $params)) {
         $ret = 'Something went wrong - ' . $nxsToWPclient->getErrorCode() . ' : ' . $nxsToWPclient->getErrorMessage();
     } else {
         $ret = 'OK';
     }
     $rwpOpt = $nxsToWPclient->getResponse();
     $rwpOpt = $rwpOpt['software_version']['value'];
     $rwpOpt = floatval($rwpOpt);
     //prr($rwpOpt);prr($nxsToWPclient);
     $extInfo = ' | PostID: ' . $postID . " - " . $post->post_title;
     if ($rwpOpt == 0) {
         $errMsg = $nxsToWPclient->getErrorMessage();
         if ($errMsg != '') {
             $ret = $errMsg;
         } else {
             $ret = 'XMLRPC is not found or not active. WP admin - Settings - Writing - Enable XML-RPC';
         }
     } else {
         if ($rwpOpt < 3.0) {
             $ret = 'XMLRPC is too OLD - ' . $rwpOpt . ' You need at least 3.0';
//.........这里部分代码省略.........
开发者ID:JalpMi,项目名称:v2contact,代码行数:101,代码来源:wp.php

示例15: nxs_doNewNPPost

 function nxs_doNewNPPost($options)
 {
     global $nxs_snapAvNts, $nxs_plurl;
     $postResults = '';
     if (!empty($_POST['mNts']) && is_array($_POST['mNts'])) {
         nxs_addToLogN('S', '-=== New Form Post requested ===-', 'Form', count($_POST['mNts']) . ' Networks', print_r($_POST['mNts'], true));
         $message = array('title' => '', 'text' => '', 'siteName' => '', 'url' => '', 'imageURL' => '', 'videoURL' => '', 'tags' => '', 'urlDescr' => '', 'urlTitle' => '');
         if (get_magic_quotes_gpc() || $_POST['nxs_mqTest'] == "\\'") {
             $_POST['mText'] = stripslashes($_POST['mText']);
             $_POST['mTitle'] = stripslashes($_POST['mTitle']);
         }
         $message['pText'] = $_POST['mText'];
         $message['pTitle'] = $_POST['mTitle'];
         //## Get URL info
         if (!empty($_POST['mLink']) && substr($_POST['mLink'], 0, 4) == 'http') {
             $message['url'] = $_POST['mLink'];
             $flds = array('id' => $message['url'], 'scrape' => 'true');
             $response = wp_remote_post('https://graph.facebook.com/v2.3/', array('body' => $flds));
             if (is_wp_error($response)) {
                 $badOut['Error'] = print_r($response, true) . " - ERROR";
             } else {
                 $response = json_decode($response['body'], true);
                 if (!empty($response['description'])) {
                     $message['urlDescr'] = $response['description'];
                 }
                 if (!empty($response['title'])) {
                     $message['urlTitle'] = $response['title'];
                 }
                 if (!empty($response['site_name'])) {
                     $message['siteName'] = $response['site_name'];
                 }
                 if (!empty($response['image'][0]['url'])) {
                     $message['imageURL'] = $response['image'][0]['url'];
                 }
             }
         }
         if (!empty($_POST['mImg']) && substr($_POST['mImg'], 0, 4) == 'http') {
             $message['imageURL'] = $_POST['mImg'];
         }
         foreach ($_POST['mNts'] as $ntC) {
             $ntA = explode('--', $ntC);
             $ntOpts = $options[$ntA[0]][$ntA[1]];
             if (!empty($ntOpts) && is_array($ntOpts)) {
                 $logNT = $ntA[0];
                 $clName = 'nxs_class_SNAP_' . strtoupper($logNT);
                 $logNT = '<span style="color:#800000">' . strtoupper($logNT) . '</span> - ' . $ntOpts['nName'];
                 $ntOpts['postType'] = $_POST['mType'];
                 $ntToPost = new $clName();
                 $ret = $ntToPost->doPostToNT($ntOpts, $message);
                 if (!is_array($ret) || $ret['isPosted'] != '1') {
                     //## Error
                     nxs_addToLogN('E', 'Error', $logNT, '-=ERROR=- ' . print_r($ret, true), '');
                     $postResults .= $logNT . " - Error (Please see log)<br/>";
                 } else {
                     // ## All Good - log it.
                     if (!empty($ret['postURL'])) {
                         $extInfo = '<a href="' . $ret['postURL'] . '" target="_blank">Post Link</a>';
                     }
                     nxs_addToLogN('S', 'Posted', $logNT, 'OK - Message Posted ', $extInfo);
                     $postResults .= $logNT . " - OK - " . $extInfo . "<br/>";
                 }
             }
         }
         echo "Done. Results:<br/> " . $postResults;
     }
 }
开发者ID:digideskio,项目名称:stammtisch,代码行数:66,代码来源:NextScripts_SNAP.php


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