本文整理汇总了PHP中prr函数的典型用法代码示例。如果您正苦于以下问题:PHP prr函数的具体用法?PHP prr怎么用?PHP prr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了prr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: connect
function connect($u,$p){ $badOut = 'Error: '; // $this->debug = true;
//## Check if alrady IN
if (!$this->check($u)){ if ($this->debug) echo "[PN] NO Saved Data; Logging in...<br/>\r\n";
$hdrsArr = $this->headers('https://www.pinterest.com/login/'); $rep = nxs_remote_get('https://www.pinterest.com/login/', array('headers' => $hdrsArr, 'timeout' => 45, 'httpversion' => '1.1'));
if (is_nxs_error($rep)) { $badOut = print_r($rep, true)." - ERROR -01-"; return $badOut; } $ck = $rep['cookies']; $contents = $rep['body']; prr($contents); $apVer = trim(CutFromTo($contents,'"app_version": "', '"'));
$fldsTxt = 'data=%7B%22options%22%3A%7B%22username_or_email%22%3A%22'.urlencode($u).'%22%2C%22password%22%3A%22'.str_replace('%5C','%5C%5C',urlencode($p)).'%22%7D%2C%22context%22%3A%7B%22app_version%22%3A%22'.$apVer.
'%22%7D%7D&source_url=%2Flogin%2F&module_path=App()%3ELoginPage()%3ELogin()%3EButton(class_name%3Dprimary%2C+text%3DLog+in%2C+type%3Dsubmit%2C+tagName%3Dbutton%2C+size%3Dlarge)';
foreach ($ck as $c) if ($c->name=='csrftoken') $xftkn = $c->value;
//## ACTUAL LOGIN
$hdrsArr = $this->headers('https://www.pinterest.com/login/', 'https://www.pinterest.com', 'POST', true); $hdrsArr['X-NEW-APP']='1'; $hdrsArr['X-APP-VERSION']=$apVer; $hdrsArr['X-CSRFToken']=$xftkn;
$advSet = array('headers' => $hdrsArr, 'httpversion' => '1.1', 'timeout' => 45, 'redirection' => 0, 'cookies' => $ck, 'body' => $fldsTxt); // prr($advSet);
$rep = nxs_remote_post('https://www.pinterest.com/resource/UserSessionResource/create/', $advSet); if (is_nxs_error($rep)) { $badOut = print_r($rep, true)." - ERROR -02-"; return $badOut; }
if (!empty($rep['body'])) { $contents = $rep['body']; $resp = json_decode($contents, true); } else { $badOut = print_r($rep, true)." - ERROR -03-"; return $badOut; }
if (is_array($resp) && empty($resp['resource_response']['error'])) { $ck = $rep['cookies']; foreach ($ck as $ci=>$cc) $ck[$ci]->value = str_replace(' ','+', $cc->value);
$hdrsArr = $this->headers('https://www.pinterest.com/login'); $rep=nxs_remote_get('https://www.pinterest.com/', array('headers' => $hdrsArr, 'timeout' => 45, 'redirection' => 0, 'cookies' => $ck, 'httpversion' => '1.1')); if (is_nxs_error($rep)) { $badOut = print_r($rep, true)." - ERROR -02.1-"; return $badOut; }
if (!empty($rep['cookies'])) foreach ($rep['cookies'] as $ccN) { $fdn = false; foreach ($ck as $ci=>$cc) if ($ccN->name == $cc->name) { $fdn = true; $ck[$ci] = $ccN; } if (!$fdn) $ck[] = $ccN; }
foreach ($ck as $ci=>$cc) $ck[$ci]->value = str_replace(' ','+', $cc->value); $this->tk = $xftkn; $this->ck = $ck; $this->apVer = $apVer;
if ($this->debug) echo "[PN] You are IN;<br/>\r\n"; return false; // echo "You are IN";
} elseif (is_array($resp) && isset($resp['resource_response']['error'])) return "ERROR -04-: ".$resp['resource_response']['error']['http_status']." | ".$resp['resource_response']['error']['message'];
elseif (stripos($contents, 'CSRF verification failed')!==false) { $retText = trim(str_replace(array("\r\n", "\r", "\n"), " | ", strip_tags(CutFromTo($contents, '</head>', '</body>'))));
return "CSRF verification failed - Please contact NextScripts Support | Pinterest Message:".$retText;
} elseif (stripos($contents, 'IP because of suspicious activity')!==false) return 'Pinterest blocked logins from this IP because of suspicious activity';
elseif (stripos($contents, 've detected a bot!')!==false) return 'Pinterest has your IP ('.CutFromTo($contents, 'ess: <b>','<').') blocked. Please <a target="_blank" class="link" href="//help.pinterest.com/entries/22914692">Contact Pinterest</a> and ask them to unblock your IP. ';
elseif (stripos($contents, 'bot running on your network')!==false) return 'Pinterest has your IP ('.CutFromTo($contents, 'Your IP is:','<').') blocked. Please <a target="_blank" class="link" href="//help.pinterest.com/entries/22914692">Contact Pinterest</a> and ask them to unblock your IP. ';
else return 'Pinterest login failed. Unknown Error. Please contact support.';
return 'Pinterest login failed. Unknown Error #2. Please contact support.';
} else { if ($this->debug) echo "[PN] Saved Data is OK;<br/>\r\n"; return false; }
}
示例2: doPostToNT
function doPostToNT($options, $message)
{
$badOut = array('pgID' => '', 'isPosted' => 0, 'pDate' => date('Y-m-d H:i:s'), 'Error' => '');
//## Check settings
if (!is_array($options)) {
$badOut['Error'] = 'No Options';
return $badOut;
}
if (!isset($options['ljUName']) || trim($options['ljPass']) == '') {
$badOut['Error'] = 'Not Configured';
return $badOut;
}
$pass = substr($options['ljPass'], 0, 5) == 'n5g9a' ? nsx_doDecode(substr($options['ljPass'], 5)) : $options['ljPass'];
//## Format
if (!empty($message['pText'])) {
$msg = $message['pText'];
} else {
$msg = nxs_doFormatMsg($options['ljMsgFormat'], $message);
}
if (!empty($message['pTitle'])) {
$msgT = $message['pTitle'];
} else {
$msgT = nxs_doFormatMsg($options['ljMsgTFormat'], $message);
}
require_once 'apis/xmlrpc-client.php';
if (!empty($options['ljSrv']) && $options['ljSrv'] == 'DW') {
$server = 'dreamwidth.org';
} else {
$server = 'livejournal.com';
}
$nxsToLJclient = new NXS_XMLRPC_Client('http://www.' . $server . '/interface/xmlrpc');
$nxsToLJclient->debug = false;
$date = time();
$year = date("Y", $date);
$mon = date("m", $date);
$day = date("d", $date);
$hour = date("G", $date);
$min = date("i", $date);
$nxsToLJContent = array("username" => $options['ljUName'], "password" => $pass, "event" => $msg, "subject" => $msgT, "lineendings" => "unix", "year" => $year, "mon" => $mon, "day" => $day, "hour" => $hour, "min" => $min, "ver" => 2);
if (!empty($options['commID']) && $options['commID'] != '') {
$nxsToLJContent["usejournal"] = $options['commID'];
}
if (!empty($options['inclTags']) && $options['inclTags'] == '1' && !empty($message['tags'])) {
$nxsToLJContent['props'] = array('taglist' => $message['tags']);
}
// prr($nxsToLJContent);
if (!$nxsToLJclient->query('LJ.XMLRPC.postevent', $nxsToLJContent)) {
prr($nxsToLJclient);
$ret = 'Something went wrong - ' . $nxsToLJclient->getErrorCode() . ' : ' . $nxsToLJclient->getErrorMessage();
} else {
$ret = 'OK';
}
$pid = $nxsToLJclient->getResponse();
if (is_array($pid) && !empty($pid['url'])) {
return array('postID' => $pid['url'], 'isPosted' => 1, 'postURL' => $pid['url'], 'pDate' => date('Y-m-d H:i:s'));
} else {
$badOut['Error'] .= 'Something went wrong - NO PID ' . print_r($pid, true);
}
return $badOut;
}
示例3: postShare
function postShare($tkn, $msg, $title = '', $url = '', $imgURL = '', $dsc = '')
{
$nURL = 'https://api.linkedin.com/v1/people/~/shares?format=json&oauth2_access_token=' . $tkn;
$dsc = nxs_decodeEntitiesFull(strip_tags($dsc));
$msg = strip_tags(nxs_decodeEntitiesFull($msg));
$title = nxs_decodeEntitiesFull(strip_tags($title));
$xml = '<?xml version="1.0" encoding="UTF-8"?><share><comment>' . htmlspecialchars($msg, ENT_NOQUOTES, "UTF-8") . '</comment>' . ($url != '' ? '<content><title>' . htmlspecialchars($title, ENT_NOQUOTES, "UTF-8") . '</title><submitted-url>' . $url . '</submitted-url>' . (!empty($imgURL) ? '<submitted-image-url>' . $imgURL . '</submitted-image-url>' : '') . '<description>' . htmlspecialchars($dsc, ENT_NOQUOTES, "UTF-8") . '</description></content>' : '') . '<visibility><code>anyone</code></visibility></share>';
$hdrsArr = array();
$hdrsArr['Content-Type'] = 'application/xml';
prr($xml);
$wprg = array('method' => 'POST', 'headers' => $hdrsArr, 'httpversion' => '1.1', 'timeout' => 45, 'redirection' => 0, 'body' => $xml);
$wprg['sslverify'] = false;
$response = wp_remote_post($nURL, $wprg);
if (is_wp_error($response) || empty($response['body'])) {
return "ERROR: " . print_r($response, true);
}
$post = json_decode($response['body'], true);
return $post;
}
示例4: showGenNTSettings
function showGenNTSettings($ntOpts)
{
global $nxs_snapSetPgURL, $nxs_plurl, $nxs_gOptions;
$ntInfo = $this->ntInfo;
if (isset($_GET['auth']) && $_GET['auth'] == 'tr') {
require_once 'apis/trOAuth.php';
$options = $ntOpts[$_GET['acc']];
$consumer_key = $options['trConsKey'];
$consumer_secret = $options['trConsSec'];
$callback_url = $nxs_snapSetPgURL . "&auth=tra&acc=" . $_GET['acc'];
$tum_oauth = new TumblrOAuth($consumer_key, $consumer_secret);
prr($tum_oauth);
$request_token = $tum_oauth->getRequestToken($callback_url);
echo "####";
prr($request_token);
$options['trOAuthToken'] = $request_token['oauth_token'];
$options['trOAuthTokenSecret'] = $request_token['oauth_token_secret'];
// prr($tum_oauth ); die();
switch ($tum_oauth->http_code) {
case 200:
$url = $tum_oauth->getAuthorizeURL($options['trOAuthToken']);
if (function_exists('get_option')) {
$nxs_gOptions = get_option('NS_SNAutoPoster');
}
if (!empty($nxs_gOptions)) {
$nxs_gOptions['tr'][$_GET['acc']] = $options;
nxs_settings_save($nxs_gOptions);
}
echo '<script type="text/javascript">window.location = "' . $url . '"</script>';
break;
default:
echo '<br/><b style="color:red">Could not connect to Tumblr. Refresh the page or try again later.</b>';
die;
}
die;
}
if (isset($_GET['auth']) && $_GET['auth'] == 'tra') {
require_once 'apis/trOAuth.php';
$options = $ntOpts[$_GET['acc']];
prr($options);
$consumer_key = $options['trConsKey'];
$consumer_secret = $options['trConsSec'];
$tum_oauth = new TumblrOAuth($consumer_key, $consumer_secret, $options['trOAuthToken'], $options['trOAuthTokenSecret']);
$options['trAccessTocken'] = $tum_oauth->getAccessToken($_REQUEST['oauth_verifier']);
// prr($_GET); prr($_REQUEST); prr($options['trAccessTocken']);
$tum_oauth = new TumblrOAuth($consumer_key, $consumer_secret, $options['trAccessTocken']['oauth_token'], $options['trAccessTocken']['oauth_token_secret']);
if (function_exists('get_option')) {
$nxs_gOptions = get_option('NS_SNAutoPoster');
}
if (!empty($nxs_gOptions)) {
$nxs_gOptions['tr'][$_GET['acc']] = $options;
nxs_settings_save($nxs_gOptions);
}
$userinfo = $tum_oauth->get('http://api.tumblr.com/v2/user/info');
prr($userinfo);
prr($tum_oauth);
// prr($url); die();
if (is_array($userinfo->response->user->blogs)) {
foreach ($userinfo->response->user->blogs as $blog) {
if (stripos($blog->url, $options['trPgID']) !== false) {
$gGet = $_GET;
unset($gGet['auth']);
unset($gGet['acc']);
unset($gGet['oauth_token']);
unset($gGet['oauth_verifier']);
unset($gGet['post_type']);
$sturl = explode('?', $nxs_snapSetPgURL);
$nxs_snapSetPgURL = $sturl[0] . (!empty($gGet) ? '?' . http_build_query($gGet) : '');
echo '<script type="text/javascript">window.location = "' . $nxs_snapSetPgURL . '"</script>';
die;
}
}
prr($userinfo);
die("<span style='color:red;'>ERROR: Authorized USER don't have access to the specified blog: <span style='color:darkred; font-weight: bold;'>" . $options['trPgID'] . "</span></span>");
}
}
?>
<div class="nxs_box">
<div class="nxs_box_header">
<div class="nsx_iconedTitle" style="margin-bottom:1px;background-image:url(<?php
echo $nxs_plurl;
?>
img/<?php
echo $ntInfo['lcode'];
?>
16.png);"><?php
echo $ntInfo['name'];
?>
<?php
$cbo = count($ntOpts);
?>
<?php
if ($cbo > 1) {
?>
<div class="nsBigText"><?php
echo "(" . ($cbo == '0' ? 'No' : $cbo) . " ";
_e('accounts', 'nxs_snap');
echo ")";
//.........这里部分代码省略.........
示例5: showGenNTSettings
function showGenNTSettings($ntOpts)
{
global $nxs_snapSetPgURL, $nxs_plurl, $nxs_gOptions;
$ntInfo = $this->ntInfo;
// V2 Auth
if (isset($_GET['code']) && $_GET['code'] != '' && isset($_GET['state']) && substr($_GET['state'], 0, 7) == 'nxs-bg-') {
$at = $_GET['code'];
$ii = str_replace('nxs-bg-', '', $_GET['state']);
echo "----=={ oAuth 2.0 Wordflow }==----<br/>-= This is normal technical authorization info that will dissapear (Unless you get some errors) =- <br/><br/><br/>";
$gGet = $_GET;
unset($gGet['code']);
unset($gGet['state']);
unset($gGet['post_type']);
$sturl = explode('?', $nxs_snapSetPgURL);
$nxs_snapSetPgURL = $sturl[0] . (!empty($gGet) ? '?' . http_build_query($gGet) : '');
$nto = $ntOpts[$ii];
$wprg = array();
$wprg['sslverify'] = false;
if (isset($nto['APIKey'])) {
echo "-=";
prr($nto);
// die();
$tknURL = 'https://www.googleapis.com/oauth2/v3/token?code=' . $at . '&redirect_uri=' . urlencode($nxs_snapSetPgURL) . '&scope=&client_id=' . $nto['APIKey'] . '&client_secret=' . $nto['APISec'] . '&grant_type=authorization_code';
$response = wp_remote_post($tknURL, $wprg);
prr($tknURL);
if (is_object($response) && isset($response->errors)) {
prr($response);
die;
}
if (is_array($response) && stripos($response['body'], '"error":') !== false) {
prr($response['body']);
prr(json_decode($response['body'], true));
die;
}
$resp = json_decode($response['body'], true);
prr($resp);
if (!is_array($resp) || empty($resp['access_token'])) {
prr($resp);
die;
}
if (function_exists('get_option')) {
$currTime = time() + get_option('gmt_offset') * HOUR_IN_SECONDS;
} else {
$currTime = time();
}
$nto['AccessToken'] = $resp['access_token'];
$nto['AccessTokenSecret'] = 'No Need for oAuth V2';
$nto['OAuthVerifier'] = 'No Need for oAuth V2';
$nto['AccessTokenExp'] = $currTime + $resp['expires_in'];
$nto['RefreshToken'] = $resp['refresh_token'];
echo "<br/>----=={ Expires: " . date('Y-m-d H:i:s', $nto['AccessTokenExp']) . " }==---- <br/>";
if (!empty($nto['bgBlogID'])) {
if (substr($nto['bgBlogID'], 0, 4) == 'http') {
$tknURL = 'https://www.googleapis.com/blogger/v3/blogs/byurl/?url=' . $nto['bgBlogID'] . '?access_token=' . $nto['AccessToken'];
} else {
$tknURL = 'https://www.googleapis.com/blogger/v3/blogs/' . $nto['bgBlogID'] . '?access_token=' . $nto['AccessToken'];
}
}
$response = wp_remote_get($tknURL, $wprg);
prr($tknURL);
prr($response);
$user = json_decode($response['body'], true);
prr($user);
if (!empty($user['url'])) {
$nto['blogURL'] = $user['url'];
$nto['bgBlogID'] = $user['id'];
$nto['blogInfo'] = $user['name'] . " [" . $user['id'] . "] (" . $user['url'] . ")";
if (function_exists('get_option')) {
$nxs_gOptions = get_option('NS_SNAutoPoster');
}
if (!empty($nxs_gOptions)) {
$nxs_gOptions['bg'][$ii] = $nto;
prr($nto);
nxs_settings_save($nxs_gOptions);
}
?>
<script type="text/javascript">window.location = "<?php
echo $nxs_snapSetPgURL;
?>
"</script>
<?php
}
}
die;
}
?>
<div class="nxs_box">
<div class="nxs_box_header">
<div class="nsx_iconedTitle" style="margin-bottom:1px;background-image:url(<?php
echo $nxs_plurl;
?>
img/<?php
echo $ntInfo['lcode'];
?>
16.png);"><?php
echo $ntInfo['name'];
?>
<?php
$cbo = count($ntOpts);
//.........这里部分代码省略.........
示例6: showGenNTSettings
function showGenNTSettings($ntOpts)
{
global $nxs_plurl, $nxs_snapSetPgURL, $nxs_gOptions;
$ntInfo = $this->ntInfo;
if (isset($_GET['auth']) && $_GET['auth'] == $ntInfo['lcode']) {
require_once 'apis/scOAuth.php';
$options = $ntOpts[$_GET['acc']];
$consumer_key = $options['appKey'];
$consumer_secret = $options['appSec'];
$callback_url = $nxs_snapSetPgURL . "&auth=" . $ntInfo['lcode'] . "a&acc=" . $_GET['acc'];
$tum_oauth = new wpScoopITOAuth($consumer_key, $consumer_secret);
$tum_oauth->baseURL = 'https://www.flickr.com/services';
$tum_oauth->request_token_path = '/oauth/request_token';
$tum_oauth->access_token_path = '/oauth/access_token';
$request_token = $tum_oauth->getReqToken($callback_url);
$options['oAuthToken'] = $request_token['oauth_token'];
$options['oAuthTokenSecret'] = $request_token['oauth_token_secret'];
switch ($tum_oauth->http_code) {
case 200:
$url = 'https://www.flickr.com/services/oauth/authorize?oauth_token=' . $options['oAuthToken'];
if (function_exists('get_option')) {
$nxs_gOptions = get_option('NS_SNAutoPoster');
}
if (!empty($nxs_gOptions)) {
$nxs_gOptions[$ntInfo['lcode']][$_GET['acc']] = $options;
nxs_settings_save($nxs_gOptions);
}
echo '<br/><br/>All good?! Redirecting ..... <script type="text/javascript">window.location = "' . $url . '"</script>';
break;
default:
echo '<br/><b style="color:red">Could not connect to Flickr. Refresh the page or try again later.</b>';
die;
}
die;
}
if (isset($_GET['auth']) && $_GET['auth'] == $ntInfo['lcode'] . 'a') {
require_once 'apis/scOAuth.php';
$options = $ntOpts[$_GET['acc']];
$consumer_key = $options['appKey'];
$consumer_secret = $options['appSec'];
$tum_oauth = new wpScoopITOAuth($consumer_key, $consumer_secret, $options['oAuthToken'], $options['oAuthTokenSecret']);
//prr($tum_oauth);
$tum_oauth->baseURL = 'https://www.flickr.com/services';
$tum_oauth->request_token_path = '/oauth/request_token';
$tum_oauth->access_token_path = '/oauth/access_token';
$access_token = $tum_oauth->getAccToken($_GET['oauth_verifier']);
prr($access_token);
$options['accessToken'] = $access_token['oauth_token'];
$options['accessTokenSec'] = $access_token['oauth_token_secret'];
if (function_exists('get_option')) {
$nxs_gOptions = get_option('NS_SNAutoPoster');
}
if (!empty($nxs_gOptions)) {
$nxs_gOptions[$ntInfo['lcode']][$_GET['acc']] = $options;
nxs_settings_save($nxs_gOptions);
}
$tum_oauth = new wpScoopITOAuth($consumer_key, $consumer_secret, $options['accessToken'], $options['accessTokenSec']);
echo "OK. Let's Get Profile: ";
prr($access_token);
$params = array('format' => 'php_serial', 'method' => 'flickr.urls.getUserProfile');
$uinfo = $tum_oauth->makeReq('https://api.flickr.com/services/rest/', $params);
// prr($uinfo);die();
if (is_array($uinfo) && isset($uinfo['user'])) {
$options['appAppUserName'] = $access_token['username'] . "(" . urldecode($access_token['fullname']) . ")";
$options['appAppUserID'] = urldecode($uinfo['user']['nsid']);
$options['userURL'] = urldecode($uinfo['user']['url']);
if (function_exists('get_option')) {
$nxs_gOptions = get_option('NS_SNAutoPoster');
}
if (!empty($nxs_gOptions)) {
$nxs_gOptions[$ntInfo['lcode']][$_GET['acc']] = $options;
nxs_settings_save($nxs_gOptions);
}
}
//die();
if (!empty($options['appAppUserID'])) {
$gGet = $_GET;
unset($gGet['auth']);
unset($gGet['acc']);
unset($gGet['oauth_token']);
unset($gGet['oauth_verifier']);
unset($gGet['post_type']);
$sturl = explode('?', $nxs_snapSetPgURL);
$nxs_snapSetPgURL = $sturl[0] . (!empty($gGet) ? '?' . http_build_query($gGet) : '');
echo '<br/><br/>All good?! Redirecting ..... <script type="text/javascript">window.location = "' . $nxs_snapSetPgURL . '"</script>';
break;
die;
} else {
die("<span style='color:red;'>ERROR: Authorization Error: <span style='color:darkred; font-weight: bold;'>" . print_r($uinfo, true) . "</span></span>");
}
}
?>
<div class="nxs_box">
<div class="nxs_box_header">
<div class="nsx_iconedTitle" style="margin-bottom:1px;background-image:url(<?php
echo $nxs_plurl;
?>
img/<?php
echo $ntInfo['lcode'];
?>
//.........这里部分代码省略.........
示例7: httpRequest
function httpRequest($url, $auth_header, $method, $body = NULL)
{
// $this->debug = true; //if (!is_array($auth_header)) $auth_header = array($auth_header);
if (!is_array($auth_header)) {
$auth_header = array($auth_header);
}
if (!$method) {
$method = "GET";
}
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_HTTPHEADER, $auth_header);
// Set the headers.
if ($body) {
$auth_header[] = "Content-Type: text/xml;charset=utf-8";
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $body);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($curl, CURLOPT_HTTPHEADER, $auth_header);
}
global $nxs_skipSSLCheck;
if ($nxs_skipSSLCheck === true) {
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
}
$data = curl_exec($curl);
$errmsg = curl_error($curl);
//prr($data);// die();
//## NextScripts Fix
if (curl_errno($curl) == 60 || stripos($errmsg, 'SSL') !== false) {
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
$data = curl_exec($curl);
}
if (curl_errno($curl) > 0) {
$err = curl_errno($curl);
$errmsg = curl_error($curl);
prr($errmsg);
prr($err);
}
//## /NextScripts Fix
$header = curl_getinfo($curl);
curl_close($curl);
// prr($header);
if ($this->debug) {
echo $data . "\n";
}
if (trim($data) == '' && ($header['http_code'] == '201' || $header['http_code'] == '200' || $header['http_code'] == '202')) {
$data = '201';
}
return $data;
}
示例8: getCurlPageMC
function getCurlPageMC($ch, $ref = '', $ctOnly = false, $fields = '', $dbg = false, $advSettings = '') {
$ccURL = curl_getinfo ( $ch, CURLINFO_EFFECTIVE_URL );
if ($dbg)
echo '<br/><b style="font-size:16px;color:green;">#### START CURL:' . $ccURL . '</b><br/>';
static $curl_loops = 0;
static $curl_max_loops = 20;
global $nxs_gCookiesArr;
$cookies = cookArrToStr ( $nxs_gCookiesArr );
if ($dbg) {
echo '<br/><b style="color:#005800;">## Request Cookies:</b><br/>';
prr ( $cookies );
}
if ($curl_loops ++ >= $curl_max_loops) {
$curl_loops = 0;
return false;
}
$headers = array ();
$headers [] = 'Accept: text/html, application/xhtml+xml, */*';
$headers [] = 'Cache-Control: no-cache';
$headers [] = 'Connection: Keep-Alive';
$headers [] = 'Accept-Language: en-us'; // $headers[] = 'Accept-Encoding:
// gzip, deflate';
if ($fields != '') {
if ((stripos ( $ccURL, 'http://www.blogger.com/blogger_rpc' ) !== false))
$headers [] = 'Content-Type: application/json; charset=utf-8';
else
$headers [] = 'Content-Type: application/x-www-form-urlencoded;charset=utf-8';
}
if (stripos ( $ccURL, 'http://www.blogger.com/blogger_rpc' ) !== false) {
$headers [] = 'X-GWT-Permutation: 767A98E1C0A5F1D22D727BB9E37360B2';
$headers [] = 'X-GWT-Module-Base: http://www.blogger.com/static/v1/gwt/';
}
if (isset ( $advSettings ['liXMLHttpRequest'] )) {
$headers [] = 'X-Requested-With: XMLHttpRequest';
}
if (isset ( $advSettings ['Origin'] )) {
$headers [] = 'Origin: ' . $advSettings ['Origin'];
}
if (stripos ( $ccURL, 'blogger.com' ) !== false && (isset ( $advSettings ['cdomain'] ) && $advSettings ['cdomain'] == 'google.com'))
$advSettings ['cdomain'] = 'blogger.com';
if (isset ( $advSettings ['noSSLSec'] )) {
curl_setopt ( $ch, CURLOPT_SSL_VERIFYHOST, 0 );
curl_setopt ( $ch, CURLOPT_SSL_VERIFYPEER, 0 );
}
curl_setopt ( $ch, CURLOPT_HEADER, true );
curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt ( $ch, CURLOPT_COOKIE, $cookies );
curl_setopt ( $ch, CURLOPT_HTTPHEADER, $headers );
curl_setopt ( $ch, CURLINFO_HEADER_OUT, true );
if ($ref != '')
curl_setopt ( $ch, CURLOPT_REFERER, $ref );
curl_setopt ( $ch, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)" );
if ($fields != '') {
curl_setopt ( $ch, CURLOPT_POST, true );
curl_setopt ( $ch, CURLOPT_POSTFIELDS, $fields );
} else {
curl_setopt ( $ch, CURLOPT_POST, false );
curl_setopt ( $ch, CURLOPT_POSTFIELDS, '' );
curl_setopt ( $ch, CURLOPT_HTTPGET, true );
}
$content = curl_exec ( $ch ); // prr($content);
$errmsg = curl_error ( $ch );
if (isset ( $errmsg ) && stripos ( $errmsg, 'SSL' ) !== false) {
curl_setopt ( $ch, CURLOPT_SSL_VERIFYPEER, false );
$content = curl_exec ( $ch );
}
$ndel = strpos ( $content, "\n\n" );
$rndel = strpos ( $content, "\r\n\r\n" );
if ($ndel == false)
$ndel = 100000;
if ($rndel == false)
$rndel = 100000;
$rrDel = $rndel < $ndel ? "\r\n\r\n" : "\n\n";
list ( $header, $content ) = explode ( $rrDel, $content, 2 );
if ($ctOnly !== true) {
$nsheader = curl_getinfo ( $ch );
$err = curl_errno ( $ch );
$errmsg = curl_error ( $ch );
$nsheader ['errno'] = $err;
$nsheader ['errmsg'] = $errmsg;
$nsheader ['headers'] = $header;
$nsheader ['content'] = $content;
}
$http_code = curl_getinfo ( $ch, CURLINFO_HTTP_CODE );
$headers = curl_getinfo ( $ch );
if ($dbg) {
echo '<br/><b style="color:#005800;">## Headers:</b><br/>';
prr ( $headers );
prr ( $header );
}
$results = array ();
$cookies = '';
preg_match_all ( '|Set-Cookie: (.*);|U', $header, $results );
$carTmp = $results [1]; // $nxs_gCookiesArr
// =
// array_merge($nxs_gCookiesArr,
// $ret['cookies']);
//.........这里部分代码省略.........
示例9: nxs_doPublishToKT
function nxs_doPublishToKT($postID, $options)
{
global $nxs_ktCkArray;
$ntCd = 'KT';
$ntCdL = 'kt';
$ntNm = 'Kippt';
if (!is_array($options)) {
$options = maybe_unserialize(get_post_meta($postID, $options, true));
}
// if (isset($options['timeToRun'])) wp_unschedule_event( $options['timeToRun'], 'nxs_doPublishToDI', array($postID, $options));
$addParams = nxs_makeURLParams(array('NTNAME' => $ntNm, 'NTCODE' => $ntCd, 'POSTID' => $postID, 'ACCNAME' => $options['nName']));
$blogTitle = htmlspecialchars_decode(get_bloginfo('name'), ENT_QUOTES);
if ($blogTitle == '') {
$blogTitle = home_url();
}
$ii = $options['ii'];
if (!isset($options['pType'])) {
$options['pType'] = 'im';
}
if ($options['pType'] == 'sh') {
sleep(rand(1, 10));
}
$logNT = '<span style="color:#000080">Kippt</span> - ' . $options['nName'];
$snap_ap = get_post_meta($postID, 'snap' . $ntCd, true);
$snap_ap = maybe_unserialize($snap_ap);
if ($options['pType'] != 'aj' && is_array($snap_ap) && (nxs_chArrVar($snap_ap[$ii], 'isPosted', '1') || nxs_chArrVar($snap_ap[$ii], 'isPrePosted', '1'))) {
$snap_isAutoPosted = get_post_meta($postID, 'snap_isAutoPosted', true);
if ($snap_isAutoPosted != '2') {
sleep(5);
nxs_addToLogN('W', 'Notice', $logNT, '-=Duplicate=- Post ID:' . $postID, 'Already posted. No reason for posting duplicate');
return;
}
}
if ($postID == '0') {
echo "Testing ... <br/><br/>";
$link = home_url();
$options['msgFormat'] = 'Test Message from ' . $link;
} else {
$post = get_post($postID);
if (!$post) {
return;
}
$link = get_permalink($postID);
$options['msgFrmt'] = nsFormatMessage($options['msgFrmt'], $postID, $addParams);
$options['msgTFrmt'] = nsFormatMessage($options['msgTFrmt'], $postID, $addParams);
nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPrePosted' => '1'));
}
$extInfo = ' | PostID: ' . $postID . " - " . (isset($post) && is_object($post) ? $post->post_title : '');
//## Create and Format message
$t = wp_get_post_tags($postID);
$tggs = array();
foreach ($t as $tagA) {
$tggs[] = $tagA->name;
}
$tags = implode(',', $tggs);
$tags = str_replace(' ', '+', $tags);
$message = array('url' => $link, 'surl' => $link, 'siteName' => $blogTitle, 'tags' => $tags);
//## Actual Post
$ntToPost = new nxs_class_SNAP_KT();
$ret = $ntToPost->doPostToNT($options, $message);
//## Process Results
if (!is_array($ret) || $ret['isPosted'] != '1') {
//## Error
if ($postID == '0') {
prr($ret);
}
nxs_addToLogN('E', 'Error', $logNT, '-=ERROR=- ' . print_r($ret, true), $extInfo);
} else {
// ## All Good - log it.
if ($postID == '0') {
nxs_addToLogN('S', 'Test', $logNT, 'OK - TEST Message Posted ');
echo _e('OK - Message Posted, please see your ' . $logNT . ' Page. ', 'social-networks-auto-poster-facebook-twitter-g');
} else {
nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPosted' => '1', 'pgID' => $ret['postID'], 'postURL' => $ret['postURL'], '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);
}
}
示例10: nxs_doPublishToTW
//.........这里部分代码省略.........
$pRawText = str_ireplace($cat->name, '#' . $frmTag, $pRawText);
} elseif (stripos($pRawText, $frmTag) !== false) {
$pRawText = str_ireplace($frmTag, '#' . $frmTag, $pRawText);
}
if (stripos($twMsgFormat, '%TITLE%') !== false && (stripos($pTitle, $cat->name) !== false || stripos($pTitle, $frmTag) !== false) || stripos($twMsgFormat, '%TEXT%') !== false && (stripos($pText, $cat->name) !== false || stripos($pText, $frmTag) !== false) || stripos($twMsgFormat, '%EXCERPT%') !== false && (stripos($pText, $cat->name) !== false || stripos($pText, $frmTag) !== false) || stripos($twMsgFormat, '%RAWEXCERPT%') !== false && (stripos($exrText, $cat->name) !== false || stripos($exrText, $frmTag) !== false) || stripos($twMsgFormat, '%ANNOUNCE%') !== false && (stripos($pText, $cat->name) !== false || stripos($pText, $frmTag) !== false) || stripos($twMsgFormat, '%FULLTEXT%') !== false && (stripos($pFullText, $cat->name) !== false || stripos($pFullText, $frmTag) !== false) || stripos($twMsgFormat, '%RAWTEXT%') !== false && (stripos($pRawText, $cat->name) !== false || stripos($pRawText, $frmTag) !== false)) {
} else {
$ctts[] = '#' . $frmTag;
}
}
$cats = implode(' ', $ctts);
while (count($cats) > $twLim - 10) {
array_pop($ctts);
$cats = implode(' ', $ctts);
}
$twMsgFormat = str_ireplace("%CATS%", $cats, $twMsgFormat);
$twMsgFormat = str_ireplace("%HCATS%", $cats, $twMsgFormat);
$twLim = $twLim - nxs_strLen($cats);
}
if (stripos($twMsgFormat, '%TITLE%') !== false) {
if (stripos($pTitle, '.co.uk') !== false) {
$twLim = $twLim - 14;
}
if (stripos($pTitle, '.com') !== false) {
$twLim = $twLim - 16;
}
if (stripos($pTitle, '.net') !== false) {
$twLim = $twLim - 16;
}
if (stripos($pTitle, '.org') !== false) {
$twLim = $twLim - 16;
}
$pTitle = html_entity_decode(strip_tags($pTitle), ENT_NOQUOTES, 'UTF-8');
$pTitle = nsTrnc($pTitle, $twLim);
$twMsgFormat = str_ireplace("%TITLE%", $pTitle, $twMsgFormat);
$twLim = $twLim - nxs_strLen($pTitle);
}
if (stripos($twMsgFormat, '%SITENAME%') !== false) {
$siteTitle = htmlspecialchars_decode(get_bloginfo('name'), ENT_QUOTES);
$siteTitle = nsTrnc($siteTitle, $twLim);
$twMsgFormat = str_ireplace("%SITENAME%", $siteTitle, $twMsgFormat);
$twLim = $twLim - nxs_strLen($siteTitle);
}
if (stripos($twMsgFormat, '%TEXT%') !== false) {
$pText = nsTrnc(strip_tags(strip_shortcodes($pText)), 300, " ", "...");
$pText = nsTrnc($pText, $twLim);
$twMsgFormat = str_ireplace("%TEXT%", $pText, $twMsgFormat);
$twLim = $twLim - nxs_strLen($pText);
}
if (stripos($twMsgFormat, '%EXCERPT%') !== false) {
$pText = nsTrnc(strip_tags(strip_shortcodes($pText)), 300, " ", "...");
$pText = nsTrnc($pText, $twLim);
$twMsgFormat = str_ireplace("%EXCERPT%", $pText, $twMsgFormat);
$twLim = $twLim - nxs_strLen($pText);
}
if (stripos($twMsgFormat, '%RAWEXCERPT%') !== false) {
$exrText = nsTrnc(strip_tags(strip_shortcodes($exrText)), 300, " ", "...");
$exrText = nsTrnc($exrText, $twLim);
$twMsgFormat = str_ireplace("%RAWEXCERPT%", $exrText, $twMsgFormat);
$twLim = $twLim - nxs_strLen($exrText);
}
if (stripos($twMsgFormat, '%FULLTEXT%') !== false) {
$pFullText = nsTrnc(strip_tags($pFullText), $twLim);
$twMsgFormat = str_ireplace("%FULLTEXT%", $pFullText, $twMsgFormat);
$twLim = $twLim - nxs_strLen($pFullText);
}
if (stripos($twMsgFormat, '%RAWTEXT%') !== false) {
$pRawText = nsTrnc(strip_tags($pRawText), $twLim);
$twMsgFormat = str_ireplace("%RAWTEXT%", $pRawText, $twMsgFormat);
$twLim = $twLim - nxs_strLen($pRawText);
}
$msg = nsFormatMessage($twMsgFormat, $postID);
}
$message = array('message' => $msg, 'img' => $img, 'urlLength' => $nxs_urlLen);
//## Actual Post
$ntToPost = new nxs_class_SNAP_TW();
$ret = $ntToPost->doPostToNT($options, $message);
//## Process Results
if (!is_array($ret) || $ret['isPosted'] != '1') {
//## Error
if ($postID == '0') {
prr($ret);
}
nxs_addToLogN('E', 'Error', $logNT, '-=ERROR=- ' . print_r($ret, true), $extInfo);
} else {
// ## All Good - log it.
if ($postID == '0') {
nxs_addToLogN('S', 'Test', $logNT, 'OK - TEST Message Posted ');
echo _e('OK - Message Posted, please see your ' . $logNT . ' Page. ', 'nxs_snap');
} else {
nxs_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);
}
}
示例11: nxs_doPublishToDA
function nxs_doPublishToDA($postID, $options)
{
$ntCd = 'DA';
$ntCdL = 'da';
$ntNm = 'deviantART';
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']));
$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:#800000">deviantART</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;
}
$options['daTitleFormat'] = nsFormatMessage($options['daTitleFormat'], $postID, $addParams);
$options['daTextFormat'] = nsFormatMessage($options['daTextFormat'], $postID, $addParams);
// prr($options['daTextFormat']); echo $postID;
$extInfo = ' | PostID: ' . $postID . " - " . (isset($post) && is_object($post) ? $post->post_title : '');
}
//## Actual Post
$ntToPost = new nxs_class_SNAP_DA();
$ret = $ntToPost->doPostToNT($options, $message);
// echo "~~~"; prr($ret); echo "+++";
//## Save Session
if (empty($options['ck'])) {
$options['ck'] = '';
}
if (!empty($ret) && is_array($ret) && !empty($ret['ck']) && !empty($ret['ck']) && serialize($ret['ck']) != $options['ck']) {
$options['ck'] = serialize($ret['ck']);
$options['mh'] = serialize($ret['mh']);
if (function_exists('get_option')) {
$nxs_gOptions = get_option('NS_SNAutoPoster');
}
if (!empty($nxs_gOptions)) {
$nxs_gOptions['da'][$ii] = $options;
nxs_settings_save($nxs_gOptions);
}
}
//## Process Results
if (!is_array($ret) || $ret['isPosted'] != '1') {
//## Error
if ($postID == '0') {
prr($ret);
}
nxs_addToLogN('E', 'Error', $logNT, '-=ERROR=- ' . print_r($ret, true), $extInfo);
} else {
// ## All Good - log it.
if ($postID == '0') {
nxs_addToLogN('S', 'Test', $logNT, 'OK - TEST Message Posted ');
echo _e('OK - Message Posted, please see your ' . $logNT . ' Page. ', 'social-networks-auto-poster-facebook-twitter-g');
} else {
nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPosted' => '1', 'pgID' => $ret['postID'], 'postURL' => $ret['postURL'], '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);
}
}
示例12: nxs_doPublishToWP
//.........这里部分代码省略.........
$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('&', '&', $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') {
prr($ret);
}
nxs_addToLogN('E', 'Error', $logNT, '-=ERROR=- ' . print_r($ret, true), $extInfo);
} else {
// ## All Good - log it.
if ($postID == '0') {
nxs_addToLogN('S', 'Test', $logNT, 'OK - TEST Message Posted ');
echo _e('OK - Message Posted, please see your ' . $logNT . ' Page. ', 'social-networks-auto-poster-facebook-twitter-g');
} else {
do_action('nxs_actOnWP', array('postID' => $postID, 'pgID' => $ret['postID'], 'wpURL' => $options['wpURL'], 'ii' => $ii));
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);
}
}
示例13: nxs_snapAjax
function nxs_snapAjax()
{
check_ajax_referer('nxsSsPageWPN');
global $plgn_NS_SNAutoPoster;
if (!isset($plgn_NS_SNAutoPoster)) {
return;
}
$options = $plgn_NS_SNAutoPoster->nxs_options;
if ($_POST['nxsact'] == 'getNTset') {
$ii = $_POST['ii'];
$nt = $_POST['nt'];
$ntl = strtolower($nt);
$pbo = $options[$ntl][$ii];
$pbo['ntInfo']['lcode'] = $ntl;
$clName = 'nxs_snapClass' . $nt;
$ntObj = new $clName();
$ntObj->showNTSettings($ii, $pbo);
}
if ($_POST['nxsact'] == 'svEdFlds') {
$cn = str_replace(']', '', $_POST['cname']);
$cna = explode('[', $cn);
prr($cna);
$id = $_POST['pid'];
$nt = $cna[0];
$ntU = strtoupper($nt);
$ii = $cna[1];
$fname = $cna[2];
$savedMeta = maybe_unserialize(get_post_meta($id, 'snap' . $ntU, true));
$savedMeta[$ii][$fname] = $_POST['cval'];
prr($savedMeta);
delete_post_meta($id, 'snap' . $ntU);
add_post_meta($id, 'snap' . $ntU, str_replace('\\', '\\\\', serialize($savedMeta)));
}
if ($_POST['nxsact'] == 'getNewPostDlg') {
nxs_showNewPostForm($options);
}
if ($_POST['nxsact'] == 'doNewPost') {
nxs_doNewNPPost($options);
}
if ($_POST['nxsact'] == 'nxsCptCheckGP') {
nxs_CptCheckGP($options);
}
die;
}
示例14: nxs_cURLTest
function nxs_cURLTest($url, $msg, $testText)
{
echo "<br/>--== Test Requested ... " . $url . "<br/>";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
$response = curl_exec($ch);
$errmsg = curl_error($ch);
$cInfo = curl_getinfo($ch);
curl_close($ch);
echo "Testing ... " . $url . " - " . $cInfo['url'] . "<br/>";
if (stripos($response, $testText) !== false) {
echo "...." . $msg . " - OK<br/>";
} else {
echo "....<b style='color:red;'>" . $msg . " - Problem</b><br/>";
prr($response);
prr($errmsg);
prr($cInfo);
echo nxs_cURLTestCode($url);
}
}
示例15: showGenNTSettings
function showGenNTSettings($ntOpts)
{
global $nxs_snapThisPageUrl, $nxs_plurl;
$ntInfo = array('code' => 'LI', 'lcode' => 'li', 'name' => 'LinkedIn', 'defNName' => 'ulName', 'tstReq' => true);
if (isset($_GET['auth']) && $_GET['auth'] == 'li') {
require_once 'apis/liOAuth.php';
$options = $ntOpts[$_GET['acc']];
$api_key = $options['liAPIKey'];
$api_secret = $options['liAPISec'];
$callback_url = $nxs_snapThisPageUrl . "&auth=lia&acc=" . $_GET['acc'];
$li_oauth = new nsx_LinkedIn($api_key, $api_secret, $callback_url);
$request_token = $li_oauth->getRequestToken();
//echo "####"; prr($request_token); die();
$options['liOAuthToken'] = $request_token->key;
$options['liOAuthTokenSecret'] = $request_token->secret;
// prr($li_oauth);
switch ($li_oauth->http_code) {
case 200:
$url = $li_oauth->generateAuthorizeUrl();
$optionsG = get_option('NS_SNAutoPoster');
$optionsG['li'][$_GET['acc']] = $options;
update_option('NS_SNAutoPoster', $optionsG);
echo '<script type="text/javascript">window.location = "' . $url . '"</script>';
break;
default:
echo '<br/><b style="color:red">Could not connect to LinkedIn. Refresh the page or try again later.</b>';
die;
}
die;
}
if (isset($_GET['auth']) && $_GET['auth'] == 'lia') {
require_once 'apis/liOAuth.php';
$options = $ntOpts[$_GET['acc']];
$api_key = $options['liAPIKey'];
$api_secret = $options['liAPISec'];
$li_oauth = new nsx_LinkedIn($api_key, $api_secret);
$li_oauth->request_token = new nsx_trOAuthConsumer($options['liOAuthToken'], $options['liOAuthTokenSecret'], 1);
$li_oauth->oauth_verifier = $_REQUEST['oauth_verifier'];
$li_oauth->getAccessToken($_REQUEST['oauth_verifier']);
$options['liOAuthVerifier'] = $_REQUEST['oauth_verifier'];
$options['liAccessToken'] = $li_oauth->access_token->key;
$options['liAccessTokenSecret'] = $li_oauth->access_token->secret;
try {
$xml_response = $li_oauth->getProfile("~:(id,first-name,last-name)");
} catch (Exception $o) {
prr($o);
die("<span style='color:red;'>ERROR: Authorization Error</span>");
}
if (stripos($xml_response, '<first-name>') !== false) {
$userinfo = CutFromTo($xml_response, '<id>', '</id>') . " - " . CutFromTo($xml_response, '<first-name>', '</first-name>') . " " . CutFromTo($xml_response, '<last-name>', '</last-name>');
} else {
$userinfo = '';
}
if ($userinfo != '') {
$options['liUserInfo'] = $userinfo;
$optionsG = get_option('NS_SNAutoPoster');
$optionsG['li'][$_GET['acc']] = $options;
update_option('NS_SNAutoPoster', $optionsG);
echo '<script type="text/javascript">window.location = "' . $nxs_snapThisPageUrl . '"</script>';
die;
}
prr($xml_response);
die("<span style='color:red;'>ERROR: Something is Wrong with your LinkedIn account</span>");
}
?>
<div class="nxs_box">
<div class="nxs_box_header">
<div class="nsx_iconedTitle" style="margin-bottom:1px;background-image:url(<?php
echo $nxs_plurl;
?>
img/<?php
echo $ntInfo['lcode'];
?>
16.png);"><?php
echo $ntInfo['name'];
?>
<?php
$cbo = count($ntOpts);
?>
<?php
wp_nonce_field('ns' . $ntInfo['code'], 'ns' . $ntInfo['code'] . '_wpnonce');
?>
<?php
if ($cbo > 1) {
?>
<div class="nsBigText"><?php
echo "(" . ($cbo == '0' ? 'No' : $cbo) . " ";
_e('accounts', 'nxs_snap');
echo ")";
?>
</div><?php
}
?>
</div>
</div>
<div class="nxs_box_inside">
<?php
foreach ($ntOpts as $indx => $pbo) {
if (trim($pbo['nName'] == '')) {
//.........这里部分代码省略.........