function doPostToNT($options, $message)
 {
     $badOut = array('postID' => '', 'isPosted' => 0, 'pDate' => date('Y-m-d H:i:s'), 'Error' => '');
     $liPostID = '';
     //## Check settings
     if (!is_array($options)) {
         $badOut['Error'] = 'No Options';
         return $badOut;
     }
     if ((!isset($options['ulName']) || trim($options['uPass']) == '') && empty($options['liOAuthVerifier'])) {
         $badOut['Error'] = 'Not Configured';
         return $badOut;
     }
     if (empty($options['imgSize'])) {
         $options['imgSize'] = '';
     }
     if (empty($options['liMsgFormatT'])) {
         $options['liMsgFormatT'] = '%TITLE%';
     }
     //## Format
     if (!empty($message['pText'])) {
         $msg = $message['pText'];
     } else {
         $msg = nxs_doFormatMsg($options['liMsgFormat'], $message);
     }
     if (!empty($message['pTitle'])) {
         $msgT = $message['pTitle'];
     } else {
         $msgT = nxs_doFormatMsg($options['liMsgFormatT'], $message);
     }
     if (empty($options['postType'])) {
         if ((int) $options['liAttch'] == 1 || $isNew) {
             $options['postType'] = 'A';
         }
     }
     if ($options['postType'] == 'A' || $options['postType'] == 'I') {
         if (isset($message['imageURL'])) {
             $imgURL = trim(nxs_getImgfrOpt($message['imageURL'], $options['imgSize']));
         } else {
             $imgURL = '';
         }
         if (preg_match("/noImg.\\.png/i", $imgURL)) {
             $imgURL = '';
         }
         if (!empty($message['urlDescr'])) {
             $dsc = $message['urlDescr'];
         } else {
             $dsc = $msg;
         }
         $dsc = strip_tags($dsc);
         $dsc = nxs_decodeEntitiesFull($dsc);
         $dsc = nxs_html_to_utf8($dsc);
         $dsc = nsTrnc($dsc, 300);
     }
     $msg = strip_tags($msg);
     $msg = nxs_html_to_utf8($msg);
     $msgT = nxs_html_to_utf8($msgT);
     $urlToGo = $message['url'];
     if (function_exists("doConnectToLinkedIn") && $options['ulName'] != '' && $options['uPass'] != '') {
         $dusername = $options['ulName'];
         $pass = substr($options['uPass'], 0, 5) == 'n5g9a' ? nsx_doDecode(substr($options['uPass'], 5)) : $options['uPass'];
         // ??? Do we need that??????
         $auth = doConnectToLinkedIn($options['ulName'], $options['uPass'], $options['ii']);
         if ($auth != false) {
             $badOut['Error'] .= "|Auth Error - " . $auth;
             return $badOut;
         }
         $to = $options['uPage'] != '' ? $options['uPage'] : 'https://www.linkedin.com/home';
         $lnk = array();
         $msg = str_ireplace(' ', ' ', $msg);
         $msg = nsTrnc(strip_tags($msg), 700);
         $lnk['postTitle'] = $msgT;
         if ($options['postType'] == 'A') {
             $lnk['title'] = $message['urlTitle'];
             $lnk['desc'] = $message['urlDescr'];
             $lnk['url'] = $urlToGo;
             $lnk['img'] = $imgURL;
             $lnk['postType'] = 'A';
         }
         if ($options['postType'] == 'I') {
             $lnk['title'] = '';
             $lnk['desc'] = '';
             $lnk['url'] = $imgURL;
             $lnk['img'] = $imgURL;
             $lnk['postType'] = 'I';
             $lnk['postTitle'] = $msgT;
         }
         if ($options['postType'] == 'T') {
             $lnk['postType'] = 'T';
         }
         global $nxs_gCookiesArr;
         $li = new nxsAPI_LI();
         $li->debug = false;
         if (!empty($nxs_gCookiesArr)) {
             $li->ck = $nxs_gCookiesArr;
         }
         $ret = $li->post($msg, $lnk, $to);
         if (is_array($ret) && !empty($ret['isPosted'])) {
             return $ret;
         }
         $liPostID = $options['uPage'];
     } else {
         if (!empty($options['isV2'])) {
             //## V2
             if ($options['grpID'] != '') {
                 try {
                     if ($msgT == '') {
                         $msgT = ' ';
                     }
                     if ($options['postType'] == 'A') {
                         $ret = $this->postToGroup($options['liAccessToken'], $msg, $msgT, $options['grpID'], str_replace('&', '&', $urlToGo), $imgURL, $dsc);
                     } else {
                         $ret = $this->postToGroup($options['liAccessToken'], $msg, $msgT, $options['grpID']);
                     }
                     $liPostID = 'http://www.linkedin.com/groups?gid=' . $options['grpID'];
                 } catch (Exception $o) {
                     $ret = "ERROR: " . print_r($o, true);
                 }
             } else {
                 //echo $msg ."|". nsTrnc($msgT, 200) ."|". $urlToGo ."|". $imgURL ."|". $dsc;
                 if ($options['postType'] == 'A') {
                     $ret = $this->postShare($options['liAccessToken'], $msg, nsTrnc($msgT, 200), str_replace('&', '&', $urlToGo), $imgURL, $dsc);
                 } else {
                     $ret = $this->postShare($options['liAccessToken'], $msg);
                 }
             }
         } else {
             //## V1
             require_once 'apis/liOAuth.php';
             $linkedin = new nsx_LinkedIn($options['liAPIKey'], $options['liAPISec']);
             $linkedin->oauth_verifier = $options['liOAuthVerifier'];
             $linkedin->request_token = new nsx_trOAuthConsumer($options['liOAuthToken'], $options['liOAuthTokenSecret'], 1);
             $linkedin->access_token = new nsx_trOAuthConsumer($options['liAccessToken'], $options['liAccessTokenSecret'], 1);
             $msg = nsTrnc($msg, 700);
             //prr($urlToGo);  $urlToGo = urlencode($urlToGo);   prr($urlToGo); die();
             if ($options['grpID'] != '') {
                 try {
                     if ($msgT == '') {
                         $msgT = ' ';
                     }
                     if ($options['postType'] == 'A') {
                         $ret = $linkedin->postToGroup($msg, $msgT, $options['grpID'], str_replace('&', '&', $urlToGo), $imgURL, $dsc);
                     } else {
                         $ret = $linkedin->postToGroup($msg, $msgT, $options['grpID']);
                     }
                     $liPostID = 'http://www.linkedin.com/groups?gid=' . $options['grpID'];
                     if ($ret == '201') {
                         $ret = array('updateUrl' => $liPostID);
                     }
                 } catch (Exception $o) {
                     $ret = "ERROR: " . print_r($o, true);
                 }
             } else {
                 //echo $msg ."|". nsTrnc($msgT, 200) ."|". $urlToGo ."|". $imgURL ."|". $dsc;
                 try {
                     if ($options['postType'] == 'A') {
                         $ret = $linkedin->postShare($msg, nsTrnc($msgT, 200), str_replace('&', '&', $urlToGo), $imgURL, $dsc);
                     } else {
                         $ret = $linkedin->postShare($msg);
                     }
                 } catch (Exception $o) {
                     $ret = "ERROR:" . print_r($o, true);
                 }
             }
         }
         if ($liPostID == '') {
             $liPostID = $options['liUserInfo'];
         }
     }
     // prr($ret);
     if (!is_array($ret) && stripos($ret, '<update-url>') !== false) {
         $rurl = CutFromTo($ret, '<update-url>', '</update-url>');
         $ret = array('updateUrl' => $rurl);
     }
     if (is_array($ret) && !empty($ret['updateUrl'])) {
         if (stripos($ret['updateUrl'], 'topic=') !== false) {
             $liPostID = CutFromTo($ret['updateUrl'], 'topic=', '&');
         } else {
             $liPostID = '';
         }
         return array('isPosted' => '1', 'postID' => $liPostID, 'postURL' => $ret['updateUrl'], 'pDate' => date('Y-m-d H:i:s'));
     } else {
         $badOut['Error'] .= print_r($ret, true);
     }
     return $badOut;
 }
