nxs_snapClassSC

The NextScripts: Social Networks Auto-Poster nxs snapClassSC class.

Defined (1)

The class is defined in the following location(s).

/inc-cl/sc.php  
  1. if (!class_exists("nxs_snapClassSC")) { class nxs_snapClassSC { var $ntInfo = array('code'=>'SC', 'lcode'=>'sc', 'name'=>'Scoop.It', 'defNName'=>'', 'tstReq' => true); 
  2. //#### Show Common Settings 
  3. function showGenNTSettings($ntOpts) { global $nxs_plurl, $nxs_snapSetPgURL; $ntInfo = $this->ntInfo; 
  4. if ( isset($_GET['auth']) && $_GET['auth']==$ntInfo['lcode']) { require_once('apis/scOAuth.php'); $options = $ntOpts[$_GET['acc']]; 
  5.  
  6. $consumer_key = $options['appKey']; $consumer_secret = $options['appSec']; 
  7. $callback_url = $nxs_snapSetPgURL."&auth=".$ntInfo['lcode']."a&acc=".$_GET['acc']; 
  8.  
  9. $tum_oauth = new wpScoopITOAuth($consumer_key, $consumer_secret);  
  10. $request_token = $tum_oauth->getReqToken($callback_url);  
  11. $options['oAuthToken'] = $request_token['oauth_token']; 
  12. $options['oAuthTokenSecret'] = $request_token['oauth_token_secret']; 
  13.  
  14. //prr($tum_oauth); prr($options); die(); 
  15.  
  16. switch ($tum_oauth->http_code) { case 200: $url = 'http://www.scoop.it/oauth/authorize?oauth_token='.$options['oAuthToken'];  
  17. $optionsG = get_option('NS_SNAutoPoster'); $optionsG[$ntInfo['lcode']][$_GET['acc']] = $options; update_option('NS_SNAutoPoster', $optionsG); 
  18. echo '<br/><br/>All good?! Redirecting ..... <script type="text/javascript">window.location = "'.$url.'"</script>'; break;  
  19. default: echo '<br/><b style="color:red">Could not connect to ScoopIT. Refresh the page or try again later.</b>'; die(); 
  20. die(); 
  21. if ( isset($_GET['auth']) && $_GET['auth']==$ntInfo['lcode'].'a') { require_once('apis/scOAuth.php'); $options = $ntOpts[$_GET['acc']]; 
  22. $consumer_key = $options['appKey']; $consumer_secret = $options['appSec']; 
  23.  
  24. $tum_oauth = new wpScoopITOAuth($consumer_key, $consumer_secret, $options['oAuthToken'], $options['oAuthTokenSecret']); //prr($tum_oauth); 
  25. $access_token = $tum_oauth->getAccToken($_GET['oauth_verifier']); prr($access_token); 
  26. $options['accessToken'] = $access_token['oauth_token']; $options['accessTokenSec'] = $access_token['oauth_token_secret'];  
  27. $optionsG = get_option('NS_SNAutoPoster'); $optionsG[$ntInfo['lcode']][$_GET['acc']] = $options; update_option('NS_SNAutoPoster', $optionsG);  
  28. $tum_oauth = new wpScoopITOAuth($consumer_key, $consumer_secret, $options['accessToken'], $options['accessTokenSec']);  
  29. $uinfo = $tum_oauth->makeReq('http://www.scoop.it/api/1/profile', '');  
  30. if (is_array($uinfo) && isset($uinfo['user'])) { $options['appAppUserName'] = $uinfo['user']['name']."(".$uinfo['user']['shortName'].")";  
  31. $options['appAppUserID'] = $uinfo['user']['id']; $optionsG = get_option('NS_SNAutoPoster'); $optionsG[$ntInfo['lcode']][$_GET['acc']] = $options; update_option('NS_SNAutoPoster', $optionsG); 
  32. } //die(); 
  33. if (!empty($options['appAppUserID'])) { echo '<br/><br/>All good?! Redirecting ..... <script type="text/javascript">window.location = "'.$nxs_snapSetPgURL.'"</script>'; die();} 
  34. else die("<span style='color:red;'>ERROR: Authorization Error: <span style='color:darkred; font-weight: bold;'>".print_r($uinfo, true)."</span></span>");  
  35.  
  36. ?>  
  37. <div class="nxs_box"> 
  38. <div class="nxs_box_header">  
  39. <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']; ?> 
  40. <?php $cbo = count($ntOpts); ?>  
  41. <?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 } ?> 
  42. </div> 
  43. </div> 
  44. <div class="nxs_box_inside"> 
  45. <?php foreach ($ntOpts as $indx=>$pbo) { if (trim($pbo['nName']=='')) $pbo['nName'] = $ntInfo['name'];  
  46. if (!isset($pbo[$ntInfo['lcode'].'OK']) || $pbo[$ntInfo['lcode'].'OK']=='') $pbo[$ntInfo['lcode'].'OK'] = (isset($pbo['appAppUserID']) && $pbo['appAppUserID']>1)?'1':''; 
  47. ?> 
  48. <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' /> 
  49.  
  50. <input value="0" name="<?php echo $ntInfo['lcode']; ?>[<?php echo $indx; ?>][apDo<?php echo $ntInfo['code']; ?>]" type="hidden" />  
  51. <?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 { ?>  
  52. <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"; ?> />  
  53.  
  54. <?php } ?> 
  55.  
  56. <?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 } ?> 
  57. <?php if (isset($pbo['rpstOn']) && (int)$pbo['rpstOn'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popReActive');" onmouseover="nxs_showPopUpInfo('popReActive', event);"><?php echo "*[R]*" ?></span><?php } ?> 
  58. <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> 
  59.   <?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'); ?> ==></b><?php } ?> 
  60. <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>    
  61. <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> 
  62. </p><div id="nxsNTSetDiv<?php echo $ntInfo['code'].$indx; ?>"></div><?php //$pbo['ntInfo'] = $ntInfo; $this->showNTSettings($indx, $pbo);  
  63. }?> 
  64. </div> 
  65. </div> <?php  
  66. }  
  67. //#### Show NEW Settings Page 
  68. function showNewNTSettings($options) { $opts = array('nName'=>'', 'doSC'=>'1', 'appKey'=>'', 'appSec'=>'', 'topicURL'=>'', 'inclTags'=>'1', 'postType'=>'A'); $opts['ntInfo']= $this->ntInfo; $this->showNTSettings($options, $opts, true);} 
  69. //#### Show Unit Settings 
  70. function showNTSettings($ii, $options, $isNew=false) { global $nxs_plurl, $nxs_snapSetPgURL; $ntInfo = $this->ntInfo; $nt = $ntInfo['lcode']; $ntU = $ntInfo['code'];  
  71. if (!isset($options['nHrs'])) $options['nHrs'] = 0; if (!isset($options['nMin'])) $options['nMin'] = 0; if (!isset($options['catSel'])) $options['catSel'] = 0; if (!isset($options['catSelEd'])) $options['catSelEd'] = '';  
  72. if (!isset($options['nDays'])) $options['nDays'] = 0; if (!isset($options['qTLng'])) $options['qTLng'] = ''; if (!isset($options['topicURL'])) $options['topicURL'] = '';  
  73. if (!isset($options['appKey'])) $options['appKey'] = ''; if (!isset($options['appSec'])) $options['appSec'] = ''; ?>  
  74. <div id="do<?php echo $ntU; ?><?php echo $ii; ?>Div" class="insOneDiv<?php if ($isNew) echo " clNewNTSets"; ?>">  
  75. <input type="hidden" value="0" id="apDoS<?php echo $ntU.$ii; ?>" /> 
  76. <div class="nsx_iconedTitle" style="float: right; background-image: url(<?php echo $nxs_plurl; ?>img/<?php echo $nt; ?>16.png);"><a style="font-size: 12px;" target="_blank" href="http://www.nextscripts.com/instructions/scoopit-social-networks-auto-poster-setup-installation/"><?php $nType=$ntInfo['name']; printf( __( 'Detailed %s Installation/Configuration Instructions', 'social-networks-auto-poster-facebook-twitter-g' ), $nType); ?></a></div> 
  77.  
  78. <div style="width:100%;"><strong><?php _e('Account Nickname', 'social-networks-auto-poster-facebook-twitter-g'); ?>:</strong> <i><?php _e('Just so you can easily identify it', 'social-networks-auto-poster-facebook-twitter-g'); ?></i> </div><input name="<?php echo $nt; ?>[<?php echo $ii; ?>][nName]" id="apnName<?php echo $ii; ?>" style="font-weight: bold; color: #005800; border: 1px solid #ACACAC; width: 40%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['nName'], ENT_COMPAT, "UTF-8")), 'social-networks-auto-poster-facebook-twitter-g') ?>" /><br/> 
  79. <?php echo nxs_addQTranslSel($nt, $ii, $options['qTLng']); ?> 
  80. <br/> 
  81. <ul class="nsx_tabs"> 
  82. <li><a href="#nsx<?php echo $nt.$ii ?>_tab1"><?php _e('Account Info', 'social-networks-auto-poster-facebook-twitter-g'); ?></a></li>  
  83. <?php if (!$isNew) { ?> <li><a href="#nsx<?php echo $nt.$ii ?>_tab2"><?php _e('Advanced', 'social-networks-auto-poster-facebook-twitter-g'); ?></a></li> <?php } ?> 
  84. </ul> 
  85. <div class="nsx_tab_container"><?php /** ######################## Account Tab ####################### */ ?> 
  86. <div id="nsx<?php echo $nt.$ii ?>_tab1" class="nsx_tab_content" style="background-image: url(<?php echo $nxs_plurl; ?>img/<?php echo $nt; ?>-bg.png); background-repeat: no-repeat; background-position:90% 10%;"> 
  87.  
  88. <div style="width:100%;"><strong><?php echo $nType; ?> Consumer Key:</strong> </div><input name="<?php echo $nt; ?>[<?php echo $ii; ?>][appKey]" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['appKey'], ENT_COMPAT, "UTF-8")), 'social-networks-auto-poster-facebook-twitter-g') ?>" />  
  89. <div style="width:100%;"><strong><?php echo $nType; ?> Consumer Secret:</strong> </div><input name="<?php echo $nt; ?>[<?php echo $ii; ?>][appSec]" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['appSec'], ENT_COMPAT, "UTF-8")), 'social-networks-auto-poster-facebook-twitter-g') ?>" /> <br/>  
  90. <div style="width:100%;"><strong><?php echo $nType; ?> Topic URL:</strong> </div>http://www.scoop.it/t/<input name="<?php echo $nt; ?>[<?php echo $ii; ?>][topicURL]" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['topicURL'], ENT_COMPAT, "UTF-8")), 'social-networks-auto-poster-facebook-twitter-g') ?>" /> <br/>  
  91. <br/>  
  92.  
  93. <div style="width:100%;"><strong id="altFormatText"><?php _e('Post Title Format', 'social-networks-auto-poster-facebook-twitter-g'); ?>:</strong> (<a href="#" id="msgFrmtT<?php echo $ntU.$ii; ?>HintInfo" onclick="mxs_showHideFrmtInfo('msgFrmtT<?php echo $ntU.$ii; ?>'); return false;"><?php _e('Show format info', 'social-networks-auto-poster-facebook-twitter-g'); ?></a>)</div>  
  94. <input name="<?php echo $nt; ?>[<?php echo $ii; ?>][msgTFrmt]" style="width: 50%;" value="<?php if (!empty($options['msgTFrmt'])) _e(apply_filters('format_to_edit', htmlentities($options['msgTFrmt'], ENT_COMPAT, "UTF-8")), 'social-networks-auto-poster-facebook-twitter-g'); else echo "%TITLE%"; ?>" onfocus="mxs_showFrmtInfo('msgFrmtT<?php echo $ntU.$ii; ?>');" /><?php nxs_doShowHint("msgFrmtT".$ntU.$ii); ?><br/>  
  95.  
  96. <div id="altFormat" style="margin-left: 0px;"> 
  97. <div style="width:100%;"><strong id="altFormatText"><?php _e('Text Format', 'social-networks-auto-poster-facebook-twitter-g'); ?>:</strong> (<a href="#" id="msgFrmt<?php echo $ntU; ?><?php echo $ii; ?>HintInfo" onclick="mxs_showHideFrmtInfo('msgFrmt<?php echo $ntU; ?><?php echo $ii; ?>'); return false;"><?php _e('Show format info', 'social-networks-auto-poster-facebook-twitter-g'); ?></a>) 
  98. </div> 
  99.  
  100. <textarea cols="150" rows="3" id="<?php echo $nt; ?><?php echo $ii; ?>msgFrmt" name="<?php echo $nt; ?>[<?php echo $ii; ?>][msgFrmt]" style="width:51%;max-width: 650px;" onfocus="jQuery('#<?php echo $nt; ?><?php echo $ii; ?>msgFrmt').attr('rows', 6); mxs_showFrmtInfo('msgFrmt<?php echo $ntU.$ii; ?>');"><?php if ($isNew) _e("%EXCERPT% \r\n\r\n%URL%", 'social-networks-auto-poster-facebook-twitter-g'); else _e(apply_filters('format_to_edit', htmlentities($options['msgFrmt'], ENT_COMPAT, "UTF-8")), 'social-networks-auto-poster-facebook-twitter-g'); ?></textarea><?php nxs_doShowHint("msgFrmt".$ntU.$ii); ?> 
  101. </div> 
  102.  
  103. <p style="margin-bottom: 20px;margin-top: 5px;"><input value="1" type="checkbox" name="<?php echo $nt; ?>[<?php echo $ii; ?>][inclTags]" <?php if ((int)$options['inclTags'] == 1) echo "checked"; ?> />  
  104. <strong><?php _e('Post with tags', 'social-networks-auto-poster-facebook-twitter-g'); ?></strong> <?php _e('Tags from the blogpost will be auto-posted to '.$ntInfo['name'], 'social-networks-auto-poster-facebook-twitter-g'); ?>  
  105. </p> 
  106.  
  107. <div style="width:100%;"><strong id="altFormatText">Post Type:</strong></div>  
  108. <div style="margin-left: 10px;"> 
  109. <input type="radio" name="<?php echo $nt; ?>[<?php echo $ii; ?>][postType]" value="T" <?php if ($options['postType'] == 'T') echo 'checked="checked"'; ?> /> <?php _e('Text Post', 'social-networks-auto-poster-facebook-twitter-g'); ?> - <i><?php _e('just text message', 'social-networks-auto-poster-facebook-twitter-g'); ?></i><br/>  
  110. <input type="radio" name="<?php echo $nt; ?>[<?php echo $ii; ?>][postType]" value="I" <?php if ($options['postType'] == 'I') echo 'checked="checked"'; ?> /> <?php _e('Image Post', 'social-networks-auto-poster-facebook-twitter-g'); ?> - <i><?php _e('big image with text message', 'social-networks-auto-poster-facebook-twitter-g'); ?></i><br/> 
  111. <input type="radio" name="<?php echo $nt; ?>[<?php echo $ii; ?>][postType]" value="A" <?php if ( !isset($options['postType']) || $options['postType'] == '' || $options['postType'] == 'A') echo 'checked="checked"'; ?> /> <?php _e('Add blogpost to message as an attachment', 'social-networks-auto-poster-facebook-twitter-g'); ?><br/> 
  112. </div> 
  113.  
  114. <br/><br/> 
  115. <?php if($options['appKey']=='') { ?> 
  116. <b><?php _e('Authorize Your '.$ntInfo['name'].' Account', 'social-networks-auto-poster-facebook-twitter-g'); ?></b> <?php _e('Please click "Update Settings" to be able to Authorize your account.', 'social-networks-auto-poster-facebook-twitter-g'); ?> 
  117. <?php } else { if(isset($options['appAppUserID']) && $options['appAppUserID']>0) { ?> 
  118. <?php _e('Your '.$ntInfo['name'].' Account has been authorized.', 'social-networks-auto-poster-facebook-twitter-g'); ?> User ID: <?php _e(apply_filters('format_to_edit', htmlentities($options['appAppUserID'].' - '.$options['appAppUserName'], ENT_COMPAT, "UTF-8")), 'social-networks-auto-poster-facebook-twitter-g') ?>. 
  119. <?php _e('You can', 'social-networks-auto-poster-facebook-twitter-g'); ?> Re- <?php } ?>  
  120. <a href="<?php echo $nxs_snapSetPgURL;?>&auth=<?php echo $nt; ?>&acc=<?php echo $ii; ?>">Authorize Your <?php echo $ntInfo['name']; ?> Account</a>  
  121.  
  122. <?php if (!isset($options['appAppUserID']) || $options['appAppUserID']<1) { ?> <div class="blnkg"><=== <?php _e('Authorize your account', 'social-networks-auto-poster-facebook-twitter-g'); ?> ===</div> <?php }?> 
  123. <?php } ?> 
  124. <br/><br/>  
  125.  
  126. <?php if ($isNew) { ?> <input type="hidden" name="<?php echo $nt; ?>[<?php echo $ii; ?>][apDo<?php echo $ntU; ?>]" value="1" id="apDoNew<?php echo $ntU; ?><?php echo $ii; ?>" /> <?php } ?> 
  127. <?php if (isset($options['appAppUserID']) && $options['appAppUserID']>0) { ?> 
  128.  
  129. <b><?php _e('Test your settings', 'social-networks-auto-poster-facebook-twitter-g'); ?>:</b>    <a href="#" class="NXSButton" onclick="testPost('<?php echo $ntU; ?>', '<?php echo $ii; ?>'); return false;"><?php printf( __( 'Submit Test Post to %s', 'social-networks-auto-poster-facebook-twitter-g' ), $nType); ?></a> <?php }  
  130. ?> 
  131.  
  132. </div> 
  133. <?php /** ######################## Tools Tab ####################### */ ?> 
  134. <?php if (!$isNew) { ?><div id="nsx<?php echo $nt.$ii ?>_tab2" class="nsx_tab_content">  
  135. <?php nxs_showCatTagsCTFilters($nt, $ii, $options); 
  136. nxs_addPostingDelaySelV3($nt, $ii, $options['nHrs'], $options['nMin'], $options['nDays']); 
  137. nxs_showRepostSettings($nt, $ii, $options); ?>  
  138. </div> <?php } ?> <?php /** #### End of Tab #### */ ?> 
  139. </div><br/> <?php /** #### End of Tabs #### */ ?> 
  140.  
  141. <div class="submitX nxclear" style="padding-bottom: 0px;"><input type="submit" class="button-primary" name="update_NS_SNAutoPoster_settings" value="<?php _e('Update Settings', 'social-networks-auto-poster-facebook-twitter-g') ?>" /></div> 
  142.  
  143.  
  144. </div><?php 
  145. //#### Set Unit Settings from POST 
  146. function setNTSettings($post, $options) { $code = $this->ntInfo['code'];  
  147. foreach ($post as $ii => $pval) {  
  148. if (isset($pval['appKey']) && $pval['appKey']!='') { if (!isset($options[$ii])) $options[$ii] = array(); 
  149.  
  150. if (isset($pval['apDo'.$code])) $options[$ii]['do'.$code] = $pval['apDo'.$code]; else $options[$ii]['do'.$code] = 0;  
  151. if (isset($pval['nName'])) $options[$ii]['nName'] = trim($pval['nName']);  
  152.  
  153. if (isset($pval['appKey'])) $options[$ii]['appKey'] = trim($pval['appKey']);  
  154. if (isset($pval['appSec'])) $options[$ii]['appSec'] = trim($pval['appSec']);  
  155. if (isset($pval['topicURL'])) $options[$ii]['topicURL'] = trim($pval['topicURL']);  
  156.  
  157.  
  158. if (isset($pval['catSel'])) $options[$ii]['catSel'] = trim($pval['catSel']); else $options[$ii]['catSel'] = 0; 
  159. if ($options[$ii]['catSel']=='1' && trim($pval['catSelEd'])!='') $options[$ii]['catSelEd'] = trim($pval['catSelEd']); else $options[$ii]['catSelEd'] = '';  
  160.  
  161. if (isset($pval['postType'])) $options[$ii]['postType'] = $pval['postType'];  
  162. if (isset($pval['inclTags'])) $options[$ii]['inclTags'] = trim($pval['inclTags']); else $options[$ii]['inclTags'] = 0; 
  163. if (isset($pval['msgFrmt'])) $options[$ii]['msgFrmt'] = trim($pval['msgFrmt']);  
  164. if (isset($pval['msgTFrmt'])) $options[$ii]['msgTFrmt'] = trim($pval['msgTFrmt']);  
  165.  
  166. $options[$ii] = nxs_adjRpst($options[$ii], $pval);  
  167.  
  168. if (isset($pval['delayDays'])) $options[$ii]['nDays'] = trim($pval['delayDays']); 
  169. if (isset($pval['delayHrs'])) $options[$ii]['nHrs'] = trim($pval['delayHrs']); if (isset($pval['delayMin'])) $options[$ii]['nMin'] = trim($pval['delayMin']);  
  170. if (isset($pval['qTLng'])) $options[$ii]['qTLng'] = trim($pval['qTLng']);  
  171. } elseif ( count($pval)==1 ) if (isset($pval['apDo'.$code])) $options[$ii]['do'.$code] = $pval['apDo'.$code]; else $options[$ii]['do'.$code] = 0;  
  172. } return $options; 
  173. }  
  174. //#### Show Post->Edit Meta Box Settings 
  175. function showEdPostNTSettings($ntOpts, $post) { global $nxs_plurl; $post_id = $post->ID; $nt = $this->ntInfo['lcode']; $ntU = $this->ntInfo['code']; 
  176. foreach($ntOpts as $ii=>$ntOpt) { $pMeta = maybe_unserialize(get_post_meta($post_id, 'snap'.$ntU, true));  
  177. if (is_array($pMeta) && isset($pMeta[$ii]) && is_array($pMeta[$ii])) $ntOpt = $this->adjMetaOpt($ntOpt, $pMeta[$ii]); if (empty($ntOpt['imgToUse'])) $ntOpt['imgToUse'] = ''; 
  178. $doIT = $ntOpt['do'.$ntU] && (is_array($pMeta) || $ntOpt['catSel']!='1'); $imgToUse = $ntOpt['imgToUse'];  
  179. $isAvail = $ntOpt['appKey']!='' && $ntOpt['appSec']!=''; $msgFormat = htmlentities($ntOpt['msgFrmt'], ENT_COMPAT, "UTF-8"); $msgFormatT = htmlentities($ntOpt['msgTFrmt'], ENT_COMPAT, "UTF-8");  
  180. $postType = $ntOpt['postType'];  
  181. ?>  
  182. <tr><th style="text-align:left;" colspan="2"> 
  183. <?php if ($ntOpt['catSel']=='1' && trim($ntOpt['catSelEd'])!='') { ?> <input type="hidden" class="nxs_SC" id="nxs_SC_<?php echo $ntU; ?><?php echo $ii; ?>" value="<?php echo $ntOpt['catSelEd']; ?>" /> <?php } ?> 
  184. <?php if (!empty($ntOpt['tagsSelX'])) { ?> <input type="hidden" class="nxs_TG" id="nxs_TG_<?php echo $ntU; ?><?php echo $ii; ?>" value="<?php echo $ntOpt['tagsSelX']; ?>" /> <?php } ?> 
  185. <?php if ($isAvail) { ?><input class="nxsGrpDoChb" value="1" id="do<?php echo $ntU.$ii; ?>" <?php if ($post->post_status == "publish") echo 'disabled="disabled"';?> type="checkbox" name="<?php echo $nt; ?>[<?php echo $ii; ?>][do<?php echo $ntU; ?>]" <?php if ((int)$doIT == 1) echo 'checked="checked" title="def"'; ?> />  
  186. <?php if ($post->post_status == "publish") { ?> <input type="hidden" name="<?php echo $nt; ?>[<?php echo $ii; ?>][do<?php echo $ntU; ?>]" value="<?php echo $doIT;?>"> <?php } ?> <?php } ?> 
  187.  
  188. <div class="nsx_iconedTitle" style="display: inline; font-size: 13px; background-image: url(<?php echo $nxs_plurl; ?>img/<?php echo $nt; ?>16.png);"><?php echo $this->ntInfo['name']; ?> - <?php _e('publish to', 'social-networks-auto-poster-facebook-twitter-g') ?> (<i style="color: #005800;"><?php echo $ntOpt['nName']; ?></i>)</div></th> <td><?php //## Only show RePost button if the post is "published" 
  189. if ($post->post_status == "publish" && $isAvail) { ?><input alt="<?php echo $ii; ?>" style="float: right;" onmouseout="hidePopShAtt('SV');" onmouseover="showPopShAtt('SV', event);" onclick="return false;" type="button" class="button" name="rePostTo<?php echo $ntU; ?>_repostButton" id="rePostTo<?php echo $ntU; ?>_button" value="<?php _e('Repost to '.$this->ntInfo['name'], 'social-networks-auto-poster-facebook-twitter-g') ?>" /> 
  190. <?php } ?> 
  191.  
  192. <?php if (is_array($pMeta) && is_array($pMeta[$ii]) && isset($pMeta[$ii]['pgID']) ) {  
  193.  
  194. ?> <span id="pstd<?php echo $ntU; ?><?php echo $ii; ?>" style="float: right;padding-top: 4px; padding-right: 10px;"> 
  195. <a style="font-size: 10px;" href="<?php echo $pMeta[$ii]['postURL']; ?>" target="_blank"><?php $nType=$this->ntInfo['name']; printf( __( 'Posted on', 'social-networks-auto-poster-facebook-twitter-g' ), $nType); ?> <?php echo (isset($pMeta[$ii]['pDate']) && $pMeta[$ii]['pDate']!='')?(" (".$pMeta[$ii]['pDate'].")"):""; ?></a> 
  196. </span><?php } ?> 
  197.  
  198. </td></tr>  
  199.  
  200. <?php if (!$isAvail) { ?><tr><th scope="row" style="text-align:right; width:150px; padding-top: 5px; padding-right:10px;"></th> <td><b>Setup your <?php echo $this->ntInfo['name']; ?> Account to AutoPost to <?php echo $this->ntInfo['name']; ?></b></td></tr> 
  201. <?php } else { if ($post->post_status != "publish" && function_exists('nxs_doSMAS5') ) { $ntOpt['postTime'] = get_post_time('U', false, $post_id); nxs_doSMAS5($nt, $ii, $ntOpt); } ?> 
  202.  
  203. <?php if ($ntOpt['rpstOn']=='1') { ?>  
  204.  
  205. <tr id="altFormat1" style=""><th scope="row" class="nxsTHRow"> 
  206. <input value="0" type="hidden" name="<?php echo $nt; ?>[<?php echo $ii; ?>][rpstPostIncl]"/><input value="nxsi<?php echo $ii; ?>ap" type="checkbox" name="<?php echo $nt; ?>[<?php echo $ii; ?>][rpstPostIncl]" <?php if (!empty($ntOpt['rpstPostIncl'])) echo "checked"; ?> />  
  207. </th> 
  208. <td> <?php _e('Include in "Auto-Reposting" to this network.', 'social-networks-auto-poster-facebook-twitter-g') ?> 
  209. </td></tr> <?php } ?> 
  210.  
  211. <tr id="altFormat1" style=""><th scope="row" style="vertical-align:top; padding-top: 6px; text-align:right; width:60px; padding-right:10px;"><?php _e('Title Format:', 'NS_SPAP') ?></th> 
  212. <td><input value="<?php echo $msgFormatT; ?>" type="text" name="<?php echo $nt; ?>[<?php echo $ii; ?>][msgTFrmt]" style="width:60%;max-width: 610px;" onfocus="jQuery('.nxs_FRMTHint').hide();mxs_showFrmtInfo('msgFrmtT<?php echo $nt.$ii; ?>');"/><?php nxs_doShowHint("msgFrmtT".$nt.$ii, '', '58'); ?></td></tr>  
  213.  
  214. <tr id="altFormat1" style=""><th scope="row" style="vertical-align:top; padding-top: 6px; text-align:right; width:60px; padding-right:10px;"><?php _e('Text Format:', 'social-networks-auto-poster-facebook-twitter-g') ?></th><td>  
  215.  
  216. <textarea cols="150" rows="1" id="<?php echo $nt.$ii; ?>msgFrmt" name="<?php echo $nt; ?>[<?php echo $ii; ?>][msgFrmt]" style="width:60%;max-width: 610px;" onfocus="jQuery('#<?php echo $nt.$ii; ?>msgFrmt').attr('rows', 4); jQuery('.nxs_FRMTHint').hide();mxs_showFrmtInfo('msgFrmt<?php echo $nt.$ii; ?>');"><?php echo $msgFormat ?></textarea> <?php nxs_doShowHint("msgFrmt".$nt.$ii, '', '58'); ?> 
  217.  
  218. </td></tr> 
  219.  
  220. <tr><th scope="row" style="text-align:right; width:150px; vertical-align:top; padding-top: 0px; padding-right:10px;"> <?php _e('Post Type:', 'social-networks-auto-poster-facebook-twitter-g') ?> <br/></th><td>  
  221. <input type="radio" name="<?php echo $nt; ?>[<?php echo $ii; ?>][postType]" value="T" <?php if ($postType == 'T') echo 'checked="checked"'; ?> /> <?php _e('Text Post', 'social-networks-auto-poster-facebook-twitter-g') ?> - <i><?php _e('just text message', 'social-networks-auto-poster-facebook-twitter-g') ?></i><br/> 
  222. <input type="radio" name="<?php echo $nt; ?>[<?php echo $ii; ?>][postType]" value="I" <?php if ($postType == 'I') echo 'checked="checked"'; ?> /> <?php _e('Post as "Image post"', 'social-networks-auto-poster-facebook-twitter-g') ?> - <i><?php _e('big image with text message', 'social-networks-auto-poster-facebook-twitter-g') ?></i><br/>  
  223. <input type="radio" name="<?php echo $nt; ?>[<?php echo $ii; ?>][postType]" value="A" <?php if ( !isset($postType) || $postType == '' || $postType == 'A') echo 'checked="checked"'; ?> /><?php _e('Text Post with "attached" blogpost', 'social-networks-auto-poster-facebook-twitter-g') ?> 
  224. </td></tr> 
  225.  
  226. <?php /** ## Select Image & URL ## */ nxs_showImgToUseDlg($nt, $ii, $imgToUse); ?> 
  227. <?php }  
  228.  
  229. //#### Save Meta Tags to the Post 
  230. function adjMetaOpt($optMt, $pMeta) { if (isset($pMeta['isPosted'])) $optMt['isPosted'] = $pMeta['isPosted']; else $optMt['isPosted'] = '';  
  231. if (isset($pMeta['doSC'])) $optMt['doSC'] = $pMeta['doSC'] == 1?1:0; else { if (isset($pMeta['msgFormat'])) $optMt['doSC'] = 0; }  
  232.  
  233. if (isset($pMeta['msgFrmt'])) $optMt['msgFrmt'] = $pMeta['msgFrmt']; if (isset($pMeta['msgTFrmt'])) $optMt['msgTFrmt'] = $pMeta['msgTFrmt']; 
  234. if (isset($pMeta['postType'])) $optMt['postType'] = $pMeta['postType']; 
  235.  
  236. if (isset($pMeta['imgToUse'])) $optMt['imgToUse'] = $pMeta['imgToUse']; if (isset($pMeta['urlToUse'])) $optMt['urlToUse'] = $pMeta['urlToUse'];  
  237. if (isset($pMeta['timeToRun'])) $optMt['timeToRun'] = $pMeta['timeToRun']; if (isset($pMeta['rpstPostIncl'])) $optMt['rpstPostIncl'] = $pMeta['rpstPostIncl'];  
  238. if (isset($pMeta['SNAPincludeSC']) && $pMeta['SNAPincludeSC'] == '1' ) $optMt['doSC'] = 1;  
  239. return $optMt; 
  240. }  
  241. }}