nxs_snapClassDL

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

Defined (1)

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

/inc-cl/dl.php  
  1. if (!class_exists("nxs_snapClassDL")) { class nxs_snapClassDL { 
  2. //#### Show Common Settings 
  3. function showGenNTSettings($ntOpts) { global $nxs_plurl; $ntInfo = array('code'=>'DL', 'lcode'=>'dl', 'name'=>'Delicious', 'defNName'=>'dlUName', 'tstReq' => false); ?>  
  4. <div class="nxs_box"> 
  5. <div class="nxs_box_header">  
  6. <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']; ?> 
  7. <?php $cbo = count($ntOpts); ?>  
  8. <?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 } ?> 
  9. </div> 
  10. </div> 
  11. <div class="nxs_box_inside"> 
  12. <?php foreach ($ntOpts as $indx=>$pbo) { if (trim($pbo['nName']=='')) $pbo['nName'] = $pbo[$ntInfo['defNName']]; ?> 
  13. <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' /> 
  14. <input value="0" name="<?php echo $ntInfo['lcode']; ?>[<?php echo $indx; ?>][apDo<?php echo $ntInfo['code']; ?>]" type="hidden" />  
  15. <?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 { ?>  
  16. <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"; ?> /> 
  17. <?php } ?> 
  18. <?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 } ?> 
  19. <?php if (isset($pbo['rpstOn']) && (int)$pbo['rpstOn'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popReActive');" onmouseover="nxs_showPopUpInfo('popReActive', event);"><?php echo "*[R]*" ?></span><?php } ?> 
  20. <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> 
  21.   <?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 } ?><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>   
  22. <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> 
  23. </p><div id="nxsNTSetDiv<?php echo $ntInfo['code'].$indx; ?>"></div><?php //$pbo['ntInfo'] = $ntInfo; $this->showNTSettings($indx, $pbo);  
  24. }?> 
  25. </div> 
  26. </div> <?php  
  27. }  
  28. //#### Show NEW Settings Page 
  29. function showNewNTSettings($mgpo) { $options = array('nName'=>'', 'doDL'=>'1', 'dlUName'=>'', 'dlPageID'=>'', 'dlAttch'=>'', 'dlPass'=>''); $options['ntInfo']= array('lcode'=>'dl'); $this->showNTSettings($mgpo, $options, true);} 
  30. //#### Show Unit Settings 
  31. function showNTSettings($ii, $options, $isNew=false) { global $nxs_plurl; $nt = $options['ntInfo']['lcode']; $ntU = strtoupper($nt);  
  32. 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'] = '';  
  33. if (!isset($options['nDays'])) $options['nDays'] = 0; if (!isset($options['qTLng'])) $options['qTLng'] = ''; ?> 
  34. <div id="doDL<?php echo $ii; ?>Div" class="insOneDiv<?php if ($isNew) echo " clNewNTSets"; ?>" style="max-width: 1000px; background-color: #EBF4FB; margin: 10px; border: 1px solid #808080; padding: 10px; display:none;"> <input type="hidden" name="apDoSDL<?php echo $ii; ?>" value="0" id="apDoSDL<?php echo $ii; ?>" />  
  35.  
  36. <div class="nsx_iconedTitle" style="float: right; background-image: url(<?php echo $nxs_plurl; ?>img/dl16.png);"><a style="font-size: 12px;" target="_blank" href="http://www.nextscripts.com/setup-installation-delicious-social-networks-auto-poster-wordpress/"><?php $nType="Delicious"; printf( __( 'Detailed %s Installation/Configuration Instructions', 'social-networks-auto-poster-facebook-twitter-g' ), $nType); ?></a></div> 
  37.  
  38. <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="dl[<?php echo $ii; ?>][nName]" id="dlnName<?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/> 
  39. <?php echo nxs_addQTranslSel('dl', $ii, $options['qTLng']); ?>  
  40.  
  41. <br/> 
  42. <ul class="nsx_tabs"> 
  43. <li><a href="#nsx<?php echo $nt.$ii ?>_tab1"><?php _e('Account Info', 'social-networks-auto-poster-facebook-twitter-g'); ?></a></li>  
  44. <?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 } ?> 
  45. </ul> 
  46. <div class="nsx_tab_container"><?php /** ######################## Account Tab ####################### */ ?> 
  47. <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%;"> 
  48.  
  49.  
  50. <div style="width:100%;"><strong>Delicious Username:</strong> </div><input name="dl[<?php echo $ii; ?>][apDLUName]" id="apDLUName" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['dlUName'], ENT_COMPAT, "UTF-8")), 'social-networks-auto-poster-facebook-twitter-g') ?>" />  
  51. <div style="width:100%;"><strong>Delicious Password:</strong> </div><input autocomplete="false" readonly onfocus="this.removeAttribute('readonly');" name="dl[<?php echo $ii; ?>][apDLPass]" id="apDLPass" type="password" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities(substr($options['dlPass'], 0, 5)=='n5g9a'?nsx_doDecode(substr($options['dlPass'], 5)):$options['dlPass'], ENT_COMPAT, "UTF-8")), 'social-networks-auto-poster-facebook-twitter-g') ?>" /> <br/>  
  52.  
  53. <?php if ($isNew) { ?> <input type="hidden" name="dl[<?php echo $ii; ?>][apDoDL]" value="1" id="apDoNewDL<?php echo $ii; ?>" /> <?php } ?> 
  54. <br/>  
  55.  
  56. <div id="altFormat" style=""> 
  57. <div style="width:100%;"><strong id="altFormatText"><?php _e('Post Title Format', 'social-networks-auto-poster-facebook-twitter-g'); ?></strong> (<a href="#" id="apDLTMsgFrmt<?php echo $ii; ?>HintInfo" onclick="mxs_showHideFrmtInfo('apDLTMsgFrmt<?php echo $ii; ?>'); return false;"><?php _e('Show format info', 'social-networks-auto-poster-facebook-twitter-g'); ?></a>)</div> 
  58.  
  59. <input name="dl[<?php echo $ii; ?>][apDLMsgTFrmt]" id="apDLMsgTFrmt" style="width: 50%;" value="<?php if ($isNew) echo "%TITLE%"; else _e(apply_filters('format_to_edit', htmlentities($options['dlMsgTFormat'], ENT_COMPAT, "UTF-8")), 'social-networks-auto-poster-facebook-twitter-g'); ?>" onfocus="mxs_showFrmtInfo('apDLTMsgFrmt<?php echo $ii; ?>');" /><?php nxs_doShowHint("apDLTMsgFrmt".$ii); ?> 
  60. </div>  
  61.  
  62. <div id="altFormat" style=""> 
  63. <div style="width:100%;"><strong id="altFormatText"><?php _e('Post Text Format', 'social-networks-auto-poster-facebook-twitter-g'); ?></strong> (<a href="#" id="apDLMsgFrmt<?php echo $ii; ?>HintInfo" onclick="mxs_showHideFrmtInfo('apDLMsgFrmt<?php echo $ii; ?>'); return false;"><?php _e('Show format info', 'social-networks-auto-poster-facebook-twitter-g'); ?></a>)</div> 
  64.  
  65. <textarea cols="150" rows="3" id="di<?php echo $ii; ?>SNAPformat" name="dl[<?php echo $ii; ?>][apDLMsgFrmt]" style="width:51%;max-width: 650px;" onfocus="jQuery('#dl<?php echo $ii; ?>SNAPformat').attr('rows', 6); mxs_showFrmtInfo('apDLMsgFrmt<?php echo $ii; ?>');"><?php if ($isNew) echo "%EXCERPT%"; else _e(apply_filters('format_to_edit', htmlentities($options['dlMsgFormat'], ENT_COMPAT, "UTF-8")), 'social-networks-auto-poster-facebook-twitter-g'); ?></textarea> 
  66.  
  67. <?php nxs_doShowHint("apDLMsgFrmt".$ii); ?> 
  68. </div><br/>  
  69.  
  70. <?php if ($options['dlPass']!='') { ?> 
  71.  
  72. <b><?php _e('Test your settings', 'social-networks-auto-poster-facebook-twitter-g'); ?>:</b>    <a href="#" class="NXSButton" onclick="testPost('DL', '<?php echo $ii; ?>'); return false;"><?php printf( __( 'Submit Test Post to %s', 'social-networks-auto-poster-facebook-twitter-g' ), $nType); ?></a>  
  73.  
  74. <?php }  
  75.  
  76. ?></div> 
  77. <?php /** ######################## Advanced Tab ####################### */ ?> 
  78. <?php if (!$isNew) { ?> <div id="nsx<?php echo $nt.$ii ?>_tab2" class="nsx_tab_content"> 
  79.  
  80. <?php nxs_showCatTagsCTFilters($nt, $ii, $options);  
  81. nxs_addPostingDelaySelV3($nt, $ii, $options['nHrs'], $options['nMin'], $options['nDays']);  
  82. nxs_showRepostSettings($nt, $ii, $options); ?>  
  83.  
  84.  
  85. </div> <?php } ?> <?php /** #### End of Tab #### */ ?> 
  86. </div><br/> <?php /** #### End of Tabs #### */ ?> 
  87.  
  88. <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></div><?php 
  89. //#### Set Unit Settings from POST 
  90. function setNTSettings($post, $options) {$code = 'DL'; $lcode = 'dl';  
  91. foreach ($post as $ii => $pval) {  
  92. if (!empty($pval['apDLUName']) && !empty($pval['apDLPass'])) { if (!isset($options[$ii])) $options[$ii] = array(); 
  93. if (isset($pval['apDLUName'])) $options[$ii]['dlUName'] = trim($pval['apDLUName']); 
  94. if (isset($pval['nName'])) $options[$ii]['nName'] = trim($pval['nName']); 
  95. if (isset($pval['apDLPass'])) $options[$ii]['dlPass'] = 'n5g9a'.nsx_doEncode($pval['apDLPass']); else $options[$ii]['dlPass'] = '';  
  96.  
  97. if (isset($pval['catSel'])) $options[$ii]['catSel'] = trim($pval['catSel']); else $options[$ii]['catSel'] = 0; 
  98. if ($options[$ii]['catSel']=='1' && trim($pval['catSelEd'])!='') $options[$ii]['catSelEd'] = trim($pval['catSelEd']); else $options[$ii]['catSelEd'] = ''; 
  99.  
  100. if (isset($pval['apDLMsgFrmt'])) $options[$ii]['dlMsgFormat'] = trim($pval['apDLMsgFrmt']);  
  101. if (isset($pval['apDLMsgTFrmt'])) $options[$ii]['dlMsgTFormat'] = trim($pval['apDLMsgTFrmt']);  
  102. if (isset($pval['apDoDL'])) $options[$ii]['doDL'] = $pval['apDoDL']; else $options[$ii]['doDL'] = 0;  
  103.  
  104. $options[$ii] = nxs_adjRpst($options[$ii], $pval);  
  105.  
  106. if (isset($pval['delayDays'])) $options[$ii]['nDays'] = trim($pval['delayDays']); 
  107. if (isset($pval['delayHrs'])) $options[$ii]['nHrs'] = trim($pval['delayHrs']); if (isset($pval['delayMin'])) $options[$ii]['nMin'] = trim($pval['delayMin']);  
  108. if (isset($pval['qTLng'])) $options[$ii]['qTLng'] = trim($pval['qTLng']);  
  109. } elseif ( count($pval)==1 ) if (isset($pval['apDo'.$code])) $options[$ii]['do'.$code] = $pval['apDo'.$code]; else $options[$ii]['do'.$code] = 0;  
  110. } return $options; 
  111. }  
  112. //#### Show Post->Edit Meta Box Settings 
  113. function showEdPostNTSettings($ntOpts, $post) { global $nxs_plurl; $post_id = $post->ID; $nt = 'dl'; $ntU = 'DL'; 
  114. foreach($ntOpts as $ii=>$ntOpt) { $pMeta = maybe_unserialize(get_post_meta($post_id, 'snapDL', true)); if (is_array($pMeta)) $ntOpt = $this->adjMetaOpt($ntOpt, $pMeta[$ii]);  
  115. $doDL = $ntOpt['doDL'] && (is_array($pMeta) || $ntOpt['catSel']!='1');  
  116. $isAvailDL = $ntOpt['dlUName']!='' && $ntOpt['dlPass']!=''; $dlMsgFormat = htmlentities($ntOpt['dlMsgFormat'], ENT_COMPAT, "UTF-8"); $dlMsgTFormat = htmlentities($ntOpt['dlMsgTFormat'], ENT_COMPAT, "UTF-8");  
  117. ?>  
  118. <tr><th style="text-align:left;" colspan="2"> 
  119. <?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 } ?> 
  120. <?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 } ?> 
  121. <?php if ($isAvailDL) { ?><input class="nxsGrpDoChb" value="1" id="doDL<?php echo $ii; ?>" <?php if ($post->post_status == "publish") echo 'disabled="disabled"';?> type="checkbox" name="dl[<?php echo $ii; ?>][doDL]" <?php if ((int)$doDL == 1) echo 'checked="checked" title="def"'; ?> />  
  122. <?php if ($post->post_status == "publish") { ?> <input type="hidden" name="dl[<?php echo $ii; ?>][doDL]" value="<?php echo $doDL;?>"> <?php } ?> <?php } ?> 
  123.  
  124. <div class="nsx_iconedTitle" style="display: inline; font-size: 13px; background-image: url(<?php echo $nxs_plurl; ?>img/dl16.png);">Delicious - <?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" 
  125. if ($post->post_status == "publish" && $isAvailDL) { ?><input alt="<?php echo $ii; ?>" style="float: right;" onmouseout="hidePopShAtt('SV');" onmouseover="showPopShAtt('SV', event);" onclick="return false;" type="button" class="button" name="rePostToDL_repostButton" id="rePostToDL_button" value="<?php _e('Repost to Delicious', 'social-networks-auto-poster-facebook-twitter-g') ?>" /> 
  126. <?php } ?> 
  127.  
  128. <?php if (is_array($pMeta) && is_array($pMeta[$ii]) && isset($pMeta[$ii]['pgID']) ) {  
  129. ?> <span id="pstdDL<?php echo $ii; ?>" style="float: right; padding-top: 4px; padding-right: 10px;"> 
  130. <a style="font-size: 10px;" href="http://delicious.com/<?php echo $ntOpt['dlUName']; ?>" target="_blank"><?php $nType="Delicious"; printf( __( 'Posted on', 'social-networks-auto-poster-facebook-twitter-g' ), $nType); ?> <?php echo (isset($pMeta[$ii]['pDate']) && $pMeta[$ii]['pDate']!='')?(" (".$pMeta[$ii]['pDate'].")"):""; ?></a> 
  131. </span><?php } ?> 
  132.  
  133. </td></tr>  
  134.  
  135. <?php if (!$isAvailDL) { ?><tr><th scope="row" style="text-align:right; width:150px; padding-top: 5px; padding-right:10px;"></th> <td><b>Setup your Delicious Account to AutoPost to Delicious</b> 
  136. <?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); } ?> 
  137.  
  138. <?php if ($ntOpt['rpstOn']=='1') { ?>  
  139.  
  140. <tr id="altFormat1" style=""><th scope="row" class="nxsTHRow"> 
  141. <input value="0" type="hidden" name="<?php echo $nt; ?>[<?php echo $ii; ?>][rpstPostIncl]"/><input value="nxsi<?php echo $ii; ?>dl" type="checkbox" name="<?php echo $nt; ?>[<?php echo $ii; ?>][rpstPostIncl]" <?php if (!empty($ntOpt['rpstPostIncl'])) echo "checked"; ?> />  
  142. </th> 
  143. <td> <?php _e('Include in "Auto-Reposting" to this network.', 'social-networks-auto-poster-facebook-twitter-g') ?>  
  144. </td></tr> <?php } ?> 
  145.  
  146.  
  147. <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:', 'social-networks-auto-poster-facebook-twitter-g') ?></th> 
  148. <td><input class="nxs_postEditCtrl" value="<?php echo $dlMsgTFormat ?>" type="text" name="dl[<?php echo $ii; ?>][SNAPformatT]" style="width:60%;max-width: 610px;" onfocus="jQuery('.nxs_FRMTHint').hide();mxs_showFrmtInfo('apDLTMsgFrmt<?php echo $ii; ?>');"/><?php nxs_doShowHint("apDLTMsgFrmt".$ii, '', '58'); ?></td></tr> 
  149.  
  150. <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> 
  151. <td>  
  152. <textarea class="nxs_postEditCtrl" cols="150" rows="1" id="dl<?php echo $ii; ?>SNAPformat" name="dl[<?php echo $ii; ?>][SNAPformat]" style="width:60%;max-width: 610px;" onfocus="jQuery('#dl<?php echo $ii; ?>SNAPformat').attr('rows', 4); jQuery('.nxs_FRMTHint').hide();mxs_showFrmtInfo('apDLMsgFrmt<?php echo $ii; ?>');"><?php echo $dlMsgFormat; ?></textarea> 
  153. <?php nxs_doShowHint("apDLMsgFrmt".$ii, '', '58'); ?></td></tr> 
  154. <?php }  
  155. //#### Save Meta Tags to the Post 
  156. function adjMetaOpt($optMt, $pMeta) { if (isset($pMeta['isPosted'])) $optMt['isPosted'] = $pMeta['isPosted']; else $optMt['isPosted'] = '';  
  157. if (isset($pMeta['SNAPformat'])) $optMt['dlMsgFormat'] = $pMeta['SNAPformat'];  
  158. if (isset($pMeta['SNAPformatT'])) $optMt['dlMsgTFormat'] = $pMeta['SNAPformatT'];  
  159. if (isset($pMeta['imgToUse'])) $optMt['imgToUse'] = $pMeta['imgToUse'];  
  160. if (isset($pMeta['timeToRun'])) $optMt['timeToRun'] = $pMeta['timeToRun']; if (isset($pMeta['rpstPostIncl'])) $optMt['rpstPostIncl'] = $pMeta['rpstPostIncl'];  
  161. if (isset($pMeta['doDL'])) $optMt['doDL'] = $pMeta['doDL'] == 1?1:0; else { if (isset($pMeta['SNAPformat'])) $optMt['doDL'] = 0; }  
  162. if (isset($pMeta['SNAPincludeDL']) && $pMeta['SNAPincludeDL'] == '1' ) $optMt['doDL'] = 1;  
  163. return $optMt; 
  164. }  
  165. }}