Beispiel #2
0
        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-li-') {
                $at = $_GET['code'];
                $ii = str_replace('nxs-li-', '', $_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['liAPIKey'])) {
                    echo "-=";
                    prr($nto);
                    // die();
                    $tknURL = 'https://www.linkedin.com/uas/oauth2/accessToken?grant_type=authorization_code&code=' . $at . '&redirect_uri=' . urlencode($nxs_snapSetPgURL) . '&client_id=' . $nto['liAPIKey'] . '&client_secret=' . $nto['liAPISec'];
                    $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['liAccessToken'] = $resp['access_token'];
                    $nto['liAccessTokenSecret'] = 'No Need for oAuth V2';
                    $nto['liOAuthVerifier'] = 'No Need for oAuth V2';
                    $nto['liAccessTokenExp'] = $currTime + $resp['expires_in'];
                    echo "<br/>----=={ Expires: " . date('Y-m-d H:i:s', $nto['liAccessTokenExp']) . " }==---- <br/>";
                    $tknURL = 'https://api.linkedin.com/v1/people/~:(id,first-name,last-name)?format=json&oauth2_access_token=' . $nto['liAccessToken'];
                    $response = wp_remote_get($tknURL, $wprg);
                    prr($tknURL);
                    prr($response);
                    $user = json_decode($response['body'], true);
                    if (!empty($user['id'])) {
                        $nto['liUserID'] = $user['id'];
                        $nto['liUserInfo'] = $user['firstName'] . $user['lastName'] . (!empty($user['id']) ? " (" . $user['id'] . ")" : '');
                        $nto['isV2'] = true;
                        if (function_exists('get_option')) {
                            $nxs_gOptions = get_option('NS_SNAutoPoster');
                        }
                        if (!empty($nxs_gOptions)) {
                            $nxs_gOptions['li'][$ii] = $nto;
                            prr($nto);
                            nxs_settings_save($nxs_gOptions);
                        }
                        ?>
<script type="text/javascript">window.location = "<?php 
                        echo $nxs_snapSetPgURL;
                        ?>
"</script>      
        <?php 
                    }
                }
                die;
            }
            // V1 Auth
            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_snapSetPgURL . "&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();
                if (!is_object($request_token)) {
                    echo "### LinkedIn Authorization Error:";
                    prr($request_token);
                    if (is_string($request_token) && stripos($request_token, 'timestamp') !== false) {
                        echo "Your Server Time: " . date('m/d/Y h:i:s a');
                        echo " Correct Time: " . date('m/d/Y h:i:s a', nxs_ntp_time('t1.timegps.net'));
                    }
                    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_snapSetPgURL . '"</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 
            if ($cbo > 1) {
                ?>
<div class="nsBigText"><?php 
                echo "(" . ($cbo == '0' ? 'No' : $cbo) . " ";
                _e('accounts', 'social-networks-auto-poster-facebook-twitter-g');
                echo ")";
                ?>
</div><?php 
            }
            ?>
        </div>
      </div>
      <div class="nxs_box_inside">
        <?php 
            foreach ($ntOpts as $indx => $pbo) {
                if (trim($pbo['nName'] == '')) {
                    $pbo['nName'] = !empty($pbo[$ntInfo['defNName']]) ? $pbo[$ntInfo['defNName']] : 'LinkedIn';
                }
                if (!isset($pbo[$ntInfo['lcode'] . 'OK']) || $pbo[$ntInfo['lcode'] . 'OK'] == '') {
                    $pbo[$ntInfo['lcode'] . 'OK'] = isset($pbo['liAccessToken']) && $pbo['liAccessTokenSecret'] != '' ? '1' : '';
                }
                ?>
          <p style="margin:0px;margin-left:5px;"> <img id="<?php 
                echo $ntInfo['code'] . $indx;
                ?>
LoadingImg" style="display: none;" src='<?php 
                echo $nxs_plurl;
                ?>
img/ajax-loader-sm.gif' />
            <input value="0" name="<?php 
                echo $ntInfo['lcode'];
                ?>
[<?php 
                echo $indx;
                ?>
][apDo<?php 
                echo $ntInfo['code'];
                ?>
]" type="hidden" />             
            <?php 
                if ((int) $pbo['do' . $ntInfo['code']] == 1 && isset($pbo['catSel']) && (int) $pbo['catSel'] == 1) {
                    ?>
 <input type="radio" name="<?php 
                    echo $ntInfo['lcode'];
                    ?>
[<?php 
                    echo $indx;
                    ?>
][apDo<?php 
                    echo $ntInfo['code'];
                    ?>
]" id="rbtn<?php 
                    echo $ntInfo['lcode'] . $indx;
                    ?>
" value="1" checked="checked" onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);" /> <?php 
                } else {
                    ?>
            
            <input value="1" name="<?php 
                    echo $ntInfo['lcode'];
                    ?>
[<?php 
                    echo $indx;
                    ?>
][apDo<?php 
                    echo $ntInfo['code'];
                    ?>
]" type="checkbox" <?php 
                    if ((int) $pbo['do' . $ntInfo['code']] == 1 && $pbo['catSel'] != '1') {
                        echo "checked";
                    }
                    ?>
 />
           <?php 
                }
                ?>
            <?php 
                if (isset($pbo['catSel']) && (int) $pbo['catSel'] == 1) {
                    ?>
 <span onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);"><?php 
                    echo "*[" . (substr_count($pbo['catSelEd'], ",") + 1) . "]*";
                    ?>
</span><?php 
                }
                ?>
            <?php 
                if (isset($pbo['rpstOn']) && (int) $pbo['rpstOn'] == 1) {
                    ?>
 <span onmouseout="nxs_hidePopUpInfo('popReActive');" onmouseover="nxs_showPopUpInfo('popReActive', event);"><?php 
                    echo "*[R]*";
                    ?>
</span><?php 
                }
                ?>
            <strong><?php 
                _e('Auto-publish to', 'social-networks-auto-poster-facebook-twitter-g');
                ?>
 <?php 
                echo $ntInfo['name'];
                ?>
 <i style="color: #005800;"><?php 
                if ($pbo['nName'] != '') {
                    echo "(" . $pbo['nName'] . ")";
                }
                ?>
</i></strong>
          &nbsp;&nbsp;<?php 
                if ($ntInfo['tstReq'] && (!isset($pbo[$ntInfo['lcode'] . 'OK']) || $pbo[$ntInfo['lcode'] . 'OK'] == '')) {
                    ?>
<b style="color: #800000"><?php 
                    _e('Attention requred. Unfinished setup', 'social-networks-auto-poster-facebook-twitter-g');
                    ?>
 ==&gt;</b><?php 
                }
                ?>
 <?php 
                if (!empty($pbo['grpID'])) {
                    ?>
<b style="color: #800000"><?php 
                    _e('Attention requred. Groups are no longer supported by LinkedIn Native API', 'social-networks-auto-poster-facebook-twitter-g');
                    ?>
 ==&gt;</b><?php 
                }
                ?>
 <a id="do<?php 
                echo $ntInfo['code'] . $indx;
                ?>
AG" href="#" onclick="doGetHideNTBlock('<?php 
                echo $ntInfo['code'];
                ?>
' , '<?php 
                echo $indx;
                ?>
');return false;">[<?php 
                _e('Show Settings', 'social-networks-auto-poster-facebook-twitter-g');
                ?>
]</a>&nbsp;&nbsp;
          <a href="#" onclick="doDelAcct('<?php 
                echo $ntInfo['lcode'];
                ?>
', '<?php 
                echo $indx;
                ?>
', '<?php 
                if (isset($pbo['bgBlogID'])) {
                    echo $pbo['nName'];
                }
                ?>
');return false;">[<?php 
                _e('Remove Account', 'social-networks-auto-poster-facebook-twitter-g');
                ?>
]</a>
          </p><div id="nxsNTSetDiv<?php 
                echo $ntInfo['code'] . $indx;
                ?>
"></div><?php 
                //$pbo['ntInfo'] = $ntInfo; $this->showNTSettings($indx, $pbo);
            }
            ?>
      </div>
    </div> <?php 
        }
Beispiel #3
0
        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'] == '')) {
                    $pbo['nName'] = $pbo[$ntInfo['defNName']];
                }
                if (!isset($pbo[$ntInfo['lcode'] . 'OK']) || $pbo[$ntInfo['lcode'] . 'OK'] == '') {
                    $pbo[$ntInfo['lcode'] . 'OK'] = isset($pbo['liAccessToken']) && $pbo['liAccessTokenSecret'] != '' ? '1' : '';
                }
                ?>
          <p style="margin:0px;margin-left:5px;">
            <input value="1" name="<?php 
                echo $ntInfo['lcode'];
                ?>
[<?php 
                echo $indx;
                ?>
][apDo<?php 
                echo $ntInfo['code'];
                ?>
]" onchange="doShowHideBlocks('<?php 
                echo $ntInfo['code'];
                ?>
');" type="checkbox" <?php 
                if ((int) $pbo['do' . $ntInfo['code']] == 1) {
                    echo "checked";
                }
                ?>
 /> <?php 
                if ((int) $pbo['catSel'] == 1) {
                    ?>
   <span onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);"><?php 
                    echo "*[" . (substr_count($pbo['catSelEd'], ",") + 1) . "]*";
                    ?>
</span><?php 
                }
                ?>
            <strong><?php 
                _e('Auto-publish to', 'nxs_snap');
                ?>
 <?php 
                echo $ntInfo['name'];
                ?>
 <i style="color: #005800;"><?php 
                if ($pbo['nName'] != '') {
                    echo "(" . $pbo['nName'] . ")";
                }
                ?>
</i></strong>
          &nbsp;&nbsp;<?php 
                if ($ntInfo['tstReq'] && (!isset($pbo[$ntInfo['lcode'] . 'OK']) || $pbo[$ntInfo['lcode'] . 'OK'] == '')) {
                    ?>
<b style="color: #800000"><?php 
                    _e('Attention requred. Unfinished setup', 'nxs_snap');
                    ?>
 ==&gt;</b><?php 
                }
                ?>
<a id="do<?php 
                echo $ntInfo['code'] . $indx;
                ?>
A" href="#" onclick="doShowHideBlocks2('<?php 
                echo $ntInfo['code'] . $indx;
                ?>
');return false;">[<?php 
                _e('Show Settings', 'nxs_snap');
                ?>
]</a>&nbsp;&nbsp;
          <a href="#" onclick="doDelAcct('<?php 
                echo $ntInfo['lcode'];
                ?>
', '<?php 
                echo $indx;
                ?>
', '<?php 
                if (isset($pbo['bgBlogID'])) {
                    echo $pbo['nName'];
                }
                ?>
');return false;">[<?php 
                _e('Remove Account', 'nxs_snap');
                ?>
]</a>
          </p><?php 
                $this->showNTSettings($indx, $pbo);
            }
            ?>
      </div>
    </div> <?php 
        }