NextScripts: Social Networks Auto-Poster - Version 2.6.3

Version Description

[02/07/2013] =

  • Improvement/Bug fix - Twitter - Better hashtags support.
  • Improvement - Bigger "text format" area for facebook and G+
  • Bug fix - Previously shedulled posts were not autoposted.
  • Bug fix - VK - Open community autoposting fixed.
  • Bug fix - LinkedIn - Immideate Posting problems fixed.
Download this release

Release Info

Developer NextScripts
Plugin Icon 128x128 NextScripts: Social Networks Auto-Poster
Version 2.6.3
Comparing to
See all releases

Code changes from version 2.5.5 to 2.6.3

NextScripts_SNAP.php CHANGED
@@ -4,11 +4,11 @@ Plugin Name: NextScripts: Social Networks Auto-Poster
4
  Plugin URI: http://www.nextscripts.com/social-networks-auto-poster-for-wordpress
5
  Description: This plugin automatically publishes posts from your blog to multiple accounts on Facebook, Twitter, and Google+ profiles and/or pages.
6
  Author: Next Scripts
7
- Version: 2.5.5
8
  Author URI: http://www.nextscripts.com
9
  Copyright 2012 Next Scripts, Inc
10
  */
11
- define( 'NextScripts_SNAP_Version' , '2.5.5' ); require_once "nxs_functions.php";
12
  //## Include All Available Networks
13
  global $nxs_snapAvNts, $nxs_snapThisPageUrl, $nxs_plurl, $nxs_isWPMU, $nxs_tpWMPU;
14
  $nxs_snapAvNts = array(); foreach (glob(plugin_dir_path( __FILE__ ).'inc-cl/*.php') as $filename){ require_once $filename; }
@@ -23,7 +23,7 @@ if (!class_exists("NS_SNAutoPoster")) {
23
  var $dbOptionsName = "NS_SNAutoPoster";
24
  var $nxs_options = ""; var $nxs_ntoptions = "";
25
 
26
- function __construct() { $this->nxs_options = $this->getAPOptions();}
27
  //## Constructor
28
  function NS_SNAutoPoster() { }
29
  //## Initialization function
@@ -121,6 +121,8 @@ define('WP_ALLOW_MULTISITE', true);<br/>to<br/>define('WP_ALLOW_MULTISITE', fals
121
  }
122
  }
123
 
 
 
124
  if (isset($_POST['update_NS_SNAutoPoster_settings'])) { if (get_magic_quotes_gpc()) {array_walk_recursive($_POST, 'nsx_stripSlashes');} array_walk_recursive($_POST, 'nsx_fixSlashes');
125
  //## Load Networks Settings
126
  foreach ($nxs_snapAvNts as $avNt) if (isset($_POST[$avNt['lcode']])) { $clName = 'nxs_snapClass'.$avNt['code']; if (!isset($options[$avNt['lcode']])) $options[$avNt['lcode']] = array();
@@ -140,13 +142,15 @@ define('WP_ALLOW_MULTISITE', true);<br/>to<br/>define('WP_ALLOW_MULTISITE', fals
140
  if (isset($_POST['nsOpenGraph'])) $options['nsOpenGraph'] = $_POST['nsOpenGraph']; else $options['nsOpenGraph'] = 0;
141
  if (isset($_POST['imgNoCheck'])) $options['imgNoCheck'] = 0; else $options['imgNoCheck'] = 1;
142
  if (isset($_POST['useForPages'])) $options['useForPages'] = 1; else $options['useForPages'] = 0;
143
-
144
-
145
  if (isset($_POST['showPrxTab'])) $options['showPrxTab'] = 1; else $options['showPrxTab'] = 0;
146
  if (isset($_POST['useRndProxy'])) $options['useRndProxy'] = 1; else $options['useRndProxy'] = 0;
147
 
148
  if (isset($_POST['prxList'])) $options['prxList'] = $_POST['prxList'];
 
149
 
 
 
150
 
151
  if (isset($_POST['useUnProc'])) $options['useUnProc'] = $_POST['useUnProc']; else $options['useUnProc'] = 0;
152
  if (isset($_POST['nxsCPTSeld'])) $options['nxsCPTSeld'] = serialize($_POST['nxsCPTSeld']);
@@ -160,7 +164,7 @@ define('WP_ALLOW_MULTISITE', true);<br/>to<br/>define('WP_ALLOW_MULTISITE', fals
160
  foreach ($options['whoCanSeeSNAPBox'] as $uRole) { $role = get_role($uRole); $role->add_cap('see_snap_box'); }
161
 
162
  update_option($this->dbOptionsName, $options); // prr($options);
163
- ?><div class="updated"><p><strong><?php _e("Settings Updated.", "NS_SNAutoPoster");?></strong></p></div><?php
164
  }
165
  $isNoNts = true; foreach ($nxs_snapAvNts as $avNt) if (isset($options[$avNt['lcode']]) && is_array($options[$avNt['lcode']]) && count($options[$avNt['lcode']])>0) {$isNoNts = false; break;}
166
 
@@ -170,8 +174,12 @@ if ( is_array($category_ids) && is_array($pk) && count($category_ids) == count($
170
  <?php }
171
 
172
  if(!$nxs_isWPMU) $this->NS_SNAP_ShowPageTop(); ?>
173
- Please see the <a target="_blank" href="http://www.nextscripts.com/installation-of-social-networks-auto-poster-for-wordpress">detailed installation/configuration instructions</a> (will open in a new tab)<br/><br/>
174
-
 
 
 
 
175
 
176
  <ul class="nsx_tabs">
177
  <li><a href="#nsx_tab1">Your Social Networks Accounts</a></li>
@@ -183,7 +191,7 @@ if ( is_array($category_ids) && is_array($pk) && count($category_ids) == count($
183
  <form method="post" id="nsStForm" action="<?php echo $nxs_snapThisPageUrl?>">
184
  <div class="nsx_tab_container">
185
  <div id="nsx_tab1" class="nsx_tab_content"><a href="#" class="NXSButton" id="nxs_snapAddNew">Add new account</a> <div class="nxsInfoMsg"><img style="position: relative; top: 8px;" alt="Arrow" src="<?php echo $nxs_plurl; ?>img/arrow_l_green_c1.png"/> You can add Facebook, Twitter, Google+, Pinterest, LinkedIn, Tumblr, Blogger/Blogspot, Delicious, etc accounts</div><br/><br/>
186
- <div id="nxs_spPopup"><span class="nxspButton bClose"><span>X</span></span>Add New Network: <select onchange="doShowFillBlockX(this.value);" id="nxs_ntType"><option value =""></option>
187
  <?php foreach ($nxs_snapAvNts as $avNt) { if (!isset($options[$avNt['lcode']]) || count($options[$avNt['lcode']])==0) $mt=0; else $mt = 1+max(array_keys($options[$avNt['lcode']]));
188
  echo '<option value ="'.$avNt['code'].$mt.'">'.$avNt['name'].'</option>';
189
  } ?>
@@ -216,11 +224,11 @@ if ( is_array($category_ids) && is_array($pk) && count($category_ids) == count($
216
 
217
  <div style="float: right; padding: 1.5em;">
218
 
219
- <input onclick="nxs_expSettings(); return false;" type="button" class="button" name="expSettings_repostButton" id="expSettings_button" value="<?php _e('Export Settings', 'expSettings') ?>" />
220
- <input onclick="jQuery('#impFileSettings_button').click(); return false;" type="button" class="button" name="impSettings_repostButton" id="impSettings_button" value="<?php _e('Import Settings', 'impSettings') ?>" />
221
  </div>
222
 
223
- <div class="submit"><input type="submit" id="nxs-button-primary-submit" class="button-primary" name="update_NS_SNAutoPoster_settings" value="<?php _e('Update Settings', 'NS_SNAutoPoster') ?>" /></div>
224
 
225
  <?php } ?>
226
  </div> <!-- END TAB -->
@@ -251,6 +259,14 @@ if ( is_array($category_ids) && is_array($pk) && count($category_ids) == count($
251
  if ($role=='subscriber') echo ' - Somebody who can only manage their profile';
252
  echo '<br/>';
253
  } ?>
 
 
 
 
 
 
 
 
254
 
255
  <h3 style="font-size: 14px; margin-bottom: 2px;">Include/Exclude Custom Post Types</h3> <?php $nxsOne = base64_encode("v=".$nxsOne); ?>
256
  <p style="font-size: 11px; margin: 0px;">Select Custom Post Types that you would to be published on your social networks</p>
@@ -267,12 +283,7 @@ if ( is_array($category_ids) && is_array($pk) && count($category_ids) == count($
267
  ?>
268
  </select>
269
 
270
- <h3 style="font-size: 14px; margin-bottom: 2px;">Use for pages</h3>
271
-
272
- <p style="margin: 0px;margin-left: 5px;"><input value="set" id="useForPages" name="useForPages" type="checkbox" <?php if ((int)$options['useForPages'] != 1) echo "checked"; ?> />
273
- <strong>Use for pages</strong>
274
- <span style="font-size: 11px; margin-left: 1px;">Show the metabox and autopost for pages.</span>
275
- </p>
276
 
277
  <div style="width:500px;"><strong style="font-size: 14px;"><br/>Categories to Include/Exclude:</strong>
278
  <p style="font-size: 11px; margin: 0px;">Each blogpost will be autoposted to all categories selected below. All categories are selected by default.
@@ -309,12 +320,32 @@ function nxs_chAllCats(ch){
309
 
310
  <!-- ##################### URL Shorthener #####################-->
311
  <br/>
312
- <h3 style="font-size: 14px; margin-bottom: 2px;">URL Shorthener</h3>
313
  &nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="nxsURLShrtnr" value="G" <?php if (!isset($options['nxsURLShrtnr']) || $options['nxsURLShrtnr']=='' || $options['nxsURLShrtnr']=='G') echo 'checked="checked"'; ?> /> gd.is (Default) - fast, simple, free, no configuration nessesary.<br/>
314
  <?php if (function_exists('wp_get_shortlink')) { ?> &nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="nxsURLShrtnr" value="W" <?php if (isset($options['nxsURLShrtnr']) && $options['nxsURLShrtnr']=='W') echo 'checked="checked"'; ?> /> Wordpress Built-in Shortener (wp.me if you use Jetpack)<br/> <?php } ?>
315
  &nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="nxsURLShrtnr" value="B" <?php if (isset($options['nxsURLShrtnr']) && $options['nxsURLShrtnr']=='B') echo 'checked="checked"'; ?> /> bit.ly - <i>Enter bit.ly username and <a target="_blank" href="http://bitly.com/a/your_api_key">API Key</a> below</i><br/>
316
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bit.ly Username: <input name="bitlyUname" style="width: 20%;" value="<?php if (isset($options['bitlyUname'])) _e(apply_filters('format_to_edit',$options['bitlyUname']), 'NS_SNAutoPoster') ?>" /><br/>
317
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bit.ly&nbsp;&nbsp;API Key:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input name="bitlyAPIKey" style="width: 20%;" value="<?php if (isset($options['bitlyAPIKey'])) _e(apply_filters('format_to_edit',$options['bitlyAPIKey']), 'NS_SNAutoPoster') ?>" /><br/>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
318
 
319
  <!-- ##################### Open Graph #####################-->
320
 
@@ -332,14 +363,14 @@ function nxs_chAllCats(ch){
332
  </div>
333
 
334
  <strong style="font-size: 11px; margin: 10px; margin-left: 10px;">Default Image URL for og:image tag:</strong>
335
- <input name="ogImgDef" style="width: 30%;" value="<?php if (isset($options['ogImgDef'])) _e(apply_filters('format_to_edit',$options['ogImgDef']), 'NS_SNAutoPoster') ?>" />
336
 
337
  </div>
338
 
339
  <h3 style="font-size: 14px; margin-bottom: 2px;">Alternative "Featured Image" location</h3> <span style="font-size: 11px; margin-left: 1px;">Plugin uses standard Wordpress Featured Image by default. If your theme stores "Featured Image" in the custom field, please enter the name of it. Use prefix if your custom field has only partial location.</span>
340
  <br/>
341
- Custom field name: <input name="featImgLoc" style="width: 200px;" value="<?php if (isset($options['featImgLoc'])) _e(apply_filters('format_to_edit',$options['featImgLoc']), 'NS_SNAutoPoster') ?>" /> <br/>
342
- Custom field Image Prefix: <input name="featImgLocPrefix" style="width: 200px;" value="<?php if (isset($options['featImgLocPrefix'])) _e(apply_filters('format_to_edit',$options['featImgLocPrefix']), 'NS_SNAutoPoster') ?>" />
343
 
344
 
345
  <h3 style="font-size: 14px; margin-bottom: 2px;">Verify "Featured" Image</h3>
@@ -349,6 +380,8 @@ function nxs_chAllCats(ch){
349
  <span style="font-size: 11px; margin-left: 1px;">Advanced Setting. Uncheck only if you are 100% sure that your images are valid or if you have troubles with image verification.</span>
350
  </p>
351
 
 
 
352
  <?php if (function_exists("nxs_showPRXTab")) { ?>
353
 
354
  <h3 style="font-size: 14px; margin-bottom: 2px;">Show "Proxies" Tab</h3>
@@ -359,7 +392,7 @@ function nxs_chAllCats(ch){
359
  </p>
360
  <?php } ?>
361
 
362
- <div class="submit"><input type="submit" class="button-primary" name="update_NS_SNAutoPoster_settings" value="<?php _e('Update Settings', 'NS_SNAutoPoster') ?>" /></div>
363
 
364
  </div>
365
  <?php if ((function_exists("nxs_showPRXTab")) && (int)$options['showPrxTab'] == 1) { nxs_showPRXTab($options); } ?>
@@ -491,6 +524,7 @@ Please see #4 and #5 for Twitter:<br/>
491
 
492
  <br/>&nbsp;<br/> <?php
493
  }
 
494
 
495
  function NS_SNAP_ShowPageTop(){ global $nxs_snapAvNts, $nxs_snapThisPageUrl, $nxsOne, $nxs_plurl, $nxs_isWPMU; $nxsOne = ''; $options = $this->nxs_options;
496
  $nxsOne = NextScripts_SNAP_Version; if (defined('NXSAPIVER')) $nxsOne .= " (<span id='nxsAPIUpd'>API</span> Version: ".NXSAPIVER.")"; ?>
@@ -498,27 +532,27 @@ Please see #4 and #5 for Twitter:<br/>
498
 
499
  <div style="float:right; padding-top: 10px; padding-right: 10px;">
500
  <div style="float:right; text-align: center;"><a target="_blank" href="http://www.nextscripts.com"><img src="<?php echo $nxs_plurl; ?>img/Next_Scripts_Logo2.1-HOR-100px.png"></a><br/>
501
- <a style="font-weight: normal; font-size: 16px; line-height: 24px;" target="_blank" href="http://www.nextscripts.com/support">[Contact support]</a>
502
- <?php if(!$options['isMA']) { ?><br/> <span style="color:#800000;">Ready to to Upgrade to Multiple Accounts Edition<br/> and get Google+ and Pinterest Auto-Posting?</span>
503
- <?php if(function_exists('nxsDoLic_ajax')) { ?> <br/><a style="font-weight: normal; font-size: 12px; line-height: 24px;" target="_blank" id="showLic" href="#">[Enter your Activation Key]</a>&nbsp;&nbsp;&nbsp;&nbsp; <?php } ?>
504
- <a target="_blank" href="http://www.nextscripts.com/social-networks-auto-poster-for-wp-multiple-accounts#getit">[Get It here]</a> <?php } ?>
505
  </div>
506
- <div id="showLicForm"><span class="nxspButton bClose"><span>X</span></span><div style="position: absolute; right: 10px; top:10px; font-family: 'News Cycle'; font-size: 34px; font-weight: lighter;">Activation</div>
507
  <br/><br/>
508
- <h3>Multiple Accounts Edition and Google+ and Pinterest Auto-Posting</h3><br/>You can find your key on this page: <a href="http://www.nextscripts.com/mypage">http://www.nextscripts.com/mypage</a>
509
- <br/><br/> Enter your Key: <input name="eLic" id="eLic" style="width: 50%;"/>
510
  <input type="button" class="button-primary" name="eLicDo" onclick="doLic();" value="Enter" />
511
- <br/><br/>Your plugin will be automatically upgraded. <?php wp_nonce_field( 'doLic', 'doLic_wpnonce' ); ?>
512
  </div>
513
  </div>
514
 
515
 
516
- <div class=wrap><h2>Next Scripts: Social Networks Auto Poster Options</h2> Plugin Version: <span style="color:#008000;font-weight: bold;"><?php echo $nxsOne; ?></span> <?php if($options['isMA']) { ?> [Pro - Multiple Accounts Edition]&nbsp;&nbsp;<?php } else {?>
517
  <span style="color:#800000; font-weight: bold;">[Single Accounts Edition]</span>
518
  <?php if(!$nxs_isWPMU) { ?>
519
- - <a target="_blank" href="http://www.nextscripts.com/social-networks-auto-poster-for-wp-multiple-accounts">Get PRO - Multiple Accounts Edition</a><br/><br/>
520
 
521
- Here you can setup "Social Networks Auto Poster".<br/> You can start by clicking "Add new account" button and choosing the Social Network you would like to add.<?php }} ?><br/>
522
  <?php
523
  if (!function_exists('curl_init')) {
524
  echo ("<br/><b style='font-size:16px; color:red;'>Error: No CURL Found</b> <br/><i>Social Networks AutoPoster needs the CURL PHP extension. Please install it or contact your hosting company to install it.</i><br/>");
@@ -530,29 +564,30 @@ Please see #4 and #5 for Twitter:<br/>
530
  */
531
  ?>
532
 
533
- <?php if (function_exists('yoast_analytics')) { ?>
534
- <div class="error" id="message"><p><strong>You have Google Analytics Plugin installed and activated.</strong> This plugin hijacks the authorization workflow. Please temporary <a href="<?php echo admin_url();?>/plugins.php">deactivate</a> Google Analytics plugin, do all authorizations and then activate it back.</div>
 
535
  <?php }
536
  }
537
 
538
- function NS_SNAP_SavePostMetaTags($id) { global $nxs_snapAvNts, $plgn_NS_SNAutoPoster; if (!isset($plgn_NS_SNAutoPoster)) return; $options = $plgn_NS_SNAutoPoster->nxs_options;
539
- $post = get_post($id); if ($post->post_type=='revision') return; if (isset($_POST["SNAPEdit"])) $nspost_edit = $_POST["SNAPEdit"];
 
540
  if (isset($nspost_edit) && !empty($nspost_edit)) { delete_post_meta($id, 'snapEdIT'); add_post_meta($id, 'snapEdIT', '1' );
541
  foreach ($nxs_snapAvNts as $avNt) {
542
  if (count($options[$avNt['lcode']])>0 && isset($_POST[$avNt['lcode']]) && count($_POST[$avNt['lcode']])>0) { $savedMeta = maybe_unserialize(get_post_meta($id, 'snap'.$avNt['code'], true));
543
  if(is_array($_POST[$avNt['lcode']])) { $ii=0;
544
  foreach ($_POST[$avNt['lcode']] as $pst ) {
545
- if (is_array($pst) && $pst['SNAPinclude'.$avNt['code']]=='') $_POST[$avNt['lcode']][$ii]['SNAPinclude'.$avNt['code']]= 0; $ii++;
546
  }
547
- } $newMeta = $_POST[$avNt['lcode']]; // prr($newMeta); echo "~~~~~";
548
- if (is_array($savedMeta) && is_array($newMeta)) $newMeta = nxsMergeArraysOV($savedMeta, $newMeta); // echo "## snap".$avNt['code']; prr($savedMeta); echo "||"; prr($newMeta);
549
- delete_post_meta($id, 'snap'.$avNt['code']); add_post_meta($id, 'snap'.$avNt['code'], $newMeta);
550
  }
551
  }
552
  } // prr($_POST);
553
  }
554
 
555
-
556
  function NS_SNAP_AddPostMetaTags() { global $post, $nxs_snapAvNts, $plgn_NS_SNAutoPoster; $post_id = $post; if (is_object($post_id)) $post_id = $post_id->ID; if (!is_object($post)) $post = get_post($post_id);
557
  if (!isset($plgn_NS_SNAutoPoster)) return; $options = $plgn_NS_SNAutoPoster->nxs_options;
558
  ?>
@@ -563,31 +598,28 @@ Please see #4 and #5 for Twitter:<br/>
563
  </style>
564
 
565
  <input value="SNAPEdit" type="hidden" name="SNAPEdit" />
566
- <div class="popShAtt" style="width: 200px;" id="popShAttSV">Please "Update" the post before reposting, if you made any changes to the format</div>
567
  <?php if($post->post_status != "publish" ) { ?>
568
  <div style="float: right;"> <input type="hidden" id="nxsLockIt" value="0" />
569
- <a href="#" onclick="jQuery('#nxsLockIt').val('1'); jQuery('.nxsGrpDoChb').attr('checked','checked'); return false;">Check All</a>&nbsp;<a href="#" onclick="jQuery('#nxsLockIt').val('1');jQuery('.nxsGrpDoChb').removeAttr('checked'); return false;">Uncheck All</a>
570
  </div>
571
  <?php } ?>
572
-
573
-
574
- <table style="margin-bottom:40px; clear:both;" width="100%" border="0"><?php
575
-
576
  foreach ($nxs_snapAvNts as $avNt) { $clName = 'nxs_snapClass'.$avNt['code'];
577
  if (count($options[$avNt['lcode']])>0) { $ntClInst = new $clName(); $ntClInst->showEdPostNTSettings($options[$avNt['lcode']], $post); }
578
  }
579
  ?></table></div></div></div> <?php
580
  }
581
  //## Add MetaBox to Post->Edit
582
- function NS_SNAP_addCustomBoxes() { add_meta_box( 'NS_SNAP_AddPostMetaTags', __( 'NextScripts: Social Networks Auto Poster - Post Options', 'NS_SNAutoPoster' ), array($this, 'NS_SNAP_AddPostMetaTags'), 'post' );
583
  global $plgn_NS_SNAutoPoster; if (!isset($plgn_NS_SNAutoPoster)) return; $options = $plgn_NS_SNAutoPoster->nxs_options;
584
 
585
- if ($options['useForPages']=='1') add_meta_box( 'NS_SNAP_AddPostMetaTags', __( 'NextScripts: Social Networks Auto Poster - Post Options', 'NS_SNAutoPoster' ), array($this, 'NS_SNAP_AddPostMetaTags'), 'page' );
586
 
587
  $args=array('public'=>true, '_builtin'=>false); $output = 'names'; $operator = 'and'; $post_types = array(); if (function_exists('get_post_types')) $post_types=get_post_types($args, $output, $operator);
588
  if ((isset($options['nxsCPTSeld'])) && $options['nxsCPTSeld']!='') $nxsCPTSeld = unserialize($options['nxsCPTSeld']); else $nxsCPTSeld = array_keys($post_types); //prr($nxsCPTSeld);
589
  foreach ($post_types as $cptID=>$cptName) if (in_array($cptID, $nxsCPTSeld)){
590
- add_meta_box( 'NS_SNAP_AddPostMetaTags', __( 'NextScripts: Social Networks Auto Poster - Post Options', 'NS_SNAutoPoster' ), array($this, 'NS_SNAP_AddPostMetaTags'), $cptID );
591
  }
592
  }
593
  }
@@ -604,22 +636,29 @@ if (!function_exists("nsAuthFBSv_ajax")) { function nsAuthFBSv_ajax() { check_aj
604
  foreach ($options['fb'] as $two) { if ($two['fbPgID']==$pgID) $two['wfa']=time(); $fbs[] = $two; } $options['fb'] = $fbs; if (is_array($options)) update_option('NS_SNAutoPoster', $options);
605
  }}
606
  if (!function_exists("nsGetBoards_ajax")) {
607
- function nsGetBoards_ajax() { global $nxs_gCookiesArr; check_ajax_referer('getBoards'); global $plgn_NS_SNAutoPoster; if (!isset($plgn_NS_SNAutoPoster)) return; $options = $plgn_NS_SNAutoPoster->nxs_options;
608
  if (get_magic_quotes_gpc()) { $_POST['u'] = stripslashes($_POST['u']); $_POST['p'] = stripslashes($_POST['p']);} $_POST['p'] = trim($_POST['p']); $u = trim($_POST['u']);
609
  $loginError = doConnectToPinterest($_POST['u'], substr($_POST['p'], 0, 5)=='g9c1a'?nsx_doDecode(substr($_POST['p'], 5)):$_POST['p'] ); if ($loginError!==false) {echo $loginError; return "BAD USER/PASS";}
610
- $gPNBoards = doGetBoardsFromPinterest(); $options['pn'][$_POST['ii']]['pnBoardsList'] = $gPNBoards;
611
  $options['pn'][$_POST['ii']]['pnSvC'] = serialize($nxs_gCookiesArr); if (is_array($options)) update_option('NS_SNAutoPoster', $options); echo $gPNBoards; die();
612
  }
613
  }
 
 
 
 
 
 
 
 
614
 
615
  if (!function_exists("nxs_clLgo_ajax")) { function nxs_clLgo_ajax() { check_ajax_referer('nxsSsPageWPN');
616
  update_option('NS_SNAutoPosterLog', ''); echo "OK";
617
  }}
618
 
619
- if (!function_exists("nxs_rfLgo_ajax")) { function nxs_rfLgo_ajax() { check_ajax_referer('nxsSsPageWPN'); echo "Y:";
620
- $log = get_option('NS_SNAutoPosterLog');
621
- $logInfo = maybe_unserialize(get_option('NS_SNAutoPosterLog')); if (is_array($logInfo))
622
- foreach (array_reverse($logInfo) as $logline) echo '<snap style="color:#008000">['.$logline['date'].']</snap> - ['.$logline['nt'].'] - <snap style="color:#'.($logline['type']=='E'?'FF0000':'585858').'">'.$logline['msg'].'</snap> '.$logline['extInfo'].'<br/>';
623
  }}
624
 
625
  //## Initialize the admin panel if the plugin has been activated
@@ -627,10 +666,13 @@ if (!function_exists("nxs_AddSUASettings")) { function nxs_AddSUASettings() { g
627
  add_menu_page('Social Networks Auto Poster', 'Social Networks Auto Poster', 'manage_options', basename(__FILE__), array(&$plgn_NS_SNAutoPoster, 'showSNAP_WPMU_OptionsPage'), $nxs_plurl.'img/snap-icon12.png'); }}
628
  //## Initialize the admin panel if the plugin has been activated
629
  if (!function_exists("NS_SNAutoPoster_ap")) { function NS_SNAutoPoster_ap() { global $plgn_NS_SNAutoPoster, $nxs_plurl; if (!isset($plgn_NS_SNAutoPoster)) return; $options = $plgn_NS_SNAutoPoster->nxs_options;
630
- if (function_exists('add_options_page')) {
631
- add_options_page('Social Networks Auto Poster', '<img src="'.$nxs_plurl.'img/snap-icon12.png"/><span style="color:#287A0A">{SNAP}</span> Social Networks Auto Poster', 'manage_options', basename(__FILE__), array(&$plgn_NS_SNAutoPoster, 'showSNAutoPosterOptionsPage'));
632
- }
633
- }}
 
 
 
634
 
635
  //## Main Function to Post
636
  if (!function_exists("nxs_snapPublishTo")) { function nxs_snapPublishTo($postArr, $type='', $aj=false) { global $plgn_NS_SNAutoPoster, $nxs_snapAvNts, $blog_id, $nxs_tpWMPU;
@@ -654,7 +696,7 @@ if (!function_exists("nxs_snapPublishTo")) { function nxs_snapPublishTo($postArr
654
  $optMt = $options[$avNt['lcode']][0]; if (isset($po) && is_array($po)) { $ntClInst = new $clName(); $optMt = $ntClInst->adjMetaOpt($optMt, $po[0]); }
655
  $isCustBoxMeta = get_post_meta($postID, 'nxs_snapPostTo_'.$avNt['code'], true);
656
  if ($snap_isEdIT!='1') { $doPost = true;
657
- if ( $optMt['catSel']=='1' && trim($optMt['catSelEd'])!='' ) { $exclCats = explode(',',$optMt['catSelEd']); foreach ($postCats as $pCat) { if (in_array($pCat, $exclCats)) $doPost = false; else {$doPost = true; break;}} if (!$doPost) break; }
658
  }
659
  if ($optMt['do'.$avNt['code']]=='1' || $isCustBoxMeta=='1') { delete_post_meta($postID, 'snap_isAutoPosted'); add_post_meta($postID, 'snap_isAutoPosted', '1'); $optMt['ii'] = 0;
660
  if ($publtype=='S') { // nxs_addToLog($logNT, 'M', $avNt['code'].' autopost scheduled');
@@ -674,7 +716,7 @@ if (!function_exists("ns_add_settings_link")) { function ns_add_settings_link($l
674
  static $this_plugin;
675
  if (!$this_plugin) $this_plugin = plugin_basename(__FILE__);
676
  if ($file == $this_plugin){
677
- $settings_link = '<a href="options-general.php?page=NextScripts_SNAP.php">'.__("Settings","default").'</a>';
678
  array_unshift($links, $settings_link);
679
  }
680
  return $links;
@@ -695,10 +737,10 @@ if (!function_exists("ns_custom_types_setup")) { function ns_custom_types_setup(
695
  }}
696
 
697
  //## Format Message
698
- if (!function_exists("nsFormatMessage")) { function nsFormatMessage($msg, $postID){ global $ShownAds; $post = get_post($postID); // $title = $post->post_title; echo "##".$title."##"; $tta = qtrans_split($title); prr($tta); prr($post); die();
699
  $msg = stripcslashes($msg); if (isset($ShownAds)) $ShownAdsL = $ShownAds; // $msg = htmlspecialchars(stripcslashes($msg));
700
- if (preg_match('%URL%', $msg)) { $url = get_permalink($postID); $msg = str_ireplace("%URL%", $url, $msg);}
701
- if (preg_match('%SURL%', $msg)) { $url = get_permalink($postID); $url = nxs_mkShortURL($url, $postID); $msg = str_ireplace("%SURL%", $url, $msg);}
702
  if (preg_match('%IMG%', $msg)) { $imgURL = nxs_getPostImage($postID); $msg = str_ireplace("%IMG%", $imgURL, $msg); }
703
  if (preg_match('%TITLE%', $msg)) { $title = nxs_doQTrans($post->post_title, $lng); $msg = str_ireplace("%TITLE%", $title, $msg); }
704
  if (preg_match('%STITLE%', $msg)) { $title = nxs_doQTrans($post->post_title, $lng); $title = substr($title, 0, 115); $msg = str_ireplace("%STITLE%", $title, $msg); }
@@ -802,7 +844,6 @@ if (!function_exists("nxssnap_enqueue_scripts")) { function nxssnap_enqueue_scri
802
  wp_localize_script( 'nxssnap-scripts', 'MyAjax', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ), 'nxsnapWPnonce' => wp_create_nonce( 'nxsnapWPnonce' ),));
803
  }}
804
 
805
-
806
  if (!function_exists("nxs_getExpSettings_ajax")) { function nxs_getExpSettings_ajax() { check_ajax_referer('nsDN'); $filename = preg_replace('/[^a-z0-9\-\_\.]/i','',$_POST['filename']);
807
  header("Cache-Control: "); header("Content-type: text/plain"); header('Content-Disposition: attachment; filename="'.$filename.'"');
808
  global $plgn_NS_SNAutoPoster; if (!isset($plgn_NS_SNAutoPoster)) return; $options = $plgn_NS_SNAutoPoster->nxs_options;
@@ -814,12 +855,13 @@ if (isset($plgn_NS_SNAutoPoster)) { //## Actions
814
  //## Add the admin menu
815
  if ($nxs_isWPMU) add_action('network_admin_menu', 'nxs_AddSUASettings'); $suOptions = array();
816
  $suOptions = $plgn_NS_SNAutoPoster->nxs_options; if ($nxs_isWPMU) { $ntOptions = $plgn_NS_SNAutoPoster->nxs_ntoptions; if (!isset($suOptions['suaMode'])) $suOptions['suaMode'] = ''; }
817
-
818
  $isO = !$nxs_isWPMU || ($nxs_isWPMU && ($suOptions['isMU']||$suOptions['isMUx']) && ($suOptions['suaMode']=='O' || ($suOptions['suaMode']=='' && $ntOptions['nxsSUType']=='O')));
819
  $isS = !$nxs_isWPMU || ($nxs_isWPMU && ($suOptions['isMU']||$suOptions['isMUx']) && ($suOptions['suaMode']=='S' || ($suOptions['suaMode']=='' && $ntOptions['nxsSUType']=='S')));
820
  if ($nxs_isWPMU) { if ($isO) $nxs_tpWMPU = 'O'; elseif ($isS) $nxs_tpWMPU = 'S';} // prr($nxs_tpWMPU); prr($suOptions);
821
 
822
  if (function_exists('nxs_doSMAS3')) nxs_doSMAS3($isS, $isO);
 
823
 
824
  add_action('admin_init', 'nxs_adminInitFunc');
825
  add_action( 'admin_enqueue_scripts', 'nxssnap_enqueue_scripts' );
@@ -829,6 +871,10 @@ if (isset($plgn_NS_SNAutoPoster)) { //## Actions
829
  add_action('wp_ajax_nxs_prxTest', 'nxs_prxTest_ajax');
830
  add_action('wp_ajax_nxs_prxGet', 'nxs_prxGet_ajax');
831
  add_action('wp_ajax_nxs_getExpSettings', 'nxs_getExpSettings_ajax');
 
 
 
 
832
 
833
  if ($isO || $isS) {
834
  //## Whenever you publish a post, post to Social Networks
@@ -859,9 +905,9 @@ if (isset($plgn_NS_SNAutoPoster)) { //## Actions
859
  //## Add AJAX Calls for Test and Repost
860
  foreach ($nxs_snapAvNts as $avNt) { add_action('wp_ajax_rePostTo'.$avNt['code'], 'nxs_rePostTo'.$avNt['code'].'_ajax'); }
861
  add_action('wp_ajax_getBoards' , 'nsGetBoards_ajax');
 
862
  add_action('wp_ajax_nsDN', 'ns_delNT_ajax');
863
 
864
-
865
  add_action('wp_ajax_nsAuthFBSv', 'nsAuthFBSv_ajax');
866
  //## Custom Post Types and OG tags
867
  add_filter('plugin_action_links','ns_add_settings_link', 10, 2 );
4
  Plugin URI: http://www.nextscripts.com/social-networks-auto-poster-for-wordpress
5
  Description: This plugin automatically publishes posts from your blog to multiple accounts on Facebook, Twitter, and Google+ profiles and/or pages.
6
  Author: Next Scripts
7
+ Version: 2.6.3
8
  Author URI: http://www.nextscripts.com
9
  Copyright 2012 Next Scripts, Inc
10
  */
11
+ define( 'NextScripts_SNAP_Version' , '2.6.3' ); require_once "nxs_functions.php";
12
  //## Include All Available Networks
13
  global $nxs_snapAvNts, $nxs_snapThisPageUrl, $nxs_plurl, $nxs_isWPMU, $nxs_tpWMPU;
14
  $nxs_snapAvNts = array(); foreach (glob(plugin_dir_path( __FILE__ ).'inc-cl/*.php') as $filename){ require_once $filename; }
23
  var $dbOptionsName = "NS_SNAutoPoster";
24
  var $nxs_options = ""; var $nxs_ntoptions = "";
25
 
26
+ function __construct() { load_plugin_textdomain('nxs_snap', FALSE, dirname(plugin_basename(__FILE__)).'/lang/'); $this->nxs_options = $this->getAPOptions();}
27
  //## Constructor
28
  function NS_SNAutoPoster() { }
29
  //## Initialization function
121
  }
122
  }
123
 
124
+ nxs_psCron();
125
+
126
  if (isset($_POST['update_NS_SNAutoPoster_settings'])) { if (get_magic_quotes_gpc()) {array_walk_recursive($_POST, 'nsx_stripSlashes');} array_walk_recursive($_POST, 'nsx_fixSlashes');
127
  //## Load Networks Settings
128
  foreach ($nxs_snapAvNts as $avNt) if (isset($_POST[$avNt['lcode']])) { $clName = 'nxs_snapClass'.$avNt['code']; if (!isset($options[$avNt['lcode']])) $options[$avNt['lcode']] = array();
142
  if (isset($_POST['nsOpenGraph'])) $options['nsOpenGraph'] = $_POST['nsOpenGraph']; else $options['nsOpenGraph'] = 0;
143
  if (isset($_POST['imgNoCheck'])) $options['imgNoCheck'] = 0; else $options['imgNoCheck'] = 1;
144
  if (isset($_POST['useForPages'])) $options['useForPages'] = 1; else $options['useForPages'] = 0;
145
+
 
146
  if (isset($_POST['showPrxTab'])) $options['showPrxTab'] = 1; else $options['showPrxTab'] = 0;
147
  if (isset($_POST['useRndProxy'])) $options['useRndProxy'] = 1; else $options['useRndProxy'] = 0;
148
 
149
  if (isset($_POST['prxList'])) $options['prxList'] = $_POST['prxList'];
150
+ if (isset($_POST['addURLParams'])) $options['addURLParams'] = $_POST['addURLParams'];
151
 
152
+ if (isset($_POST['riActive'])) $options['riActive'] = 1; else $options['riActive'] = 0;
153
+ if (isset($_POST['riHowManyPostsToTrack'])) $options['riHowManyPostsToTrack'] = $_POST['riHowManyPostsToTrack'];
154
 
155
  if (isset($_POST['useUnProc'])) $options['useUnProc'] = $_POST['useUnProc']; else $options['useUnProc'] = 0;
156
  if (isset($_POST['nxsCPTSeld'])) $options['nxsCPTSeld'] = serialize($_POST['nxsCPTSeld']);
164
  foreach ($options['whoCanSeeSNAPBox'] as $uRole) { $role = get_role($uRole); $role->add_cap('see_snap_box'); }
165
 
166
  update_option($this->dbOptionsName, $options); // prr($options);
167
+ ?><div class="updated"><p><strong><?php _e("Settings Updated.", 'nxs_snap');?></strong></p></div><?php
168
  }
169
  $isNoNts = true; foreach ($nxs_snapAvNts as $avNt) if (isset($options[$avNt['lcode']]) && is_array($options[$avNt['lcode']]) && count($options[$avNt['lcode']])>0) {$isNoNts = false; break;}
170
 
174
  <?php }
175
 
176
  if(!$nxs_isWPMU) $this->NS_SNAP_ShowPageTop(); ?>
177
+ Please see the <a target="_blank" href="http://www.nextscripts.com/installation-of-social-networks-auto-poster-for-wordpress">detailed installation/configuration instructions</a> (will open in a new tab)<br/>
178
+ <?php if(!isset($options['hideTopTip']) || (int)$options['hideTopTip'] != 1) { /* ?>
179
+ <div id="nxs_TopTip" class="nxsInfoMsg" style="font-size: 11px; margin-left: 3px; max-width: 1100px; display: block; font-style: italic; margin-bottom: 5px;">Tip: If autoposting works when you click "Test" buttons, but is not working when you publish new posts, try to switch from "Scheduled" to "Immediately" in the Plugin Settings->Other Settings->How to make auto-posts.
180
+ <span style="float: right;"><a style="text-decoration: none" href="#" onclick="nxs_hideTip('nxs_TopTip'); return false;">[Hide]</a></span>
181
+ </div>
182
+ <?php */ } else { ?><br/><?php } ?>
183
 
184
  <ul class="nsx_tabs">
185
  <li><a href="#nsx_tab1">Your Social Networks Accounts</a></li>
191
  <form method="post" id="nsStForm" action="<?php echo $nxs_snapThisPageUrl?>">
192
  <div class="nsx_tab_container">
193
  <div id="nsx_tab1" class="nsx_tab_content"><a href="#" class="NXSButton" id="nxs_snapAddNew">Add new account</a> <div class="nxsInfoMsg"><img style="position: relative; top: 8px;" alt="Arrow" src="<?php echo $nxs_plurl; ?>img/arrow_l_green_c1.png"/> You can add Facebook, Twitter, Google+, Pinterest, LinkedIn, Tumblr, Blogger/Blogspot, Delicious, etc accounts</div><br/><br/>
194
+ <div id="nxs_spPopup"><span class="nxspButton bClose"><span>X</span></span>Add New Network: <select onchange="doShowFillBlockX(this.value);" id="nxs_ntType"><option value =""></option>
195
  <?php foreach ($nxs_snapAvNts as $avNt) { if (!isset($options[$avNt['lcode']]) || count($options[$avNt['lcode']])==0) $mt=0; else $mt = 1+max(array_keys($options[$avNt['lcode']]));
196
  echo '<option value ="'.$avNt['code'].$mt.'">'.$avNt['name'].'</option>';
197
  } ?>
224
 
225
  <div style="float: right; padding: 1.5em;">
226
 
227
+ <input onclick="nxs_expSettings(); return false;" type="button" class="button" name="expSettings_repostButton" id="expSettings_button" value="<?php _e('Export Settings', 'nxs_snap') ?>" />
228
+ <input onclick="jQuery('#impFileSettings_button').click(); return false;" type="button" class="button" name="impSettings_repostButton" id="impSettings_button" value="<?php _e('Import Settings', 'nxs_snap') ?>" />
229
  </div>
230
 
231
+ <div class="submit"><input type="submit" id="nxs-button-primary-submit" class="button-primary" name="update_NS_SNAutoPoster_settings" value="<?php _e('Update Settings', 'nxs_snap') ?>" /></div>
232
 
233
  <?php } ?>
234
  </div> <!-- END TAB -->
259
  if ($role=='subscriber') echo ' - Somebody who can only manage their profile';
260
  echo '<br/>';
261
  } ?>
262
+
263
+ <h3 style="font-size: 14px; margin-bottom: 2px;">Use SNAP for Wordpress Pages</h3>
264
+
265
+ <p style="margin: 0px;margin-left: 5px;"><input value="set" id="useForPages" name="useForPages" type="checkbox" <?php if ((int)$options['useForPages'] == 1) echo "checked"; ?> />
266
+ <strong>Use for pages</strong>
267
+ <span style="font-size: 11px; margin-left: 1px;">Show the SNAP metabox and auto-post for pages, not just posts.</span>
268
+ </p>
269
+
270
 
271
  <h3 style="font-size: 14px; margin-bottom: 2px;">Include/Exclude Custom Post Types</h3> <?php $nxsOne = base64_encode("v=".$nxsOne); ?>
272
  <p style="font-size: 11px; margin: 0px;">Select Custom Post Types that you would to be published on your social networks</p>
283
  ?>
284
  </select>
285
 
286
+
 
 
 
 
 
287
 
288
  <div style="width:500px;"><strong style="font-size: 14px;"><br/>Categories to Include/Exclude:</strong>
289
  <p style="font-size: 11px; margin: 0px;">Each blogpost will be autoposted to all categories selected below. All categories are selected by default.
320
 
321
  <!-- ##################### URL Shorthener #####################-->
322
  <br/>
323
+ <h3 style="font-size: 14px; margin-bottom: 2px;">URL Shorthener</h3> <span style="font-size: 11px; margin-left: 1px;">Please use %SURL% in "Message Format" to get shortened urls. </span> <br/>
324
  &nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="nxsURLShrtnr" value="G" <?php if (!isset($options['nxsURLShrtnr']) || $options['nxsURLShrtnr']=='' || $options['nxsURLShrtnr']=='G') echo 'checked="checked"'; ?> /> gd.is (Default) - fast, simple, free, no configuration nessesary.<br/>
325
  <?php if (function_exists('wp_get_shortlink')) { ?> &nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="nxsURLShrtnr" value="W" <?php if (isset($options['nxsURLShrtnr']) && $options['nxsURLShrtnr']=='W') echo 'checked="checked"'; ?> /> Wordpress Built-in Shortener (wp.me if you use Jetpack)<br/> <?php } ?>
326
  &nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="nxsURLShrtnr" value="B" <?php if (isset($options['nxsURLShrtnr']) && $options['nxsURLShrtnr']=='B') echo 'checked="checked"'; ?> /> bit.ly - <i>Enter bit.ly username and <a target="_blank" href="http://bitly.com/a/your_api_key">API Key</a> below</i><br/>
327
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bit.ly Username: <input name="bitlyUname" style="width: 20%;" value="<?php if (isset($options['bitlyUname'])) _e(apply_filters('format_to_edit',$options['bitlyUname']), 'nxs_snap') ?>" /><br/>
328
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bit.ly&nbsp;&nbsp;API Key:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input name="bitlyAPIKey" style="width: 20%;" value="<?php if (isset($options['bitlyAPIKey'])) _e(apply_filters('format_to_edit',$options['bitlyAPIKey']), 'nxs_snap') ?>" /><br/>
329
+
330
+ <h3 style="font-size: 14px; margin-bottom: 2px;"> Import comments from Social Networks<span style="font-size: 11px; color:red; padding-left: 5px; padding-right: 5px;">[<?php _e('New', 'nxs_snap') ?>]</span></h3> <span style="font-size: 11px; margin-left: 1px;">Plugin will automatically grab the comments posted on Social Networks and insert them as "Comments to your post". Plugin will check for the new comments every hour. </span>
331
+ <p style="margin: 0px;margin-left: 5px;"><input value="set" id="riActive" name="riActive" type="checkbox" <?php if ((int)$options['riActive'] == 1) echo "checked"; ?> />
332
+ <strong>Enable "Comments Import"</strong>
333
+ <br/>
334
+ <strong style="font-size: 12px; margin: 10px; margin-left: 1px;">How many posts should be tracked:</strong>
335
+ <input name="riHowManyPostsToTrack" style="width: 50px;" value="<?php if (isset($options['riHowManyPostsToTrack'])) _e(apply_filters('format_to_edit', $options['riHowManyPostsToTrack']), 'nxs_snap'); else echo "10"; ?>" /> <br/>
336
+
337
+ <span style="font-size: 11px; margin-left: 1px;">Setting two many will degrade your website's prefomance. 10-20 posts are recommended</span>
338
+ </p>
339
+
340
+
341
+ <h3 style="font-size: 14px; margin-bottom: 2px;">Additional URL Parameters<span style="font-size: 11px; color:red; padding-left: 5px; padding-right: 5px;">[<?php _e('New', 'nxs_snap') ?>]</span></h3> <span style="font-size: 11px; margin-left: 1px;">Will be added to backlinks. </span>
342
+
343
+ <p style="margin: 0px;margin-left: 5px;"><input name="addURLParams" style="width: 800px;" value="<?php if (isset($options['addURLParams'])) _e(apply_filters('format_to_edit', $options['addURLParams']), 'nxs_snap'); ?>" /> <br/>
344
+
345
+ <span style="font-size: 11px; margin-left: 1px;">You can use %NTNAME% for social network name, %NTCODE% for social network two-letter code, %ACCNAME% for account name, %POSTID% for post ID, %POSTTITLE% for post title, %SITENAME% for website name. <b>Any text must be URL Encoded</b><br/>
346
+ Example: utm_source=%NTCODE%&utm_medium=%ACCNAME%&utm_campaign=SNAP%2Bfrom%2B%SITENAME%</span>
347
+ </p>
348
+
349
 
350
  <!-- ##################### Open Graph #####################-->
351
 
363
  </div>
364
 
365
  <strong style="font-size: 11px; margin: 10px; margin-left: 10px;">Default Image URL for og:image tag:</strong>
366
+ <input name="ogImgDef" style="width: 30%;" value="<?php if (isset($options['ogImgDef'])) _e(apply_filters('format_to_edit',$options['ogImgDef']), 'nxs_snap') ?>" />
367
 
368
  </div>
369
 
370
  <h3 style="font-size: 14px; margin-bottom: 2px;">Alternative "Featured Image" location</h3> <span style="font-size: 11px; margin-left: 1px;">Plugin uses standard Wordpress Featured Image by default. If your theme stores "Featured Image" in the custom field, please enter the name of it. Use prefix if your custom field has only partial location.</span>
371
  <br/>
372
+ Custom field name: <input name="featImgLoc" style="width: 200px;" value="<?php if (isset($options['featImgLoc'])) _e(apply_filters('format_to_edit',$options['featImgLoc']), 'nxs_snap') ?>" /> <br/>
373
+ Custom field Image Prefix: <input name="featImgLocPrefix" style="width: 200px;" value="<?php if (isset($options['featImgLocPrefix'])) _e(apply_filters('format_to_edit',$options['featImgLocPrefix']), 'nxs_snap') ?>" />
374
 
375
 
376
  <h3 style="font-size: 14px; margin-bottom: 2px;">Verify "Featured" Image</h3>
380
  <span style="font-size: 11px; margin-left: 1px;">Advanced Setting. Uncheck only if you are 100% sure that your images are valid or if you have troubles with image verification.</span>
381
  </p>
382
 
383
+
384
+
385
  <?php if (function_exists("nxs_showPRXTab")) { ?>
386
 
387
  <h3 style="font-size: 14px; margin-bottom: 2px;">Show "Proxies" Tab</h3>
392
  </p>
393
  <?php } ?>
394
 
395
+ <div class="submit"><input type="submit" class="button-primary" name="update_NS_SNAutoPoster_settings" value="<?php _e('Update Settings', 'nxs_snap') ?>" /></div>
396
 
397
  </div>
398
  <?php if ((function_exists("nxs_showPRXTab")) && (int)$options['showPrxTab'] == 1) { nxs_showPRXTab($options); } ?>
524
 
525
  <br/>&nbsp;<br/> <?php
526
  }
527
+ function showSNAutoPosterOptionsPagex() {?> <br/><br/><br/>This version of the plugin is not compatible with <b>Wordpress Multisite Edition</b>. Please contact your Network Admin for the upgrade. <?php }
528
 
529
  function NS_SNAP_ShowPageTop(){ global $nxs_snapAvNts, $nxs_snapThisPageUrl, $nxsOne, $nxs_plurl, $nxs_isWPMU; $nxsOne = ''; $options = $this->nxs_options;
530
  $nxsOne = NextScripts_SNAP_Version; if (defined('NXSAPIVER')) $nxsOne .= " (<span id='nxsAPIUpd'>API</span> Version: ".NXSAPIVER.")"; ?>
532
 
533
  <div style="float:right; padding-top: 10px; padding-right: 10px;">
534
  <div style="float:right; text-align: center;"><a target="_blank" href="http://www.nextscripts.com"><img src="<?php echo $nxs_plurl; ?>img/Next_Scripts_Logo2.1-HOR-100px.png"></a><br/>
535
+ <a style="font-weight: normal; font-size: 16px; line-height: 24px;" target="_blank" href="http://www.nextscripts.com/support">[<?php _e('Contact support', 'nxs_snap'); ?>]</a>
536
+ <?php if(!$options['isMA']) { ?><br/> <span style="color:#800000;"><?php _e('Ready to to Upgrade to Multiple Accounts Edition<br/> and get Google+ and Pinterest Auto-Posting?', 'nxs_snap'); ?></span>
537
+ <?php if(function_exists('nxsDoLic_ajax')) { ?> <br/><a style="font-weight: normal; font-size: 12px; line-height: 24px;" target="_blank" id="showLic" href="#">[<?php _e('Enter your Activation Key', 'nxs_snap'); ?>]</a>&nbsp;&nbsp;&nbsp;&nbsp; <?php } ?>
538
+ <a target="_blank" href="http://www.nextscripts.com/social-networks-auto-poster-for-wp-multiple-accounts#getit">[<?php _e('Get It here', 'nxs_snap'); ?>]</a> <?php } ?>
539
  </div>
540
+ <div id="showLicForm"><span class="nxspButton bClose"><span>X</span></span><div style="position: absolute; right: 10px; top:10px; font-family: 'News Cycle'; font-size: 34px; font-weight: lighter;"><?php _e('Activation', 'nxs_snap'); ?></div>
541
  <br/><br/>
542
+ <h3><?php _e('Multiple Accounts Edition and Google+ and Pinterest Auto-Posting', 'nxs_snap'); ?></h3><br/><?php _e('You can find your key on this page', 'nxs_snap'); ?>: <a href="http://www.nextscripts.com/mypage">http://www.nextscripts.com/mypage</a>
543
+ <br/><br/> <?php _e('Enter your Key', 'nxs_snap'); ?>: <input name="eLic" id="eLic" style="width: 50%;"/>
544
  <input type="button" class="button-primary" name="eLicDo" onclick="doLic();" value="Enter" />
545
+ <br/><br/><?php _e('Your plugin will be automatically upgraded', 'nxs_snap'); ?>. <?php wp_nonce_field( 'doLic', 'doLic_wpnonce' ); ?>
546
  </div>
547
  </div>
548
 
549
 
550
+ <div class=wrap><h2><?php _e('Next Scripts: Social Networks Auto Poster Options', 'nxs_snap'); ?></h2> <?php _e('Plugin Version', 'nxs_snap'); ?>: <span style="color:#008000;font-weight: bold;"><?php echo $nxsOne; ?></span> <?php if($options['isMA']) { ?> [Pro - Multiple Accounts Edition]&nbsp;&nbsp;<?php } else {?>
551
  <span style="color:#800000; font-weight: bold;">[Single Accounts Edition]</span>
552
  <?php if(!$nxs_isWPMU) { ?>
553
+ - <a target="_blank" href="http://www.nextscripts.com/social-networks-auto-poster-for-wp-multiple-accounts"><?php _e('Get', 'nxs_snap'); ?> PRO - Multiple Accounts Edition</a><br/><br/>
554
 
555
+ <?php _e('Here you can setup "Social Networks Auto Poster".', 'nxs_snap'); ?><br/> <?php _e('You can start by clicking "Add new account" button and choosing the Social Network you would like to add.', 'nxs_snap'); ?><?php }} ?><br/>
556
  <?php
557
  if (!function_exists('curl_init')) {
558
  echo ("<br/><b style='font-size:16px; color:red;'>Error: No CURL Found</b> <br/><i>Social Networks AutoPoster needs the CURL PHP extension. Please install it or contact your hosting company to install it.</i><br/>");
564
  */
565
  ?>
566
 
567
+ <?php if (function_exists('yoast_analytics')) { $plgnsLink = admin_url().'/plugins.php' ?>
568
+ <div class="error" id="message"><p><strong><?php _e('You have Google Analytics Plugin installed and activated.', 'nxs_snap'); ?></strong> <?php _e('This plugin hijacks the authorization workflow.', 'nxs_snap'); ?>
569
+ <?php printf( __( 'Please temporary <a href="%s">deactivate</a> Google Analytics plugin, do all authorizations and then activate it back.', 'nxs_snap' ), $plgnsLink ); ?></div>
570
  <?php }
571
  }
572
 
573
+ function NS_SNAP_SavePostMetaTags($id) { global $nxs_snapAvNts, $plgn_NS_SNAutoPoster; if (!isset($plgn_NS_SNAutoPoster)) return; $options = $plgn_NS_SNAutoPoster->nxs_options;
574
+ $post = get_post($id); if ($post->post_type=='revision') return; if (isset($_POST["SNAPEdit"])) $nspost_edit = $_POST["SNAPEdit"];
575
+ if (get_magic_quotes_gpc()) {array_walk_recursive($_POST, 'nsx_stripSlashes');}
576
  if (isset($nspost_edit) && !empty($nspost_edit)) { delete_post_meta($id, 'snapEdIT'); add_post_meta($id, 'snapEdIT', '1' );
577
  foreach ($nxs_snapAvNts as $avNt) {
578
  if (count($options[$avNt['lcode']])>0 && isset($_POST[$avNt['lcode']]) && count($_POST[$avNt['lcode']])>0) { $savedMeta = maybe_unserialize(get_post_meta($id, 'snap'.$avNt['code'], true));
579
  if(is_array($_POST[$avNt['lcode']])) { $ii=0;
580
  foreach ($_POST[$avNt['lcode']] as $pst ) {
581
+ if (is_array($pst) && $pst['do'.$avNt['code']]=='') $_POST[$avNt['lcode']][$ii]['do'.$avNt['code']]= 0; $ii++;
582
  }
583
+ } $newMeta = $_POST[$avNt['lcode']];
584
+ if (is_array($savedMeta) && is_array($newMeta)) $newMeta = nxsMergeArraysOV($savedMeta, $newMeta); // echo "##### ".$id."| snap".$avNt['code']; prr($savedMeta); echo "||"; prr($newMeta);// $newMeta = 'AAA';
585
+ delete_post_meta($id, 'snap'.$avNt['code']); add_post_meta($id, 'snap'.$avNt['code'], serialize($newMeta));
586
  }
587
  }
588
  } // prr($_POST);
589
  }
590
 
 
591
  function NS_SNAP_AddPostMetaTags() { global $post, $nxs_snapAvNts, $plgn_NS_SNAutoPoster; $post_id = $post; if (is_object($post_id)) $post_id = $post_id->ID; if (!is_object($post)) $post = get_post($post_id);
592
  if (!isset($plgn_NS_SNAutoPoster)) return; $options = $plgn_NS_SNAutoPoster->nxs_options;
593
  ?>
598
  </style>
599
 
600
  <input value="SNAPEdit" type="hidden" name="SNAPEdit" />
601
+ <div class="popShAtt" style="width: 200px;" id="popShAttSV"><?php _e('If you made any changes to the format, please "Update" the post before reposting', 'nxs_snap'); ?></div>
602
  <?php if($post->post_status != "publish" ) { ?>
603
  <div style="float: right;"> <input type="hidden" id="nxsLockIt" value="0" />
604
+ <a href="#" onclick="jQuery('#nxsLockIt').val('1'); jQuery('.nxsGrpDoChb').attr('checked','checked'); return false;"><?php _e('Check All', 'nxs_snap'); ?></a>&nbsp;<a href="#" onclick="jQuery('#nxsLockIt').val('1');jQuery('.nxsGrpDoChb').removeAttr('checked'); return false;"><?php _e('Uncheck All', 'nxs_snap'); ?></a>
605
  </div>
606
  <?php } ?>
607
+ <table style="margin-bottom:40px; clear:both;" width="100%" border="0"><?php
 
 
 
608
  foreach ($nxs_snapAvNts as $avNt) { $clName = 'nxs_snapClass'.$avNt['code'];
609
  if (count($options[$avNt['lcode']])>0) { $ntClInst = new $clName(); $ntClInst->showEdPostNTSettings($options[$avNt['lcode']], $post); }
610
  }
611
  ?></table></div></div></div> <?php
612
  }
613
  //## Add MetaBox to Post->Edit
614
+ function NS_SNAP_addCustomBoxes() { add_meta_box( 'NS_SNAP_AddPostMetaTags', __( 'NextScripts: Social Networks Auto Poster - Post Options', 'nxs_snap' ), array($this, 'NS_SNAP_AddPostMetaTags'), 'post' );
615
  global $plgn_NS_SNAutoPoster; if (!isset($plgn_NS_SNAutoPoster)) return; $options = $plgn_NS_SNAutoPoster->nxs_options;
616
 
617
+ if ($options['useForPages']=='1') add_meta_box( 'NS_SNAP_AddPostMetaTags', __( 'NextScripts: Social Networks Auto Poster - Post Options', 'nxs_snap' ), array($this, 'NS_SNAP_AddPostMetaTags'), 'page' );
618
 
619
  $args=array('public'=>true, '_builtin'=>false); $output = 'names'; $operator = 'and'; $post_types = array(); if (function_exists('get_post_types')) $post_types=get_post_types($args, $output, $operator);
620
  if ((isset($options['nxsCPTSeld'])) && $options['nxsCPTSeld']!='') $nxsCPTSeld = unserialize($options['nxsCPTSeld']); else $nxsCPTSeld = array_keys($post_types); //prr($nxsCPTSeld);
621
  foreach ($post_types as $cptID=>$cptName) if (in_array($cptID, $nxsCPTSeld)){
622
+ add_meta_box( 'NS_SNAP_AddPostMetaTags', __('NextScripts: Social Networks Auto Poster - Post Options', 'nxs_snap'), array($this, 'NS_SNAP_AddPostMetaTags'), $cptID );
623
  }
624
  }
625
  }
636
  foreach ($options['fb'] as $two) { if ($two['fbPgID']==$pgID) $two['wfa']=time(); $fbs[] = $two; } $options['fb'] = $fbs; if (is_array($options)) update_option('NS_SNAutoPoster', $options);
637
  }}
638
  if (!function_exists("nsGetBoards_ajax")) {
639
+ function nsGetBoards_ajax() { global $nxs_gCookiesArr; check_ajax_referer('getBoards'); global $plgn_NS_SNAutoPoster; if (!isset($plgn_NS_SNAutoPoster)) return; $options = $plgn_NS_SNAutoPoster->nxs_options;
640
  if (get_magic_quotes_gpc()) { $_POST['u'] = stripslashes($_POST['u']); $_POST['p'] = stripslashes($_POST['p']);} $_POST['p'] = trim($_POST['p']); $u = trim($_POST['u']);
641
  $loginError = doConnectToPinterest($_POST['u'], substr($_POST['p'], 0, 5)=='g9c1a'?nsx_doDecode(substr($_POST['p'], 5)):$_POST['p'] ); if ($loginError!==false) {echo $loginError; return "BAD USER/PASS";}
642
+ $gPNBoards = doGetBoardsFromPinterest(); $options['pn'][$_POST['ii']]['pnBoardsList'] = base64_encode($gPNBoards);
643
  $options['pn'][$_POST['ii']]['pnSvC'] = serialize($nxs_gCookiesArr); if (is_array($options)) update_option('NS_SNAutoPoster', $options); echo $gPNBoards; die();
644
  }
645
  }
646
+ if (!function_exists("nsGetWLBoards_ajax")) {
647
+ function nsGetWLBoards_ajax() { global $nxs_gCookiesArr; check_ajax_referer('getWLBoards'); global $plgn_NS_SNAutoPoster; if (!isset($plgn_NS_SNAutoPoster)) return; $options = $plgn_NS_SNAutoPoster->nxs_options;
648
+ if (get_magic_quotes_gpc()) { $_POST['u'] = stripslashes($_POST['u']); $_POST['p'] = stripslashes($_POST['p']);} $_POST['p'] = trim($_POST['p']); $u = trim($_POST['u']);
649
+ $loginError = doConnectToWaNeLo($_POST['u'], substr($_POST['p'], 0, 5)=='g9c1a'?nsx_doDecode(substr($_POST['p'], 5)):$_POST['p'] ); if ($loginError!==false) {echo $loginError; return "BAD USER/PASS";}
650
+ $gWLBoards = doGetBoardsFromWaNeLo(); $options['wl'][$_POST['ii']]['wlBoardsList'] = base64_encode($gWLBoards);
651
+ $options['wl'][$_POST['ii']]['wlSvC'] = serialize($nxs_gCookiesArr); if (is_array($options)) update_option('NS_SNAutoPoster', $options); echo $gWLBoards; die();
652
+ }
653
+ }
654
 
655
  if (!function_exists("nxs_clLgo_ajax")) { function nxs_clLgo_ajax() { check_ajax_referer('nxsSsPageWPN');
656
  update_option('NS_SNAutoPosterLog', ''); echo "OK";
657
  }}
658
 
659
+ if (!function_exists("nxs_rfLgo_ajax")) { function nxs_rfLgo_ajax() { check_ajax_referer('nxsSsPageWPN'); echo "Y:";
660
+ $log = get_option('NS_SNAutoPosterLog'); $logInfo = maybe_unserialize(get_option('NS_SNAutoPosterLog')); if (is_array($logInfo))
661
+ foreach (array_reverse($logInfo) as $logline) echo '<snap style="color:#008000">['.$logline['date'].']</snap> - ['.$logline['nt'].'] - <snap style="color:#'.($logline['type']=='E'?'FF0000':'585858').'">'.$logline['msg'].'</snap> '.$logline['extInfo'].'<br/>';
 
662
  }}
663
 
664
  //## Initialize the admin panel if the plugin has been activated
666
  add_menu_page('Social Networks Auto Poster', 'Social Networks Auto Poster', 'manage_options', basename(__FILE__), array(&$plgn_NS_SNAutoPoster, 'showSNAP_WPMU_OptionsPage'), $nxs_plurl.'img/snap-icon12.png'); }}
667
  //## Initialize the admin panel if the plugin has been activated
668
  if (!function_exists("NS_SNAutoPoster_ap")) { function NS_SNAutoPoster_ap() { global $plgn_NS_SNAutoPoster, $nxs_plurl; if (!isset($plgn_NS_SNAutoPoster)) return; $options = $plgn_NS_SNAutoPoster->nxs_options;
669
+ if (function_exists('add_options_page')) { add_options_page('Social Networks Auto Poster',
670
+ '<img src="'.$nxs_plurl.'img/snap-icon12.png"/><span style="color:#287A0A">{SNAP}</span> Social Networks Auto Poster', 'manage_options', basename(__FILE__), array(&$plgn_NS_SNAutoPoster, 'showSNAutoPosterOptionsPage'));
671
+ }}}
672
+ if (!function_exists("NS_SNAutoPoster_apx")) { function NS_SNAutoPoster_apx() { global $plgn_NS_SNAutoPoster, $nxs_plurl; if (!isset($plgn_NS_SNAutoPoster)) return; $options = $plgn_NS_SNAutoPoster->nxs_options;
673
+ if (function_exists('add_options_page')) { add_options_page('Social Networks Auto Poster',
674
+ '<img src="'.$nxs_plurl.'img/snap-icon12.png"/><span style="color:#287A0A">{SNAP}</span> Social Networks Auto Poster', 'manage_options', basename(__FILE__), array(&$plgn_NS_SNAutoPoster, 'showSNAutoPosterOptionsPagex'));
675
+ }}}
676
 
677
  //## Main Function to Post
678
  if (!function_exists("nxs_snapPublishTo")) { function nxs_snapPublishTo($postArr, $type='', $aj=false) { global $plgn_NS_SNAutoPoster, $nxs_snapAvNts, $blog_id, $nxs_tpWMPU;
696
  $optMt = $options[$avNt['lcode']][0]; if (isset($po) && is_array($po)) { $ntClInst = new $clName(); $optMt = $ntClInst->adjMetaOpt($optMt, $po[0]); }
697
  $isCustBoxMeta = get_post_meta($postID, 'nxs_snapPostTo_'.$avNt['code'], true);
698
  if ($snap_isEdIT!='1') { $doPost = true;
699
+ if ( $optMt['catSel']=='1' && trim($optMt['catSelEd'])!='' ) { $inclCats = explode(',',$optMt['catSelEd']); foreach ($postCats as $pCat) { if (!in_array($pCat, $inclCats)) $doPost = false; else {$doPost = true; break;}} if (!$doPost) break; }
700
  }
701
  if ($optMt['do'.$avNt['code']]=='1' || $isCustBoxMeta=='1') { delete_post_meta($postID, 'snap_isAutoPosted'); add_post_meta($postID, 'snap_isAutoPosted', '1'); $optMt['ii'] = 0;
702
  if ($publtype=='S') { // nxs_addToLog($logNT, 'M', $avNt['code'].' autopost scheduled');
716
  static $this_plugin;
717
  if (!$this_plugin) $this_plugin = plugin_basename(__FILE__);
718
  if ($file == $this_plugin){
719
+ $settings_link = '<a href="options-general.php?page=NextScripts_SNAP.php">'.__("Settings", "default").'</a>';
720
  array_unshift($links, $settings_link);
721
  }
722
  return $links;
737
  }}
738
 
739
  //## Format Message
740
+ if (!function_exists("nsFormatMessage")) { function nsFormatMessage($msg, $postID, $addURLParams=''){ global $ShownAds, $plgn_NS_SNAutoPoster; $post = get_post($postID); $options = $plgn_NS_SNAutoPoster->nxs_options;
741
  $msg = stripcslashes($msg); if (isset($ShownAds)) $ShownAdsL = $ShownAds; // $msg = htmlspecialchars(stripcslashes($msg));
742
+ if (preg_match('%URL%', $msg)) { $url = get_permalink($postID); if($addURLParams!='') $url .= (strpos($url,'?')!==false?'&':'?').$addURLParams; $msg = str_ireplace("%URL%", $url, $msg);}
743
+ if (preg_match('%SURL%', $msg)) { $url = get_permalink($postID); if($addURLParams!='') $url .= (strpos($url,'?')!==false?'&':'?').$addURLParams; $url = nxs_mkShortURL($url, $postID); $msg = str_ireplace("%SURL%", $url, $msg);}
744
  if (preg_match('%IMG%', $msg)) { $imgURL = nxs_getPostImage($postID); $msg = str_ireplace("%IMG%", $imgURL, $msg); }
745
  if (preg_match('%TITLE%', $msg)) { $title = nxs_doQTrans($post->post_title, $lng); $msg = str_ireplace("%TITLE%", $title, $msg); }
746
  if (preg_match('%STITLE%', $msg)) { $title = nxs_doQTrans($post->post_title, $lng); $title = substr($title, 0, 115); $msg = str_ireplace("%STITLE%", $title, $msg); }
844
  wp_localize_script( 'nxssnap-scripts', 'MyAjax', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ), 'nxsnapWPnonce' => wp_create_nonce( 'nxsnapWPnonce' ),));
845
  }}
846
 
 
847
  if (!function_exists("nxs_getExpSettings_ajax")) { function nxs_getExpSettings_ajax() { check_ajax_referer('nsDN'); $filename = preg_replace('/[^a-z0-9\-\_\.]/i','',$_POST['filename']);
848
  header("Cache-Control: "); header("Content-type: text/plain"); header('Content-Disposition: attachment; filename="'.$filename.'"');
849
  global $plgn_NS_SNAutoPoster; if (!isset($plgn_NS_SNAutoPoster)) return; $options = $plgn_NS_SNAutoPoster->nxs_options;
855
  //## Add the admin menu
856
  if ($nxs_isWPMU) add_action('network_admin_menu', 'nxs_AddSUASettings'); $suOptions = array();
857
  $suOptions = $plgn_NS_SNAutoPoster->nxs_options; if ($nxs_isWPMU) { $ntOptions = $plgn_NS_SNAutoPoster->nxs_ntoptions; if (!isset($suOptions['suaMode'])) $suOptions['suaMode'] = ''; }
858
+ $isPMB = $nxs_isWPMU && function_exists('nxs_doSMAS1') && $blog_id==1;
859
  $isO = !$nxs_isWPMU || ($nxs_isWPMU && ($suOptions['isMU']||$suOptions['isMUx']) && ($suOptions['suaMode']=='O' || ($suOptions['suaMode']=='' && $ntOptions['nxsSUType']=='O')));
860
  $isS = !$nxs_isWPMU || ($nxs_isWPMU && ($suOptions['isMU']||$suOptions['isMUx']) && ($suOptions['suaMode']=='S' || ($suOptions['suaMode']=='' && $ntOptions['nxsSUType']=='S')));
861
  if ($nxs_isWPMU) { if ($isO) $nxs_tpWMPU = 'O'; elseif ($isS) $nxs_tpWMPU = 'S';} // prr($nxs_tpWMPU); prr($suOptions);
862
 
863
  if (function_exists('nxs_doSMAS3')) nxs_doSMAS3($isS, $isO);
864
+ if (!$isO && !$isS && !$isPMB) add_action('admin_menu', 'NS_SNAutoPoster_apx');
865
 
866
  add_action('admin_init', 'nxs_adminInitFunc');
867
  add_action( 'admin_enqueue_scripts', 'nxssnap_enqueue_scripts' );
871
  add_action('wp_ajax_nxs_prxTest', 'nxs_prxTest_ajax');
872
  add_action('wp_ajax_nxs_prxGet', 'nxs_prxGet_ajax');
873
  add_action('wp_ajax_nxs_getExpSettings', 'nxs_getExpSettings_ajax');
874
+ add_action('wp_ajax_nxs_hideTip', 'nxs_hideTip_ajax');
875
+
876
+ add_action('nxs_hourly_event', 'nxs_do_this_hourly');
877
+ add_action('wp', 'nxs_activation');
878
 
879
  if ($isO || $isS) {
880
  //## Whenever you publish a post, post to Social Networks
905
  //## Add AJAX Calls for Test and Repost
906
  foreach ($nxs_snapAvNts as $avNt) { add_action('wp_ajax_rePostTo'.$avNt['code'], 'nxs_rePostTo'.$avNt['code'].'_ajax'); }
907
  add_action('wp_ajax_getBoards' , 'nsGetBoards_ajax');
908
+ add_action('wp_ajax_getWLBoards' , 'nsGetWLBoards_ajax');
909
  add_action('wp_ajax_nsDN', 'ns_delNT_ajax');
910
 
 
911
  add_action('wp_ajax_nsAuthFBSv', 'nsAuthFBSv_ajax');
912
  //## Custom Post Types and OG tags
913
  add_filter('plugin_action_links','ns_add_settings_link', 10, 2 );
img/ip-bg.png ADDED
Binary file
img/ip16.png ADDED
Binary file
inc-cl/apis/liOAuth.php CHANGED
@@ -34,10 +34,11 @@ class nsx_LinkedIn {
34
  $consumer = $this->consumer;
35
  $request = nsx_trOAuthRequest::from_consumer_and_token($consumer, NULL, "GET", $this->request_token_path);
36
  $request->set_parameter("oauth_callback", $this->oauth_callback);
37
- $request->sign_request($this->signature_method, $consumer, NULL); prr($request);
38
  $headers = Array();
39
- $url = $request->to_url(); echo "^^^^^"; prr($url);
40
- $response = $this->httpRequest($url, $headers, "GET"); prr($response); if ($response!='') $this->http_code = 200;
 
41
  parse_str($response, $response_params); //prr($response_params); echo "!!!!";
42
  $this->request_token = new nsx_trOAuthConsumer($response_params['oauth_token'], $response_params['oauth_token_secret'], 1); return $this->request_token;
43
  }
@@ -53,9 +54,9 @@ class nsx_LinkedIn {
53
  $request->set_parameter("oauth_verifier", $oauth_verifier);
54
  $request->sign_request($this->signature_method, $this->consumer, $this->request_token);
55
  $headers = Array();
56
- $url = $request->to_url(); echo "==========";
57
- $response = $this->httpRequest($url, $headers, "GET"); prr($request);
58
- parse_str($response, $response_params); prr($response_params);
59
  if($debug) {
60
  echo $response . "\n";
61
  }
@@ -119,7 +120,7 @@ class nsx_LinkedIn {
119
  if ($debug) {
120
  echo $auth_header . "\n";
121
  }
122
- $response = $this->httpRequest($status_url, $auth_header, "PUT", $xml); prr($response);
123
  return $response;
124
  }
125
 
34
  $consumer = $this->consumer;
35
  $request = nsx_trOAuthRequest::from_consumer_and_token($consumer, NULL, "GET", $this->request_token_path);
36
  $request->set_parameter("oauth_callback", $this->oauth_callback);
37
+ $request->sign_request($this->signature_method, $consumer, NULL); // prr($request);
38
  $headers = Array();
39
+ $url = $request->to_url(); // echo "^^^^^"; prr($url);
40
+ $response = $this->httpRequest($url, $headers, "GET"); //prr($response);
41
+ if ($response!='') $this->http_code = 200;
42
  parse_str($response, $response_params); //prr($response_params); echo "!!!!";
43
  $this->request_token = new nsx_trOAuthConsumer($response_params['oauth_token'], $response_params['oauth_token_secret'], 1); return $this->request_token;
44
  }
54
  $request->set_parameter("oauth_verifier", $oauth_verifier);
55
  $request->sign_request($this->signature_method, $this->consumer, $this->request_token);
56
  $headers = Array();
57
+ $url = $request->to_url(); // echo "==========";
58
+ $response = $this->httpRequest($url, $headers, "GET"); //prr($request);
59
+ parse_str($response, $response_params); // prr($response_params);
60
  if($debug) {
61
  echo $response . "\n";
62
  }
120
  if ($debug) {
121
  echo $auth_header . "\n";
122
  }
123
+ $response = $this->httpRequest($status_url, $auth_header, "PUT", $xml); // prr($response);
124
  return $response;
125
  }
126
 
inc-cl/apis/plurkOAuth.php CHANGED
@@ -165,13 +165,14 @@ class wpPlurkOAuth{
165
  'oauth_verifier' => $verifier,
166
  'oauth_signature_method' => 'HMAC-SHA1'
167
  );
168
- $req = array(); $req['method'] = 'GET'; $req['normalized_url'] = $this->baseURL.PLURK_ACCESS_TOKEN_PATH; echo "ARGS:"; prr($args);
169
  $req['normalized_parameters'] = $this->get_normalized_parameters($args);
170
  $args['oauth_signature'] = $this->sign_method->sign2($req, $this->consumer_secret, $this->access_secret);
171
  $url = $this->baseURL.PLURK_ACCESS_TOKEN_PATH.'?oauth_nonce='.$args['oauth_nonce'].'&oauth_timestamp='.$args['oauth_timestamp'].'&oauth_token_secret='.$this->access_secret.'&oauth_signature_method='.$args['oauth_signature_method'].'&oauth_consumer_key='.$this->consumer_key.'&oauth_verifier='.$verifier.'&oauth_version='.$args['oauth_version'].'&oauth_token='.$this->access_token.'&oauth_signature='.$args['oauth_signature'];
172
  echo "<br/>REQ Token URL: ".$url."<br/>";
173
  $hdrsArr = $this->makeHTTPHeaders($url); $ckArr = $nxs_vbCkArray;
174
  $response = wp_remote_get($url, array( 'method' => 'GET', 'timeout' => 45, 'redirection' => 0, 'headers' => $hdrsArr, 'cookies' => $ckArr));
 
175
  $this->http_code = $response['response']['code'];
176
  if (stripos($response['body'],'oauth_token_secret=')===false) echo 'Bad oAuth Login:'.$response['body']; else return $this->oAuthRespToArr($response['body']);
177
  }
@@ -193,6 +194,7 @@ class wpPlurkOAuth{
193
  $argsStr = ''; $argsT = array(); foreach ($args as $arN=>$arV){$argsT[] = $arN.'='.$arV;} $argsStr = implode('&', $argsT); $url .= '?'.$argsStr;
194
  $hdrsArr = $this->makeHTTPHeaders($url); $ckArr = $nxs_vbCkArray;
195
  $response = wp_remote_get($url, array( 'method' => 'GET', 'timeout' => 45, 'redirection' => 0, 'headers' => $hdrsArr, 'cookies' => $ckArr)); // prr($response);
 
196
  $this->http_code = $response['response']['code'];
197
  return json_decode($response['body'], true);
198
  }
165
  'oauth_verifier' => $verifier,
166
  'oauth_signature_method' => 'HMAC-SHA1'
167
  );
168
+ $req = array(); $req['method'] = 'GET'; $req['normalized_url'] = $this->baseURL.PLURK_ACCESS_TOKEN_PATH; // echo "ARGS:"; prr($args);
169
  $req['normalized_parameters'] = $this->get_normalized_parameters($args);
170
  $args['oauth_signature'] = $this->sign_method->sign2($req, $this->consumer_secret, $this->access_secret);
171
  $url = $this->baseURL.PLURK_ACCESS_TOKEN_PATH.'?oauth_nonce='.$args['oauth_nonce'].'&oauth_timestamp='.$args['oauth_timestamp'].'&oauth_token_secret='.$this->access_secret.'&oauth_signature_method='.$args['oauth_signature_method'].'&oauth_consumer_key='.$this->consumer_key.'&oauth_verifier='.$verifier.'&oauth_version='.$args['oauth_version'].'&oauth_token='.$this->access_token.'&oauth_signature='.$args['oauth_signature'];
172
  echo "<br/>REQ Token URL: ".$url."<br/>";
173
  $hdrsArr = $this->makeHTTPHeaders($url); $ckArr = $nxs_vbCkArray;
174
  $response = wp_remote_get($url, array( 'method' => 'GET', 'timeout' => 45, 'redirection' => 0, 'headers' => $hdrsArr, 'cookies' => $ckArr));
175
+ if ( is_wp_error($response) ) return $response;
176
  $this->http_code = $response['response']['code'];
177
  if (stripos($response['body'],'oauth_token_secret=')===false) echo 'Bad oAuth Login:'.$response['body']; else return $this->oAuthRespToArr($response['body']);
178
  }
194
  $argsStr = ''; $argsT = array(); foreach ($args as $arN=>$arV){$argsT[] = $arN.'='.$arV;} $argsStr = implode('&', $argsT); $url .= '?'.$argsStr;
195
  $hdrsArr = $this->makeHTTPHeaders($url); $ckArr = $nxs_vbCkArray;
196
  $response = wp_remote_get($url, array( 'method' => 'GET', 'timeout' => 45, 'redirection' => 0, 'headers' => $hdrsArr, 'cookies' => $ckArr)); // prr($response);
197
+ if ( is_wp_error($response) ) return $response;
198
  $this->http_code = $response['response']['code'];
199
  return json_decode($response['body'], true);
200
  }
inc-cl/bg.php CHANGED
@@ -4,72 +4,80 @@ $nxs_snapAvNts[] = array('code'=>'BG', 'lcode'=>'bg', 'name'=>'Blogger');
4
 
5
  if (!class_exists("nxs_snapClassBG")) { class nxs_snapClassBG {
6
  //#### Show Common Settings
7
- function showGenNTSettings($ntOpts){ global $nxs_snapThisPageUrl, $nxs_plurl; $code = 'BG'; $lcode = 'bg'; wp_nonce_field( 'ns'.$code, 'ns'.$code.'_wpnonce' );
8
- ?>
9
- <hr/><div class="nsx_iconedTitle" style="background-image: url(<?php echo $nxs_plurl; ?>img/<?php echo $lcode; ?>16.png);">Blogger Settings: <?php $cfbo = count($ntOpts); $mfbo = 1+max(array_keys($ntOpts)); ?> <?php wp_nonce_field( 'nsFB', 'nsFB_wpnonce' ); ?>
10
- <div class="nsBigText">You have <?php echo $cfbo=='0'?'No':$cfbo; ?> Blogger account<?php if ($cfbo!=1){ ?>s<?php } ?> <!-- - <a href="#" class="NXSButton" onclick="doShowHideBlocks2('FB<?php echo $mfbo; ?>');return false;">Add new Facebook Account</a> --> </div></div>
11
- <?php // if (function_exists('nxs_doSMAS1')) nxs_doSMAS1($this, $mfbo); else nxs_doSMAS('Blogger', 'BG'.$mfbo); ?>
12
- <?php foreach ($ntOpts as $indx=>$pbo){ if (trim($pbo['nName']=='')) $pbo['nName'] = $pbo['bgBlogID']; ?>
13
- <p style="margin: 0px;margin-left: 5px;"><input value="1" id="apDoBG" name="bg[<?php echo $indx; ?>][apDoBG]" onchange="doShowHideBlocks('BG');" type="checkbox" <?php if ((int)$pbo['doBG'] == 1) echo "checked"; ?> />
14
- <strong>Auto-publish your Posts to your Blogger <i style="color: #005800;"><?php if($pbo['nName']!='') echo "(".$pbo['nName'].")"; ?></i></strong>
15
- &nbsp;&nbsp;<a id="doBG<?php echo $indx; ?>A" href="#" onclick="doShowHideBlocks2('BG<?php echo $indx; ?>');return false;">[Show Settings]</a>&nbsp;&nbsp;
16
- <a href="#" onclick="doDelAcct('bg', '<?php echo $indx; ?>', '<?php if (isset($pbo['bgBlogID'])) echo $pbo['bgBlogID']; ?>');return false;">[Remove Account]</a>
17
- </p><?php $this->showNTSettings($indx, $pbo);
18
- } //## END TR Settings
 
 
 
 
 
 
 
19
  }
20
  //#### Show NEW Settings Page
21
  function showNewNTSettings($bo){ $po = array('nName'=>'', 'doBG'=>'1', 'bgUName'=>'', 'bgPass'=>'', 'bgBlogID'=>'', 'bgInclTags'=>'1', 'bgMsgFormat'=>'%FULLTEXT% <br/><a href=\'%URL%\'>%TITLE%</a>', 'bgMsgTFormat'=>'%TITLE%' ); $this->showNTSettings($bo, $po, true);}
22
  //#### Show Unit Settings
23
  function showNTSettings($ii, $options, $isNew=false){ global $nxs_plurl; ?>
24
- <div id="doBG<?php echo $ii; ?>Div" <?php if ($isNew){ ?>class="clNewNTSets"<?php } ?> style="max-width: 1000px; background-color: #EBF4FB; background-image: url(<?php echo $nxs_plurl; ?>img/bg-bg.png); background-position:90% 10%; background-repeat: no-repeat; margin: 10px; border: 1px solid #808080; padding: 10px; <?php if ((isset($options['bgOK']) && $options['bgOK']!='')||$isNew) { ?>display:none;<?php } ?>"> <input type="hidden" name="apDoSBG<?php echo $ii; ?>" value="0" id="apDoSBG<?php echo $ii; ?>" />
25
  <?php if ($isNew) { ?> <input type="hidden" name="bg[<?php echo $ii; ?>][apDoBG]" value="1" id="apDoNewBG<?php echo $ii; ?>" /> <?php } ?>
26
 
27
  <div style="display: none;"><input name="bg[<?php echo $ii; ?>][apBGPassChr]" id="apBGPassChr" type="password" value="" /></div>
28
 
29
- <div id="doBG<?php echo $ii; ?>Div" style="margin-left: 10px;"> <div class="nsx_iconedTitle" style="float: right; background-image: url(<?php echo $nxs_plurl; ?>img/bg16.png);"><a style="font-size: 12px;" target="_blank" href="http://www.nextscripts.com/setup-installation-blogger-social-networks-auto-poster-wordpress/">Detailed Blogger Installation/Configuration Instructions</a></div>
30
 
31
- <div style="width:100%;"><strong>Account Nickname:</strong> <i>Just so you can easely identify it</i> </div><input name="bg[<?php echo $ii; ?>][nName]" id="bgnName<?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")), 'NS_SNAutoPoster') ?>" /><br/>
32
  <?php echo nxs_addQTranslSel('bg', $ii, $options['qTLng']); ?>
33
  <?php echo nxs_addPostingDelaySel('bg', $ii, $options['nHrs'], $options['nMin']); ?>
34
 
35
  <?php if (!$isNew) { ?>
36
- <div style="width:100%;"><strong>Auto-Post Categories:</strong>
37
  <input value="0" id="catSelA<?php echo $ii; ?>" type="radio" name="bg[<?php echo $ii; ?>][catSel]" <?php if ((int)$options['catSel'] != 1) echo "checked"; ?> /> All
38
  <input value="1" id="catSelSBG<?php echo $ii; ?>" type="radio" name="bg[<?php echo $ii; ?>][catSel]" <?php if ((int)$options['catSel'] == 1) echo "checked"; ?> /> <a href="#" style="text-decoration: none;" class="showCats" id="nxs_SCA_BG<?php echo $ii; ?>" onclick="jQuery('#catSelSBG<?php echo $ii; ?>').attr('checked', true); jQuery('#tmpCatSelNT').val('BG<?php echo $ii; ?>'); nxs_markCats( jQuery('#nxs_SC_BG<?php echo $ii; ?>').val() ); jQuery('#showCatSel').bPopup({ modalClose: false, appendTo: '#nsStForm', opacity: 0.6, follow: [false, false], position: [75, 'auto']}); return false;">Selected<?php if ($options['catSelEd']!='') echo "[".(substr_count($options['catSelEd'], ",")+1)."]"; ?></a>
39
  <input type="hidden" name="bg[<?php echo $ii; ?>][catSelEd]" id="nxs_SC_BG<?php echo $ii; ?>" value="<?php echo $options['catSelEd']; ?>" />
 
40
  </div>
41
  <br/>
42
  <?php } ?>
43
 
44
- <div style="width:100%;"><strong>Blogger Username/Email:</strong> </div><input name="bg[<?php echo $ii; ?>][apBGUName]" id="apBGUName" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit',htmlentities($options['bgUName'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" />
45
- <div style="width:100%;"><strong>Blogger Password:</strong> </div><input name="bg[<?php echo $ii; ?>][apBGPass]" id="apBGPass" autocomplete="off" type="password" style="width: 30%;" value="<?php if (trim($options['bgPass'])!='') _e(apply_filters('format_to_edit', htmlentities(substr($options['bgPass'], 0, 5)=='b4d7s'?nsx_doDecode(substr($options['bgPass'], 5)):$options['bgPass'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" /> <br/>
46
  <div style="width:100%;"><strong>Blogger Blog ID:</strong>
47
- <p style="font-size: 11px; margin: 0px;">Log to your Blogger management panel and look at the URL: http://www.blogger.com/blogger.g?blogID=8959085979163812093#allposts. Your Blog ID will be: 8959085979163812093</p>
48
- </div><input name="bg[<?php echo $ii; ?>][apBGBlogID]" id="apBGBlogID" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['bgBlogID'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" />
49
  <br/><br/>
50
 
51
- <div style="width:100%;"><strong id="altFormatText">Post Title Format:</strong> (<a href="#" id="apBGTMsgFrmt<?php echo $ii; ?>HintInfo" onclick="mxs_showHideFrmtInfo('apBGTMsgFrmt<?php echo $ii; ?>'); return false;">Show format info</a>)</div>
52
 
53
- <input name="bg[<?php echo $ii; ?>][apBGMsgTFrmt]" id="apBGMsgTFrmt" style="width: 50%;" value="<?php if ($options['bgMsgTFormat']!='') _e(apply_filters('format_to_edit', htmlentities($options['bgMsgTFormat'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster'); else echo "%TITLE%"; ?>" onfocus="mxs_showFrmtInfo('apBGTMsgFrmt<?php echo $ii; ?>');" /><?php nxs_doShowHint("apBGTMsgFrmt".$ii); ?><br/>
54
 
55
  <div id="altFormat" style="">
56
- <div style="width:100%;"><strong id="altFormatText">Post Text Format:</strong> (<a href="#" id="apBGMsgFrmt<?php echo $ii; ?>HintInfo" onclick="mxs_showHideFrmtInfo('apBGMsgFrmt<?php echo $ii; ?>'); return false;">Show format info</a>)
57
 
58
  HTML is <?php if(!function_exists('doPostToGooglePlus')) {?> <b>NOT</b> <?php } ?> allowed. <?php if(!function_exists('doPostToGooglePlus')) {?> <i>- Blogger "Free API" limitation. Please get <a href="http://www.nextscripts.com/google-plus-automated-posting/#blogger">NextScripts API</a> to allow HTML</i> <?php } ?>
59
  </div>
60
- <input name="bg[<?php echo $ii; ?>][apBGMsgFrmt]" id="apBGMsgFrmt" style="width: 50%;" value="<?php if ($options['bgMsgFormat']!='') _e(apply_filters('format_to_edit',htmlentities($options['bgMsgFormat'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster'); else echo "%FULLTEXT% <br/><a href='%URL%'>%TITLE%</a>"; ?>" onfocus="mxs_showFrmtInfo('apBGMsgFrmt<?php echo $ii; ?>');"/><?php nxs_doShowHint("apBGMsgFrmt".$ii); ?>
61
  </div>
62
 
63
  <p style="margin-bottom: 20px;margin-top: 5px;"><input value="1" id="bgInclTags" type="checkbox" name="bg[<?php echo $ii; ?>][bgInclTags]" <?php if ((int)$options['bgInclTags'] == 1) echo "checked"; ?> />
64
- <strong>Post with tags</strong> Tags from the blogpost will be auto-posted to Blogger/Blogspot
65
  </p>
66
 
67
  <?php if ($options['bgPass']!='') { ?>
68
  <?php wp_nonce_field( 'rePostToBG', 'rePostToBG_wpnonce' ); ?>
69
- <b>Test your settings:</b>&nbsp;&nbsp;&nbsp; <?php if (!isset($options['bgOK']) || $options['bgOK']!='1') { ?> <div class="blnkg">=== Submit Test Post to Complete ===&gt;</div> <?php } ?> <a href="#" class="NXSButton" onclick="testPost('BG', '<?php echo $ii; ?>'); return false;">Submit Test Post to Blogger</a>
70
  <?php } ?>
71
 
72
- <div class="submit"><input type="submit" class="button-primary" name="update_NS_SNAutoPoster_settings" value="<?php _e('Update Settings', 'NS_SNAutoPoster') ?>" /></div>
73
  </div>
74
  </div>
75
  <?php
@@ -102,24 +110,25 @@ if (!class_exists("nxs_snapClassBG")) { class nxs_snapClassBG {
102
  }
103
  //#### Show Post->Edit Meta Box Settings
104
  function showEdPostNTSettings($ntOpts, $post){ global $nxs_plurl; $post_id = $post->ID;
105
- foreach($ntOpts as $ii=>$options){ $pMeta = maybe_unserialize(get_post_meta($post_id, 'snapBG', true)); if (is_array($pMeta)) $options = $this->adjMetaOpt($options, $pMeta[$ii]); $doBG = $options['doBG'] && $options['catSel']!='1';
 
106
  $isAvailBG = $options['bgUName']!='' && $options['bgPass']!=''; $bgMsgFormat = htmlentities($options['bgMsgFormat'], ENT_COMPAT, "UTF-8"); $bgMsgTFormat = htmlentities($options['bgMsgTFormat'], ENT_COMPAT, "UTF-8");
107
  ?>
108
 
109
  <tr><th style="text-align:left;" colspan="2"><?php if ( $options['catSel']=='1' && trim($options['catSelEd'])!='' ) { ?> <input type="hidden" class="nxs_SC" id="nxs_SC_BG<?php echo $ii; ?>" value="<?php echo $options['catSelEd']; ?>" /> <?php } ?>
110
- <?php if ($isAvailBG) { ?><input class="nxsGrpDoChb" value="1" id="doBG<?php echo $ii; ?>" <?php if ($post->post_status == "publish") echo 'disabled="disabled"';?> type="checkbox" name="bg[<?php echo $ii; ?>][SNAPincludeBG]" <?php if (($post->post_status == "publish" && $options['isPosted'] == '1') || ($post->post_status != "publish" && ((int)$doBG == 1)) ) echo 'checked="checked" title="def"'; ?> /> <?php } ?>
111
- <div class="nsx_iconedTitle" style="display: inline; font-size: 13px; background-image: url(<?php echo $nxs_plurl; ?>img/bg16.png);">Blogger - publish to (<i style="color: #005800;"><?php echo $options['nName']; ?></i>)</div></th> <td><?php //## Only show RePost button if the post is "published"
112
  if ($post->post_status == "publish" && $isAvailBG) { ?>
113
- <input alt="<?php echo $ii; ?>" style="float: right;" onmouseout="hidePopShAtt('SV');" onmouseover="showPopShAtt('SV', event);" onclick="return false;" type="button" class="button" name="rePostToBG_repostButton" id="rePostToBG_button" value="<?php _e('Repost to Blogger', 're-post') ?>" />
114
  <?php wp_nonce_field( 'rePostToBG', 'rePostToBG_wpnonce' ); } ?>
115
 
116
  <?php if (is_array($pMeta) && is_array($pMeta[$ii]) && isset($pMeta[$ii]['pgID']) ) {
117
  ?> <span id="pstdBG<?php echo $ii; ?>" style="float: right; padding-top: 4px; padding-right: 10px;">
118
- <a style="font-size: 10px;" href="<?php echo $pMeta[$ii]['pgID']; ?>" target="_blank">Posted on Blogger <?php echo (isset($pMeta[$ii]['pDate']) && $pMeta[$ii]['pDate']!='')?(" (".$pMeta[$ii]['pDate'].")"):""; ?></a>
119
  </span><?php } ?>
120
 
121
  </td></tr>
122
- <?php if (!$isAvailBG) { ?><tr><th scope="row" style="text-align:right; width:150px; padding-top: 5px; padding-right:10px;"></th> <td><b>Setup your Blogger Account to AutoPost to Blogger</b>
123
  <?php } elseif ($post->post_status != "puZblish") { ?>
124
  <tr id="altFormat1" style=""><th scope="row" style="text-align:right; width:60px; padding-right:10px;"><?php _e('Title Format:', 'NS_SPAP') ?></th>
125
  <td><input value="<?php echo $bgMsgTFormat ?>" type="text" name="bg[<?php echo $ii; ?>][SNAPTformat]" style="width:60%;max-width: 610px;" onfocus="jQuery('.nxs_FRMTHint').hide();mxs_showFrmtInfo('apBGTMsgFrmt<?php echo $ii; ?>');"/><?php nxs_doShowHint("apBGTMsgFrmt".$ii); ?></td></tr>
@@ -132,7 +141,8 @@ if (!class_exists("nxs_snapClassBG")) { class nxs_snapClassBG {
132
  function adjMetaOpt($optMt, $pMeta){ if (isset($pMeta['isPosted'])) $optMt['isPosted'] = $pMeta['isPosted']; else $optMt['isPosted'] = '';
133
  if (isset($pMeta['SNAPformat'])) $optMt['bgMsgFormat'] = $pMeta['SNAPformat'];
134
  if (isset($pMeta['SNAPTformat'])) $optMt['bgMsgTFormat'] = $pMeta['SNAPTformat'];
135
- if (isset($pMeta['SNAPincludeBG'])) $optMt['doBG'] = $pMeta['SNAPincludeBG'] == 1?1:0; else { if (isset($pMeta['SNAPformat'])) $optMt['doBG'] = 0; }
 
136
  return $optMt;
137
  }
138
  }}
@@ -157,7 +167,7 @@ if (!function_exists('nsBloggerGetAuth')){ function nsBloggerGetAuth($email, $pa
157
  curl_setopt($ch, CURLOPT_CONNECTTIMEOUT ,10); curl_setopt($ch, CURLOPT_TIMEOUT, 10);
158
  curl_setopt($ch, CURLOPT_HEADER,0); curl_setopt($ch, CURLOPT_RETURNTRANSFER ,1);
159
  $result = curl_exec($ch); $resultArray = curl_getinfo($ch);
160
- curl_close($ch); $arr = explode("=",$result); $token = $arr[3]; if (trim($token)=='') die('Incorrect Username/Password'); return $token;
161
  }}
162
  if (!function_exists('nsBloggerNewPost')){ function nsBloggerNewPost($auth, $blogID, $title, $text) {$text = str_ireplace('allowfullscreen','', $text); $title = utf8_decode(strip_tags($title));
163
  $text = preg_replace('/<object\b[^>]*>(.*?)<\/object>/is', "", $text); $text = preg_replace('/<iframe\b[^>]*>(.*?)<\/iframe>/is', "", $text);
@@ -174,13 +184,14 @@ if (!function_exists('nsBloggerNewPost')){ function nsBloggerNewPost($auth, $blo
174
  if (!function_exists("nxs_doPublishToBG")) { //## Second Function to Post to BG
175
  function nxs_doPublishToBG($postID, $options){ $ntCd = 'BG'; $ntCdL = 'bg'; $ntNm = 'Blogger';
176
  $blogTitle = htmlspecialchars_decode(get_bloginfo('name'), ENT_QUOTES); if ($blogTitle=='') $blogTitle = home_url();
 
177
  $ii = $options['ii']; if (!isset($options['pType'])) $options['pType'] = 'im'; if ($options['pType']=='sh') sleep(rand(1, 10)); $snap_ap = get_post_meta($postID, 'snap'.$ntCd, true); $snap_ap = maybe_unserialize($snap_ap);
178
  if ($options['pType']!='aj' && is_array($snap_ap) && (nxs_chArrVar($snap_ap[$ii], 'isPosted', '1') || nxs_chArrVar($snap_ap[$ii], 'isPrePosted', '1'))) {
179
  nxs_addToLog($ntCd.' - '.$options['nName'], 'E', '-=Duplicate=- Post ID:'.$postID, 'Not posted. No reason for posting duplicate'); return;
180
  }
181
  if ($postID=='0') { echo "Testing ... <br/><br/>"; $msgT = 'Test Post from '.htmlentities($blogTitle); $link = home_url(); $msg = 'Test Post from '.$blogTitle. " ".$link; }
182
- else { $post = get_post($postID); if(!$post) return; $msgFormat = $options['bgMsgFormat']; $msg = nsFormatMessage($msgFormat, $postID);
183
- $link = get_permalink($postID); $msgTFormat = $options['bgMsgTFormat']; $msgT = nsFormatMessage($msgTFormat, $postID); nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPrePosted'=>'1'));
184
  }
185
  //## Actual POST Code
186
  $email = $options['bgUName']; $pass = substr($options['bgPass'], 0, 5)=='b4d7s'?nsx_doDecode(substr($options['bgPass'], 5)):$options['bgPass']; $blogID = $options['bgBlogID'];
@@ -197,8 +208,10 @@ if (!function_exists("nxs_doPublishToBG")) { //## Second Function to Post to BG
197
  $msg = preg_replace('/<script\b[^>]*>(.*?)<\/script>/is', "", $msg); $msg = preg_replace('/<!--(.*)-->/Uis', "", $msg); $nxshf = new NXS_HtmlFixer(); $nxshf->debug = false; $msg = $nxshf->getFixedHtml($msg);
198
  // prr($msg); die();
199
 
200
- if (function_exists("doConnectToBlogger")) {$auth = doConnectToBlogger($email, $pass); if ($auth!==false) die($auth); $ret = doPostToBlogger($blogID, $msgT, $msg, $tags);}
201
- else {$auth = nsBloggerGetAuth($email, $pass); $msgT = str_ireplace('&amp;', '&', $msgT); $msgT = utf8_encode(str_ireplace('&', '&amp;', $msgT)); $msg = utf8_encode($msg); $ret = nsBloggerNewPost($auth, $blogID, $msgT, $msg);}
 
 
202
  //## /Actual POST Code
203
  if ( (!is_array($ret)) && $ret!='OK') { if ($postID=='0') prr($ret); nxs_addToLog($logNT, 'E', '-=ERROR=- '. strip_tags(print_r($ret, true)), $extInfo); return $ret; }
204
  else { if ($postID=='0') { echo 'OK - Message Posted, please see your '.$ntNm.' Page '; nxs_addToLog($logNT, 'M', 'OK - TEST Message Posted '); return 201;}
4
 
5
  if (!class_exists("nxs_snapClassBG")) { class nxs_snapClassBG {
6
  //#### Show Common Settings
7
+ function showGenNTSettings($ntOpts){ global $nxs_plurl; $ntInfo = array('code'=>'BG', 'lcode'=>'bg', 'name'=>'Blogger', 'defNName'=>'diUName', 'tstReq' => true); ?>
8
+ <div class="nxs_box">
9
+ <div class="nxs_box_header">
10
+ <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']; ?>
11
+ <?php $cbo = count($ntOpts); ?> <?php wp_nonce_field( 'ns'.$ntInfo['code'], 'ns'.$ntInfo['code'].'_wpnonce' ); ?>
12
+ <?php if ($cbo>1){ ?><div class="nsBigText"><?php echo "(".($cbo=='0'?'No':$cbo)." "; _e('accounts', 'nxs_snap'); echo ")"; ?></div><?php } ?>
13
+ </div>
14
+ </div>
15
+ <div class="nxs_box_inside">
16
+ <?php foreach ($ntOpts as $indx=>$pbo){ if (trim($pbo['nName']=='')) $pbo['nName'] = $pbo[$ntInfo['defNName']]; ?>
17
+ <p style="margin:0px;margin-left:5px;">
18
+ <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"; ?> />
19
+ <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>
20
+ &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;
21
+ <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>
22
+ </p><?php $this->showNTSettings($indx, $pbo);
23
+ }?>
24
+ </div>
25
+ </div> <?php //## END Settings
26
  }
27
  //#### Show NEW Settings Page
28
  function showNewNTSettings($bo){ $po = array('nName'=>'', 'doBG'=>'1', 'bgUName'=>'', 'bgPass'=>'', 'bgBlogID'=>'', 'bgInclTags'=>'1', 'bgMsgFormat'=>'%FULLTEXT% <br/><a href=\'%URL%\'>%TITLE%</a>', 'bgMsgTFormat'=>'%TITLE%' ); $this->showNTSettings($bo, $po, true);}
29
  //#### Show Unit Settings
30
  function showNTSettings($ii, $options, $isNew=false){ global $nxs_plurl; ?>
31
+ <div id="doBG<?php echo $ii; ?>Div" class="insOneDiv<?php if ($isNew){ ?> clNewNTSets<?php } ?>" style="background-image: url(<?php echo $nxs_plurl; ?>img/bg-bg.png);background-position:90% 10%;"> <input type="hidden" name="apDoSBG<?php echo $ii; ?>" value="0" id="apDoSBG<?php echo $ii; ?>" />
32
  <?php if ($isNew) { ?> <input type="hidden" name="bg[<?php echo $ii; ?>][apDoBG]" value="1" id="apDoNewBG<?php echo $ii; ?>" /> <?php } ?>
33
 
34
  <div style="display: none;"><input name="bg[<?php echo $ii; ?>][apBGPassChr]" id="apBGPassChr" type="password" value="" /></div>
35
 
36
+ <div id="doBG<?php echo $ii; ?>Div" style="margin-left: 10px;"> <div class="nsx_iconedTitle" style="float: right; background-image: url(<?php echo $nxs_plurl; ?>img/bg16.png);"><a style="font-size: 12px;" target="_blank" href="http://www.nextscripts.com/setup-installation-blogger-social-networks-auto-poster-wordpress/"><?php $nType="Blogger"; printf( __( 'Detailed %s Installation/Configuration Instructions', 'nxs_snap' ), $nType); ?></a></div>
37
 
38
+ <div style="width:100%;"><strong><?php _e('Account Nickname', 'nxs_snap'); ?>:</strong> <i><?php _e('Just so you can easely identify it', 'nxs_snap'); ?></i> </div><input name="bg[<?php echo $ii; ?>][nName]" id="bgnName<?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")), 'nxs_snap') ?>" /><br/>
39
  <?php echo nxs_addQTranslSel('bg', $ii, $options['qTLng']); ?>
40
  <?php echo nxs_addPostingDelaySel('bg', $ii, $options['nHrs'], $options['nMin']); ?>
41
 
42
  <?php if (!$isNew) { ?>
43
+ <div style="width:100%;"><strong><?php _e('Categories', 'nxs_snap'); ?>:</strong>
44
  <input value="0" id="catSelA<?php echo $ii; ?>" type="radio" name="bg[<?php echo $ii; ?>][catSel]" <?php if ((int)$options['catSel'] != 1) echo "checked"; ?> /> All
45
  <input value="1" id="catSelSBG<?php echo $ii; ?>" type="radio" name="bg[<?php echo $ii; ?>][catSel]" <?php if ((int)$options['catSel'] == 1) echo "checked"; ?> /> <a href="#" style="text-decoration: none;" class="showCats" id="nxs_SCA_BG<?php echo $ii; ?>" onclick="jQuery('#catSelSBG<?php echo $ii; ?>').attr('checked', true); jQuery('#tmpCatSelNT').val('BG<?php echo $ii; ?>'); nxs_markCats( jQuery('#nxs_SC_BG<?php echo $ii; ?>').val() ); jQuery('#showCatSel').bPopup({ modalClose: false, appendTo: '#nsStForm', opacity: 0.6, follow: [false, false], position: [75, 'auto']}); return false;">Selected<?php if ($options['catSelEd']!='') echo "[".(substr_count($options['catSelEd'], ",")+1)."]"; ?></a>
46
  <input type="hidden" name="bg[<?php echo $ii; ?>][catSelEd]" id="nxs_SC_BG<?php echo $ii; ?>" value="<?php echo $options['catSelEd']; ?>" />
47
+ <br/><i><?php _e('Only selected categories will be autoposted to this account', 'nxs_snap'); ?></i>
48
  </div>
49
  <br/>
50
  <?php } ?>
51
 
52
+ <div style="width:100%;"><strong>Blogger Username/Email:</strong> </div><input name="bg[<?php echo $ii; ?>][apBGUName]" id="apBGUName" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit',htmlentities($options['bgUName'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" />
53
+ <div style="width:100%;"><strong>Blogger Password:</strong> </div><input name="bg[<?php echo $ii; ?>][apBGPass]" id="apBGPass" autocomplete="off" type="password" style="width: 30%;" value="<?php if (trim($options['bgPass'])!='') _e(apply_filters('format_to_edit', htmlentities(substr($options['bgPass'], 0, 5)=='b4d7s'?nsx_doDecode(substr($options['bgPass'], 5)):$options['bgPass'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" /> <br/>
54
  <div style="width:100%;"><strong>Blogger Blog ID:</strong>
55
+ <p style="font-size: 11px; margin: 0px;"><?php _e('Log to your Blogger management panel and look at the URL of your blog: http://www.blogger.com/blogger.g?blogID=8959085979163812093#allposts. Your Blog ID will be: 8959085979163812093', 'nxs_snap'); ?></p>
56
+ </div><input name="bg[<?php echo $ii; ?>][apBGBlogID]" id="apBGBlogID" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['bgBlogID'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" />
57
  <br/><br/>
58
 
59
+ <div style="width:100%;"><strong id="altFormatText"><?php _e('Post Title Format', 'nxs_snap'); ?>:</strong> (<a href="#" id="apBGTMsgFrmt<?php echo $ii; ?>HintInfo" onclick="mxs_showHideFrmtInfo('apBGTMsgFrmt<?php echo $ii; ?>'); return false;"><?php _e('Show format info', 'nxs_snap'); ?></a>)</div>
60
 
61
+ <input name="bg[<?php echo $ii; ?>][apBGMsgTFrmt]" id="apBGMsgTFrmt" style="width: 50%;" value="<?php if ($options['bgMsgTFormat']!='') _e(apply_filters('format_to_edit', htmlentities($options['bgMsgTFormat'], ENT_COMPAT, "UTF-8")), 'nxs_snap'); else echo "%TITLE%"; ?>" onfocus="mxs_showFrmtInfo('apBGTMsgFrmt<?php echo $ii; ?>');" /><?php nxs_doShowHint("apBGTMsgFrmt".$ii); ?><br/>
62
 
63
  <div id="altFormat" style="">
64
+ <div style="width:100%;"><strong id="altFormatText"><?php _e('Post Text Format', 'nxs_snap'); ?>:</strong> (<a href="#" id="apBGMsgFrmt<?php echo $ii; ?>HintInfo" onclick="mxs_showHideFrmtInfo('apBGMsgFrmt<?php echo $ii; ?>'); return false;"><?php _e('Show format info', 'nxs_snap'); ?></a>)
65
 
66
  HTML is <?php if(!function_exists('doPostToGooglePlus')) {?> <b>NOT</b> <?php } ?> allowed. <?php if(!function_exists('doPostToGooglePlus')) {?> <i>- Blogger "Free API" limitation. Please get <a href="http://www.nextscripts.com/google-plus-automated-posting/#blogger">NextScripts API</a> to allow HTML</i> <?php } ?>
67
  </div>
68
+ <input name="bg[<?php echo $ii; ?>][apBGMsgFrmt]" id="apBGMsgFrmt" style="width: 50%;" value="<?php if ($options['bgMsgFormat']!='') _e(apply_filters('format_to_edit',htmlentities($options['bgMsgFormat'], ENT_COMPAT, "UTF-8")), 'nxs_snap'); else echo "%FULLTEXT% <br/><a href='%URL%'>%TITLE%</a>"; ?>" onfocus="mxs_showFrmtInfo('apBGMsgFrmt<?php echo $ii; ?>');"/><?php nxs_doShowHint("apBGMsgFrmt".$ii); ?>
69
  </div>
70
 
71
  <p style="margin-bottom: 20px;margin-top: 5px;"><input value="1" id="bgInclTags" type="checkbox" name="bg[<?php echo $ii; ?>][bgInclTags]" <?php if ((int)$options['bgInclTags'] == 1) echo "checked"; ?> />
72
+ <strong><?php _e('Post with tags', 'nxs_snap'); ?></strong> <?php _e('Tags from the blogpost will be auto-posted to Blogger/Blogspot', 'nxs_snap'); ?>
73
  </p>
74
 
75
  <?php if ($options['bgPass']!='') { ?>
76
  <?php wp_nonce_field( 'rePostToBG', 'rePostToBG_wpnonce' ); ?>
77
+ <b><?php _e('Test your settings', 'nxs_snap'); ?>:</b>&nbsp;&nbsp;&nbsp; <?php if (!isset($options['bgOK']) || $options['bgOK']!='1') { ?> <div class="blnkg">=== <?php _e('Submit Test Post to Finish Configuration', 'nxs_snap'); ?> ===&gt;</div> <?php } ?> <a href="#" class="NXSButton" onclick="testPost('BG', '<?php echo $ii; ?>'); return false;"><?php printf( __( 'Submit Test Post to %s', 'nxs_snap' ), $nType); ?></a>
78
  <?php } ?>
79
 
80
+ <div class="submit"><input type="submit" class="button-primary" name="update_NS_SNAutoPoster_settings" value="<?php _e('Update Settings', 'nxs_snap') ?>" /></div>
81
  </div>
82
  </div>
83
  <?php
110
  }
111
  //#### Show Post->Edit Meta Box Settings
112
  function showEdPostNTSettings($ntOpts, $post){ global $nxs_plurl; $post_id = $post->ID;
113
+ foreach($ntOpts as $ii=>$options){ $pMeta = maybe_unserialize(get_post_meta($post_id, 'snapBG', true)); if (is_array($pMeta)) $options = $this->adjMetaOpt($options, $pMeta[$ii]);
114
+ $doBG = $options['doBG'] && (is_array($pMeta) || $options['catSel']!='1');
115
  $isAvailBG = $options['bgUName']!='' && $options['bgPass']!=''; $bgMsgFormat = htmlentities($options['bgMsgFormat'], ENT_COMPAT, "UTF-8"); $bgMsgTFormat = htmlentities($options['bgMsgTFormat'], ENT_COMPAT, "UTF-8");
116
  ?>
117
 
118
  <tr><th style="text-align:left;" colspan="2"><?php if ( $options['catSel']=='1' && trim($options['catSelEd'])!='' ) { ?> <input type="hidden" class="nxs_SC" id="nxs_SC_BG<?php echo $ii; ?>" value="<?php echo $options['catSelEd']; ?>" /> <?php } ?>
119
+ <?php if ($isAvailBG) { ?><input class="nxsGrpDoChb" value="1" id="doBG<?php echo $ii; ?>" <?php if ($post->post_status == "publish") echo 'disabled="disabled"';?> type="checkbox" name="bg[<?php echo $ii; ?>][doBG]" <?php if (($post->post_status == "publish" && $options['isPosted'] == '1') || ($post->post_status != "publish" && ((int)$doBG == 1)) ) echo 'checked="checked" title="def"'; ?> /> <?php } ?>
120
+ <div class="nsx_iconedTitle" style="display: inline; font-size: 13px; background-image: url(<?php echo $nxs_plurl; ?>img/bg16.png);">Blogger - <?php _e('publish to', 'nxs_snap') ?> (<i style="color: #005800;"><?php echo $options['nName']; ?></i>)</div></th> <td><?php //## Only show RePost button if the post is "published"
121
  if ($post->post_status == "publish" && $isAvailBG) { ?>
122
+ <input alt="<?php echo $ii; ?>" style="float: right;" onmouseout="hidePopShAtt('SV');" onmouseover="showPopShAtt('SV', event);" onclick="return false;" type="button" class="button" name="rePostToBG_repostButton" id="rePostToBG_button" value="<?php _e('Repost to Blogger', 'nxs_snap') ?>" />
123
  <?php wp_nonce_field( 'rePostToBG', 'rePostToBG_wpnonce' ); } ?>
124
 
125
  <?php if (is_array($pMeta) && is_array($pMeta[$ii]) && isset($pMeta[$ii]['pgID']) ) {
126
  ?> <span id="pstdBG<?php echo $ii; ?>" style="float: right; padding-top: 4px; padding-right: 10px;">
127
+ <a style="font-size: 10px;" href="<?php echo $pMeta[$ii]['pgID']; ?>" target="_blank"><?php $nType="Blogger"; printf( __( 'Posted on', 'nxs_snap' ), $nType); ?><?php echo (isset($pMeta[$ii]['pDate']) && $pMeta[$ii]['pDate']!='')?(" (".$pMeta[$ii]['pDate'].")"):""; ?></a>
128
  </span><?php } ?>
129
 
130
  </td></tr>
131
+ <?php if (!$isAvailBG) { ?><tr><th scope="row" style="text-align:right; width:150px; padding-top: 5px; padding-right:10px;"></th> <td><b><?php _e('Setup your Blogger Account to AutoPost to Blogger', 'nxs_snap') ?></b>
132
  <?php } elseif ($post->post_status != "puZblish") { ?>
133
  <tr id="altFormat1" style=""><th scope="row" style="text-align:right; width:60px; padding-right:10px;"><?php _e('Title Format:', 'NS_SPAP') ?></th>
134
  <td><input value="<?php echo $bgMsgTFormat ?>" type="text" name="bg[<?php echo $ii; ?>][SNAPTformat]" style="width:60%;max-width: 610px;" onfocus="jQuery('.nxs_FRMTHint').hide();mxs_showFrmtInfo('apBGTMsgFrmt<?php echo $ii; ?>');"/><?php nxs_doShowHint("apBGTMsgFrmt".$ii); ?></td></tr>
141
  function adjMetaOpt($optMt, $pMeta){ if (isset($pMeta['isPosted'])) $optMt['isPosted'] = $pMeta['isPosted']; else $optMt['isPosted'] = '';
142
  if (isset($pMeta['SNAPformat'])) $optMt['bgMsgFormat'] = $pMeta['SNAPformat'];
143
  if (isset($pMeta['SNAPTformat'])) $optMt['bgMsgTFormat'] = $pMeta['SNAPTformat'];
144
+ if (isset($pMeta['doBG'])) $optMt['doBG'] = $pMeta['doBG'] == 1?1:0; else { if (isset($pMeta['SNAPformat'])) $optMt['doBG'] = 0; }
145
+ if (isset($pMeta['SNAPincludeBG']) && $pMeta['SNAPincludeBG'] == '1' ) $optMt['doBG'] = 1;
146
  return $optMt;
147
  }
148
  }}
167
  curl_setopt($ch, CURLOPT_CONNECTTIMEOUT ,10); curl_setopt($ch, CURLOPT_TIMEOUT, 10);
168
  curl_setopt($ch, CURLOPT_HEADER,0); curl_setopt($ch, CURLOPT_RETURNTRANSFER ,1);
169
  $result = curl_exec($ch); $resultArray = curl_getinfo($ch);
170
+ curl_close($ch); $arr = explode("=",$result); $token = $arr[3]; if (trim($token)=='') return false; else return $token;
171
  }}
172
  if (!function_exists('nsBloggerNewPost')){ function nsBloggerNewPost($auth, $blogID, $title, $text) {$text = str_ireplace('allowfullscreen','', $text); $title = utf8_decode(strip_tags($title));
173
  $text = preg_replace('/<object\b[^>]*>(.*?)<\/object>/is', "", $text); $text = preg_replace('/<iframe\b[^>]*>(.*?)<\/iframe>/is', "", $text);
184
  if (!function_exists("nxs_doPublishToBG")) { //## Second Function to Post to BG
185
  function nxs_doPublishToBG($postID, $options){ $ntCd = 'BG'; $ntCdL = 'bg'; $ntNm = 'Blogger';
186
  $blogTitle = htmlspecialchars_decode(get_bloginfo('name'), ENT_QUOTES); if ($blogTitle=='') $blogTitle = home_url();
187
+ $addParams = nxs_makeURLParams(array('NTNAME'=>$ntNm, 'NTCODE'=>$ntCd, 'ACCNAME'=>$options['nName'], 'POSTID'=>$postID));
188
  $ii = $options['ii']; if (!isset($options['pType'])) $options['pType'] = 'im'; if ($options['pType']=='sh') sleep(rand(1, 10)); $snap_ap = get_post_meta($postID, 'snap'.$ntCd, true); $snap_ap = maybe_unserialize($snap_ap);
189
  if ($options['pType']!='aj' && is_array($snap_ap) && (nxs_chArrVar($snap_ap[$ii], 'isPosted', '1') || nxs_chArrVar($snap_ap[$ii], 'isPrePosted', '1'))) {
190
  nxs_addToLog($ntCd.' - '.$options['nName'], 'E', '-=Duplicate=- Post ID:'.$postID, 'Not posted. No reason for posting duplicate'); return;
191
  }
192
  if ($postID=='0') { echo "Testing ... <br/><br/>"; $msgT = 'Test Post from '.htmlentities($blogTitle); $link = home_url(); $msg = 'Test Post from '.$blogTitle. " ".$link; }
193
+ else { $post = get_post($postID); if(!$post) return; $msgFormat = $options['bgMsgFormat']; $msg = nsFormatMessage($msgFormat, $postID, $addParams);
194
+ $link = get_permalink($postID); $msgTFormat = $options['bgMsgTFormat']; $msgT = nsFormatMessage($msgTFormat, $postID, $addParams); nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPrePosted'=>'1'));
195
  }
196
  //## Actual POST Code
197
  $email = $options['bgUName']; $pass = substr($options['bgPass'], 0, 5)=='b4d7s'?nsx_doDecode(substr($options['bgPass'], 5)):$options['bgPass']; $blogID = $options['bgBlogID'];
208
  $msg = preg_replace('/<script\b[^>]*>(.*?)<\/script>/is', "", $msg); $msg = preg_replace('/<!--(.*)-->/Uis', "", $msg); $nxshf = new NXS_HtmlFixer(); $nxshf->debug = false; $msg = $nxshf->getFixedHtml($msg);
209
  // prr($msg); die();
210
 
211
+ if (function_exists("doConnectToBlogger")) {$auth = doConnectToBlogger($email, $pass); if ($auth!==false) $ret = $auth; else $ret = doPostToBlogger($blogID, $msgT, $msg, $tags);}
212
+ else {$auth = nsBloggerGetAuth($email, $pass); if ($auth===false) $ret = 'Incorrect Username/Password'; else { $msgT = str_ireplace('&amp;', '&', $msgT);
213
+ $msgT = utf8_encode(str_ireplace('&', '&amp;', $msgT)); $msg = utf8_encode($msg); $ret = nsBloggerNewPost($auth, $blogID, $msgT, $msg);
214
+ }}
215
  //## /Actual POST Code
216
  if ( (!is_array($ret)) && $ret!='OK') { if ($postID=='0') prr($ret); nxs_addToLog($logNT, 'E', '-=ERROR=- '. strip_tags(print_r($ret, true)), $extInfo); return $ret; }
217
  else { if ($postID=='0') { echo 'OK - Message Posted, please see your '.$ntNm.' Page '; nxs_addToLog($logNT, 'M', 'OK - TEST Message Posted '); return 201;}
inc-cl/di.php CHANGED
@@ -1,79 +1,79 @@
1
  <?php
2
  //## NextScripts Facebook Connection Class
3
- $nxs_snapAvNts[] = array('code'=>'DI', 'lcode'=>'di', 'name'=>'Diigo (Beta)');
4
 
5
  if (!class_exists("nxs_snapClassDI")) { class nxs_snapClassDI {
6
  //#### Show Common Settings
7
- function showGenNTSettings($ntOpts){ global $nxs_snapThisPageUrl, $nxs_plurl, $nxsOne; $code = 'DI'; $lcode = 'di'; wp_nonce_field( 'ns'.$code, 'ns'.$code.'_wpnonce' ); ?>
8
- <hr/><div class="nsx_iconedTitle" style="background-image: url(<?php echo $nxs_plurl; ?>img/<?php echo $lcode; ?>16.png);">Diigo Settings:
9
- <?php $cgpo = count($ntOpts); $mgpo = 1+max(array_keys($ntOpts)); $nxsOne .= "&g=1"; ?>
10
- <div class="nsBigText">You have <?php echo $cgpo=='0'?'No':$cgpo; ?> Diigo account<?php if ($cgpo!=1){ ?>s<?php } ?> </div></div>
11
- <?php //if (function_exists('nxs_doSMAS1')) nxs_doSMAS1($this, $mgpo); else nxs_doSMAS('Google+', 'GP'.$mgpo); ?>
12
- <?php foreach ($ntOpts as $indx=>$options){ if (trim($options['nName']=='')) $options['nName'] =$options['diUName']; ?>
13
- <p style="margin: 0px;margin-left: 5px;">
14
- <input value="1" id="apDoDI" name="di[<?php echo $indx; ?>][apDoDI]" onchange="doShowHideBlocks('DI');" type="checkbox" <?php if ((int)$options['doDI'] == 1) echo "checked"; ?> />
15
- <strong>Auto-publish your Posts to your Diigo Account <i style="color: #005800;"><?php if($options['nName']!='') echo "(".$options['nName'].")"; ?></i> </strong>
16
- &nbsp;&nbsp;<a id="doDI<?php echo $indx; ?>A" href="#" onclick="doShowHideBlocks2('DI<?php echo $indx; ?>');return false;">[Show Settings]</a> &nbsp;&nbsp;
17
- <a href="#" onclick="doDelAcct('di','<?php echo $indx; ?>', '<?php echo $options['diUName']; ?>');return false;">[Remove Account]</a>
18
- </p>
19
- <?php $this->showNTSettings($indx, $options);
20
- } ?>
21
- <?php
22
- }
23
- //#### Show NEW Settings Page
24
- function showNewNTSettings($mgpo){ $options = array('nName'=>'', 'doDI'=>'1', 'diUName'=>'', 'diInclTags'=>'1', 'diAttch'=>'', 'diAPIKey'=>'', 'diPass'=>''); $this->showNTSettings($mgpo, $options, true);}
25
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
 
27
  //#### Show Unit Settings
28
  function showNTSettings($ii, $options, $isNew=false){ global $nxs_plurl; ?>
29
- <div id="doDI<?php echo $ii; ?>Div" <?php if ($isNew){ ?>class="clNewNTSets"<?php } ?> style="max-width: 1000px; background-color: #EBF4FB; background-image: url(<?php echo $nxs_plurl; ?>img/di-bg.png); background-position:90% 10%; background-repeat: no-repeat; margin: 10px; border: 1px solid #808080; padding: 10px; display:none;"> <input type="hidden" name="apDoSDI<?php echo $ii; ?>" value="0" id="apDoSDI<?php echo $ii; ?>" />
30
 
31
- <div class="nsx_iconedTitle" style="float: right; background-image: url(<?php echo $nxs_plurl; ?>img/di16.png);"><a style="font-size: 12px;" target="_blank" href="http://www.nextscripts.com/setup-installation-diigo-social-networks-auto-poster-wordpress/">Detailed Diigo Installation/Configuration Instructions</a></div>
32
 
33
- <div style="width:100%;"><strong>Account Nickname:</strong> <i>Just so you can easely identify it</i> </div><input name="di[<?php echo $ii; ?>][nName]" id="dinName<?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")), 'NS_SNAutoPoster') ?>" /><br/>
34
  <?php echo nxs_addQTranslSel('di', $ii, $options['qTLng']); ?>
35
  <?php echo nxs_addPostingDelaySel('di', $ii, $options['nHrs'], $options['nMin']); ?>
36
 
37
  <?php if (!$isNew) { ?>
38
- <div style="width:100%;"><strong>Auto-Post Categories:</strong>
39
  <input value="0" id="catSelA<?php echo $ii; ?>" type="radio" name="di[<?php echo $ii; ?>][catSel]" <?php if ((int)$options['catSel'] != 1) echo "checked"; ?> /> All
40
  <input value="1" id="catSelSDI<?php echo $ii; ?>" type="radio" name="di[<?php echo $ii; ?>][catSel]" <?php if ((int)$options['catSel'] == 1) echo "checked"; ?> /> <a href="#" style="text-decoration: none;" class="showCats" id="nxs_SCA_DI<?php echo $ii; ?>" onclick="jQuery('#catSelSDI<?php echo $ii; ?>').attr('checked', true); jQuery('#tmpCatSelNT').val('DI<?php echo $ii; ?>'); nxs_markCats( jQuery('#nxs_SC_DI<?php echo $ii; ?>').val() ); jQuery('#showCatSel').bPopup({ modalClose: false, appendTo: '#nsStForm', opacity: 0.6, follow: [false, false], position: [75, 'auto']}); return false;">Selected<?php if ($options['catSelEd']!='') echo "[".(substr_count($options['catSelEd'], ",")+1)."]"; ?></a>
41
  <input type="hidden" name="di[<?php echo $ii; ?>][catSelEd]" id="nxs_SC_DI<?php echo $ii; ?>" value="<?php echo $options['catSelEd']; ?>" />
42
- </div>
43
  <br/>
44
  <?php } ?>
45
 
46
  <div id="altFormat" style="">
47
  <div style="width:100%;"><strong id="altFormatText">Diigo API Key:</strong> <span style="font-size: 11px; margin: 0px;">Get it from <a target="_blank" href="http://www.diigo.com/api_keys/">http://www.diigo.com/api_keys</a>.</span></div>
48
- <input name="di[<?php echo $ii; ?>][apDIAPIKey]" id="apDIAPIKey" style="width: 60%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['diAPIKey'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" /> <br/>
49
  </div>
50
- <div style="width:100%;"><strong>Diigo Username:</strong> </div><input name="di[<?php echo $ii; ?>][apDIUName]" id="apDIUName" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['diUName'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" />
51
- <div style="width:100%;"><strong>Diigo Password:</strong> </div><input name="di[<?php echo $ii; ?>][apDIPass]" id="apDIPass" type="password" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities(substr($options['diPass'], 0, 5)=='n5g9a'?nsx_doDecode(substr($options['diPass'], 5)):$options['diPass'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" /> <br/>
52
-
53
- <?php if ($isNew) { ?> <input type="hidden" name="di[<?php echo $ii; ?>][apDoDI]" value="1" id="apDoNewDI<?php echo $ii; ?>" /> <?php } ?>
54
- <br/>
55
 
 
56
  <p style="margin-bottom: 20px;margin-top: 5px;"><input value="1" id="diInclTags" type="checkbox" name="di[<?php echo $ii; ?>][diInclTags]" <?php if ((int)$options['diInclTags'] == 1) echo "checked"; ?> />
57
- <strong>Post with tags</strong> Tags from the blogpost will be auto posted to Diigo
58
  </p>
59
 
60
  <div id="altFormat" style="">
61
- <div style="width:100%;"><strong id="altFormatText">Post Title Format</strong> (<a href="#" id="apDIMsgTFrmt<?php echo $ii; ?>HintInfo" onclick="mxs_showHideFrmtInfo('apDIMsgTFrmt<?php echo $ii; ?>'); return false;">Show format info</a>)</div>
62
- <input name="di[<?php echo $ii; ?>][apDIMsgTFrmt]" id="apDIMsgTFrmt" style="width: 50%;" value="<?php if ($isNew) echo "%TITLE%"; else _e(apply_filters('format_to_edit', htmlentities($options['diMsgTFormat'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster'); ?>" onfocus="mxs_showFrmtInfo('apDIMsgTFrmt<?php echo $ii; ?>');" /><?php nxs_doShowHint("apDIMsgTFrmt".$ii); ?>
63
  </div><br/>
64
 
65
  <div id="altFormat" style="">
66
- <div style="width:100%;"><strong id="altFormatText">Post Text Format</strong> (<a href="#" id="apDIMsgFrmt<?php echo $ii; ?>HintInfo" onclick="mxs_showHideFrmtInfo('apDIMsgFrmt<?php echo $ii; ?>'); return false;">Show format info</a>)</div>
67
- <input name="di[<?php echo $ii; ?>][apDIMsgFrmt]" id="apDIMsgFrmt" style="width: 50%;" value="<?php if ($isNew) echo "%TEXT%"; else _e(apply_filters('format_to_edit', htmlentities($options['diMsgFormat'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster'); ?>" onfocus="mxs_showFrmtInfo('apDIMsgFrmt<?php echo $ii; ?>');" /><?php nxs_doShowHint("apDIMsgFrmt".$ii); ?>
68
  </div><br/>
69
 
70
  <?php if ($options['diPass']!='') { ?>
71
  <?php wp_nonce_field( 'rePostToDI', 'rePostToDI_wpnonce' ); ?>
72
- <b>Test your settings:</b>&nbsp;&nbsp;&nbsp; <a href="#" class="NXSButton" onclick="testPost('DI', '<?php echo $ii; ?>'); return false;">Submit Test Post to Diigo</a>
73
-
74
- <?php }
75
-
76
- ?><div class="submit"><input type="submit" class="button-primary" name="update_NS_SNAutoPoster_settings" value="<?php _e('Update Settings', 'NS_SNAutoPoster') ?>" /></div></div><?php
77
  }
78
  //#### Set Unit Settings from POST
79
  function setNTSettings($post, $options){ global $nxs_snapThisPageUrl; $code = 'DI'; $lcode = 'di';
@@ -98,30 +98,26 @@ if (!class_exists("nxs_snapClassDI")) { class nxs_snapClassDI {
98
  }
99
  //#### Show Post->Edit Meta Box Settings
100
  function showEdPostNTSettings($ntOpts, $post){ global $nxs_plurl; $post_id = $post->ID;
101
- foreach($ntOpts as $ii=>$ntOpt) { $pMeta = maybe_unserialize(get_post_meta($post_id, 'snapDI', true)); if (is_array($pMeta)) $ntOpt = $this->adjMetaOpt($ntOpt, $pMeta[$ii]); $doDI = $ntOpt['doDI'] && $ntOpt['catSel']!='1';
 
102
  $isAvailDI = $ntOpt['diUName']!='' && $ntOpt['diPass']!=''; $diMsgFormat = htmlentities($ntOpt['diMsgFormat'], ENT_COMPAT, "UTF-8"); $diMsgTFormat = htmlentities($ntOpt['diMsgTFormat'], ENT_COMPAT, "UTF-8");
103
  ?>
104
  <tr><th style="text-align:left;" colspan="2"><?php if ( $ntOpt['catSel']=='1' && trim($ntOpt['catSelEd'])!='' ) { ?> <input type="hidden" class="nxs_SC" id="nxs_SC_DI<?php echo $ii; ?>" value="<?php echo $ntOpt['catSelEd']; ?>" /> <?php } ?>
105
- <?php if ($isAvailDI) { ?><input class="nxsGrpDoChb" value="1" id="doDI<?php echo $ii; ?>" <?php if ($post->post_status == "publish") echo 'disabled="disabled"';?> type="checkbox" name="di[<?php echo $ii; ?>][SNAPincludeDI]" <?php if (($post->post_status == "publish" && $ntOpt['isPosted'] == '1') || ($post->post_status != "publish" && ((int)$doDI == 1)) ) echo 'checked="checked" title="def"'; ?> /> <?php } ?>
106
 
107
- <div class="nsx_iconedTitle" style="display: inline; font-size: 13px; background-image: url(<?php echo $nxs_plurl; ?>img/di16.png);">Diigo - publish to (<i style="color: #005800;"><?php echo $ntOpt['nName']; ?></i>)</div></th> <td><?php //## Only show RePost button if the post is "published"
108
- if ($post->post_status == "publish" && $isAvailDI) { ?><input alt="<?php echo $ii; ?>" style="float: right;" onmouseout="hidePopShAtt('SV');" onmouseover="showPopShAtt('SV', event);" onclick="return false;" type="button" class="button" name="rePostToDI_repostButton" id="rePostToDI_button" value="<?php _e('Repost to Diigo', 're-post') ?>" />
109
- <?php wp_nonce_field( 'rePostToDI', 'rePostToDI_wpnonce' ); } ?>
110
-
111
  <?php if (is_array($pMeta) && is_array($pMeta[$ii]) && isset($pMeta[$ii]['pgID']) ) {
112
  ?> <span id="pstdDI<?php echo $ii; ?>" style="float: right; padding-top: 4px; padding-right: 10px;">
113
- <a style="font-size: 10px;" href="http://www.diigo.com/user/<?php echo $ntOpt['diUName']; ?>" target="_blank">Posted on Diigo <?php echo (isset($pMeta[$ii]['pDate']) && $pMeta[$ii]['pDate']!='')?(" (".$pMeta[$ii]['pDate'].")"):""; ?></a>
114
- </span><?php } ?>
115
-
116
- </td></tr>
117
-
118
  <?php if (!$isAvailDI) { ?><tr><th scope="row" style="text-align:right; width:150px; padding-top: 5px; padding-right:10px;"></th> <td><b>Setup your Diigo Account to AutoPost to Diigo</b>
119
- <?php } elseif ($post->post_status != "pubZlish") { ?>
120
-
121
- <tr id="altFormat1" style=""><th scope="row" style="text-align:right; width:60px; padding-right:10px;"><?php _e('Text Format:', 'NS_SPAP') ?></th>
122
- <td><input value="<?php echo $diMsgTFormat ?>" type="text" name="di[<?php echo $ii; ?>][SNAPformatT]" style="width:60%;max-width: 610px;" onfocus="jQuery('.nxs_FRMTHint').hide();mxs_showFrmtInfo('apDIMsgTFrmt<?php echo $ii; ?>');"/><?php nxs_doShowHint("apDIMsgTFrmt".$ii); ?></td></tr>
123
-
124
- <tr id="altFormat1" style=""><th scope="row" style="text-align:right; width:60px; padding-right:10px;"><?php _e('Text Format:', 'NS_SPAP') ?></th>
125
  <td><input value="<?php echo $diMsgFormat ?>" type="text" name="di[<?php echo $ii; ?>][SNAPformat]" style="width:60%;max-width: 610px;" onfocus="jQuery('.nxs_FRMTHint').hide();mxs_showFrmtInfo('apDIMsgFrmt<?php echo $ii; ?>');"/><?php nxs_doShowHint("apDIMsgFrmt".$ii); ?></td></tr>
126
  <?php }
127
  }
@@ -130,7 +126,9 @@ if (!class_exists("nxs_snapClassDI")) { class nxs_snapClassDI {
130
  function adjMetaOpt($optMt, $pMeta){ if (isset($pMeta['isPosted'])) $optMt['isPosted'] = $pMeta['isPosted']; else $optMt['isPosted'] = '';
131
  if (isset($pMeta['SNAPformat'])) $optMt['diMsgFormat'] = $pMeta['SNAPformat'];
132
  if (isset($pMeta['SNAPformatT'])) $optMt['diMsgTFormat'] = $pMeta['SNAPformatT'];
133
- if (isset($pMeta['SNAPincludeDI'])) $optMt['doDI'] = $pMeta['SNAPincludeDI'] == 1?1:0; else { if (isset($pMeta['SNAPformat'])) $optMt['doDI'] = 0; } return $optMt;
 
 
134
  }
135
  }}
136
  if (!function_exists("nxs_rePostToDI_ajax")) {
1
  <?php
2
  //## NextScripts Facebook Connection Class
3
+ $nxs_snapAvNts[] = array('code'=>'DI', 'lcode'=>'di', 'name'=>'Diigo');
4
 
5
  if (!class_exists("nxs_snapClassDI")) { class nxs_snapClassDI {
6
  //#### Show Common Settings
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
 
8
+ function showGenNTSettings($ntOpts){ global $nxs_plurl; $ntInfo = array('code'=>'DI', 'lcode'=>'di', 'name'=>'Diigo', 'defNName'=>'diUName', 'tstReq' => false); ?>
9
+ <div class="nxs_box">
10
+ <div class="nxs_box_header">
11
+ <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']; ?>
12
+ <?php $cbo = count($ntOpts); ?> <?php wp_nonce_field( 'ns'.$ntInfo['code'], 'ns'.$ntInfo['code'].'_wpnonce' ); ?>
13
+ <?php if ($cbo>1){ ?><div class="nsBigText"><?php echo "(".($cbo=='0'?'No':$cbo)." "; _e('accounts', 'nxs_snap'); echo ")"; ?></div><?php } ?>
14
+ </div>
15
+ </div>
16
+ <div class="nxs_box_inside">
17
+ <?php foreach ($ntOpts as $indx=>$pbo){ if (trim($pbo['nName']=='')) $pbo['nName'] = $pbo[$ntInfo['defNName']]; ?>
18
+ <p style="margin:0px;margin-left:5px;">
19
+ <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"; ?> />
20
+ <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>
21
+ &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;
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', 'nxs_snap'); ?>]</a>
23
+ </p><?php $this->showNTSettings($indx, $pbo);
24
+ }?>
25
+ </div>
26
+ </div> <?php
27
+ }
28
+
29
+ //#### Show NEW Settings Page
30
+ function showNewNTSettings($mgpo){ $options = array('nName'=>'', 'doDI'=>'1', 'diUName'=>'', 'diInclTags'=>'1', 'diAttch'=>'', 'diAPIKey'=>'', 'diPass'=>''); $this->showNTSettings($mgpo, $options, true);}
31
 
32
  //#### Show Unit Settings
33
  function showNTSettings($ii, $options, $isNew=false){ global $nxs_plurl; ?>
34
+ <div id="doDI<?php echo $ii; ?>Div" class="insOneDiv<?php if ($isNew){ ?> clNewNTSets<?php } ?>" style="background-image: url(<?php echo $nxs_plurl; ?>img/di-bg.png);background-position:90% 10%;"> <input type="hidden" name="apDoSDI<?php echo $ii; ?>" value="0" id="apDoSDI<?php echo $ii; ?>" />
35
 
36
+ <div class="nsx_iconedTitle" style="float: right; background-image: url(<?php echo $nxs_plurl; ?>img/di16.png);"><a style="font-size: 12px;" target="_blank" href="http://www.nextscripts.com/setup-installation-diigo-social-networks-auto-poster-wordpress/"><?php $nType="Diigo"; printf( __( 'Detailed %s Installation/Configuration Instructions', 'nxs_snap' ), $nType); ?></a></div>
37
 
38
+ <div style="width:100%;"><strong><?php _e('Account Nickname', 'nxs_snap'); ?>:</strong> <i><?php _e('Just so you can easely identify it', 'nxs_snap'); ?></i> </div><input name="di[<?php echo $ii; ?>][nName]" id="dinName<?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")), 'nxs_snap') ?>" /><br/>
39
  <?php echo nxs_addQTranslSel('di', $ii, $options['qTLng']); ?>
40
  <?php echo nxs_addPostingDelaySel('di', $ii, $options['nHrs'], $options['nMin']); ?>
41
 
42
  <?php if (!$isNew) { ?>
43
+ <div style="width:100%;"><strong><?php _e('Categories', 'nxs_snap'); ?>:</strong>
44
  <input value="0" id="catSelA<?php echo $ii; ?>" type="radio" name="di[<?php echo $ii; ?>][catSel]" <?php if ((int)$options['catSel'] != 1) echo "checked"; ?> /> All
45
  <input value="1" id="catSelSDI<?php echo $ii; ?>" type="radio" name="di[<?php echo $ii; ?>][catSel]" <?php if ((int)$options['catSel'] == 1) echo "checked"; ?> /> <a href="#" style="text-decoration: none;" class="showCats" id="nxs_SCA_DI<?php echo $ii; ?>" onclick="jQuery('#catSelSDI<?php echo $ii; ?>').attr('checked', true); jQuery('#tmpCatSelNT').val('DI<?php echo $ii; ?>'); nxs_markCats( jQuery('#nxs_SC_DI<?php echo $ii; ?>').val() ); jQuery('#showCatSel').bPopup({ modalClose: false, appendTo: '#nsStForm', opacity: 0.6, follow: [false, false], position: [75, 'auto']}); return false;">Selected<?php if ($options['catSelEd']!='') echo "[".(substr_count($options['catSelEd'], ",")+1)."]"; ?></a>
46
  <input type="hidden" name="di[<?php echo $ii; ?>][catSelEd]" id="nxs_SC_DI<?php echo $ii; ?>" value="<?php echo $options['catSelEd']; ?>" />
47
+ <br/><i><?php _e('Only selected categories will be autoposted to this account', 'nxs_snap'); ?></i></div>
48
  <br/>
49
  <?php } ?>
50
 
51
  <div id="altFormat" style="">
52
  <div style="width:100%;"><strong id="altFormatText">Diigo API Key:</strong> <span style="font-size: 11px; margin: 0px;">Get it from <a target="_blank" href="http://www.diigo.com/api_keys/">http://www.diigo.com/api_keys</a>.</span></div>
53
+ <input name="di[<?php echo $ii; ?>][apDIAPIKey]" id="apDIAPIKey" style="width: 60%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['diAPIKey'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" /> <br/>
54
  </div>
55
+ <div style="width:100%;"><strong>Diigo Username:</strong> </div><input name="di[<?php echo $ii; ?>][apDIUName]" id="apDIUName" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['diUName'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" />
56
+ <div style="width:100%;"><strong>Diigo Password:</strong> </div><input name="di[<?php echo $ii; ?>][apDIPass]" id="apDIPass" type="password" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities(substr($options['diPass'], 0, 5)=='n5g9a'?nsx_doDecode(substr($options['diPass'], 5)):$options['diPass'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" /> <br/>
 
 
 
57
 
58
+ <?php if ($isNew) { ?> <input type="hidden" name="di[<?php echo $ii; ?>][apDoDI]" value="1" id="apDoNewDI<?php echo $ii; ?>" /> <?php } ?><br/>
59
  <p style="margin-bottom: 20px;margin-top: 5px;"><input value="1" id="diInclTags" type="checkbox" name="di[<?php echo $ii; ?>][diInclTags]" <?php if ((int)$options['diInclTags'] == 1) echo "checked"; ?> />
60
+ <strong><?php _e('Post with tags', 'nxs_snap'); ?></strong> <?php _e('Tags from the blogpost will be auto posted to Diigo', 'nxs_snap'); ?>
61
  </p>
62
 
63
  <div id="altFormat" style="">
64
+ <div style="width:100%;"><strong id="altFormatText"><?php _e('Post Title Format', 'nxs_snap'); ?></strong> (<a href="#" id="apDIMsgTFrmt<?php echo $ii; ?>HintInfo" onclick="mxs_showHideFrmtInfo('apDIMsgTFrmt<?php echo $ii; ?>'); return false;"><?php _e('Show format info', 'nxs_snap'); ?></a>)</div>
65
+ <input name="di[<?php echo $ii; ?>][apDIMsgTFrmt]" id="apDIMsgTFrmt<?php echo $ii; ?>" style="width: 50%;" value="<?php if ($isNew) echo "%TITLE%"; else _e(apply_filters('format_to_edit', htmlentities($options['diMsgTFormat'], ENT_COMPAT, "UTF-8")), 'nxs_snap'); ?>" onfocus="mxs_showFrmtInfo('apDIMsgTFrmt<?php echo $ii; ?>');" /><?php nxs_doShowHint("apDIMsgTFrmt".$ii); ?>
66
  </div><br/>
67
 
68
  <div id="altFormat" style="">
69
+ <div style="width:100%;"><strong id="altFormatText"><?php _e('Post Text Format', 'nxs_snap'); ?></strong> (<a href="#" id="apDIMsgFrmt<?php echo $ii; ?>HintInfo" onclick="mxs_showHideFrmtInfo('apDIMsgFrmt<?php echo $ii; ?>'); return false;"><?php _e('Show format info', 'nxs_snap'); ?></a>)</div>
70
+ <input name="di[<?php echo $ii; ?>][apDIMsgFrmt]" id="apDIMsgFrmt" style="width: 50%;" value="<?php if ($isNew) echo "%TEXT%"; else _e(apply_filters('format_to_edit', htmlentities($options['diMsgFormat'], ENT_COMPAT, "UTF-8")), 'nxs_snap'); ?>" onfocus="mxs_showFrmtInfo('apDIMsgFrmt<?php echo $ii; ?>');" /><?php nxs_doShowHint("apDIMsgFrmt".$ii); ?>
71
  </div><br/>
72
 
73
  <?php if ($options['diPass']!='') { ?>
74
  <?php wp_nonce_field( 'rePostToDI', 'rePostToDI_wpnonce' ); ?>
75
+ <b><?php _e('Test your settings', 'nxs_snap'); ?>:</b>&nbsp;&nbsp;&nbsp; <a href="#" class="NXSButton" onclick="testPost('DI', '<?php echo $ii; ?>'); return false;"><?php printf( __( 'Submit Test Post to %s', 'nxs_snap' ), $nType); ?></a> <?php }
76
+ ?><div class="submit"><input type="submit" class="button-primary" name="update_NS_SNAutoPoster_settings" value="<?php _e('Update Settings', 'nxs_snap') ?>" /></div></div><?php
 
 
 
77
  }
78
  //#### Set Unit Settings from POST
79
  function setNTSettings($post, $options){ global $nxs_snapThisPageUrl; $code = 'DI'; $lcode = 'di';
98
  }
99
  //#### Show Post->Edit Meta Box Settings
100
  function showEdPostNTSettings($ntOpts, $post){ global $nxs_plurl; $post_id = $post->ID;
101
+ foreach($ntOpts as $ii=>$ntOpt) { $pMeta = maybe_unserialize(get_post_meta($post_id, 'snapDI', true)); if (is_array($pMeta)) $ntOpt = $this->adjMetaOpt($ntOpt, $pMeta[$ii]);
102
+ $doDI = $ntOpt['doDI'] && (is_array($pMeta) || $ntOpt['catSel']!='1');
103
  $isAvailDI = $ntOpt['diUName']!='' && $ntOpt['diPass']!=''; $diMsgFormat = htmlentities($ntOpt['diMsgFormat'], ENT_COMPAT, "UTF-8"); $diMsgTFormat = htmlentities($ntOpt['diMsgTFormat'], ENT_COMPAT, "UTF-8");
104
  ?>
105
  <tr><th style="text-align:left;" colspan="2"><?php if ( $ntOpt['catSel']=='1' && trim($ntOpt['catSelEd'])!='' ) { ?> <input type="hidden" class="nxs_SC" id="nxs_SC_DI<?php echo $ii; ?>" value="<?php echo $ntOpt['catSelEd']; ?>" /> <?php } ?>
106
+ <?php if ($isAvailDI) { ?><input class="nxsGrpDoChb" value="1" id="doDI<?php echo $ii; ?>" <?php if ($post->post_status == "publish") echo 'disabled="disabled"';?> type="checkbox" name="di[<?php echo $ii; ?>][doDI]" <?php if (($post->post_status == "publish" && $ntOpt['isPosted'] == '1') || ($post->post_status != "publish" && ((int)$doDI == 1)) ) echo 'checked="checked" title="def"'; ?> /> <?php } ?>
107
 
108
+ <div class="nsx_iconedTitle" style="display: inline; font-size: 13px; background-image: url(<?php echo $nxs_plurl; ?>img/di16.png);">Diigo - <?php _e('publish to', 'nxs_snap') ?> (<i style="color: #005800;"><?php echo $ntOpt['nName']; ?></i>)</div></th> <td><?php //## Only show RePost button if the post is "published"
109
+ if ($post->post_status == "publish" && $isAvailDI) { ?><input alt="<?php echo $ii; ?>" style="float: right;" onmouseout="hidePopShAtt('SV');" onmouseover="showPopShAtt('SV', event);" onclick="return false;" type="button" class="button" name="rePostToDI_repostButton" id="rePostToDI_button" value="<?php _e('Repost to Diigo', 'nxs_snap') ?>" />
110
+ <?php wp_nonce_field( 'rePostToDI', 'rePostToDI_wpnonce' ); } ?>
 
111
  <?php if (is_array($pMeta) && is_array($pMeta[$ii]) && isset($pMeta[$ii]['pgID']) ) {
112
  ?> <span id="pstdDI<?php echo $ii; ?>" style="float: right; padding-top: 4px; padding-right: 10px;">
113
+ <a style="font-size: 10px;" href="http://www.diigo.com/user/<?php echo $ntOpt['diUName']; ?>" target="_blank"><?php $nType="Diigo"; printf( __( 'Posted on', 'nxs_snap' ), $nType); ?> <?php echo (isset($pMeta[$ii]['pDate']) && $pMeta[$ii]['pDate']!='')?(" (".$pMeta[$ii]['pDate'].")"):""; ?></a>
114
+ </span><?php } ?>
115
+ </td></tr>
 
 
116
  <?php if (!$isAvailDI) { ?><tr><th scope="row" style="text-align:right; width:150px; padding-top: 5px; padding-right:10px;"></th> <td><b>Setup your Diigo Account to AutoPost to Diigo</b>
117
+ <?php } elseif ($post->post_status != "pubZlish") { ?>
118
+ <tr id="altFormat1" style=""><th scope="row" style="text-align:right; width:60px; padding-right:10px;"><?php _e('Title Format:', 'nxs_snap') ?></th>
119
+ <td><input value="<?php echo $diMsgTFormat ?>" type="text" name="di[<?php echo $ii; ?>][SNAPformatT]" style="width:60%;max-width: 610px;" onfocus="jQuery('.nxs_FRMTHint').hide();mxs_showFrmtInfo('apDIMsgTFrmt<?php echo $ii; ?>');"/><?php nxs_doShowHint("apDIMsgTFrmt".$ii); ?></td></tr>
120
+ <tr id="altFormat1" style=""><th scope="row" style="text-align:right; width:60px; padding-right:10px;"><?php _e('Text Format:', 'nxs_snap') ?></th>
 
 
121
  <td><input value="<?php echo $diMsgFormat ?>" type="text" name="di[<?php echo $ii; ?>][SNAPformat]" style="width:60%;max-width: 610px;" onfocus="jQuery('.nxs_FRMTHint').hide();mxs_showFrmtInfo('apDIMsgFrmt<?php echo $ii; ?>');"/><?php nxs_doShowHint("apDIMsgFrmt".$ii); ?></td></tr>
122
  <?php }
123
  }
126
  function adjMetaOpt($optMt, $pMeta){ if (isset($pMeta['isPosted'])) $optMt['isPosted'] = $pMeta['isPosted']; else $optMt['isPosted'] = '';
127
  if (isset($pMeta['SNAPformat'])) $optMt['diMsgFormat'] = $pMeta['SNAPformat'];
128
  if (isset($pMeta['SNAPformatT'])) $optMt['diMsgTFormat'] = $pMeta['SNAPformatT'];
129
+ if (isset($pMeta['doDI'])) $optMt['doDI'] = $pMeta['doDI'] == 1?1:0; else { if (isset($pMeta['SNAPformat'])) $optMt['doDI'] = 0; }
130
+ if (isset($pMeta['SNAPincludeDI']) && $pMeta['SNAPincludeDI'] == '1' ) $optMt['doDI'] = 1;
131
+ return $optMt;
132
  }
133
  }}
134
  if (!function_exists("nxs_rePostToDI_ajax")) {
inc-cl/dl.php CHANGED
@@ -4,66 +4,70 @@ $nxs_snapAvNts[] = array('code'=>'DL', 'lcode'=>'dl', 'name'=>'Delicious');
4
 
5
  if (!class_exists("nxs_snapClassDL")) { class nxs_snapClassDL {
6
  //#### Show Common Settings
7
- function showGenNTSettings($ntOpts){ global $nxs_snapThisPageUrl, $nxs_plurl, $nxsOne; $code = 'DL'; $lcode = 'dl'; wp_nonce_field( 'ns'.$code, 'ns'.$code.'_wpnonce' ); ?>
8
- <hr/><div class="nsx_iconedTitle" style="background-image: url(<?php echo $nxs_plurl; ?>img/<?php echo $lcode; ?>16.png);">Delicious Settings:
9
- <?php $cgpo = count($ntOpts); $mgpo = 1+max(array_keys($ntOpts)); $nxsOne .= "&g=1"; ?>
10
- <div class="nsBigText">You have <?php echo $cgpo=='0'?'No':$cgpo; ?> Delicious account<?php if ($cgpo!=1){ ?>s<?php } ?> </div></div>
11
- <?php //if (function_exists('nxs_doSMAS1')) nxs_doSMAS1($this, $mgpo); else nxs_doSMAS('Google+', 'GP'.$mgpo); ?>
12
- <?php foreach ($ntOpts as $indx=>$gpo){ if (trim($gpo['nName']=='')) $gpo['nName'] =$gpo['dlUName']; ?>
13
- <p style="margin: 0px;margin-left: 5px;">
14
- <input value="1" id="apDoDL" name="dl[<?php echo $indx; ?>][apDoDL]" onchange="doShowHideBlocks('DL');" type="checkbox" <?php if ((int)$gpo['doDL'] == 1) echo "checked"; ?> />
15
- <strong>Auto-publish your Posts to your Delicious Account <i style="color: #005800;"><?php if($gpo['nName']!='') echo "(".$gpo['nName'].")"; ?></i> </strong>
16
- &nbsp;&nbsp;<a id="doDL<?php echo $indx; ?>A" href="#" onclick="doShowHideBlocks2('DL<?php echo $indx; ?>');return false;">[Show Settings]</a> &nbsp;&nbsp;
17
- <a href="#" onclick="doDelAcct('dl','<?php echo $indx; ?>', '<?php echo $gpo['dlUName']; ?>');return false;">[Remove Account]</a>
18
- </p>
19
- <?php $this->showNTSettings($indx, $gpo);
20
- } ?>
21
- <?php
 
 
 
 
22
  }
23
  //#### Show NEW Settings Page
24
  function showNewNTSettings($mgpo){ $gpo = array('nName'=>'', 'doDL'=>'1', 'dlUName'=>'', 'dlPageID'=>'', 'dlAttch'=>'', 'dlPass'=>''); $this->showNTSettings($mgpo, $gpo, true);}
25
  //#### Show Unit Settings
26
  function showNTSettings($ii, $gpo, $isNew=false){ global $nxs_plurl; ?>
27
- <div id="doDL<?php echo $ii; ?>Div" <?php if ($isNew){ ?>class="clNewNTSets"<?php } ?> style="max-width: 1000px; background-color: #EBF4FB; background-image: url(<?php echo $nxs_plurl; ?>img/dl-bg.png); background-position:90% 10%; background-repeat: no-repeat; 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; ?>" />
28
 
29
- <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/">Detailed Delicious Installation/Configuration Instructions</a></div>
30
 
31
- <div style="width:100%;"><strong>Account Nickname:</strong> <i>Just so you can easely identify it</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($gpo['nName'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" /><br/>
32
  <?php echo nxs_addQTranslSel('dl', $ii, $gpo['qTLng']); ?><?php echo nxs_addPostingDelaySel('dl', $ii, $gpo['nHrs'], $gpo['nMin']); ?>
33
 
34
  <?php if (!$isNew) { ?>
35
- <div style="width:100%;"><strong>Auto-Post Categories:</strong>
36
  <input value="0" id="catSelA<?php echo $ii; ?>" type="radio" name="dl[<?php echo $ii; ?>][catSel]" <?php if ((int)$gpo['catSel'] != 1) echo "checked"; ?> /> All
37
  <input value="1" id="catSelSDL<?php echo $ii; ?>" type="radio" name="dl[<?php echo $ii; ?>][catSel]" <?php if ((int)$gpo['catSel'] == 1) echo "checked"; ?> /> <a href="#" style="text-decoration: none;" class="showCats" id="nxs_SCA_DL<?php echo $ii; ?>" onclick="jQuery('#catSelSDL<?php echo $ii; ?>').attr('checked', true); jQuery('#tmpCatSelNT').val('DL<?php echo $ii; ?>'); nxs_markCats( jQuery('#nxs_SC_DL<?php echo $ii; ?>').val() ); jQuery('#showCatSel').bPopup({ modalClose: false, appendTo: '#nsStForm', opacity: 0.6, follow: [false, false], position: [75, 'auto']}); return false;">Selected<?php if ($gpo['catSelEd']!='') echo "[".(substr_count($gpo['catSelEd'], ",")+1)."]"; ?></a>
38
  <input type="hidden" name="dl[<?php echo $ii; ?>][catSelEd]" id="nxs_SC_DL<?php echo $ii; ?>" value="<?php echo $gpo['catSelEd']; ?>" />
39
- </div>
40
  <br/>
41
  <?php } ?>
42
 
43
- <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($gpo['dlUName'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" />
44
- <div style="width:100%;"><strong>Delicious Password:</strong> </div><input name="dl[<?php echo $ii; ?>][apDLPass]" id="apDLPass" type="password" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities(substr($gpo['dlPass'], 0, 5)=='n5g9a'?nsx_doDecode(substr($gpo['dlPass'], 5)):$gpo['dlPass'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" /> <br/>
45
 
46
  <?php if ($isNew) { ?> <input type="hidden" name="dl[<?php echo $ii; ?>][apDoDL]" value="1" id="apDoNewDL<?php echo $ii; ?>" /> <?php } ?>
47
  <br/>
48
 
49
  <div id="altFormat" style="">
50
- <div style="width:100%;"><strong id="altFormatText">Post Title Format</strong> (<a href="#" id="apDLTMsgFrmt<?php echo $ii; ?>HintInfo" onclick="mxs_showHideFrmtInfo('apDLTMsgFrmt<?php echo $ii; ?>'); return false;">Show format info</a>)</div>
51
 
52
- <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($gpo['dlMsgTFormat'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster'); ?>" onfocus="mxs_showFrmtInfo('apDLTMsgFrmt<?php echo $ii; ?>');" /><?php nxs_doShowHint("apDLTMsgFrmt".$ii); ?>
53
  </div>
54
 
55
  <div id="altFormat" style="">
56
- <div style="width:100%;"><strong id="altFormatText">Post Text Format</strong> (<a href="#" id="apDLMsgFrmt<?php echo $ii; ?>HintInfo" onclick="mxs_showHideFrmtInfo('apDLMsgFrmt<?php echo $ii; ?>'); return false;">Show format info</a>)</div>
57
- <input name="dl[<?php echo $ii; ?>][apDLMsgFrmt]" id="apDLMsgFrmt" style="width: 50%;" value="<?php if ($isNew) echo "%TEXT%"; else _e(apply_filters('format_to_edit', htmlentities($gpo['dlMsgFormat'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster'); ?>" onfocus="mxs_showFrmtInfo('apDLMsgFrmt<?php echo $ii; ?>');" /><?php nxs_doShowHint("apDLMsgFrmt".$ii); ?>
58
  </div><br/>
59
 
60
  <?php if ($gpo['dlPass']!='') { ?>
61
  <?php wp_nonce_field( 'rePostToDL', 'rePostToDL_wpnonce' ); ?>
62
- <b>Test your settings:</b>&nbsp;&nbsp;&nbsp; <a href="#" class="NXSButton" onclick="testPost('DL', '<?php echo $ii; ?>'); return false;">Submit Test Post to Delicious</a>
63
 
64
  <?php }
65
 
66
- ?><div class="submit"><input type="submit" class="button-primary" name="update_NS_SNAutoPoster_settings" value="<?php _e('Update Settings', 'NS_SNAutoPoster') ?>" /></div></div><?php
67
  }
68
  //#### Set Unit Settings from POST
69
  function setNTSettings($post, $options){ global $nxs_snapThisPageUrl; $code = 'DL'; $lcode = 'dl';
@@ -86,19 +90,20 @@ if (!class_exists("nxs_snapClassDL")) { class nxs_snapClassDL {
86
  }
87
  //#### Show Post->Edit Meta Box Settings
88
  function showEdPostNTSettings($ntOpts, $post){ global $nxs_plurl; $post_id = $post->ID;
89
- 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]); $doDL = $ntOpt['doDL'] && $ntOpt['catSel']!='1';
 
90
  $isAvailDL = $ntOpt['dlUName']!='' && $ntOpt['dlPass']!=''; $dlMsgFormat = htmlentities($ntOpt['dlMsgFormat'], ENT_COMPAT, "UTF-8"); $dlMsgTFormat = htmlentities($ntOpt['dlMsgTFormat'], ENT_COMPAT, "UTF-8");
91
  ?>
92
  <tr><th style="text-align:left;" colspan="2"><?php if ( $ntOpt['catSel']=='1' && trim($ntOpt['catSelEd'])!='' ) { ?> <input type="hidden" class="nxs_SC" id="nxs_SC_DL<?php echo $ii; ?>" value="<?php echo $ntOpt['catSelEd']; ?>" /> <?php } ?>
93
- <?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; ?>][SNAPincludeDL]" <?php if (($post->post_status == "publish" && $ntOpt['isPosted'] == '1') || ($post->post_status != "publish" && ((int)$doDL == 1)) ) echo 'checked="checked" title="def"'; ?> /> <?php } ?>
94
 
95
- <div class="nsx_iconedTitle" style="display: inline; font-size: 13px; background-image: url(<?php echo $nxs_plurl; ?>img/dl16.png);">Delicious - publish to (<i style="color: #005800;"><?php echo $ntOpt['nName']; ?></i>)</div></th> <td><?php //## Only show RePost button if the post is "published"
96
- 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', 're-post') ?>" />
97
  <?php wp_nonce_field( 'rePostToDL', 'rePostToDL_wpnonce' ); } ?>
98
 
99
  <?php if (is_array($pMeta) && is_array($pMeta[$ii]) && isset($pMeta[$ii]['pgID']) ) {
100
  ?> <span id="pstdDL<?php echo $ii; ?>" style="float: right; padding-top: 4px; padding-right: 10px;">
101
- <a style="font-size: 10px;" href="http://delicious.com/<?php echo $ntOpt['dlUName']; ?>" target="_blank">Posted on Delicious <?php echo (isset($pMeta[$ii]['pDate']) && $pMeta[$ii]['pDate']!='')?(" (".$pMeta[$ii]['pDate'].")"):""; ?></a>
102
  </span><?php } ?>
103
 
104
  </td></tr>
@@ -106,19 +111,21 @@ if (!class_exists("nxs_snapClassDL")) { class nxs_snapClassDL {
106
  <?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>
107
  <?php } elseif ($post->post_status != "pubZlish") { ?>
108
 
109
- <tr id="altFormat1" style=""><th scope="row" style="text-align:right; width:60px; padding-right:10px;"><?php _e('Title Format:', 'NS_SPAP') ?></th>
110
  <td><input 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); ?></td></tr>
111
 
112
- <tr id="altFormat1" style=""><th scope="row" style="text-align:right; width:60px; padding-right:10px;"><?php _e('Text Format:', 'NS_SPAP') ?></th>
113
  <td><input value="<?php echo $dlMsgFormat ?>" type="text" name="dl[<?php echo $ii; ?>][SNAPformat]" style="width:60%;max-width: 610px;" onfocus="jQuery('.nxs_FRMTHint').hide();mxs_showFrmtInfo('apDLMsgFrmt<?php echo $ii; ?>');"/><?php nxs_doShowHint("apDLMsgFrmt".$ii); ?></td></tr>
114
  <?php }
115
  }
116
  }
117
  //#### Save Meta Tags to the Post
118
- function adjMetaOpt($optMt, $pMeta){ if (isset($pMeta['isPosted'])) $optMt['isPosted'] = $pMeta['isPosted']; else $optMt['isPosted'] = '';
119
  if (isset($pMeta['SNAPformat'])) $optMt['dlMsgFormat'] = $pMeta['SNAPformat'];
120
  if (isset($pMeta['SNAPformatT'])) $optMt['dlMsgTFormat'] = $pMeta['SNAPformatT'];
121
- if (isset($pMeta['SNAPincludeDL'])) $optMt['doDL'] = $pMeta['SNAPincludeDL'] == 1?1:0; else { if (isset($pMeta['SNAPformat'])) $optMt['doDL'] = 0; } return $optMt;
 
 
122
  }
123
  }}
124
  if (!function_exists("nxs_rePostToDL_ajax")) {
@@ -132,11 +139,20 @@ if (!function_exists("nxs_rePostToDL_ajax")) {
132
  }
133
  if (!function_exists("doConnectToDelicious")) { function doConnectToDelicious($u, $p){ global $nxs_gCookiesArr; $nxs_gCookiesArr = array(); $advSettings = array();
134
  $fldsTxt = 'username='.$u.'&password='.$p;
135
- $contents = getCurlPageX(' http://www.delicious.com/login ','', false, $fldsTxt, false, $advSettings); prr($nxs_gCookiesArr); prr($contents);
136
  }}
137
  if (!function_exists("doPostToDelicious")) { function doPostToDelicious($postID, $options){ global $nxs_gCookiesArr;
138
 
139
  }}
 
 
 
 
 
 
 
 
 
140
  if (!function_exists("nxs_doPublishToDL")) { //## Second Function to Post to DL
141
  function nxs_doPublishToDL($postID, $options){ $ntCd = 'DL'; $ntCdL = 'dl'; $ntNm = 'Delicious';
142
 
@@ -149,24 +165,22 @@ if (!function_exists("nxs_doPublishToDL")) { //## Second Function to Post to DL
149
  $msgFormat = $options['dlMsgFormat']; $msgTFormat = $options['dlMsgTFormat']; $msgT = nsFormatMessage($msgTFormat, $postID); $msg = nsFormatMessage($msgFormat, $postID);
150
  nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPrePosted'=>'1'));
151
  }
152
-
153
- $dusername = $options['dlUName']; $pass = urlencode(substr($options['dlPass'], 0, 5)=='n5g9a'?nsx_doDecode(substr($options['dlPass'], 5)):$options['dlPass']);
154
  $api = "api.del.icio.us/v1"; $link = urlencode($link); $desc = urlencode(substr($msgT, 0, 250)); $ext = urlencode(substr($msg, 0, 1000));
155
-
156
  $extInfo = ' | PostID: '.$postID." - ".$post->post_title; $logNT = '<span style="color:#000080">Delicious</span> - '.$options['nName'];
157
-
158
  $t = wp_get_post_tags($postID); $tggs = array(); foreach ($t as $tagA) {$tggs[] = $tagA->name;} $tags = urlencode(implode(',',$tggs)); $tags = str_replace(' ','+',$tags);
159
- $apicall = "http://$dusername:$pass@$api/posts/add?&url=$link&description=$desc&extended=$ext&tags=$tags"; // prr($apicall);
160
- $cnt = wp_remote_get( $apicall, '' ); // prr($cnt);
161
-
162
- // nxs_addToLog($logNT, 'E', '-=ER!!ROR=- '.$ret. "ERR: ".print_r($cnt, true), $extInfo);
163
 
164
- if(is_wp_error($cnt)) { $error_string = $cnt->get_error_message(); if (stripos($error_string, ' timed out')!==false) { sleep(10); $cnt = wp_remote_get( $apicall, '' );}}
 
 
165
  if(is_wp_error($cnt)) {
166
  $ret = 'Something went wrong - '."http://$dusername:*********@$api/posts/add?&url=$link&description=$desc&extended=$ext&tags=$tags"; nxs_addToLog($logNT, 'E', '-=ERROR=- '.$ret. "ERR: ".print_r($cnt, true), $extInfo);
167
  } else {
168
  if (is_array($cnt) && stripos($cnt['body'],'code="done"')!==false)
169
  { $ret = 'OK'; nxs_metaMarkAsPosted($postID, 'DL', $options['ii'], array('isPosted'=>'1', 'pgID'=>'DL', 'pDate'=>date('Y-m-d H:i:s'))); nxs_addToLog($logNT, 'M', 'OK - Message Posted ', $extInfo); }
 
170
  elseif (is_array($cnt) && stripos($cnt['body'],'item already exists')!==false) { $ret = '..All good, but this link has already been bookmarked..'; nxs_addToLog($logNT, 'M', 'All good, but this link has already been bookmarked', $extInfo); }
171
  else { if ($cnt['response']['code']=='401') $ret = " Incorrect Username/Password "; else $ret = 'Something went wrong - '."https://$dusername:*********@$api/posts/add?&url=$link&description=$desc&extended=$ext&tags=$tags"; nxs_addToLog($logNT, 'E', '-=ERROR=- '.$ret. "ERR: ".print_r($cnt, true), $extInfo);
172
  }
4
 
5
  if (!class_exists("nxs_snapClassDL")) { class nxs_snapClassDL {
6
  //#### Show Common Settings
7
+ function showGenNTSettings($ntOpts){ global $nxs_plurl; $ntInfo = array('code'=>'DL', 'lcode'=>'dl', 'name'=>'Delicious', 'defNName'=>'dlUName', 'tstReq' => false); ?>
8
+ <div class="nxs_box">
9
+ <div class="nxs_box_header">
10
+ <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']; ?>
11
+ <?php $cbo = count($ntOpts); ?> <?php wp_nonce_field( 'ns'.$ntInfo['code'], 'ns'.$ntInfo['code'].'_wpnonce' ); ?>
12
+ <?php if ($cbo>1){ ?><div class="nsBigText"><?php echo "(".($cbo=='0'?'No':$cbo)." "; _e('accounts', 'nxs_snap'); echo ")"; ?></div><?php } ?>
13
+ </div>
14
+ </div>
15
+ <div class="nxs_box_inside">
16
+ <?php foreach ($ntOpts as $indx=>$pbo){ if (trim($pbo['nName']=='')) $pbo['nName'] = $pbo[$ntInfo['defNName']]; ?>
17
+ <p style="margin:0px;margin-left:5px;">
18
+ <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"; ?> />
19
+ <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>
20
+ &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;
21
+ <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>
22
+ </p><?php $this->showNTSettings($indx, $pbo);
23
+ }?>
24
+ </div>
25
+ </div> <?php
26
  }
27
  //#### Show NEW Settings Page
28
  function showNewNTSettings($mgpo){ $gpo = array('nName'=>'', 'doDL'=>'1', 'dlUName'=>'', 'dlPageID'=>'', 'dlAttch'=>'', 'dlPass'=>''); $this->showNTSettings($mgpo, $gpo, true);}
29
  //#### Show Unit Settings
30
  function showNTSettings($ii, $gpo, $isNew=false){ global $nxs_plurl; ?>
31
+ <div id="doDL<?php echo $ii; ?>Div" class="insOneDiv<?php if ($isNew) echo " clNewNTSets"; ?>" style="max-width: 1000px; background-color: #EBF4FB; background-image: url(<?php echo $nxs_plurl; ?>img/dl-bg.png); background-position:90% 10%; background-repeat: no-repeat; 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; ?>" />
32
 
33
+ <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', 'nxs_snap' ), $nType); ?></a></div>
34
 
35
+ <div style="width:100%;"><strong><?php _e('Account Nickname', 'nxs_snap'); ?>:</strong> <i><?php _e('Just so you can easely identify it', 'nxs_snap'); ?></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($gpo['nName'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" /><br/>
36
  <?php echo nxs_addQTranslSel('dl', $ii, $gpo['qTLng']); ?><?php echo nxs_addPostingDelaySel('dl', $ii, $gpo['nHrs'], $gpo['nMin']); ?>
37
 
38
  <?php if (!$isNew) { ?>
39
+ <div style="width:100%;"><strong><?php _e('Categories', 'nxs_snap'); ?>:</strong>
40
  <input value="0" id="catSelA<?php echo $ii; ?>" type="radio" name="dl[<?php echo $ii; ?>][catSel]" <?php if ((int)$gpo['catSel'] != 1) echo "checked"; ?> /> All
41
  <input value="1" id="catSelSDL<?php echo $ii; ?>" type="radio" name="dl[<?php echo $ii; ?>][catSel]" <?php if ((int)$gpo['catSel'] == 1) echo "checked"; ?> /> <a href="#" style="text-decoration: none;" class="showCats" id="nxs_SCA_DL<?php echo $ii; ?>" onclick="jQuery('#catSelSDL<?php echo $ii; ?>').attr('checked', true); jQuery('#tmpCatSelNT').val('DL<?php echo $ii; ?>'); nxs_markCats( jQuery('#nxs_SC_DL<?php echo $ii; ?>').val() ); jQuery('#showCatSel').bPopup({ modalClose: false, appendTo: '#nsStForm', opacity: 0.6, follow: [false, false], position: [75, 'auto']}); return false;">Selected<?php if ($gpo['catSelEd']!='') echo "[".(substr_count($gpo['catSelEd'], ",")+1)."]"; ?></a>
42
  <input type="hidden" name="dl[<?php echo $ii; ?>][catSelEd]" id="nxs_SC_DL<?php echo $ii; ?>" value="<?php echo $gpo['catSelEd']; ?>" />
43
+ <br/><i><?php _e('Only selected categories will be autoposted to this account', 'nxs_snap'); ?></i></div>
44
  <br/>
45
  <?php } ?>
46
 
47
+ <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($gpo['dlUName'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" />
48
+ <div style="width:100%;"><strong>Delicious Password:</strong> </div><input name="dl[<?php echo $ii; ?>][apDLPass]" id="apDLPass" type="password" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities(substr($gpo['dlPass'], 0, 5)=='n5g9a'?nsx_doDecode(substr($gpo['dlPass'], 5)):$gpo['dlPass'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" /> <br/>
49
 
50
  <?php if ($isNew) { ?> <input type="hidden" name="dl[<?php echo $ii; ?>][apDoDL]" value="1" id="apDoNewDL<?php echo $ii; ?>" /> <?php } ?>
51
  <br/>
52
 
53
  <div id="altFormat" style="">
54
+ <div style="width:100%;"><strong id="altFormatText"><?php _e('Post Title Format', 'nxs_snap'); ?></strong> (<a href="#" id="apDLTMsgFrmt<?php echo $ii; ?>HintInfo" onclick="mxs_showHideFrmtInfo('apDLTMsgFrmt<?php echo $ii; ?>'); return false;"><?php _e('Show format info', 'nxs_snap'); ?></a>)</div>
55
 
56
+ <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($gpo['dlMsgTFormat'], ENT_COMPAT, "UTF-8")), 'nxs_snap'); ?>" onfocus="mxs_showFrmtInfo('apDLTMsgFrmt<?php echo $ii; ?>');" /><?php nxs_doShowHint("apDLTMsgFrmt".$ii); ?>
57
  </div>
58
 
59
  <div id="altFormat" style="">
60
+ <div style="width:100%;"><strong id="altFormatText"><?php _e('Post Text Format', 'nxs_snap'); ?></strong> (<a href="#" id="apDLMsgFrmt<?php echo $ii; ?>HintInfo" onclick="mxs_showHideFrmtInfo('apDLMsgFrmt<?php echo $ii; ?>'); return false;"><?php _e('Show format info', 'nxs_snap'); ?></a>)</div>
61
+ <input name="dl[<?php echo $ii; ?>][apDLMsgFrmt]" id="apDLMsgFrmt" style="width: 50%;" value="<?php if ($isNew) echo "%TEXT%"; else _e(apply_filters('format_to_edit', htmlentities($gpo['dlMsgFormat'], ENT_COMPAT, "UTF-8")), 'nxs_snap'); ?>" onfocus="mxs_showFrmtInfo('apDLMsgFrmt<?php echo $ii; ?>');" /><?php nxs_doShowHint("apDLMsgFrmt".$ii); ?>
62
  </div><br/>
63
 
64
  <?php if ($gpo['dlPass']!='') { ?>
65
  <?php wp_nonce_field( 'rePostToDL', 'rePostToDL_wpnonce' ); ?>
66
+ <b><?php _e('Test your settings', 'nxs_snap'); ?>:</b>&nbsp;&nbsp;&nbsp; <a href="#" class="NXSButton" onclick="testPost('DL', '<?php echo $ii; ?>'); return false;"><?php printf( __( 'Submit Test Post to %s', 'nxs_snap' ), $nType); ?></a>
67
 
68
  <?php }
69
 
70
+ ?><div class="submit"><input type="submit" class="button-primary" name="update_NS_SNAutoPoster_settings" value="<?php _e('Update Settings', 'nxs_snap') ?>" /></div></div><?php
71
  }
72
  //#### Set Unit Settings from POST
73
  function setNTSettings($post, $options){ global $nxs_snapThisPageUrl; $code = 'DL'; $lcode = 'dl';
90
  }
91
  //#### Show Post->Edit Meta Box Settings
92
  function showEdPostNTSettings($ntOpts, $post){ global $nxs_plurl; $post_id = $post->ID;
93
+ 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]);
94
+ $doDL = $ntOpt['doDL'] && (is_array($pMeta) || $ntOpt['catSel']!='1');
95
  $isAvailDL = $ntOpt['dlUName']!='' && $ntOpt['dlPass']!=''; $dlMsgFormat = htmlentities($ntOpt['dlMsgFormat'], ENT_COMPAT, "UTF-8"); $dlMsgTFormat = htmlentities($ntOpt['dlMsgTFormat'], ENT_COMPAT, "UTF-8");
96
  ?>
97
  <tr><th style="text-align:left;" colspan="2"><?php if ( $ntOpt['catSel']=='1' && trim($ntOpt['catSelEd'])!='' ) { ?> <input type="hidden" class="nxs_SC" id="nxs_SC_DL<?php echo $ii; ?>" value="<?php echo $ntOpt['catSelEd']; ?>" /> <?php } ?>
98
+ <?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 (($post->post_status == "publish" && $ntOpt['isPosted'] == '1') || ($post->post_status != "publish" && ((int)$doDL == 1)) ) echo 'checked="checked" title="def"'; ?> /> <?php } ?>
99
 
100
+ <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', 'nxs_snap') ?> (<i style="color: #005800;"><?php echo $ntOpt['nName']; ?></i>)</div></th> <td><?php //## Only show RePost button if the post is "published"
101
+ 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', 'nxs_snap') ?>" />
102
  <?php wp_nonce_field( 'rePostToDL', 'rePostToDL_wpnonce' ); } ?>
103
 
104
  <?php if (is_array($pMeta) && is_array($pMeta[$ii]) && isset($pMeta[$ii]['pgID']) ) {
105
  ?> <span id="pstdDL<?php echo $ii; ?>" style="float: right; padding-top: 4px; padding-right: 10px;">
106
+ <a style="font-size: 10px;" href="http://delicious.com/<?php echo $ntOpt['dlUName']; ?>" target="_blank"><?php $nType="Delicious"; printf( __( 'Posted on', 'nxs_snap' ), $nType); ?> <?php echo (isset($pMeta[$ii]['pDate']) && $pMeta[$ii]['pDate']!='')?(" (".$pMeta[$ii]['pDate'].")"):""; ?></a>
107
  </span><?php } ?>
108
 
109
  </td></tr>
111
  <?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>
112
  <?php } elseif ($post->post_status != "pubZlish") { ?>
113
 
114
+ <tr id="altFormat1" style=""><th scope="row" style="text-align:right; width:60px; padding-right:10px;"><?php _e('Title Format:', 'nxs_snap') ?></th>
115
  <td><input 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); ?></td></tr>
116
 
117
+ <tr id="altFormat1" style=""><th scope="row" style="text-align:right; width:60px; padding-right:10px;"><?php _e('Text Format:', 'nxs_snap') ?></th>
118
  <td><input value="<?php echo $dlMsgFormat ?>" type="text" name="dl[<?php echo $ii; ?>][SNAPformat]" style="width:60%;max-width: 610px;" onfocus="jQuery('.nxs_FRMTHint').hide();mxs_showFrmtInfo('apDLMsgFrmt<?php echo $ii; ?>');"/><?php nxs_doShowHint("apDLMsgFrmt".$ii); ?></td></tr>
119
  <?php }
120
  }
121
  }
122
  //#### Save Meta Tags to the Post
123
+ function adjMetaOpt($optMt, $pMeta){ if (isset($pMeta['isPosted'])) $optMt['isPosted'] = $pMeta['isPosted']; else $optMt['isPosted'] = '';
124
  if (isset($pMeta['SNAPformat'])) $optMt['dlMsgFormat'] = $pMeta['SNAPformat'];
125
  if (isset($pMeta['SNAPformatT'])) $optMt['dlMsgTFormat'] = $pMeta['SNAPformatT'];
126
+ if (isset($pMeta['doDL'])) $optMt['doDL'] = $pMeta['doDL'] == 1?1:0; else { if (isset($pMeta['SNAPformat'])) $optMt['doDL'] = 0; }
127
+ if (isset($pMeta['SNAPincludeDL']) && $pMeta['SNAPincludeDL'] == '1' ) $optMt['doDL'] = 1;
128
+ return $optMt;
129
  }
130
  }}
131
  if (!function_exists("nxs_rePostToDL_ajax")) {
139
  }
140
  if (!function_exists("doConnectToDelicious")) { function doConnectToDelicious($u, $p){ global $nxs_gCookiesArr; $nxs_gCookiesArr = array(); $advSettings = array();
141
  $fldsTxt = 'username='.$u.'&password='.$p;
142
+ $contents = getCurlPageX(' http://www.delicious.com/login ','', false, $fldsTxt, false, $advSettings); // prr($nxs_gCookiesArr); prr($contents);
143
  }}
144
  if (!function_exists("doPostToDelicious")) { function doPostToDelicious($postID, $options){ global $nxs_gCookiesArr;
145
 
146
  }}
147
+
148
+ if (!function_exists("nxs_getDLHeaders")) { function nxs_getDLHeaders($up){ $hdrsArr = array();
149
+ $hdrsArr['Cache-Control']='no-cache'; $hdrsArr['Connection']='keep-alive';
150
+ $hdrsArr['User-Agent']='SNAP for Wordpress; Ver '.NextScripts_SNAP_Version;
151
+ $hdrsArr['Accept']='text/html, application/xhtml+xml, */*'; $hdrsArr['DNT']='1';
152
+ $hdrsArr['Authorization'] = 'Basic ' . base64_encode("$up");
153
+ $hdrsArr['Accept-Encoding']='gzip,deflate'; $hdrsArr['Accept-Language']='en-US,en;q=0.8'; $hdrsArr['Accept-Charset']='ISO-8859-1,utf-8;q=0.7,*;q=0.3'; return $hdrsArr;
154
+ }}
155
+
156
  if (!function_exists("nxs_doPublishToDL")) { //## Second Function to Post to DL
157
  function nxs_doPublishToDL($postID, $options){ $ntCd = 'DL'; $ntCdL = 'dl'; $ntNm = 'Delicious';
158
 
165
  $msgFormat = $options['dlMsgFormat']; $msgTFormat = $options['dlMsgTFormat']; $msgT = nsFormatMessage($msgTFormat, $postID); $msg = nsFormatMessage($msgFormat, $postID);
166
  nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPrePosted'=>'1'));
167
  }
168
+ $dusername = $options['dlUName']; $pass = (substr($options['dlPass'], 0, 5)=='n5g9a'?nsx_doDecode(substr($options['dlPass'], 5)):$options['dlPass']);
 
169
  $api = "api.del.icio.us/v1"; $link = urlencode($link); $desc = urlencode(substr($msgT, 0, 250)); $ext = urlencode(substr($msg, 0, 1000));
 
170
  $extInfo = ' | PostID: '.$postID." - ".$post->post_title; $logNT = '<span style="color:#000080">Delicious</span> - '.$options['nName'];
 
171
  $t = wp_get_post_tags($postID); $tggs = array(); foreach ($t as $tagA) {$tggs[] = $tagA->name;} $tags = urlencode(implode(',',$tggs)); $tags = str_replace(' ','+',$tags);
172
+ $apicall = "https://$api/posts/add?red=api&url=$link&description=$desc&extended=$ext&tags=$tags";
173
+ $hdrsArr = nxs_getDLHeaders($dusername.':'.$pass); $cnt = wp_remote_get( $apicall, array( 'method' => 'GET', 'timeout' => 45, 'redirection' => 0, 'headers' => $hdrsArr) ); // prr($cnt);
 
 
174
 
175
+ if(is_wp_error($cnt)) { $error_string = $cnt->get_error_message(); if (stripos($error_string, ' timed out')!==false) { sleep(10);
176
+ $cnt = wp_remote_get( $apicall, array( 'method' => 'GET', 'timeout' => 45, 'redirection' => 0, 'headers' => $hdrsArr) );}
177
+ }
178
  if(is_wp_error($cnt)) {
179
  $ret = 'Something went wrong - '."http://$dusername:*********@$api/posts/add?&url=$link&description=$desc&extended=$ext&tags=$tags"; nxs_addToLog($logNT, 'E', '-=ERROR=- '.$ret. "ERR: ".print_r($cnt, true), $extInfo);
180
  } else {
181
  if (is_array($cnt) && stripos($cnt['body'],'code="done"')!==false)
182
  { $ret = 'OK'; nxs_metaMarkAsPosted($postID, 'DL', $options['ii'], array('isPosted'=>'1', 'pgID'=>'DL', 'pDate'=>date('Y-m-d H:i:s'))); nxs_addToLog($logNT, 'M', 'OK - Message Posted ', $extInfo); }
183
+ elseif (is_array($cnt) && $cnt['body']=='<?xml version="1.0" encoding="UTF-8"?>') { $ret = 'It looks like Delicious API is Down'; nxs_addToLog($logNT, 'M', 'It looks like Delicious API is Down', $extInfo); }
184
  elseif (is_array($cnt) && stripos($cnt['body'],'item already exists')!==false) { $ret = '..All good, but this link has already been bookmarked..'; nxs_addToLog($logNT, 'M', 'All good, but this link has already been bookmarked', $extInfo); }
185
  else { if ($cnt['response']['code']=='401') $ret = " Incorrect Username/Password "; else $ret = 'Something went wrong - '."https://$dusername:*********@$api/posts/add?&url=$link&description=$desc&extended=$ext&tags=$tags"; nxs_addToLog($logNT, 'E', '-=ERROR=- '.$ret. "ERR: ".print_r($cnt, true), $extInfo);
186
  }
inc-cl/fb.php CHANGED
@@ -4,8 +4,8 @@ $nxs_snapAvNts[] = array('code'=>'FB', 'lcode'=>'fb', 'name'=>'Facebook');
4
 
5
  if (!class_exists("nxs_snapClassFB")) { class nxs_snapClassFB {
6
  //#### Show Common Settings
7
- function showGenNTSettings($ntOpts){ global $nxs_snapThisPageUrl, $nxs_plurl; $code = 'FB'; $lcode = 'fb'; wp_nonce_field( 'ns'.$code, 'ns'.$code.'_wpnonce' );
8
- if ( isset($_GET['code']) && $_GET['code']!='' && (isset($_GET['auth']) && $_GET['auth']=='fb') && ((!isset($_GET['action'])) || $_GET['action']!='gPlusAuth')){ $at = $_GET['code']; echo "-= This is normal technical authorization info that will dissapear (Unless you get some errors) =- <br/><br/><br/>-= Code:".$at;
9
  //$fbo = array('wfa'=> 1339160000); //foreach ($ntOpts as $two) { if (isset($two['wfa']) && $two['wfa']>$fbo['wfa']) $fbo = $two; }
10
  $fbo = $ntOpts[$_GET['acc']]; $wprg = array(); $response = wp_remote_get('https://graph.facebook.com/nextscripts', $wprg);
11
  if( is_wp_error( $response) && isset($response->errors['http_request_failed']) && stripos($response->errors['http_request_failed'][0], 'SSL')!==false ) { prr($response->errors); $wprg['sslverify'] = false; }
@@ -27,7 +27,10 @@ if (!class_exists("nxs_snapClassFB")) { class nxs_snapClassFB {
27
  } $page_info = $facebook->api("/$page_id?fields=access_token");
28
  if( !empty($page_info['access_token']) ) { $fbo['fbAppPageAuthToken'] = $page_info['access_token']; }
29
  } catch (NXS_FacebookApiException $e) { $errMsg = $e->getMessage(); prr($errMsg);
30
- if ( stripos($errMsg, 'Unknown fields: access_token')!==false) { $fbo['fbAppPageAuthToken'] = $fbo['fbAppAuthToken']; } else { echo 'Error:', $errMsg, "\n"; die(); }
 
 
 
31
  }
32
  } else echo "Can't get Facebook User. Please login to Facebook.";
33
 
@@ -35,109 +38,134 @@ if (!class_exists("nxs_snapClassFB")) { class nxs_snapClassFB {
35
  $optionsG = get_option('NS_SNAutoPoster'); $optionsG['fb'][$_GET['acc']] = $fbo; update_option('NS_SNAutoPoster', $optionsG);
36
  ?><script type="text/javascript">window.location = "<?php echo $nxs_snapThisPageUrl; ?>"</script>
37
  <?php } die(); }
38
- } ?>
39
- <hr/><div class="nsx_iconedTitle" style="background-image: url(<?php echo $nxs_plurl; ?>img/<?php echo $lcode; ?>16.png);">Facebook Settings: <?php $cfbo = count($ntOpts); $mfbo = 1+max(array_keys($ntOpts)); ?> <?php wp_nonce_field( 'nsFB', 'nsFB_wpnonce' ); ?>
40
- <div class="nsBigText">You have <?php echo $cfbo=='0'?'No':$cfbo; ?> Facebook account<?php if ($cfbo!=1){ ?>s<?php } ?> <!-- - <a href="#" class="NXSButton" onclick="doShowHideBlocks2('FB<?php echo $mfbo; ?>');return false;">Add new Facebook Account</a> --> </div></div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
 
42
- <?php // if (function_exists('nxs_doSMAS1')) nxs_doSMAS1($this, $mfbo); else nxs_doSMAS('Facebook', 'FB'.$mfbo); ?>
43
 
44
- <?php foreach ($ntOpts as $indx=>$fbo){ $fbo['ii'] = $indx; if (trim($fbo['nName']=='')) $fbo['nName'] = str_ireplace('https://www.facebook.com','', str_ireplace('http://www.facebook.com','', $fbo['fbURL'])); ?>
45
- <p style="margin: 0px;margin-left: 5px;"><input value="1" id="apDoFB" name="fb[<?php echo $indx; ?>][apDoFB]" type="checkbox" <?php if ((int)$fbo['doFB'] == 1) echo "checked"; ?> />
46
- <strong>Auto-publish your Posts to your Facebook Page or Profile <i style="color: #005800;"><?php if($fbo['nName']!='') echo "(".$fbo['nName'].")"; ?></i> </strong>
47
- &nbsp;&nbsp;<a id="doFB<?php echo $indx; ?>A" href="#" onclick="doShowHideBlocks2('FB<?php echo $indx; ?>');return false;">[Show Settings]</a>&nbsp;&nbsp;
48
- <a href="#" onclick="doDelAcct('fb', '<?php echo $indx; ?>', '<?php echo $fbo['fbURL']; ?>');return false;">[Remove Account]</a>
49
- </p><?php $this->showNTSettings($indx, $fbo);
50
- } //## END FB Settings
51
  }
52
  //#### Show NEW Settings Page
53
  function showNewNTSettings($mfbo){ $fbo = array('nName'=>'', 'doFB'=>'1', 'fbURL'=>'', 'fbAppID'=>'', 'imgUpl'=>'1', 'fbPostType'=>'A', 'fbMsgAFormat'=>'', 'fbAppSec'=>'', 'fbAttch'=>'1', 'fbPgID'=>'', 'fbAppAuthUser'=>'', 'fbMsgFormat'=>'New post has been published on %SITENAME%' ); $this->showNTSettings($mfbo, $fbo, true);}
54
  //#### Show Unit Settings
55
- function showNTSettings($ii, $fbo, $isNew=false){ global $nxs_plurl, $nxs_snapThisPageUrl; if ((int)$fbo['fbAttch']==0 && (!isset($fbo['trPostType']) || $fbo['trPostType']=='')) $fbo['trPostType'] = 'T';
 
56
  if (!isset($fbo['nHrs'])) $fbo['nHrs'] = 0; if (!isset($fbo['nMin'])) $fbo['nMin'] = 0; if (!isset($fbo['catSel'])) $fbo['catSel'] = 0; if (!isset($fbo['catSelEd'])) $fbo['catSelEd'] = ''; ?>
57
- <div id="doFB<?php echo $ii; ?>Div" <?php if ($isNew){ ?>class="clNewNTSets"<?php } ?> style="max-width: 1000px; background-color: #EBF4FB; background-image: url(<?php echo $nxs_plurl; ?>img/fb-bg.png); background-position:90% 10%; background-repeat: no-repeat; margin: 10px; border: 1px solid #808080; padding: 10px; <?php if ((isset($fbo['fbAppAuthUser']) && $fbo['fbAppAuthUser']>1)||$isNew) { ?>display:none;<?php } ?>"> <input type="hidden" name="apDoSFB<?php echo $ii; ?>" value="0" id="apDoSFB<?php echo $ii; ?>" />
58
  <?php if ($isNew) { ?> <input type="hidden" name="fb[<?php echo $ii; ?>][apDoFB]" value="1" id="apDoNewFB<?php echo $ii; ?>" /> <?php } ?>
59
 
60
- <div class="nsx_iconedTitle" style="float: right; max-width: 320px; text-align: right; background-image: url(<?php echo $nxs_plurl; ?>img/fb16.png);"><a style="font-size: 12px;" target="_blank" href="http://www.nextscripts.com/setup-installation-facebook-social-networks-auto-poster-wordpress/">Detailed Facebook Installation/Configuration Instructions</a><br/>
61
  <span style="font-size: 10px;">Please use URL <em style="font-size: 10px; color:#CB4B16;">http://<?php echo $_SERVER["SERVER_NAME"] ?></em> and domain <em style="font-size: 10px; color:#CB4B16;"><?php echo $_SERVER["SERVER_NAME"] ?></em> in your Facebook App</span>
62
 
63
  </div>
64
 
65
- <div style="width:100%;"><strong>Account Nickname:</strong> <i>Just so you can easely identify it</i> </div><input name="fb[<?php echo $ii; ?>][nName]" id="fbnName<?php echo $ii; ?>" style="font-weight: bold; color: #005800; border: 1px solid #ACACAC; width: 40%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($fbo['nName'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" /><br/>
66
  <?php echo nxs_addQTranslSel('fb', $ii, $fbo['qTLng']); ?>
67
  <?php echo nxs_addPostingDelaySel('fb', $ii, $fbo['nHrs'], $fbo['nMin']); ?>
68
 
69
  <?php if (!$isNew) { ?>
70
- <div style="width:100%;"><strong>Auto-Post Categories:</strong>
71
  <input value="0" id="catSelA<?php echo $ii; ?>" type="radio" name="fb[<?php echo $ii; ?>][catSel]" <?php if ((int)$fbo['catSel'] != 1) echo "checked"; ?> /> All
72
  <input value="1" id="catSelSFB<?php echo $ii; ?>" type="radio" name="fb[<?php echo $ii; ?>][catSel]" <?php if ((int)$fbo['catSel'] == 1) echo "checked"; ?> /> <a href="#" style="text-decoration: none;" class="showCats" id="nxs_SCA_FB<?php echo $ii; ?>" onclick="jQuery('#catSelSFB<?php echo $ii; ?>').attr('checked', true); jQuery('#tmpCatSelNT').val('FB<?php echo $ii; ?>'); nxs_markCats( jQuery('#nxs_SC_FB<?php echo $ii; ?>').val() ); jQuery('#showCatSel').bPopup({ modalClose: false, appendTo: '#nsStForm', opacity: 0.6, follow: [false, false], position: [75, 'auto']}); return false;">Selected<?php if ($fbo['catSelEd']!='') echo "[".(substr_count($fbo['catSelEd'], ",")+1)."]"; ?></a>
73
  <input type="hidden" name="fb[<?php echo $ii; ?>][catSelEd]" id="nxs_SC_FB<?php echo $ii; ?>" value="<?php echo $fbo['catSelEd']; ?>" />
74
- </div>
75
  <br/>
76
  <?php } ?>
 
77
 
78
- <div style="width:100%;"><strong>Your Facebook URL:</strong> </div>
79
- <p style="font-size: 11px; margin: 0px;">Could be your Facebook Profile, Facebook Page, Facebook Group</p>
80
- <input name="fb[<?php echo $ii; ?>][apFBURL]" id="apFBURL" style="width: 50%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($fbo['fbURL'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" />
81
- <div style="width:100%;"><strong>Your Facebook App ID:</strong> </div><input name="fb[<?php echo $ii; ?>][apFBAppID]" id="apFBAppID" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($fbo['fbAppID'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" />
82
- <div style="width:100%;"><strong>Your Facebook App Secret:</strong> </div><input name="fb[<?php echo $ii; ?>][apFBAppSec]" id="apFBAppSec" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($fbo['fbAppSec'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" /><br/><br/>
83
  <div id="altFormat">
84
- <div style="width:100%;"><strong id="altFormatText">Message text Format:</strong> (<a href="#" id="apFBMsgFrmt<?php echo $ii; ?>HintInfo" onclick="mxs_showHideFrmtInfo('apFBMsgFrmt<?php echo $ii; ?>'); return false;">Show format info</a>)</div>
85
 
86
- <input name="fb[<?php echo $ii; ?>][apFBMsgFrmt]" id="apFBMsgFrmt" style="width: 50%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($fbo['fbMsgFormat'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" onfocus="mxs_showFrmtInfo('apFBMsgFrmt<?php echo $ii; ?>');"/><?php nxs_doShowHint("apFBMsgFrmt".$ii); ?><br/>
87
  </div><br/>
88
- <div style="width:100%;"><strong id="altFormatText">Post Type:</strong>&lt;-- (<a id="showShAtt" onmouseout="hidePopShAtt('<?php echo $ii; ?>X');" onmouseover="showPopShAtt('<?php echo $ii; ?>X', event);" onclick="return false;" class="underdash" href="http://www.nextscripts.com/blog/">What's the difference?</a>) </div>
89
  <div style="margin-left: 10px;">
90
 
91
- <input type="radio" name="fb[<?php echo $ii; ?>][fbPostType]" value="T" <?php if ($fbo['fbPostType'] == 'T') echo 'checked="checked"'; ?> /> Text Post - <i>just text message</i><br/>
92
 
93
- <input type="radio" name="fb[<?php echo $ii; ?>][fbPostType]" value="I" <?php if ($fbo['fbPostType'] == 'I') echo 'checked="checked"'; ?> /> Image Post - <i>big image with text message</i><br/>
94
- <div style="width:100%; margin-left: 15px;"><strong>Upload Images to:&nbsp;</strong>
95
- <input value="2" id="apFBImgUplAPP<?php echo $ii; ?>" type="radio" name="fb[<?php echo $ii; ?>][apFBImgUpl]" <?php if ((int)$fbo['imgUpl'] == 2) echo "checked"; ?> /> App Album .. or ..
96
  <input value="1" id="apFBImgUplTML<?php echo $ii; ?>" type="radio" name="fb[<?php echo $ii; ?>][apFBImgUpl]" <?php if ((int)$fbo['imgUpl'] != 2) echo "checked"; ?> />
97
- Timeline &lt;-- (<a id="showShAtt" onmouseout="hidePopShAtt('<?php echo $ii; ?>I');" onmouseover="showPopShAtt('<?php echo $ii; ?>I', event);" onclick="return false;" class="underdash" href="http://www.nextscripts.com/blog/">What's the difference?</a>)
98
  </div>
99
 
100
- <input type="radio" name="fb[<?php echo $ii; ?>][fbPostType]" value="A" <?php if ( !isset($fbo['fbPostType']) || $fbo['fbPostType'] == '' || $fbo['fbPostType'] == 'A') echo 'checked="checked"'; ?> /> Text Post with "attached" link<br/>
101
 
102
- <div style="width:100%; margin-left: 15px;"><strong>Link attachment type:&nbsp;</strong> <input value="2" id="apFBAttchShare<?php echo $ii; ?>" type="radio" name="fb[<?php echo $ii; ?>][apFBAttch]" <?php if ((int)$fbo['fbAttch'] == 2) echo "checked"; ?> />
103
- Share a link to your blogpost .. or ..
104
  <input value="1" id="apFBAttch<?php echo $ii; ?>" type="radio" name="fb[<?php echo $ii; ?>][apFBAttch]" <?php if ((int)$fbo['fbAttch'] == 1) echo "checked"; ?> />
105
- Attach your blogpost &lt;-- (<a id="showShAtt" onmouseout="hidePopShAtt('<?php echo $ii; ?>');" onmouseover="showPopShAtt('<?php echo $ii; ?>', event);" onclick="return false;" class="underdash" href="http://www.nextscripts.com/blog/">What's the difference?</a>)
106
- <div style="margin-bottom: 5px; margin-left: 10px; "><input value="1" id="apFBAttchAsVid" type="checkbox" name="fb[<?php echo $ii; ?>][apFBAttchAsVid]" <?php if (isset($fbo['fbAttchAsVid']) && (int)$fbo['fbAttchAsVid'] == 1) echo "checked"; ?> />
107
- <strong>If post has video use it as an attachment thumbnail.</strong> <i>Video will be used for an attachment thumbnail instead of featured image. Only Youtube is supported at this time.</i><br/>
108
-
109
- </div>
110
- <strong>Attachment Text Format:</strong><br/>
111
- <input value="1" id="apFBMsgAFrmtA<?php echo $ii; ?>" <?php if (trim($fbo['fbMsgAFrmt'])=='') echo "checked"; ?> onchange="if (jQuery(this).is(':checked')) { jQuery('#apFBMsgAFrmtDiv<?php echo $ii; ?>').hide(); jQuery('#apFBMsgAFrmt<?php echo $ii; ?>').val(''); }else jQuery('#apFBMsgAFrmtDiv<?php echo $ii; ?>').show();" type="checkbox" name="fb[<?php echo $ii; ?>][apFBMsgAFrmtA]"/> <strong>Auto</strong>
112
- <i> - Recommended. Info from SEO Plugins will be used, then post excerpt, then post text </i><br/>
113
- <div id="apFBMsgAFrmtDiv<?php echo $ii; ?>" style="<?php if ($fbo['fbMsgAFrmt']=='') echo "display:none;"; ?>" >&nbsp;&nbsp;&nbsp; Set your own format:<input name="fb[<?php echo $ii; ?>][apFBMsgAFrmt]" id="apFBMsgAFrmt<?php echo $ii; ?>" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($fbo['fbMsgAFrmt'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" /><br/></div>
114
  </div><br/>
115
- </div><br/>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
 
117
- <div class="popShAtt" style="z-index: 9999; width: 350px;" id="popShAtt<?php echo $ii; ?>I"><h3>Where to upload Images</h3> <b>(App Album)</b> Facebook automatically creates an album for your app. Images will be grouped there as in any regular album. <br/><br/><b>(Timeline)</b> Images will be posted to the special "Wall/Timeline" album and won't be grouped. "Wall/Timeline" album must exist. It's created when first image posted to timeline manually.</div>
118
- <div class="popShAtt" style="z-index: 9999" id="popShAtt<?php echo $ii; ?>"><h3>Two ways of attaching post on Facebook</h3><img src="<?php echo $nxs_plurl; ?>img/fb2wops.jpg" width="600" height="271" alt="Two ways of attaching post on Facebook"/></div>
119
- <div class="popShAtt" style="z-index: 9999" id="popShAtt<?php echo $ii; ?>X"><h3>Facebook Post Types</h3><img src="<?php echo $nxs_plurl; ?>img/fbPostTypesDiff6.png" width="600" height="398" alt="Facebook Post Types"/></div>
 
 
120
 
121
 
122
- <?php if ($fbo['fbPgID']!='') {?><div style="width:100%;"><strong>Your Facebook Page ID:</strong> <?php _e(apply_filters('format_to_edit', htmlentities($fbo['fbPgID'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?> </div><?php } ?>
123
  <?php
124
  if($fbo['fbAppSec']=='') { ?>
125
- <b>Authorize Your Facebook Account</b>. Please click "Update Settings" to be able to Authorize your account.
126
  <?php } else { if(isset($fbo['fbAppAuthUser']) && $fbo['fbAppAuthUser']>0) { ?>
127
- Your Facebook Account has been authorized. User ID: <?php _e(apply_filters('format_to_edit', htmlentities($fbo['fbAppAuthUser'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>.
128
- You can Re- <?php } ?>
129
- <a href="https://www.facebook.com/dialog/oauth?client_id=<?php echo $fbo['fbAppID'];?>&client_secret='<?php echo $fbo['fbAppSec'];?>&scope=publish_stream,user_photos,offline_access,read_stream,manage_pages&redirect_uri=<?php echo urlencode($nxs_snapThisPageUrl.'&auth=fb&acc='.$fbo['ii']);?>">Authorize Your Facebook Account</a>
130
- <?php if (!isset($fbo['fbAppAuthUser']) || $fbo['fbAppAuthUser']<1) { ?> <div class="blnkg">&lt;=== Authorize your account ===</div> <?php } ?>
131
-
132
- <?php if (!isset($fbo['fbAppAuthUser']) || $fbo['fbAppAuthUser']<1) { ?>
133
- <br/><br/><i> If you get Facebook message: <b>"Error. An error occurred. Please try again later."</b> or <b>"Error 191"</b> please make sure that domain name in your Facebook App matches your website domain exactly. Please note that for example <b>nextscripts.com</b> and <b style="color:#800000;">www.</b><b>nextscripts.com</b> are different domains.</i> <?php }?>
134
  <?php } ?>
135
 
136
  <?php if(isset($fbo['fbAppAuthUser']) && $fbo['fbAppAuthUser']>0) { ?>
137
  <?php wp_nonce_field( 'rePostToFB', 'rePostToFB_wpnonce' ); ?>
138
- <br/><br/><b>Test your settings:</b>&nbsp;&nbsp;&nbsp; <a href="#" class="NXSButton" onclick="testPost('FB','<?php echo $ii; ?>'); return false;">Submit Test Post to Facebook</a>
139
  <?php }?>
140
- <div class="submit"><input type="submit" class="button-primary" name="update_NS_SNAutoPoster_settings" value="<?php _e('Update Settings', 'NS_SNAutoPoster') ?>" /></div>
141
 
142
  </div>
143
  <?php
@@ -164,6 +192,10 @@ if (!class_exists("nxs_snapClassFB")) { class nxs_snapClassFB {
164
  if (isset($pval['apFBMsgFrmt'])) $options[$ii]['fbMsgFormat'] = trim($pval['apFBMsgFrmt']);
165
  if (isset($pval['apFBMsgAFrmt'])) $options[$ii]['fbMsgAFrmt'] = trim($pval['apFBMsgAFrmt']);
166
 
 
 
 
 
167
  if (isset($pval['delayHrs'])) $options[$ii]['nHrs'] = trim($pval['delayHrs']); if (isset($pval['delayMin'])) $options[$ii]['nMin'] = trim($pval['delayMin']);
168
  if (isset($pval['qTLng'])) $options[$ii]['qTLng'] = trim($pval['qTLng']);
169
 
@@ -178,22 +210,29 @@ if (!class_exists("nxs_snapClassFB")) { class nxs_snapClassFB {
178
  }
179
  //#### Show Post->Edit Meta Box Settings
180
  function showEdPostNTSettings($ntOpts, $post){ global $nxs_plurl; $post_id = $post->ID;
181
- foreach($ntOpts as $ii=>$ntOpt) { $pMeta = maybe_unserialize(get_post_meta($post_id, 'snapFB', true)); if (is_array($pMeta)) $ntOpt = $this->adjMetaOpt($ntOpt, $pMeta[$ii]); $doFB = $ntOpt['doFB'] && $ntOpt['catSel']!='1';
 
182
  $isAvailFB = $ntOpt['fbURL']!='' && $ntOpt['fbAppID']!='' && $ntOpt['fbAppSec']!=''; $isAttachFB = $ntOpt['fbAttch']; $fbMsgFormat = htmlentities($ntOpt['fbMsgFormat'], ENT_COMPAT, "UTF-8"); $fbPostType = $ntOpt['fbPostType'];
183
  ?>
184
 
185
  <tr><th style="text-align:left;" colspan="2"> <?php if ( $ntOpt['catSel']=='1' && trim($ntOpt['catSelEd'])!='' ) { ?> <input type="hidden" class="nxs_SC" id="nxs_SC_FB<?php echo $ii; ?>" value="<?php echo $ntOpt['catSelEd']; ?>" /> <?php } ?>
186
 
187
- <?php if ($isAvailFB) { ?><input class="nxsGrpDoChb" value="1" id="doFB<?php echo $ii; ?>" <?php if ($post->post_status == "publish") echo 'disabled="disabled"';?> type="checkbox" name="fb[<?php echo $ii; ?>][SNAPincludeFB]" <?php if (($post->post_status == "publish" && $ntOpt['isPosted'] == '1') || ($post->post_status != "publish" && ((int)$doFB == 1)) ) echo 'checked="checked" title="def"'; ?> /> <?php } ?>
188
 
189
- <div class="nsx_iconedTitle" style="display: inline; font-size: 13px; background-image: url(<?php echo $nxs_plurl; ?>img/fb16.png);">Facebook - <?php _e('publish to ', 'NS_SPAP'); ?> (<i style="color: #005800;"><?php echo $ntOpt['nName']; ?></i>)</div></th><td><?php //## Only show RePost button if the post is "published"
190
- if ($post->post_status == "publish" && $isAvailFB) { ?><input alt="<?php echo $ii; ?>" style="float: right;" onmouseout="hidePopShAtt('SV');" onmouseover="showPopShAtt('SV', event);" onclick="return false;" type="button" class="button" name="rePostToFB_repostButton" id="rePostToFB_button" value="<?php _e('Repost to Facebook', 're-post') ?>" />
 
 
 
 
 
 
191
  <?php wp_nonce_field( 'rePostToFB', 'rePostToFB_wpnonce' ); } ?>
192
 
193
  <?php if (is_array($pMeta) && is_array($pMeta[$ii]) && isset($pMeta[$ii]['pgID']) && strpos($pMeta[$ii]['pgID'],'_')!==false ) { $pid = explode('_', $pMeta[$ii]['pgID']);
194
 
195
  ?> <span id="pstdFB<?php echo $ii; ?>" style="float: right;padding-top: 4px; padding-right: 10px;">
196
- <a style="font-size: 10px;" href="http://www.facebook.com/permalink.php?story_fbid=<?php echo $pid[1].'&id='.$pid[0]; ?>" target="_blank">Posted on Facebook <?php echo (isset($pMeta[$ii]['pDate']) && $pMeta[$ii]['pDate']!='')?(" (".$pMeta[$ii]['pDate'].")"):""; ?></a>
197
  </span><?php } ?>
198
 
199
  </td></tr>
@@ -207,24 +246,30 @@ if (!class_exists("nxs_snapClassFB")) { class nxs_snapClassFB {
207
  <td></td>
208
  </tr>
209
 
210
- <tr><th scope="row" style="text-align:right; width:150px; vertical-align:top; padding-top: 0px; padding-right:10px;"> Post Type: <br/>
211
- (<a id="showShAtt" style="font-weight: normal" onmouseout="hidePopShAtt('<?php echo $ii; ?>X');" onmouseover="showPopShAtt('<?php echo $ii; ?>X', event);" onclick="return false;" class="underdash" href="http://www.nextscripts.com/blog/">What's the difference?</a>)</th><td>
212
 
213
- <input type="radio" name="fb[<?php echo $ii; ?>][PostType]" value="T" <?php if ($fbPostType == 'T') echo 'checked="checked"'; ?> /> Text Post - <i>just text message</i><br/>
214
- <input type="radio" name="fb[<?php echo $ii; ?>][PostType]" value="I" <?php if ($fbPostType == 'I') echo 'checked="checked"'; ?> /> Image Post - <i>big image with text message</i><br/>
215
- <input type="radio" name="fb[<?php echo $ii; ?>][PostType]" value="A" <?php if ( !isset($fbPostType) || $fbPostType == '' || $fbPostType == 'A') echo 'checked="checked"'; ?> /> Text Post with "attached" blogpost &lt;-- (<a id="showShAtt" onmouseout="hidePopShAtt('<?php echo $ii; ?>');" onmouseover="showPopShAtt('<?php echo $ii; ?>', event);" onclick="return false;" class="underdash" href="http://www.nextscripts.com/blog/">What's the difference?</a>) <br/>
216
 
217
- <div style="width:100%; margin-left: 25px;"><strong>Link attachment type:&nbsp;</strong> <input value="2" id="apFBAttchShare<?php echo $ii; ?>" onchange="doSwitchShAtt(0,<?php echo $ii; ?>);" type="radio" name="fb[<?php echo $ii; ?>][AttachPost]" <?php if ((int)$isAttachFB == 2) echo "checked"; ?> />
218
- Share a link to your blogpost .. or ..
219
  <input value="1" id="apFBAttch<?php echo $ii; ?>" onchange="doSwitchShAtt(1,<?php echo $ii; ?>);" type="radio" name="fb[<?php echo $ii; ?>][AttachPost]" <?php if ((int)$isAttachFB == 1) echo "checked"; ?> />
220
- Attach your blogpost
221
  </div>
222
- <div class="popShAtt" id="popShAtt<?php echo $ii; ?>"><h3>Two ways of attaching post on Facebook</h3> <img src="<?php echo $nxs_plurl; ?>img/fb2wops.jpg" width="600" height="271" alt="Two ways of attaching post on Facebook"/></div>
223
- <div class="popShAtt" id="popShAtt<?php echo $ii; ?>X"><h3>Facebook Post Types</h3><img src="<?php echo $nxs_plurl; ?>img/fbPostTypesDiff6.png" width="600" height="398" alt="Facebook Post Types"/></div>
224
  </td></tr>
225
 
226
- <tr id="altFormat1" style=""><th scope="row" style="text-align:right; width:60px; padding-right:10px;"><?php _e('Message Format:', 'NS_SPAP') ?></th>
227
- <td><input value="<?php echo $fbMsgFormat ?>" type="text" name="fb[<?php echo $ii; ?>][SNAPformat]" style="width:60%;max-width: 610px;" onfocus="jQuery('.nxs_FRMTHint').hide();mxs_showFrmtInfo('apFBTMsgFrmt<?php echo $ii; ?>');"/><?php nxs_doShowHint("apFBTMsgFrmt".$ii); ?></td></tr>
 
 
 
 
 
 
228
  <?php }
229
  }
230
 
@@ -234,23 +279,40 @@ if (!class_exists("nxs_snapClassFB")) { class nxs_snapClassFB {
234
  if (isset($pMeta['SNAPformat'])) $optMt['fbMsgFormat'] = $pMeta['SNAPformat'];
235
  if (isset($pMeta['AttachPost'])) $optMt['fbAttch'] = ($pMeta['AttachPost'] != '')?$pMeta['AttachPost']:0; else { if (isset($pMeta['SNAPformat'])) $optMt['fbAttch'] = 0; }
236
  if (isset($pMeta['PostType'])) $optMt['fbPostType'] = ($pMeta['PostType'] != '')?$pMeta['PostType']:0; else { if (isset($pMeta['SNAPformat'])) $optMt['fbPostType'] = 'T'; }
237
- if (isset($pMeta['SNAPincludeFB'])) $optMt['doFB'] = $pMeta['SNAPincludeFB'] == 1?1:0; else { if (isset($pMeta['SNAPformat'])) $optMt['doFB'] = 0; }
 
238
  return $optMt;
239
  }
240
  }}
241
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
242
  if (!function_exists("nxs_rePostToFB_ajax")) { function nxs_rePostToFB_ajax() { check_ajax_referer('rePostToFB'); $postID = $_POST['id']; // $result = nsPublishTo($id, 'FB', true);
243
- $options = get_option('NS_SNAutoPoster'); foreach ($options['fb'] as $ii=>$fbo) if ($ii==$_POST['nid']) { $fbo['ii'] = $ii; $fbo['pType'] = 'aj';
244
  $fbpo = get_post_meta($postID, 'snapFB', true); /* echo $postID."|"; echo $fbpo; */ $fbpo = maybe_unserialize($fbpo); // prr($fbpo);
245
  if (is_array($fbpo) && isset($fbpo[$ii]) && is_array($fbpo[$ii]) ){ $ntClInst = new nxs_snapClassFB(); $fbo = $ntClInst->adjMetaOpt($fbo, $fbpo[$ii]); } //prr($fbo);
246
- $result = nxs_doPublishToFB($postID, $fbo); if ($result == 200) die("Successfully sent your post to FaceBook."); else die($result);
 
 
247
  }
248
  }
249
  }
250
 
251
  if (!function_exists("nxs_doPublishToFB")) { //## Second Function to Post to FB
252
  function nxs_doPublishToFB($postID, $options){ global $ShownAds; $ntCd = 'FB'; $ntCdL = 'fb'; $ntNm = 'Facebook'; $dsc = ''; require_once ('apis/facebook.php');
253
- $fbWhere = 'feed'; $page_id = $options['fbPgID']; if (isset($ShownAds)) $ShownAdsL = $ShownAds;
254
 
255
  $ii = $options['ii']; if (!isset($options['pType'])) $options['pType'] = 'im'; if ($options['pType']=='sh') sleep(rand(1, 10)); $snap_ap = get_post_meta($postID, 'snap'.$ntCd, true); $snap_ap = maybe_unserialize($snap_ap);
256
  if ($options['pType']!='aj' && is_array($snap_ap) && (nxs_chArrVar($snap_ap[$ii], 'isPosted', '1') || nxs_chArrVar($snap_ap[$ii], 'isPrePosted', '1'))) {
@@ -263,13 +325,13 @@ if (!function_exists("nxs_doPublishToFB")) { //## Second Function to Post to FB
263
  if ($postID=='0') { echo "Testing ... <br/><br/>";
264
  $mssg = array('access_token' => $options['fbAppPageAuthToken'], 'message' => 'Test Post', 'name' => 'Test Post', 'caption' => 'Test Post', 'link' => home_url(),
265
  'description' => 'test Post', 'actions' => array(array('name' => $blogTitle, 'link' => home_url())) );
266
- } else { $post = get_post($postID); if(!$post) return; $fbMsgFormat = $options['fbMsgFormat']; $msg = nsFormatMessage($fbMsgFormat, $postID); $fbMsgAFormat = $options['fbMsgAFrmt'];
267
  $isAttachFB = $options['fbAttch']; $fbPostType = $options['fbPostType']; $isAttachVidFB = $options['fbAttchAsVid'];
268
  nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPrePosted'=>'1'));
269
- if (($isAttachFB=='1' || $isAttachFB=='2' || $fbPostType=='A')) $imgURL = nxs_getPostImage($postID); // prr($options); echo "PP - ".$postID; prr($src);
270
  if ($fbPostType=='I') $imgURL = nxs_getPostImage($postID, 'full'); // prr($options); echo "PP - ".$postID; prr($src);
271
 
272
- if (trim($fbMsgAFormat)!='') {$dsc = nsFormatMessage($fbMsgAFormat, $postID);} else { if (function_exists('aioseop_mrt_fix_meta') && $dsc=='') $dsc = trim(get_post_meta($postID, '_aioseop_description', true));
273
  if (function_exists('wpseo_admin_init') && $dsc=='') $dsc = trim(get_post_meta($postID, '_yoast_wpseo_opengraph-description', true));
274
  if (function_exists('wpseo_admin_init') && $dsc=='') $dsc = trim(get_post_meta($postID, '_yoast_wpseo_metadesc', true));
275
  if ($dsc=='') $dsc = trim(apply_filters('the_content', nxs_doQTrans($post->post_excerpt, $lng))); if ($dsc=='') $dsc = trim(nxs_doQTrans($post->post_excerpt, $lng));
@@ -298,14 +360,13 @@ if (!function_exists("nxs_doPublishToFB")) { //## Second Function to Post to FB
298
  $aacct = array('access_token' => $options['fbAppPageAuthToken']); $albums = $facebook->api("/$page_id/albums", "get", $aacct);
299
  foreach ($albums["data"] as $album) { if ($album["type"] == "wall") { $chosen_album = $album; break;}}
300
  if (isset($chosen_album) && isset($chosen_album["id"])) $page_id = $chosen_album["id"];
301
- }
302
-
303
  }
304
  } // prr($mssg); // prr($options); // prr($facebook); echo "/$page_id/feed";
305
  if (isset($ShownAds)) $ShownAds = $ShownAdsL; // FIX for the quick-adsense plugin
306
  $extInfo = ' | PostID: '.$postID." - ".nxs_doQTrans($post->post_title, $lng); $logNT = '<span style="color:#0000FF">Facebook</span> - '.$options['nName']; // prr($mssg);
307
 
308
- try { $ret = $facebook->api("/$page_id/".$fbWhere, "post", $mssg);} catch (NXS_FacebookApiException $e) { nxs_addToLog($logNT, 'E', '-=ERROR=- '.$e->getMessage(), $extInfo);
309
  if (stripos($e->getMessage(),'This API call requires a valid app_id')!==false) { $page_id = $options['fbPgID'];
310
  if ( !is_numeric($page_id) && stripos($options['fbURL'], '/groups/')!=false) { $fbPgIDR = wp_remote_get('http://www.nextscripts.com/nxs.php?g='.$options['fbURL']);
311
  $fbPgIDR = trim($fbPgIDR['body']); $page_id = $fbPgIDR!=''?$fbPgIDR:$page_id;
@@ -313,15 +374,17 @@ if (!function_exists("nxs_doPublishToFB")) { //## Second Function to Post to FB
313
  if( !empty($page_info['access_token']) ) { $options['fbAppPageAuthToken'] = $page_info['access_token'];
314
  nxs_addToLog($logNT, 'M', 'Personal Auth used instead of Page. Please re-authorize Facebook.');
315
  try { $ret = $facebook->api("/$page_id/".$fbWhere,"post", $mssg); } catch (NXS_FacebookApiException $e) { nxs_addToLog($logNT, 'E', '-=ERROR 2=- '.$e->getMessage(), $extInfo);}
316
- } else { $rMsg = '-= ERROR =- (invalid app_id) Authorization Error. Your app is not authorized. Please go to the Plugin Settings - Facebook and authorize it.<br/>';
317
  nxs_addToLog($logNT, 'E', $rMsg, $extInfo); return $rMsg.$e->getMessage();
318
  }
319
  }
320
  if ($postID=='0') echo 'Error:', $e->getMessage(), "\n"; return "Valid app_id ERROR:".$e->getMessage();
321
  } // prr($ret);
322
- if ($postID=='0') { prr($ret); if (isset($ret['id']) && $ret['id']!='') { echo 'OK - Message Posted, please see your Facebook Page '; nxs_addToLog($logNT, 'M', 'Test Message Posted, please see your Facebook Page'); }}
323
- else { if (isset($ret['id']) && $ret['id']!='') {
324
- nxs_metaMarkAsPosted($postID, 'FB', $options['ii'], array('isPosted'=>'1', 'pgID'=>$ret['id'], 'pDate'=>date('Y-m-d H:i:s')) ); nxs_addToLog($logNT, 'M', 'OK - Message Posted'.print_r($ret, true), $extInfo);
 
 
325
  } else nxs_addToLog($logNT, 'E', '-=ERROR=- '.print_r($ret, true), $extInfo);
326
  }
327
  }
4
 
5
  if (!class_exists("nxs_snapClassFB")) { class nxs_snapClassFB {
6
  //#### Show Common Settings
7
+ function showGenNTSettings($ntOpts){ global $nxs_snapThisPageUrl, $nxs_plurl; $ntInfo = array('code'=>'FB', 'lcode'=>'fb', 'name'=>'Facebook', 'defNName'=>'dlUName', 'tstReq' => true);
8
+ if ( isset($_GET['code']) && $_GET['code']!='' && (isset($_GET['auth']) && $_GET['auth']=='fb') && ((!isset($_GET['action'])) || $_GET['action']!='gPlusAuth')){ $at = $_GET['code']; echo "-= This is normal technical authorization info that will dissapear (Unless you get some errors) =- <br/><br/><br/>";
9
  //$fbo = array('wfa'=> 1339160000); //foreach ($ntOpts as $two) { if (isset($two['wfa']) && $two['wfa']>$fbo['wfa']) $fbo = $two; }
10
  $fbo = $ntOpts[$_GET['acc']]; $wprg = array(); $response = wp_remote_get('https://graph.facebook.com/nextscripts', $wprg);
11
  if( is_wp_error( $response) && isset($response->errors['http_request_failed']) && stripos($response->errors['http_request_failed'][0], 'SSL')!==false ) { prr($response->errors); $wprg['sslverify'] = false; }
27
  } $page_info = $facebook->api("/$page_id?fields=access_token");
28
  if( !empty($page_info['access_token']) ) { $fbo['fbAppPageAuthToken'] = $page_info['access_token']; }
29
  } catch (NXS_FacebookApiException $e) { $errMsg = $e->getMessage(); prr($errMsg);
30
+ if ( stripos($errMsg, 'Unknown fields: access_token')!==false) { $fbo['fbAppPageAuthToken'] = $fbo['fbAppAuthToken']; } else {
31
+ if (stripos($errMsg, 'Unsupported get request')!==false) echo "<b style='color:red;'>Error </b>: Your Facebook URL ( <i>".$fbo['fbURL']."</i> ) is either incorrect or authorzing user don't have rights to post there.<br/>";
32
+ echo 'Reported Error: ', $errMsg, "\n"; die();
33
+ }
34
  }
35
  } else echo "Can't get Facebook User. Please login to Facebook.";
36
 
38
  $optionsG = get_option('NS_SNAutoPoster'); $optionsG['fb'][$_GET['acc']] = $fbo; update_option('NS_SNAutoPoster', $optionsG);
39
  ?><script type="text/javascript">window.location = "<?php echo $nxs_snapThisPageUrl; ?>"</script>
40
  <?php } die(); }
41
+ }
42
+ ?>
43
+ <div class="nxs_box">
44
+ <div class="nxs_box_header">
45
+ <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']; ?>
46
+ <?php $cbo = count($ntOpts); ?> <?php wp_nonce_field( 'ns'.$ntInfo['code'], 'ns'.$ntInfo['code'].'_wpnonce' ); ?>
47
+ <?php if ($cbo>1){ ?><div class="nsBigText"><?php echo "(".($cbo=='0'?'No':$cbo)." "; _e('accounts', 'nxs_snap'); echo ")"; ?></div><?php } ?>
48
+ </div>
49
+ </div>
50
+ <div class="nxs_box_inside">
51
+ <?php foreach ($ntOpts as $indx=>$pbo){ if (trim($pbo['nName']=='')) $pbo['nName'] = str_ireplace('https://www.facebook.com','', str_ireplace('http://www.facebook.com','', $pbo['fbURL']));
52
+ if (!isset($pbo[$ntInfo['lcode'].'OK']) || $pbo[$ntInfo['lcode'].'OK']=='') $pbo[$ntInfo['lcode'].'OK'] = (isset($pbo['fbAppAuthUser']) && $pbo['fbAppAuthUser']>1)?'1':''; ?>
53
+ <p style="margin:0px;margin-left:5px;">
54
+ <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"; ?> />
55
+ <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>
56
+ &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;
57
+ <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>
58
+ </p><?php $this->showNTSettings($indx, $pbo);
59
+ }?>
60
+ </div>
61
+ </div> <?php
62
 
 
63
 
 
 
 
 
 
 
 
64
  }
65
  //#### Show NEW Settings Page
66
  function showNewNTSettings($mfbo){ $fbo = array('nName'=>'', 'doFB'=>'1', 'fbURL'=>'', 'fbAppID'=>'', 'imgUpl'=>'1', 'fbPostType'=>'A', 'fbMsgAFormat'=>'', 'fbAppSec'=>'', 'fbAttch'=>'1', 'fbPgID'=>'', 'fbAppAuthUser'=>'', 'fbMsgFormat'=>'New post has been published on %SITENAME%' ); $this->showNTSettings($mfbo, $fbo, true);}
67
  //#### Show Unit Settings
68
+ function showNTSettings($ii, $fbo, $isNew=false){ global $nxs_plurl, $nxs_snapThisPageUrl, $plgn_NS_SNAutoPoster; if ((int)$fbo['fbAttch']==0 && (!isset($fbo['trPostType']) || $fbo['trPostType']=='')) $fbo['trPostType'] = 'T';
69
+ if (!isset($plgn_NS_SNAutoPoster)) return; $gOptions = $plgn_NS_SNAutoPoster->nxs_options;
70
  if (!isset($fbo['nHrs'])) $fbo['nHrs'] = 0; if (!isset($fbo['nMin'])) $fbo['nMin'] = 0; if (!isset($fbo['catSel'])) $fbo['catSel'] = 0; if (!isset($fbo['catSelEd'])) $fbo['catSelEd'] = ''; ?>
71
+ <div id="doFB<?php echo $ii; ?>Div" class="insOneDiv<?php if ($isNew) echo " clNewNTSets"; ?>" style="background-image: url(<?php echo $nxs_plurl; ?>img/fb-bg.png); background-position:90% 10%;"> <input type="hidden" name="apDoSFB<?php echo $ii; ?>" value="0" id="apDoSFB<?php echo $ii; ?>" />
72
  <?php if ($isNew) { ?> <input type="hidden" name="fb[<?php echo $ii; ?>][apDoFB]" value="1" id="apDoNewFB<?php echo $ii; ?>" /> <?php } ?>
73
 
74
+ <div class="nsx_iconedTitle" style="float: right; max-width: 320px; text-align: right; background-image: url(<?php echo $nxs_plurl; ?>img/fb16.png);"><a style="font-size: 12px;" target="_blank" href="http://www.nextscripts.com/setup-installation-facebook-social-networks-auto-poster-wordpress/"><?php $nType="Facebook"; printf( __( 'Detailed %s Installation/Configuration Instructions', 'nxs_snap' ), $nType); ?></a><br/>
75
  <span style="font-size: 10px;">Please use URL <em style="font-size: 10px; color:#CB4B16;">http://<?php echo $_SERVER["SERVER_NAME"] ?></em> and domain <em style="font-size: 10px; color:#CB4B16;"><?php echo $_SERVER["SERVER_NAME"] ?></em> in your Facebook App</span>
76
 
77
  </div>
78
 
79
+ <div style="width:100%;"><strong><?php _e('Account Nickname', 'nxs_snap'); ?>:</strong> <i><?php _e('Just so you can easely identify it', 'nxs_snap'); ?></i> </div><input name="fb[<?php echo $ii; ?>][nName]" id="fbnName<?php echo $ii; ?>" style="font-weight: bold; color: #005800; border: 1px solid #ACACAC; width: 40%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($fbo['nName'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" /><br/>
80
  <?php echo nxs_addQTranslSel('fb', $ii, $fbo['qTLng']); ?>
81
  <?php echo nxs_addPostingDelaySel('fb', $ii, $fbo['nHrs'], $fbo['nMin']); ?>
82
 
83
  <?php if (!$isNew) { ?>
84
+ <div style="width:100%;"><strong><?php _e('Categories', 'nxs_snap'); ?>:</strong>
85
  <input value="0" id="catSelA<?php echo $ii; ?>" type="radio" name="fb[<?php echo $ii; ?>][catSel]" <?php if ((int)$fbo['catSel'] != 1) echo "checked"; ?> /> All
86
  <input value="1" id="catSelSFB<?php echo $ii; ?>" type="radio" name="fb[<?php echo $ii; ?>][catSel]" <?php if ((int)$fbo['catSel'] == 1) echo "checked"; ?> /> <a href="#" style="text-decoration: none;" class="showCats" id="nxs_SCA_FB<?php echo $ii; ?>" onclick="jQuery('#catSelSFB<?php echo $ii; ?>').attr('checked', true); jQuery('#tmpCatSelNT').val('FB<?php echo $ii; ?>'); nxs_markCats( jQuery('#nxs_SC_FB<?php echo $ii; ?>').val() ); jQuery('#showCatSel').bPopup({ modalClose: false, appendTo: '#nsStForm', opacity: 0.6, follow: [false, false], position: [75, 'auto']}); return false;">Selected<?php if ($fbo['catSelEd']!='') echo "[".(substr_count($fbo['catSelEd'], ",")+1)."]"; ?></a>
87
  <input type="hidden" name="fb[<?php echo $ii; ?>][catSelEd]" id="nxs_SC_FB<?php echo $ii; ?>" value="<?php echo $fbo['catSelEd']; ?>" />
88
+ <br/><i><?php _e('Only selected categories will be autoposted to this account', 'nxs_snap'); ?></i></div>
89
  <br/>
90
  <?php } ?>
91
+ <div style="width:100%;"><strong style="font-size: 16px;">Facebook Settings:</strong> </div>
92
 
93
+ <div style="width:100%;"><strong>Facebook URL:</strong> </div>
94
+ <p style="font-size: 11px; margin: 0px;"><?php _e('Could be your Facebook Profile, Facebook Page, Facebook Group', 'nxs_snap'); ?></p>
95
+ <input name="fb[<?php echo $ii; ?>][apFBURL]" id="apFBURL" style="width: 50%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($fbo['fbURL'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" />
96
+ <div style="width:100%;"><strong>Facebook App ID:</strong> </div><input name="fb[<?php echo $ii; ?>][apFBAppID]" id="apFBAppID" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($fbo['fbAppID'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" />
97
+ <div style="width:100%;"><strong>Facebook App Secret:</strong> </div><input name="fb[<?php echo $ii; ?>][apFBAppSec]" id="apFBAppSec" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($fbo['fbAppSec'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" /><br/><br/>
98
  <div id="altFormat">
99
+ <div style="width:100%;"><strong id="altFormatText"><?php _e('Message text Format', 'nxs_snap'); ?>:</strong> (<a href="#" id="apFBMsgFrmt<?php echo $ii; ?>HintInfo" onclick="mxs_showHideFrmtInfo('apFBMsgFrmt<?php echo $ii; ?>'); return false;"><?php _e('Show format info', 'nxs_snap'); ?></a>)</div>
100
 
101
+ <input name="fb[<?php echo $ii; ?>][apFBMsgFrmt]" id="apFBMsgFrmt" style="width: 50%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($fbo['fbMsgFormat'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" onfocus="mxs_showFrmtInfo('apFBMsgFrmt<?php echo $ii; ?>');"/><?php nxs_doShowHint("apFBMsgFrmt".$ii); ?><br/>
102
  </div><br/>
103
+ <div style="width:100%;"><strong style="font-size: 16px;" id="altFormatText">Post Type:</strong>&lt;-- (<a id="showShAtt" onmouseout="hidePopShAtt('<?php echo $ii; ?>X');" onmouseover="showPopShAtt('<?php echo $ii; ?>X', event);" onclick="return false;" class="underdash" href="http://www.nextscripts.com/blog/"><?php _e('What\'s the difference?', 'nxs_snap'); ?></a>) </div>
104
  <div style="margin-left: 10px;">
105
 
106
+ <input type="radio" name="fb[<?php echo $ii; ?>][fbPostType]" value="T" <?php if ($fbo['fbPostType'] == 'T') echo 'checked="checked"'; ?> /> <?php _e('Text Post', 'nxs_snap'); ?> - <i><?php _e('just text message', 'nxs_snap'); ?></i><br/>
107
 
108
+ <input type="radio" name="fb[<?php echo $ii; ?>][fbPostType]" value="I" <?php if ($fbo['fbPostType'] == 'I') echo 'checked="checked"'; ?> /> <?php _e('Image Post', 'nxs_snap'); ?> - <i><?php _e('big image with text message', 'nxs_snap'); ?></i><br/>
109
+ <div style="width:100%; margin-left: 15px;"><strong><?php _e('Upload Images to', 'nxs_snap'); ?>:&nbsp;</strong>
110
+ <input value="2" id="apFBImgUplAPP<?php echo $ii; ?>" type="radio" name="fb[<?php echo $ii; ?>][apFBImgUpl]" <?php if ((int)$fbo['imgUpl'] == 2) echo "checked"; ?> /> <?php _e('App Album', 'nxs_snap'); ?> .. <?php _e('or', 'nxs_snap'); ?> ..
111
  <input value="1" id="apFBImgUplTML<?php echo $ii; ?>" type="radio" name="fb[<?php echo $ii; ?>][apFBImgUpl]" <?php if ((int)$fbo['imgUpl'] != 2) echo "checked"; ?> />
112
+ <?php _e('Timeline', 'nxs_snap'); ?> &lt;-- (<a id="showShAtt" onmouseout="hidePopShAtt('<?php echo $ii; ?>I');" onmouseover="showPopShAtt('<?php echo $ii; ?>I', event);" onclick="return false;" class="underdash" href="http://www.nextscripts.com/blog/"><?php _e('What\'s the difference?', 'nxs_snap'); ?></a>)
113
  </div>
114
 
115
+ <input type="radio" name="fb[<?php echo $ii; ?>][fbPostType]" value="A" <?php if ( !isset($fbo['fbPostType']) || $fbo['fbPostType'] == '' || $fbo['fbPostType'] == 'A') echo 'checked="checked"'; ?> /> <?php _e('Text Post with "attached" link', 'nxs_snap'); ?><br/>
116
 
117
+ <div style="width:100%; margin-left: 15px;"><strong><?php _e('Link attachment type', 'nxs_snap'); ?>:&nbsp;</strong> <input value="2" id="apFBAttchShare<?php echo $ii; ?>" type="radio" name="fb[<?php echo $ii; ?>][apFBAttch]" <?php if ((int)$fbo['fbAttch'] == 2) echo "checked"; ?> />
118
+ <?php _e('Share a link to your blogpost', 'nxs_snap'); ?> .. <?php _e('or', 'nxs_snap'); ?> ..
119
  <input value="1" id="apFBAttch<?php echo $ii; ?>" type="radio" name="fb[<?php echo $ii; ?>][apFBAttch]" <?php if ((int)$fbo['fbAttch'] == 1) echo "checked"; ?> />
120
+ <?php _e('Attach your blogpost', 'nxs_snap'); ?> &lt;-- (<a id="showShAtt" onmouseout="hidePopShAtt('<?php echo $ii; ?>');" onmouseover="showPopShAtt('<?php echo $ii; ?>', event);" onclick="return false;" class="underdash" href="http://www.nextscripts.com/blog/"><?php _e('What\'s the difference?', 'nxs_snap'); ?></a>)
121
+ <div style="margin-bottom: 5px; margin-left: 10px; "><input value="1" id="apFBAttchAsVid" type="checkbox" name="fb[<?php echo $ii; ?>][apFBAttchAsVid]" <?php if (isset($fbo['fbAttchAsVid']) && (int)$fbo['fbAttchAsVid'] == 1) echo "checked"; ?> /> <strong><?php _e('If post has video use it as an attachment thumbnail.', 'nxs_snap'); ?></strong> <i><?php _e('Video will be used for an attachment thumbnail instead of featured image. Only Youtube is supported at this time.', 'nxs_snap'); ?></i>
122
+ <br/></div>
123
+ <strong><?php _e('Attachment Text Format', 'nxs_snap'); ?>:</strong><br/>
124
+ <input value="1" id="apFBMsgAFrmtA<?php echo $ii; ?>" <?php if (trim($fbo['fbMsgAFrmt'])=='') echo "checked"; ?> onchange="if (jQuery(this).is(':checked')) { jQuery('#apFBMsgAFrmtDiv<?php echo $ii; ?>').hide(); jQuery('#apFBMsgAFrmt<?php echo $ii; ?>').val(''); }else jQuery('#apFBMsgAFrmtDiv<?php echo $ii; ?>').show();" type="checkbox" name="fb[<?php echo $ii; ?>][apFBMsgAFrmtA]"/> <strong><?php _e('Auto', 'nxs_snap'); ?></strong>
125
+ <i> - <?php _e('Recommended. Info from SEO Plugins will be used, then post excerpt, then post text', 'nxs_snap'); ?> </i><br/>
126
+ <div id="apFBMsgAFrmtDiv<?php echo $ii; ?>" style="<?php if ($fbo['fbMsgAFrmt']=='') echo "display:none;"; ?>" >&nbsp;&nbsp;&nbsp; <?php _e('Set your own format', 'nxs_snap'); ?>:<input name="fb[<?php echo $ii; ?>][apFBMsgAFrmt]" id="apFBMsgAFrmt<?php echo $ii; ?>" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($fbo['fbMsgAFrmt'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" /><br/></div>
 
 
127
  </div><br/>
128
+ </div>
129
+ <div style="width:100%;"><strong style="font-size: 16px;"><?php _e('Facebook Comments:', 'nxs_snap'); ?></strong> </div>
130
+ <div style="margin-bottom: 5px; margin-left: 10px; ">
131
+ <p style="font-size: 11px; margin: 0px;"><?php _e('Plugin could grab comments from Facebook and import them as Wordpress Comments', 'nxs_snap'); ?></p>
132
+
133
+ <?php if ( $gOptions['riActive'] == '1' ) { ?>
134
+ <input value="1" id="apFBMsgAFrmtA<?php echo $ii; ?>" <?php if (trim($fbo['riComments'])=='1') echo "checked"; ?> type="checkbox" name="fb[<?php echo $ii; ?>][riComments]"/> <strong><?php _e('Import Facebook Comments', 'nxs_snap'); ?></strong>
135
+ <br/>
136
+ <div style="margin-bottom: 5px; margin-left: 10px; ">
137
+ <input value="1" id="apFBMsgAFrmtA<?php echo $ii; ?>" <?php if (trim($fbo['riCommentsAA'])=='1') echo "checked"; ?> type="checkbox" name="fb[<?php echo $ii; ?>][riCommentsAA]"/> <strong><?php _e('Auto-approve imported comments', 'nxs_snap'); ?></strong></div>
138
+
139
+ <?php } else { echo "<br/>"; _e('Please activate the "Comments Import" from SNAP Settings - Other Settings', 'nxs_snap'); } ?>
140
+
141
+ </div>
142
+
143
+ <br/><br/>
144
 
145
+ <div class="popShAtt" style="z-index: 9999; width: 350px;" id="popShAtt<?php echo $ii; ?>I"><h3><?php _e('Where to upload Images', 'nxs_snap'); ?></h3> <b><?php _e('(App Album)', 'nxs_snap'); ?></b> <?php _e('Facebook automatically creates an album for your app. Images will be grouped there as in any regular album.', 'nxs_snap'); ?> <br/><br/><b><?php _e('(Timeline)', 'nxs_snap'); ?></b> <?php _e('Images will be posted to the special "Wall/Timeline" album and won\'t be grouped. "Wall/Timeline" album must exist. It\'s created when first image posted to timeline manually.', 'nxs_snap'); ?></div>
146
+ <div class="popShAtt" style="z-index: 9999" id="popShAtt<?php echo $ii; ?>"><h3><?php _e('Two ways of attaching post on Facebook', 'nxs_snap'); ?></h3><img src="<?php echo $nxs_plurl; ?>img/fb2wops.jpg" width="600" height="271" alt="<?php _e('Two ways of attaching post on Facebook', 'nxs_snap'); ?>"/></div>
147
+ <div class="popShAtt" style="z-index: 9999" id="popShAtt<?php echo $ii; ?>X"><h3><?php _e('Facebook Post Types', 'nxs_snap'); ?></h3><img src="<?php echo $nxs_plurl; ?>img/fbPostTypesDiff6.png" width="600" height="398" alt="<?php _e('Facebook Post Types', 'nxs_snap'); ?>"/></div>
148
+
149
+
150
 
151
 
152
+ <?php if ($fbo['fbPgID']!='') {?><div style="width:100%;"><strong>Facebook Page ID:</strong> <?php _e(apply_filters('format_to_edit', htmlentities($fbo['fbPgID'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?> </div><?php } ?>
153
  <?php
154
  if($fbo['fbAppSec']=='') { ?>
155
+ <b><?php _e('Authorize Your Facebook Account', 'nxs_snap'); ?></b> <?php _e('Please click "Update Settings" to be able to Authorize your account.', 'nxs_snap'); ?>
156
  <?php } else { if(isset($fbo['fbAppAuthUser']) && $fbo['fbAppAuthUser']>0) { ?>
157
+ <?php _e('Your Facebook Account has been authorized.', 'nxs_snap'); ?> User ID: <?php _e(apply_filters('format_to_edit', htmlentities($fbo['fbAppAuthUser'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>.
158
+ <?php _e('You can', 'nxs_snap'); ?> Re- <?php } ?>
159
+ <a href="https://www.facebook.com/dialog/oauth?client_id=<?php echo trim($fbo['fbAppID']);?>&client_secret=<?php echo trim($fbo['fbAppSec']);?>&scope=publish_stream,user_photos,offline_access,read_stream,manage_pages&redirect_uri=<?php echo trim(urlencode($nxs_snapThisPageUrl.'&auth=fb&acc='.$ii));?>">Authorize Your Facebook Account</a>
160
+ <?php if (!isset($fbo['fbAppAuthUser']) || $fbo['fbAppAuthUser']<1) { ?> <div class="blnkg">&lt;=== <?php _e('Authorize your account', 'nxs_snap'); ?> ===</div>
161
+ <br/><br/><i> <?php _e('If you get Facebook message:', 'nxs_snap'); ?> <b>"Error. An error occurred. Please try again later."</b> or <b>"Error 191"</b> <?php _e('please make sure that domain name in your Facebook App matches your website domain exactly. Please note that www. and non www. versions are different domains.', 'nxs_snap'); ?></i> <?php }?>
 
 
162
  <?php } ?>
163
 
164
  <?php if(isset($fbo['fbAppAuthUser']) && $fbo['fbAppAuthUser']>0) { ?>
165
  <?php wp_nonce_field( 'rePostToFB', 'rePostToFB_wpnonce' ); ?>
166
+ <br/><br/><b><?php _e('Test your settings', 'nxs_snap'); ?>:</b>&nbsp;&nbsp;&nbsp; <a href="#" class="NXSButton" onclick="testPost('FB','<?php echo $ii; ?>'); return false;"><?php printf( __( 'Submit Test Post to %s', 'nxs_snap' ), $nType); ?></a>
167
  <?php }?>
168
+ <div class="submit"><input type="submit" class="button-primary" name="update_NS_SNAutoPoster_settings" value="<?php _e('Update Settings', 'nxs_snap') ?>" /></div>
169
 
170
  </div>
171
  <?php
192
  if (isset($pval['apFBMsgFrmt'])) $options[$ii]['fbMsgFormat'] = trim($pval['apFBMsgFrmt']);
193
  if (isset($pval['apFBMsgAFrmt'])) $options[$ii]['fbMsgAFrmt'] = trim($pval['apFBMsgAFrmt']);
194
 
195
+ if (isset($pval['riComments'])) $options[$ii]['riComments'] = $pval['riComments']; else $options[$ii]['riComments'] = 0;
196
+ if (isset($pval['riCommentsAA'])) $options[$ii]['riCommentsAA'] = $pval['riCommentsAA']; else $options[$ii]['riCommentsAA'] = 0;
197
+
198
+
199
  if (isset($pval['delayHrs'])) $options[$ii]['nHrs'] = trim($pval['delayHrs']); if (isset($pval['delayMin'])) $options[$ii]['nMin'] = trim($pval['delayMin']);
200
  if (isset($pval['qTLng'])) $options[$ii]['qTLng'] = trim($pval['qTLng']);
201
 
210
  }
211
  //#### Show Post->Edit Meta Box Settings
212
  function showEdPostNTSettings($ntOpts, $post){ global $nxs_plurl; $post_id = $post->ID;
213
+ foreach($ntOpts as $ii=>$ntOpt) { $pMeta = maybe_unserialize(get_post_meta($post_id, 'snapFB', true)); if (is_array($pMeta)) $ntOpt = $this->adjMetaOpt($ntOpt, $pMeta[$ii]);
214
+ $doFB = $ntOpt['doFB'] && (is_array($pMeta) || $ntOpt['catSel']!='1');
215
  $isAvailFB = $ntOpt['fbURL']!='' && $ntOpt['fbAppID']!='' && $ntOpt['fbAppSec']!=''; $isAttachFB = $ntOpt['fbAttch']; $fbMsgFormat = htmlentities($ntOpt['fbMsgFormat'], ENT_COMPAT, "UTF-8"); $fbPostType = $ntOpt['fbPostType'];
216
  ?>
217
 
218
  <tr><th style="text-align:left;" colspan="2"> <?php if ( $ntOpt['catSel']=='1' && trim($ntOpt['catSelEd'])!='' ) { ?> <input type="hidden" class="nxs_SC" id="nxs_SC_FB<?php echo $ii; ?>" value="<?php echo $ntOpt['catSelEd']; ?>" /> <?php } ?>
219
 
220
+ <?php if ($isAvailFB) { ?><input class="nxsGrpDoChb" value="1" id="doFB<?php echo $ii; ?>" <?php if ($post->post_status == "publish") echo 'disabled="disabled"';?> type="checkbox" name="fb[<?php echo $ii; ?>][doFB]" <?php if (($post->post_status == "publish" && $ntOpt['isPosted'] == '1') || ($post->post_status != "publish" && ((int)$doFB == 1)) ) echo 'checked="checked" title="def"'; ?> /> <?php } ?>
221
 
222
+ <div class="nsx_iconedTitle" style="display: inline; font-size: 13px; background-image: url(<?php echo $nxs_plurl; ?>img/fb16.png);">Facebook - <?php _e('publish to', 'nxs_snap') ?> (<i style="color: #005800;"><?php echo $ntOpt['nName']; ?></i>)</div></th><td><?php //## Only show RePost button if the post is "published"
223
+ if ($post->post_status == "publish" && $isAvailFB) { ?>
224
+
225
+ <input alt="<?php echo $ii; ?>" style="float: right;margin-left: 10px" onmouseout="hidePopShAtt('SV');" onmouseover="showPopShAtt('SV', event);" onclick="return false;" type="button" class="button" name="rePostToFB_repostButton" id="rePostToFB_button" value="<?php _e('Repost to Facebook', 'nxs_snap') ?>" />
226
+ <?php if ($ntOpt['riComments']=='1' && (is_array($pMeta) && is_array($pMeta[$ii]) && isset($pMeta[$ii]['pgID']) && strpos($pMeta[$ii]['pgID'],'_')!==false ) ) { ?>
227
+ <input alt="<?php echo $ii; ?>" style="float: right; " onclick="return false;" type="button" class="button" name="riToFB_repostButton" id="riToFB_button" value="<?php _e('Import Comments from Facebook', 'nxs_snap') ?>" />
228
+ <?php } ?>
229
+
230
  <?php wp_nonce_field( 'rePostToFB', 'rePostToFB_wpnonce' ); } ?>
231
 
232
  <?php if (is_array($pMeta) && is_array($pMeta[$ii]) && isset($pMeta[$ii]['pgID']) && strpos($pMeta[$ii]['pgID'],'_')!==false ) { $pid = explode('_', $pMeta[$ii]['pgID']);
233
 
234
  ?> <span id="pstdFB<?php echo $ii; ?>" style="float: right;padding-top: 4px; padding-right: 10px;">
235
+ <a style="font-size: 10px;" href="http://www.facebook.com/permalink.php?story_fbid=<?php echo $pid[1].'&id='.$pid[0]; ?>" target="_blank"><?php $nType="Facebook"; printf( __( 'Posted on', 'nxs_snap' ), $nType); ?> <?php echo (isset($pMeta[$ii]['pDate']) && $pMeta[$ii]['pDate']!='')?(" (".$pMeta[$ii]['pDate'].")"):""; ?></a>
236
  </span><?php } ?>
237
 
238
  </td></tr>
246
  <td></td>
247
  </tr>
248
 
249
+ <tr><th scope="row" style="text-align:right; width:150px; vertical-align:top; padding-top: 0px; padding-right:10px;"> <?php _e('Post Type:', 'nxs_snap'); ?> <br/>
250
+ (<a id="showShAtt" style="font-weight: normal" onmouseout="hidePopShAtt('<?php echo $ii; ?>X');" onmouseover="showPopShAtt('<?php echo $ii; ?>X', event);" onclick="return false;" class="underdash" href="http://www.nextscripts.com/blog/"><?php _e('What\'s the difference?', 'nxs_snap'); ?></a>)</th><td>
251
 
252
+ <input type="radio" name="fb[<?php echo $ii; ?>][PostType]" value="T" <?php if ($fbPostType == 'T') echo 'checked="checked"'; ?> /> <?php _e('Text Post', 'nxs_snap'); ?> - <i><?php _e('just text message', 'nxs_snap'); ?></i><br/>
253
+ <input type="radio" name="fb[<?php echo $ii; ?>][PostType]" value="I" <?php if ($fbPostType == 'I') echo 'checked="checked"'; ?> /> <?php _e('Image Post', 'nxs_snap'); ?> - <i><?php _e('big image with text message', 'nxs_snap'); ?></i><br/>
254
+ <input type="radio" name="fb[<?php echo $ii; ?>][PostType]" value="A" <?php if ( !isset($fbPostType) || $fbPostType == '' || $fbPostType == 'A') echo 'checked="checked"'; ?> /> <?php _e('Text Post with "attached" blogpost', 'nxs_snap'); ?> &lt;-- (<a id="showShAtt" onmouseout="hidePopShAtt('<?php echo $ii; ?>');" onmouseover="showPopShAtt('<?php echo $ii; ?>', event);" onclick="return false;" class="underdash" href="http://www.nextscripts.com/blog/"><?php _e('What\'s the difference?', 'nxs_snap'); ?></a>) <br/>
255
 
256
+ <div style="width:100%; margin-left: 25px;"><strong><?php _e('Link attachment type:', 'nxs_snap'); ?>&nbsp;</strong> <input value="2" id="apFBAttchShare<?php echo $ii; ?>" onchange="doSwitchShAtt(0,<?php echo $ii; ?>);" type="radio" name="fb[<?php echo $ii; ?>][AttachPost]" <?php if ((int)$isAttachFB == 2) echo "checked"; ?> />
257
+ <?php _e('Share a link to your blogpost', 'nxs_snap'); ?> .. <?php _e('or', 'nxs_snap'); ?> ..
258
  <input value="1" id="apFBAttch<?php echo $ii; ?>" onchange="doSwitchShAtt(1,<?php echo $ii; ?>);" type="radio" name="fb[<?php echo $ii; ?>][AttachPost]" <?php if ((int)$isAttachFB == 1) echo "checked"; ?> />
259
+ <?php _e('Attach your blogpost', 'nxs_snap'); ?>
260
  </div>
261
+ <div class="popShAtt" id="popShAtt<?php echo $ii; ?>"><h3><?php _e('Two ways of attaching post on Facebook', 'nxs_snap'); ?></h3> <img src="<?php echo $nxs_plurl; ?>img/fb2wops.jpg" width="600" height="271" alt="<?php _e('Two ways of attaching post on Facebook', 'nxs_snap'); ?>"/></div>
262
+ <div class="popShAtt" id="popShAtt<?php echo $ii; ?>X"><h3><?php _e('Facebook Post Types', 'nxs_snap'); ?></h3><img src="<?php echo $nxs_plurl; ?>img/fbPostTypesDiff6.png" width="600" height="398" alt="<?php _e('Facebook Post Types', 'nxs_snap'); ?>"/></div>
263
  </td></tr>
264
 
265
+ <tr id="altFormat1" style=""><th scope="row" style="text-align:right; width:60px; padding-right:10px;"><?php _e('Message Format:', 'nxs_snap') ?></th>
266
+ <td>
267
+ <?php if (1==1) { ?>
268
+ <textarea cols="150" rows="1" id="fb<?php echo $ii; ?>SNAPformat" name="fb[<?php echo $ii; ?>][SNAPformat]" style="width:60%;max-width: 610px;" onfocus="jQuery('#fb<?php echo $ii; ?>SNAPformat').attr('rows', 4); jQuery('.nxs_FRMTHint').hide();mxs_showFrmtInfo('apFBTMsgFrmt<?php echo $ii; ?>');"><?php echo $fbMsgFormat ?></textarea>
269
+ <?php } else { ?>
270
+ <input value="<?php echo $fbMsgFormat ?>" type="text" name="fb[<?php echo $ii; ?>][SNAPformat]" style="width:60%;max-width: 610px;" onfocus="jQuery('.nxs_FRMTHint').hide();mxs_showFrmtInfo('apFBTMsgFrmt<?php echo $ii; ?>');"/><?php nxs_doShowHint("apFBTMsgFrmt".$ii); ?>
271
+ <?php } ?>
272
+ </td></tr>
273
  <?php }
274
  }
275
 
279
  if (isset($pMeta['SNAPformat'])) $optMt['fbMsgFormat'] = $pMeta['SNAPformat'];
280
  if (isset($pMeta['AttachPost'])) $optMt['fbAttch'] = ($pMeta['AttachPost'] != '')?$pMeta['AttachPost']:0; else { if (isset($pMeta['SNAPformat'])) $optMt['fbAttch'] = 0; }
281
  if (isset($pMeta['PostType'])) $optMt['fbPostType'] = ($pMeta['PostType'] != '')?$pMeta['PostType']:0; else { if (isset($pMeta['SNAPformat'])) $optMt['fbPostType'] = 'T'; }
282
+ if (isset($pMeta['doFB'])) $optMt['doFB'] = $pMeta['doFB'] == 1?1:0; else { if (isset($pMeta['SNAPformat'])) $optMt['doFB'] = 0; }
283
+ if (isset($pMeta['SNAPincludeFB']) && $pMeta['SNAPincludeFB'] == '1' ) $optMt['doFB'] = 1; // <2.6 Compatibility fix
284
  return $optMt;
285
  }
286
  }}
287
 
288
+ if (!function_exists("nxs_getBackFBComments")) { function nxs_getBackFBComments($postID, $options, $po) { require_once ('apis/facebook.php'); $opts = array('access_token' => $options['fbAppPageAuthToken']);
289
+ $facebook = new NXS_Facebook(array( 'appId' => $options['fbAppID'], 'secret' => $options['fbAppSec'], 'cookie' => true )); $ci = 0;
290
+ $ret = $facebook->api($po['pgID']."/comments", "GET", $opts); $impCmnts = get_post_meta($postID, 'snapImportedComments', true); // prr($impCmnts); // $impCmnts = array();
291
+ if (is_array($ret) && is_array($ret['data'])) foreach ($ret['data'] as $comment){ $cid = $comment['id']; if (trim($cid)=='' || in_array('fbxcw'.$cid, $impCmnts)) continue; else $impCmnts[] = 'fbxcw'.$cid; // prr($impCmnts);
292
+ $authData = $facebook->api($comment['from']['id'], "GET", $opts);
293
+ $commentdata = array( 'comment_post_ID' => $postID, 'comment_author' => $comment['from']['name'], 'comment_author_email' => $comment['from']['id'].'@facebook.com',
294
+ 'comment_author_url' => $authData['link'], 'comment_content' => $comment['message'], 'comment_date_gmt' => date('Y-m-d H:i:s', strtotime( $comment['created_time'] ) ), 'comment_type' => 'comment');
295
+ // prr($commentdata);
296
+ nxs_postNewComment($commentdata, $options['riCommentsAA']=='1'); $ci++;
297
+ }
298
+ delete_post_meta($postID, 'snapImportedComments'); add_post_meta($postID, 'snapImportedComments', $impCmnts );
299
+ if ($_POST['id']!='') printf( _n( '%d comment has been imported.', '%d comments has been imported.', $ci, 'nxs_snap'), $ci );
300
+ }}
301
+
302
  if (!function_exists("nxs_rePostToFB_ajax")) { function nxs_rePostToFB_ajax() { check_ajax_referer('rePostToFB'); $postID = $_POST['id']; // $result = nsPublishTo($id, 'FB', true);
303
+ $options = get_option('NS_SNAutoPoster'); foreach ($options['fb'] as $ii=>$fbo) if ($ii==$_POST['nid']) { $fbo['ii'] = $ii; $fbo['pType'] = 'aj';
304
  $fbpo = get_post_meta($postID, 'snapFB', true); /* echo $postID."|"; echo $fbpo; */ $fbpo = maybe_unserialize($fbpo); // prr($fbpo);
305
  if (is_array($fbpo) && isset($fbpo[$ii]) && is_array($fbpo[$ii]) ){ $ntClInst = new nxs_snapClassFB(); $fbo = $ntClInst->adjMetaOpt($fbo, $fbpo[$ii]); } //prr($fbo);
306
+ if ($_POST['ri']=='1') { nxs_getBackFBComments($postID, $fbo, $fbpo[$ii]); die(); } else {
307
+ $result = nxs_doPublishToFB($postID, $fbo); if ($result == 200) die("Successfully sent your post to FaceBook."); else die($result);
308
+ }
309
  }
310
  }
311
  }
312
 
313
  if (!function_exists("nxs_doPublishToFB")) { //## Second Function to Post to FB
314
  function nxs_doPublishToFB($postID, $options){ global $ShownAds; $ntCd = 'FB'; $ntCdL = 'fb'; $ntNm = 'Facebook'; $dsc = ''; require_once ('apis/facebook.php');
315
+ $fbWhere = 'feed'; $page_id = $options['fbPgID']; if (isset($ShownAds)) $ShownAdsL = $ShownAds; $addParams = nxs_makeURLParams(array('NTNAME'=>$ntNm, 'NTCODE'=>$ntCd, 'ACCNAME'=>$options['nName']));
316
 
317
  $ii = $options['ii']; if (!isset($options['pType'])) $options['pType'] = 'im'; if ($options['pType']=='sh') sleep(rand(1, 10)); $snap_ap = get_post_meta($postID, 'snap'.$ntCd, true); $snap_ap = maybe_unserialize($snap_ap);
318
  if ($options['pType']!='aj' && is_array($snap_ap) && (nxs_chArrVar($snap_ap[$ii], 'isPosted', '1') || nxs_chArrVar($snap_ap[$ii], 'isPrePosted', '1'))) {
325
  if ($postID=='0') { echo "Testing ... <br/><br/>";
326
  $mssg = array('access_token' => $options['fbAppPageAuthToken'], 'message' => 'Test Post', 'name' => 'Test Post', 'caption' => 'Test Post', 'link' => home_url(),
327
  'description' => 'test Post', 'actions' => array(array('name' => $blogTitle, 'link' => home_url())) );
328
+ } else { $post = get_post($postID); if(!$post) return; $fbMsgFormat = $options['fbMsgFormat']; $msg = nsFormatMessage($fbMsgFormat, $postID, $addParams); $fbMsgAFormat = $options['fbMsgAFrmt'];
329
  $isAttachFB = $options['fbAttch']; $fbPostType = $options['fbPostType']; $isAttachVidFB = $options['fbAttchAsVid'];
330
  nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPrePosted'=>'1'));
331
+ if (($isAttachFB=='1' || $isAttachFB=='2' || $fbPostType=='A')) $imgURL = nxs_getPostImage($postID, 'thumbnail'); // prr($options); echo "PP - ".$postID; prr($src);
332
  if ($fbPostType=='I') $imgURL = nxs_getPostImage($postID, 'full'); // prr($options); echo "PP - ".$postID; prr($src);
333
 
334
+ if (trim($fbMsgAFormat)!='') {$dsc = nsFormatMessage($fbMsgAFormat, $postID, $addParams);} else { if (function_exists('aioseop_mrt_fix_meta') && $dsc=='') $dsc = trim(get_post_meta($postID, '_aioseop_description', true));
335
  if (function_exists('wpseo_admin_init') && $dsc=='') $dsc = trim(get_post_meta($postID, '_yoast_wpseo_opengraph-description', true));
336
  if (function_exists('wpseo_admin_init') && $dsc=='') $dsc = trim(get_post_meta($postID, '_yoast_wpseo_metadesc', true));
337
  if ($dsc=='') $dsc = trim(apply_filters('the_content', nxs_doQTrans($post->post_excerpt, $lng))); if ($dsc=='') $dsc = trim(nxs_doQTrans($post->post_excerpt, $lng));
360
  $aacct = array('access_token' => $options['fbAppPageAuthToken']); $albums = $facebook->api("/$page_id/albums", "get", $aacct);
361
  foreach ($albums["data"] as $album) { if ($album["type"] == "wall") { $chosen_album = $album; break;}}
362
  if (isset($chosen_album) && isset($chosen_album["id"])) $page_id = $chosen_album["id"];
363
+ }
 
364
  }
365
  } // prr($mssg); // prr($options); // prr($facebook); echo "/$page_id/feed";
366
  if (isset($ShownAds)) $ShownAds = $ShownAdsL; // FIX for the quick-adsense plugin
367
  $extInfo = ' | PostID: '.$postID." - ".nxs_doQTrans($post->post_title, $lng); $logNT = '<span style="color:#0000FF">Facebook</span> - '.$options['nName']; // prr($mssg);
368
 
369
+ try { $ret = $facebook->api("/$page_id/".$fbWhere, "post", $mssg);} catch (NXS_FacebookApiException $e) { nxs_addToLog($logNT, 'E', '-=ERROR FB=- '.$e->getMessage()."|".$page_id."/".$fbWhere, $extInfo);
370
  if (stripos($e->getMessage(),'This API call requires a valid app_id')!==false) { $page_id = $options['fbPgID'];
371
  if ( !is_numeric($page_id) && stripos($options['fbURL'], '/groups/')!=false) { $fbPgIDR = wp_remote_get('http://www.nextscripts.com/nxs.php?g='.$options['fbURL']);
372
  $fbPgIDR = trim($fbPgIDR['body']); $page_id = $fbPgIDR!=''?$fbPgIDR:$page_id;
374
  if( !empty($page_info['access_token']) ) { $options['fbAppPageAuthToken'] = $page_info['access_token'];
375
  nxs_addToLog($logNT, 'M', 'Personal Auth used instead of Page. Please re-authorize Facebook.');
376
  try { $ret = $facebook->api("/$page_id/".$fbWhere,"post", $mssg); } catch (NXS_FacebookApiException $e) { nxs_addToLog($logNT, 'E', '-=ERROR 2=- '.$e->getMessage(), $extInfo);}
377
+ } else { $rMsg = "-= ERROR =- (invalid app_id) Authorization Error. <br/>\r\n<br/>\r\n Possible Reasons: <br/>\r\n 1. Your app is not authorized. Please go to the Plugin Settings - Facebook and authorize it.<br/>\r\n 2. The current authorized user have no rights to post to the specified page. Please login to Facebook as the correct user and Re-Authorize the Plugin.<br/>\r\n 3. You clicked 'Skip' or unchecked the 'Manage Pages' permissions when Authorization wizard asked you. Please Re-Authorize the Plugin<br/>\r\n";
378
  nxs_addToLog($logNT, 'E', $rMsg, $extInfo); return $rMsg.$e->getMessage();
379
  }
380
  }
381
  if ($postID=='0') echo 'Error:', $e->getMessage(), "\n"; return "Valid app_id ERROR:".$e->getMessage();
382
  } // prr($ret);
383
+ if ($postID=='0') { prr($ret); if (isset($ret['id']) && $ret['id']!='') { _e('OK - Message Posted, please see your Facebook Page', 'nxs_snap'); nxs_addToLog($logNT, 'M', 'Test Message Posted, please see your Facebook Page'); }}
384
+ else { if (isset($ret['id']) && $ret['id']!='') { $pgID = (strpos($ret['post_id'],'_')!==false)?$ret['post_id']:$ret['id'];
385
+ nxs_metaMarkAsPosted($postID, 'FB', $options['ii'], array('isPosted'=>'1', 'pgID'=>$pgID, 'pDate'=>date('Y-m-d H:i:s')) );
386
+ nxs_addToLog($logNT, 'M', 'OK - Message Posted'.print_r($ret, true), $extInfo);
387
+ nxs_addToRI($postID);
388
  } else nxs_addToLog($logNT, 'E', '-=ERROR=- '.print_r($ret, true), $extInfo);
389
  }
390
  }
inc-cl/gp.php CHANGED
@@ -4,89 +4,82 @@ $nxs_snapAvNts[] = array('code'=>'GP', 'lcode'=>'gp', 'name'=>'Google+');
4
 
5
  if (!class_exists("nxs_snapClassGP")) { class nxs_snapClassGP {
6
  //#### Show Common Settings
7
- function showGenNTSettings($ntOpts){ global $nxs_snapThisPageUrl, $nxs_plurl, $nxsOne; $code = 'GP'; $lcode = 'gp'; wp_nonce_field( 'ns'.$code, 'ns'.$code.'_wpnonce' ); ?>
8
- <hr/><div class="nsx_iconedTitle" style="background-image: url(<?php echo $nxs_plurl; ?>img/<?php echo $lcode; ?>16.png);">Google+ Settings:
9
- <?php if(!function_exists('doPostToGooglePlus')) {?> </div> Google+ doesn't have a built-in API for automated posts yet. The current <a href="http://developers.google.com/+/api/">Google+ API</a> is "Read Only" and can't be used for posting. <br/>You need to get a special <a target="_blank" href="http://www.nextscripts.com/google-plus-automated-posting">library module</a> to be able to publish your content to Google+.
10
-
11
- <?php } else { $cgpo = count($ntOpts); $mgpo = 1+max(array_keys($ntOpts)); $nxsOne .= "&g=1"; ?>
12
- <div class="nsBigText">You have <?php echo $cgpo=='0'?'No':$cgpo; ?> Google+ account<?php if ($cgpo!=1){ ?>s<?php } ?> <!--- <a href="#" class="NXSButton" onclick="doShowHideBlocks2('GP<?php echo $mgpo; ?>');return false;">Add new Google+ Account</a> --> </div></div>
13
- <?php //if (function_exists('nxs_doSMAS1')) nxs_doSMAS1($this, $mgpo); else nxs_doSMAS('Google+', 'GP'.$mgpo); ?>
14
- <?php foreach ($ntOpts as $indx=>$gpo){ if (trim($gpo['nName']=='')) { $gpo['nName'] = $gpo['gpUName'];
15
- if($gpo['gpPageID']!='') $gpo['nName'] .= "Page: ".$gpo['gpPageID']; elseif ($gpo['gpCommID']!='') $gpo['nName'] .= "Community: ".$gpo['gpCommID']; else $gpo['nName'] .= " Profile"; } ?>
16
- <p style="margin: 0px;margin-left: 5px;">
17
- <input value="1" id="apDoGP" name="gp[<?php echo $indx; ?>][apDoGP]" type="checkbox" <?php if ((int)$gpo['doGP'] == 1) echo "checked"; ?> />
18
- <strong>Auto-publish your Posts to your Google+ <i style="color: #005800;"><?php if($gpo['nName']!='') echo "(".$gpo['nName'].")"; ?></i> </strong>
19
- &nbsp;&nbsp;<a id="doGP<?php echo $indx; ?>A" href="#" onclick="doShowHideBlocks2('GP<?php echo $indx; ?>');return false;">[Show Settings]</a> &nbsp;&nbsp;
20
- <a href="#" onclick="doDelAcct('gp','<?php echo $indx; ?>', '<?php echo $gpo['gpUName']; ?>');return false;">[Remove Account]</a>
21
- </p>
22
- <?php $this->showNTSettings($indx, $gpo);
23
- } ?>
24
- <?php }
 
 
25
  }
26
  //#### Show NEW Settings Page
27
  function showNewNTSettings($mgpo){ $gpo = array('nName'=>'', 'doGP'=>'1', 'gpUName'=>'', 'gpPageID'=>'', 'gpCommID'=>'', 'postType'=>'A', 'gpPass'=>''); $this->showNTSettings($mgpo, $gpo, true);}
28
  //#### Show Unit Settings
29
  function showNTSettings($ii, $gpo, $isNew=false){ global $nxs_plurl; ?>
30
- <div id="doGP<?php echo $ii; ?>Div" <?php if ($isNew){ ?>class="clNewNTSets"<?php } ?> style="max-width: 1000px; background-color: #EBF4FB; background-image: url(<?php echo $nxs_plurl; ?>img/gp-bg.png); background-position:90% 10%; background-repeat: no-repeat; margin: 10px; border: 1px solid #808080; padding: 10px; display:none;"> <input type="hidden" name="apDoSGP<?php echo $ii; ?>" value="0" id="apDoSGP<?php echo $ii; ?>" />
31
  <?php if(!function_exists('doPostToGooglePlus')) {?><span style="color:#580000; font-size: 16px;"><br/><br/>
32
- <b>Google+ API Library not found</b>
33
- <br/><br/> Google+ doesn't have a built-in API for automated posts yet. <br/>The current <a target="_blank" href="http://developers.google.com/+/api/">Google+ API</a> is "Read Only" and can't be used for posting. <br/><br/>You need to get a special <a target="_blank" href="http://www.nextscripts.com/google-plus-automated-posting"><b>API Library Module</b></a> to be able to publish your content to Google+.</span></div>
34
-
35
- <?php return; }; ?>
36
-
37
- <div class="nsx_iconedTitle" style="float: right; background-image: url(<?php echo $nxs_plurl; ?>img/gp16.png);"><a style="font-size: 12px;" target="_blank" href="http://www.nextscripts.com/setup-installation-google-plus-social-networks-auto-poster-wordpress/">Detailed Google+ Installation/Configuration Instructions</a></div>
38
 
39
- <div style="width:100%;"><strong>Account Nickname:</strong> <i>Just so you can easely identify it</i> </div><input name="gp[<?php echo $ii; ?>][nName]" id="gpnName<?php echo $ii; ?>" style="font-weight: bold; color: #005800; border: 1px solid #ACACAC; width: 40%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($gpo['nName'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" /><br/>
40
  <?php echo nxs_addQTranslSel('gp', $ii, $gpo['qTLng']); ?><?php echo nxs_addPostingDelaySel('gp', $ii, $gpo['nHrs'], $gpo['nMin']); ?>
41
 
42
  <?php if (!$isNew) { ?>
43
- <div style="width:100%;"><strong>Auto-Post Categories:</strong>
44
  <input value="0" id="catSelA<?php echo $ii; ?>" type="radio" name="gp[<?php echo $ii; ?>][catSel]" <?php if ((int)$gpo['catSel'] != 1) echo "checked"; ?> /> All
45
  <input value="1" id="catSelSGP<?php echo $ii; ?>" type="radio" name="gp[<?php echo $ii; ?>][catSel]" <?php if ((int)$gpo['catSel'] == 1) echo "checked"; ?> /> <a href="#" style="text-decoration: none;" class="showCats" id="nxs_SCA_GP<?php echo $ii; ?>" onclick="jQuery('#catSelSGP<?php echo $ii; ?>').attr('checked', true); jQuery('#tmpCatSelNT').val('GP<?php echo $ii; ?>'); nxs_markCats( jQuery('#nxs_SC_GP<?php echo $ii; ?>').val() ); jQuery('#showCatSel').bPopup({ modalClose: false, appendTo: '#nsStForm', opacity: 0.6, follow: [false, false], position: [75, 'auto']}); return false;">Selected<?php if ($gpo['catSelEd']!='') echo "[".(substr_count($gpo['catSelEd'], ",")+1)."]"; ?></a>
46
  <input type="hidden" name="gp[<?php echo $ii; ?>][catSelEd]" id="nxs_SC_GP<?php echo $ii; ?>" value="<?php echo $gpo['catSelEd']; ?>" />
47
- </div>
48
  <br/>
49
  <?php } ?>
50
 
51
- <div style="width:100%;"><strong>Google+ Username:</strong> </div><input name="gp[<?php echo $ii; ?>][apGPUName]" id="apGPUName" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($gpo['gpUName'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" />
52
- <div style="width:100%;"><strong>Google+ Password:</strong> </div><input name="gp[<?php echo $ii; ?>][apGPPass]" id="apGPPass" type="password" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities(substr($gpo['gpPass'], 0, 5)=='n5g9a'?nsx_doDecode(substr($gpo['gpPass'], 5)):$gpo['gpPass'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" /> <br/>
53
- <p><div style="width:100%;"><strong>Google+ Page ID (Optional - for Google+ Pages Only. <b style="color: #580000;"> Leave Empty to publish to your profile or community</b>):</strong>
54
- <p style="font-size: 11px; margin: 0px;">For example if URL of your page is https://plus.google.com/u/0/b/117008619877691455570/ your Page ID is: 117008619877691455570. <b>Leave Empty to publish to your profile or community.</b></p>
55
- </div><input name="gp[<?php echo $ii; ?>][apGPPage]" id="apGPPage" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($gpo['gpPageID'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" />
56
  <br/>
57
- <p><div style="width:100%;"><strong>Google+ Community ID (Optional - for Google+ Communities Only. <b style="color: #580000;"> Leave Empty to publish to your profile or page</b>):</strong>
58
- <p style="font-size: 11px; margin: 0px;">For example if URL of your Community is https://plus.google.com/communities/100396001601096060160 your Page ID is: 100396001601096060160. <b>Leave Empty to publish to your profile or page.</b></p>
59
- </div><input name="gp[<?php echo $ii; ?>][gpCommID]" id="gpCommID" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($gpo['gpCommID'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" />
60
  <br/><br/>
61
 
62
  <div id="altFormat" style="">
63
- <div style="width:100%;"><strong id="altFormatText">Message Text Format:</strong>
64
- <p style="font-size: 11px; margin: 0px;">%SITENAME% - Inserts the Your Blog/Site Name. &nbsp; %TITLE% - Inserts the Title of your post. &nbsp; %URL% - Inserts the URL of your post. &nbsp; %TEXT% - Inserts the excerpt of your post. &nbsp; %FULLTEXT% - Inserts the body(text) of your post, %AUTHORNAME% - Inserts the author's name.</p>
65
- </div><input name="gp[<?php echo $ii; ?>][apGPMsgFrmt]" id="apGPMsgFrmt" style="width: 50%;" value="<?php if ($isNew) echo "New post has been published on %SITENAME%"; else _e(apply_filters('format_to_edit', htmlentities($gpo['gpMsgFormat'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster'); ?>" />
66
  </div><br/>
67
 
68
- <div style="width:100%;"><strong id="altFormatText">Post Type:</strong>&lt;-- (<a id="showShAtt" onmouseout="hidePopShAtt('<?php echo $ii; ?>XG');" onmouseover="showPopShAtt('<?php echo $ii; ?>XG', event);" onclick="return false;" class="underdash" href="http://www.nextscripts.com/blog/">What's the difference?</a>) </div>
69
  <div style="margin-left: 10px;">
70
  <?php if(!isset($gpo['postType']) || $gpo['postType']=='') {
71
  if ((int)$gpo['imgPost'] == 1) $gpo['postType'] = 'I';
72
  if ((int)$gpo['gpAttch'] == 1 || $isNew) $gpo['postType'] = 'A';
73
  } ?>
74
- <input type="radio" name="gp[<?php echo $ii; ?>][postType]" value="T" <?php if ($gpo['postType'] == 'T') echo 'checked="checked"'; ?> /> Text Post - <i>just text message</i><br/>
75
- <input type="radio" name="gp[<?php echo $ii; ?>][postType]" value="I" <?php if ($gpo['postType'] == 'I') echo 'checked="checked"'; ?> /> Google+ Image Post - <i>big image with text message</i><br/>
76
- <input type="radio" name="gp[<?php echo $ii; ?>][postType]" value="A" <?php if ( !isset($gpo['postType']) || $gpo['postType'] == '' || $gpo['postType'] == 'A') echo 'checked="checked"'; ?> /> Add blogpost to Google+ message as an attachment<br/>
77
- <div class="popShAtt" id="popShAtt<?php echo $ii; ?>XG"><h3>Google+ Post Types</h3><img src="<?php echo $nxs_plurl; ?>img/gpPostTypesDiff6.png" width="600" height="285" alt="Google+ Post Types"/></div>
78
- </div><br/>
79
-
80
-
81
-
82
  <?php if ($isNew) { ?> <input type="hidden" name="gp[<?php echo $ii; ?>][apDoGP]" value="1" id="apDoNewGP<?php echo $ii; ?>" /> <?php } ?>
83
  <?php if ($gpo['gpPass']!='') { ?>
84
  <?php wp_nonce_field( 'rePostToGP', 'rePostToGP_wpnonce' ); ?>
85
- <b>Test your settings:</b>&nbsp;&nbsp;&nbsp; <a href="#" class="NXSButton" onclick="testPost('GP', '<?php echo $ii; ?>'); return false;">Submit Test Post to Google+</a>
86
-
87
- <?php }
88
-
89
- ?><div class="submit"><input type="submit" class="button-primary" name="update_NS_SNAutoPoster_settings" value="<?php _e('Update Settings', 'NS_SNAutoPoster') ?>" /></div></div><?php
90
  }
91
  //#### Set Unit Settings from POST
92
  function setNTSettings($post, $options){ global $nxs_snapThisPageUrl; $code = 'GP'; $lcode = 'gp';
@@ -111,7 +104,8 @@ if (!class_exists("nxs_snapClassGP")) { class nxs_snapClassGP {
111
  }
112
  //#### Show Post->Edit Meta Box Settings
113
  function showEdPostNTSettings($ntOpts, $post){ global $nxs_plurl; $post_id = $post->ID;
114
- foreach($ntOpts as $ii=>$ntOpt) { $pMeta = maybe_unserialize(get_post_meta($post_id, 'snapGP', true)); if (is_array($pMeta)) $ntOpt = $this->adjMetaOpt($ntOpt, $pMeta[$ii]); $doGP = $ntOpt['doGP'] && $ntOpt['catSel']!='1';
 
115
  $isAvailGP = $ntOpt['gpUName']!='' && $ntOpt['gpPass']!=''; $gpMsgFormat = htmlentities($ntOpt['gpMsgFormat'], ENT_COMPAT, "UTF-8");
116
  if(!isset($ntOpt['postType']) || $ntOpt['postType']=='') {
117
  if ((int)$ntOpt['imgPost'] == 1) $ntOpt['postType'] = 'I';
@@ -119,16 +113,16 @@ if (!class_exists("nxs_snapClassGP")) { class nxs_snapClassGP {
119
  } $gpPostType = $ntOpt['postType'];
120
  ?>
121
  <tr><th style="text-align:left;" colspan="2"><?php if ( $ntOpt['catSel']=='1' && trim($ntOpt['catSelEd'])!='' ) { ?> <input type="hidden" class="nxs_SC" id="nxs_SC_GP<?php echo $ii; ?>" value="<?php echo $ntOpt['catSelEd']; ?>" /> <?php } ?>
122
- <?php if ($isAvailGP) { ?><input class="nxsGrpDoChb" value="1" id="doGP<?php echo $ii; ?>" <?php if ($post->post_status == "publish") echo 'disabled="disabled"';?> type="checkbox" name="gp[<?php echo $ii; ?>][SNAPincludeGP]" <?php if (($post->post_status == "publish" && $ntOpt['isPosted'] == '1') || ($post->post_status != "publish" && ((int)$doGP == 1)) ) echo 'checked="checked" title="def"'; ?> /> <?php } ?>
123
 
124
- <div class="nsx_iconedTitle" style="display: inline; font-size: 13px; background-image: url(<?php echo $nxs_plurl; ?>img/gp16.png);">Google+ - publish to (<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" && $isAvailGP) { ?><input alt="<?php echo $ii; ?>" style="float: right;" onmouseout="hidePopShAtt('SV');" onmouseover="showPopShAtt('SV', event);" onclick="return false;" type="button" class="button" name="rePostToGP_repostButton" id="rePostToGP_button" value="<?php _e('Repost to Google+', 're-post') ?>" />
126
  <?php wp_nonce_field( 'rePostToGP', 'rePostToGP_wpnonce' ); } ?>
127
 
128
  <?php if (is_array($pMeta) && is_array($pMeta[$ii]) && isset($pMeta[$ii]['pgID']) ) {
129
 
130
  ?> <span id="pstdGP<?php echo $ii; ?>" style="float: right;padding-top: 4px; padding-right: 10px;">
131
- <a style="font-size: 10px;" href="https://plus.google.com/<?php echo $pMeta[$ii]['pgID']; ?>" target="_blank">Posted on Google+ <?php echo (isset($pMeta[$ii]['pDate']) && $pMeta[$ii]['pDate']!='')?(" (".$pMeta[$ii]['pDate'].")"):""; ?></a>
132
  </span><?php } ?>
133
 
134
  </td></tr>
@@ -136,17 +130,26 @@ if (!class_exists("nxs_snapClassGP")) { class nxs_snapClassGP {
136
  <?php if (!$isAvailGP) { ?><tr><th scope="row" style="text-align:right; width:150px; padding-top: 5px; padding-right:10px;"></th> <td><b>Setup your Google+ Account to AutoPost to Google+</b>
137
  <?php } elseif ($post->post_status != "puZblish") { ?>
138
 
139
- <tr><th scope="row" style="text-align:right; width:150px; vertical-align:top; padding-top: 0px; padding-right:10px;"> Post Type: <br/>
140
- (<a id="showShAtt" style="font-weight: normal" onmouseout="hidePopShAtt('<?php echo $ii; ?>XG');" onmouseover="showPopShAtt('<?php echo $ii; ?>XG', event);" onclick="return false;" class="underdash" href="http://www.nextscripts.com/blog/">What's the difference?</a>)
141
  </th><td>
142
 
143
- <input type="radio" name="gp[<?php echo $ii; ?>][postType]" value="T" <?php if ($gpPostType == 'T') echo 'checked="checked"'; ?> /> Text Post - <i>just text message</i><br/>
144
- <input type="radio" name="gp[<?php echo $ii; ?>][postType]" value="I" <?php if ($gpPostType == 'I') echo 'checked="checked"'; ?> /> Post to Google+ as "Image post" - <i>big image with text message</i><br/>
145
- <input type="radio" name="gp[<?php echo $ii; ?>][postType]" value="A" <?php if ( !isset($gpPostType) || $gpPostType == '' || $gpPostType == 'A') echo 'checked="checked"'; ?> />Text Post with "attached" blogpost
146
- <div class="popShAtt" id="popShAtt<?php echo $ii; ?>XG"><h3>Google+ Post Types</h3><img src="<?php echo $nxs_plurl; ?>img/gpPostTypesDiff6.png" width="600" height="285" alt="Google+ Post Types"/></div>
147
  </td></tr>
148
- <tr id="altFormat1" style=""><th scope="row" style="text-align:right; width:60px; padding-right:10px;"><?php _e('Message Format:', 'NS_SPAP') ?></th>
149
- <td><input value="<?php echo $gpMsgFormat ?>" type="text" name="gp[<?php echo $ii; ?>][SNAPformat]" style="width:60%;max-width: 610px;" onfocus="jQuery('.nxs_FRMTHint').hide();mxs_showFrmtInfo('apGPMsgFrmt<?php echo $ii; ?>');"/><?php nxs_doShowHint("apGPMsgFrmt".$ii); ?></td></tr>
 
 
 
 
 
 
 
 
 
150
  <?php }
151
  }
152
  }
@@ -154,7 +157,9 @@ if (!class_exists("nxs_snapClassGP")) { class nxs_snapClassGP {
154
  function adjMetaOpt($optMt, $pMeta){ if (isset($pMeta['isPosted'])) $optMt['isPosted'] = $pMeta['isPosted']; else $optMt['isPosted'] = '';
155
  if (isset($pMeta['SNAPformat'])) $optMt['gpMsgFormat'] = $pMeta['SNAPformat'];
156
  if (isset($pMeta['postType'])) $optMt['postType'] = $pMeta['postType'];
157
- if (isset($pMeta['SNAPincludeGP'])) $optMt['doGP'] = $pMeta['SNAPincludeGP'] == 1?1:0; else { if (isset($pMeta['SNAPformat'])) $optMt['doGP'] = 0; } return $optMt;
 
 
158
  }
159
  }}
160
  if (!function_exists("nxs_rePostToGP_ajax")) {
@@ -176,17 +181,21 @@ if (!function_exists("nxs_doPublishToGP")) { //## Second Function to Post to G+
176
  if ($postID=='0') echo "Testing ... <br/><br/>"; else { nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPrePosted'=>'1')); $post = get_post($postID); if(!$post) return;}
177
  $gpMsgFormat = $options['gpMsgFormat']; $gpPostType = $options['postType'];
178
  $msg = nsFormatMessage($gpMsgFormat, $postID);// prr($msg); echo $postID;
 
 
 
179
  if ($gpPostType=='A') $imgURL = nxs_getPostImage($postID, 'thumbnail'); if ($gpPostType=='I') $imgURL = nxs_getPostImage($postID, 'full');
180
  $email = $options['gpUName']; $pass = substr($options['gpPass'], 0, 5)=='n5g9a'?nsx_doDecode(substr($options['gpPass'], 5)):$options['gpPass'];
181
  $extInfo = ' | PostID: '.$postID; $logNT = '<span style="color:#800000">Google+</span> - '.$options['nName'];
182
  $loginError = doConnectToGooglePlus2($email, $pass); if ($loginError!==false) {if ($postID=='0') echo $loginError; nxs_addToLog($logNT, 'E', '-=ERROR=- '.print_r($loginError, true)." - BAD USER/PASS", $extInfo); return "BAD USER/PASS";}
183
  $url = get_permalink($postID); if(trim($url)=='') $url = home_url();
184
  if ($gpPostType=='I') $lnk = array(); if ($gpPostType=='A') $lnk = doGetGoogleUrlInfo2($url); if (is_array($lnk) && $imgURL!='') $lnk['img'] = $imgURL; //prr($lnk);
 
185
  if (!empty($options['gpPageID'])) { $to = $options['gpPageID']; $ret = doPostToGooglePlus2($msg, $lnk, $to);}
186
  elseif (!empty($options['gpCommID'])) $ret = doPostToGooglePlus2($msg, $lnk, '', $options['gpCommID']); else $ret = doPostToGooglePlus2($msg, $lnk); //prr($ret);
187
  if ($ret=='OK') $ret = array("code"=>"OK", "post_id"=>'');
188
  if ( (!is_array($ret)) && $ret!='OK') { if ($postID=='0') prr($ret); nxs_addToLog($logNT, 'E', '-=ERROR=- '.print_r($ret, true), $extInfo);}
189
- else if ($postID=='0') { nxs_addToLog($logNT, 'M', 'OK - TEST Message Posted '); echo 'OK - Message Posted, please see your Google+ Page'; } else
190
  { nxs_metaMarkAsPosted($postID, 'GP', $options['ii'], array('isPosted'=>'1', 'pgID'=>$ret['post_id'], 'pDate'=>date('Y-m-d H:i:s'))); nxs_addToLog($logNT, 'M', 'OK - Message Posted ', $extInfo); }
191
  if ($ret['code']=='OK') return 200; else return $ret;
192
  }
4
 
5
  if (!class_exists("nxs_snapClassGP")) { class nxs_snapClassGP {
6
  //#### Show Common Settings
7
+ function showGenNTSettings($ntOpts){ global $nxs_plurl; $ntInfo = array('code'=>'GP', 'lcode'=>'gp', 'name'=>'Google+', 'defNName'=>'gpUName', 'tstReq' => false); ?>
8
+ <div class="nxs_box">
9
+ <div class="nxs_box_header">
10
+ <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']; ?>
11
+ <?php $cbo = count($ntOpts); ?> <?php wp_nonce_field( 'ns'.$ntInfo['code'], 'ns'.$ntInfo['code'].'_wpnonce' ); ?>
12
+ <?php if ($cbo>1){ ?><div class="nsBigText"><?php echo "(".($cbo=='0'?'No':$cbo)." "; _e('accounts', 'nxs_snap'); echo ")"; ?></div><?php } ?>
13
+ </div>
14
+ </div>
15
+ <div class="nxs_box_inside">
16
+ <?php if(!function_exists('doPostToGooglePlus')) {?> Google+ doesn't have a built-in API for automated posts yet. The current <a href="http://developers.google.com/+/api/">Google+ API</a> is "Read Only" and can't be used for posting. <br/>You need to get a special <a target="_blank" href="http://www.nextscripts.com/google-plus-automated-posting">library module</a> to be able to publish your content to Google+.
17
+ <?php } else foreach ($ntOpts as $indx=>$pbo){ if (trim($pbo['nName']=='')) $pbo['nName'] = $pbo[$ntInfo['defNName']]; ?>
18
+ <p style="margin:0px;margin-left:5px;">
19
+ <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"; ?> />
20
+ <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>
21
+ &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;
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', 'nxs_snap'); ?>]</a>
23
+ </p><?php $this->showNTSettings($indx, $pbo);
24
+ }?>
25
+ </div>
26
+ </div> <?php
27
  }
28
  //#### Show NEW Settings Page
29
  function showNewNTSettings($mgpo){ $gpo = array('nName'=>'', 'doGP'=>'1', 'gpUName'=>'', 'gpPageID'=>'', 'gpCommID'=>'', 'postType'=>'A', 'gpPass'=>''); $this->showNTSettings($mgpo, $gpo, true);}
30
  //#### Show Unit Settings
31
  function showNTSettings($ii, $gpo, $isNew=false){ global $nxs_plurl; ?>
32
+ <div id="doGP<?php echo $ii; ?>Div" class="insOneDiv<?php if ($isNew) echo " clNewNTSets"; ?>" style="background-image: url(<?php echo $nxs_plurl; ?>img/gp-bg.png); background-position:90% 10%;"> <input type="hidden" name="apDoSGP<?php echo $ii; ?>" value="0" id="apDoSGP<?php echo $ii; ?>" />
33
  <?php if(!function_exists('doPostToGooglePlus')) {?><span style="color:#580000; font-size: 16px;"><br/><br/>
34
+ <b><?php _e('Google+ API Library not found', 'nxs_snap'); ?></b>
35
+ <br/><br/> <?php _e('Google+ doesn\'t have a built-in API for automated posts yet.', 'nxs_snap'); ?> <br/><?php _e('The current <a target="_blank" href="http://developers.google.com/+/api/">Google+ API</a> is "Read Only" and can\'t be used for posting. <br/><br/>You need to get a special <a target="_blank" href="http://www.nextscripts.com/google-plus-automated-posting"><b>API Library Module</b></a> to be able to publish your content to Google+.', 'nxs_snap'); ?></span></div>
36
+ <?php return; }; ?>
37
+ <div class="nsx_iconedTitle" style="float: right; background-image: url(<?php echo $nxs_plurl; ?>img/gp16.png);"><a style="font-size: 12px;" target="_blank" href="http://www.nextscripts.com/setup-installation-google-plus-social-networks-auto-poster-wordpress/"><?php $nType="Google+"; printf( __( 'Detailed %s Installation/Configuration Instructions', 'nxs_snap' ), $nType); ?></a></div>
 
 
38
 
39
+ <div style="width:100%;"><strong><?php _e('Account Nickname', 'nxs_snap'); ?>:</strong> <i><?php _e('Just so you can easely identify it', 'nxs_snap'); ?></i> </div><input name="gp[<?php echo $ii; ?>][nName]" id="gpnName<?php echo $ii; ?>" style="font-weight: bold; color: #005800; border: 1px solid #ACACAC; width: 40%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($gpo['nName'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" /><br/>
40
  <?php echo nxs_addQTranslSel('gp', $ii, $gpo['qTLng']); ?><?php echo nxs_addPostingDelaySel('gp', $ii, $gpo['nHrs'], $gpo['nMin']); ?>
41
 
42
  <?php if (!$isNew) { ?>
43
+ <div style="width:100%;"><strong><?php _e('Categories', 'nxs_snap'); ?>:</strong>
44
  <input value="0" id="catSelA<?php echo $ii; ?>" type="radio" name="gp[<?php echo $ii; ?>][catSel]" <?php if ((int)$gpo['catSel'] != 1) echo "checked"; ?> /> All
45
  <input value="1" id="catSelSGP<?php echo $ii; ?>" type="radio" name="gp[<?php echo $ii; ?>][catSel]" <?php if ((int)$gpo['catSel'] == 1) echo "checked"; ?> /> <a href="#" style="text-decoration: none;" class="showCats" id="nxs_SCA_GP<?php echo $ii; ?>" onclick="jQuery('#catSelSGP<?php echo $ii; ?>').attr('checked', true); jQuery('#tmpCatSelNT').val('GP<?php echo $ii; ?>'); nxs_markCats( jQuery('#nxs_SC_GP<?php echo $ii; ?>').val() ); jQuery('#showCatSel').bPopup({ modalClose: false, appendTo: '#nsStForm', opacity: 0.6, follow: [false, false], position: [75, 'auto']}); return false;">Selected<?php if ($gpo['catSelEd']!='') echo "[".(substr_count($gpo['catSelEd'], ",")+1)."]"; ?></a>
46
  <input type="hidden" name="gp[<?php echo $ii; ?>][catSelEd]" id="nxs_SC_GP<?php echo $ii; ?>" value="<?php echo $gpo['catSelEd']; ?>" />
47
+ <br/><i><?php _e('Only selected categories will be autoposted to this account', 'nxs_snap'); ?></i></div>
48
  <br/>
49
  <?php } ?>
50
 
51
+ <div style="width:100%;"><strong>Google+ Username:</strong> </div><input name="gp[<?php echo $ii; ?>][apGPUName]" id="apGPUName" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($gpo['gpUName'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" />
52
+ <div style="width:100%;"><strong>Google+ Password:</strong> </div><input name="gp[<?php echo $ii; ?>][apGPPass]" id="apGPPass" type="password" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities(substr($gpo['gpPass'], 0, 5)=='n5g9a'?nsx_doDecode(substr($gpo['gpPass'], 5)):$gpo['gpPass'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" /> <br/>
53
+ <p><div style="width:100%;"><strong>Google+ Page ID (Optional - for Google+ Pages Only. <b style="color: #580000;"> <?php _e('Leave Empty to publish to your profile or community', 'nxs_snap'); ?></b>):</strong>
54
+ <p style="font-size: 11px; margin: 0px;">For example if URL of your page is https://plus.google.com/u/0/b/117008619877691455570/ your Page ID is: 117008619877691455570. <b><?php _e('Leave Empty to publish to your profile or community.', 'nxs_snap'); ?></b></p>
55
+ </div><input name="gp[<?php echo $ii; ?>][apGPPage]" id="apGPPage" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($gpo['gpPageID'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" />
56
  <br/>
57
+ <p><div style="width:100%;"><strong>Google+ Community ID (Optional - for Google+ Communities Only. <b style="color: #580000;"> <?php _e('Leave Empty to publish to your profile or page', 'nxs_snap'); ?></b>):</strong>
58
+ <p style="font-size: 11px; margin: 0px;">For example if URL of your Community is https://plus.google.com/communities/100396001601096060160 your Page ID is: 100396001601096060160. <b><?php _e('Leave Empty to publish to your profile or page', 'nxs_snap'); ?>.</b></p>
59
+ </div><input name="gp[<?php echo $ii; ?>][gpCommID]" id="gpCommID" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($gpo['gpCommID'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" />
60
  <br/><br/>
61
 
62
  <div id="altFormat" style="">
63
+ <div style="width:100%;"><strong id="altFormatText"><?php _e('Message text Format', 'nxs_snap'); ?>:</strong> (<a href="#" id="apGPMsgFrmt<?php echo $ii; ?>HintInfo" onclick="mxs_showHideFrmtInfo('apGPMsgFrmt<?php echo $ii; ?>'); return false;"><?php _e('Show format info', 'nxs_snap'); ?></a>)
64
+ </div><input name="gp[<?php echo $ii; ?>][apGPMsgFrmt]" id="apGPMsgFrmt<?php echo $ii; ?>" style="width: 50%;" value="<?php if ($isNew) echo "New post has been published on %SITENAME%"; else _e(apply_filters('format_to_edit', htmlentities($gpo['gpMsgFormat'], ENT_COMPAT, "UTF-8")), 'nxs_snap'); ?>" onfocus="mxs_showFrmtInfo('apGPMsgFrmt<?php echo $ii; ?>');" /><?php nxs_doShowHint("apGPMsgFrmt".$ii); ?>
 
65
  </div><br/>
66
 
67
+ <div style="width:100%;"><strong id="altFormatText">Post Type:</strong>&lt;-- (<a id="showShAtt" onmouseout="hidePopShAtt('<?php echo $ii; ?>XG');" onmouseover="showPopShAtt('<?php echo $ii; ?>XG', event);" onclick="return false;" class="underdash" href="http://www.nextscripts.com/blog/"><?php _e('What\'s the difference?', 'nxs_snap'); ?></a>) </div>
68
  <div style="margin-left: 10px;">
69
  <?php if(!isset($gpo['postType']) || $gpo['postType']=='') {
70
  if ((int)$gpo['imgPost'] == 1) $gpo['postType'] = 'I';
71
  if ((int)$gpo['gpAttch'] == 1 || $isNew) $gpo['postType'] = 'A';
72
  } ?>
73
+ <input type="radio" name="gp[<?php echo $ii; ?>][postType]" value="T" <?php if ($gpo['postType'] == 'T') echo 'checked="checked"'; ?> /> <?php _e('Text Post', 'nxs_snap'); ?> - <i><?php _e('just text message', 'nxs_snap'); ?></i><br/>
74
+ <input type="radio" name="gp[<?php echo $ii; ?>][postType]" value="I" <?php if ($gpo['postType'] == 'I') echo 'checked="checked"'; ?> /> <?php _e('Google+ Image Post', 'nxs_snap'); ?> - <i><?php _e('big image with text message', 'nxs_snap'); ?></i><br/>
75
+ <input type="radio" name="gp[<?php echo $ii; ?>][postType]" value="A" <?php if ( !isset($gpo['postType']) || $gpo['postType'] == '' || $gpo['postType'] == 'A') echo 'checked="checked"'; ?> /> <?php _e('Add blogpost to Google+ message as an attachment', 'nxs_snap'); ?><br/>
76
+ <div class="popShAtt" id="popShAtt<?php echo $ii; ?>XG"><h3><?php _e('Google+ Post Types', 'nxs_snap'); ?></h3><img src="<?php echo $nxs_plurl; ?>img/gpPostTypesDiff6.png" width="600" height="285" alt="<?php _e('Google+ Post Types', 'nxs_snap'); ?>"/></div>
77
+ </div><br/>
 
 
 
78
  <?php if ($isNew) { ?> <input type="hidden" name="gp[<?php echo $ii; ?>][apDoGP]" value="1" id="apDoNewGP<?php echo $ii; ?>" /> <?php } ?>
79
  <?php if ($gpo['gpPass']!='') { ?>
80
  <?php wp_nonce_field( 'rePostToGP', 'rePostToGP_wpnonce' ); ?>
81
+ <b><?php _e('Test your settings', 'nxs_snap'); ?>:</b>&nbsp;&nbsp;&nbsp; <a href="#" class="NXSButton" onclick="testPost('GP', '<?php echo $ii; ?>'); return false;"><?php printf( __( 'Submit Test Post to %s', 'nxs_snap' ), $nType); ?></a> <?php }
82
+ ?><div class="submit"><input type="submit" class="button-primary" name="update_NS_SNAutoPoster_settings" value="<?php _e('Update Settings', 'nxs_snap') ?>" /></div></div><?php
 
 
 
83
  }
84
  //#### Set Unit Settings from POST
85
  function setNTSettings($post, $options){ global $nxs_snapThisPageUrl; $code = 'GP'; $lcode = 'gp';
104
  }
105
  //#### Show Post->Edit Meta Box Settings
106
  function showEdPostNTSettings($ntOpts, $post){ global $nxs_plurl; $post_id = $post->ID;
107
+ foreach($ntOpts as $ii=>$ntOpt) { $pMeta = maybe_unserialize(get_post_meta($post_id, 'snapGP', true)); if (is_array($pMeta)) $ntOpt = $this->adjMetaOpt($ntOpt, $pMeta[$ii]);
108
+ $doGP = $ntOpt['doGP'] && (is_array($pMeta) || $ntOpt['catSel']!='1');
109
  $isAvailGP = $ntOpt['gpUName']!='' && $ntOpt['gpPass']!=''; $gpMsgFormat = htmlentities($ntOpt['gpMsgFormat'], ENT_COMPAT, "UTF-8");
110
  if(!isset($ntOpt['postType']) || $ntOpt['postType']=='') {
111
  if ((int)$ntOpt['imgPost'] == 1) $ntOpt['postType'] = 'I';
113
  } $gpPostType = $ntOpt['postType'];
114
  ?>
115
  <tr><th style="text-align:left;" colspan="2"><?php if ( $ntOpt['catSel']=='1' && trim($ntOpt['catSelEd'])!='' ) { ?> <input type="hidden" class="nxs_SC" id="nxs_SC_GP<?php echo $ii; ?>" value="<?php echo $ntOpt['catSelEd']; ?>" /> <?php } ?>
116
+ <?php if ($isAvailGP) { ?><input class="nxsGrpDoChb" value="1" id="doGP<?php echo $ii; ?>" <?php if ($post->post_status == "publish") echo 'disabled="disabled"';?> type="checkbox" name="gp[<?php echo $ii; ?>][doGP]" <?php if (($post->post_status == "publish" && $ntOpt['isPosted'] == '1') || ($post->post_status != "publish" && ((int)$doGP == 1)) ) echo 'checked="checked" title="def"'; ?> /> <?php } ?>
117
 
118
+ <div class="nsx_iconedTitle" style="display: inline; font-size: 13px; background-image: url(<?php echo $nxs_plurl; ?>img/gp16.png);">Google+ - <?php _e('publish to', 'nxs_snap') ?> (<i style="color: #005800;"><?php echo $ntOpt['nName']; ?></i>)</div></th> <td><?php //## Only show RePost button if the post is "published"
119
+ if ($post->post_status == "publish" && $isAvailGP) { ?><input alt="<?php echo $ii; ?>" style="float: right;" onmouseout="hidePopShAtt('SV');" onmouseover="showPopShAtt('SV', event);" onclick="return false;" type="button" class="button" name="rePostToGP_repostButton" id="rePostToGP_button" value="<?php _e('Repost to Google+', 'nxs_snap') ?>" />
120
  <?php wp_nonce_field( 'rePostToGP', 'rePostToGP_wpnonce' ); } ?>
121
 
122
  <?php if (is_array($pMeta) && is_array($pMeta[$ii]) && isset($pMeta[$ii]['pgID']) ) {
123
 
124
  ?> <span id="pstdGP<?php echo $ii; ?>" style="float: right;padding-top: 4px; padding-right: 10px;">
125
+ <a style="font-size: 10px;" href="https://plus.google.com/<?php echo $pMeta[$ii]['pgID']; ?>" target="_blank"><?php $nType="Google+"; printf( __( 'Posted on', 'nxs_snap' ), $nType); ?> <?php echo (isset($pMeta[$ii]['pDate']) && $pMeta[$ii]['pDate']!='')?(" (".$pMeta[$ii]['pDate'].")"):""; ?></a>
126
  </span><?php } ?>
127
 
128
  </td></tr>
130
  <?php if (!$isAvailGP) { ?><tr><th scope="row" style="text-align:right; width:150px; padding-top: 5px; padding-right:10px;"></th> <td><b>Setup your Google+ Account to AutoPost to Google+</b>
131
  <?php } elseif ($post->post_status != "puZblish") { ?>
132
 
133
+ <tr><th scope="row" style="text-align:right; width:150px; vertical-align:top; padding-top: 0px; padding-right:10px;"> <?php _e('Repost to Google+', 'nxs_snap') ?>Post Type: <br/>
134
+ (<a id="showShAtt" style="font-weight: normal" onmouseout="hidePopShAtt('<?php echo $ii; ?>XG');" onmouseover="showPopShAtt('<?php echo $ii; ?>XG', event);" onclick="return false;" class="underdash" href="http://www.nextscripts.com/blog/"><?php _e('What\'s the difference?', 'nxs_snap'); ?></a>)
135
  </th><td>
136
 
137
+ <input type="radio" name="gp[<?php echo $ii; ?>][postType]" value="T" <?php if ($gpPostType == 'T') echo 'checked="checked"'; ?> /> <?php _e('Repost to Google+', 'nxs_snap') ?>Text Post - <i><?php _e('just text message', 'nxs_snap') ?></i><br/>
138
+ <input type="radio" name="gp[<?php echo $ii; ?>][postType]" value="I" <?php if ($gpPostType == 'I') echo 'checked="checked"'; ?> /> <?php _e('Post to Google+ as "Image post"', 'nxs_snap') ?> - <i><?php _e('big image with text message', 'nxs_snap') ?></i><br/>
139
+ <input type="radio" name="gp[<?php echo $ii; ?>][postType]" value="A" <?php if ( !isset($gpPostType) || $gpPostType == '' || $gpPostType == 'A') echo 'checked="checked"'; ?> /><?php _e('Text Post with "attached" blogpost', 'nxs_snap') ?>
140
+ <div class="popShAtt" id="popShAtt<?php echo $ii; ?>XG"><h3><?php _e('Google+ Post Types', 'nxs_snap') ?></h3><img src="<?php echo $nxs_plurl; ?>img/gpPostTypesDiff6.png" width="600" height="285" alt="<?php _e('Google+ Post Types', 'nxs_snap') ?>"/></div>
141
  </td></tr>
142
+ <tr id="altFormat1" style=""><th scope="row" style="text-align:right; width:60px; padding-right:10px;"><?php _e('Message Format:', 'nxs_snap') ?></th>
143
+ <td>
144
+
145
+ <?php if (1==1) { ?>
146
+ <textarea cols="150" rows="1" id="gp<?php echo $ii; ?>SNAPformat" name="gp[<?php echo $ii; ?>][SNAPformat]" style="width:60%;max-width: 610px;" onfocus="jQuery('#gp<?php echo $ii; ?>SNAPformat').attr('rows', 4); jQuery('.nxs_FRMTHint').hide();mxs_showFrmtInfo('apGPMsgFrmt<?php echo $ii; ?>');"><?php echo $gpMsgFormat ?></textarea>
147
+ <?php } else { ?>
148
+ <input value="<?php echo $gpMsgFormat ?>" type="text" name="gp[<?php echo $ii; ?>][SNAPformat]" style="width:60%;max-width: 610px;" onfocus="jQuery('.nxs_FRMTHint').hide();mxs_showFrmtInfo('apGPMsgFrmt<?php echo $ii; ?>');"/><?php nxs_doShowHint("apGPMsgFrmt".$ii); ?>
149
+ <?php } ?>
150
+
151
+
152
+ </td></tr>
153
  <?php }
154
  }
155
  }
157
  function adjMetaOpt($optMt, $pMeta){ if (isset($pMeta['isPosted'])) $optMt['isPosted'] = $pMeta['isPosted']; else $optMt['isPosted'] = '';
158
  if (isset($pMeta['SNAPformat'])) $optMt['gpMsgFormat'] = $pMeta['SNAPformat'];
159
  if (isset($pMeta['postType'])) $optMt['postType'] = $pMeta['postType'];
160
+ if (isset($pMeta['doGP'])) $optMt['doGP'] = $pMeta['doGP'] == 1?1:0; else { if (isset($pMeta['SNAPformat'])) $optMt['doGP'] = 0; }
161
+ if (isset($pMeta['SNAPincludeGP']) && $pMeta['SNAPincludeGP'] == '1' ) $optMt['doGP'] = 1;
162
+ return $optMt;
163
  }
164
  }}
165
  if (!function_exists("nxs_rePostToGP_ajax")) {
181
  if ($postID=='0') echo "Testing ... <br/><br/>"; else { nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPrePosted'=>'1')); $post = get_post($postID); if(!$post) return;}
182
  $gpMsgFormat = $options['gpMsgFormat']; $gpPostType = $options['postType'];
183
  $msg = nsFormatMessage($gpMsgFormat, $postID);// prr($msg); echo $postID;
184
+
185
+ if($gpPostType=='I') { $vids = nsFindVidsInPost($post); if (count($vids)>0) $ytUrl = $vids[0]; if (trim($ytUrl)=='') $options['trPostType']='T'; }
186
+
187
  if ($gpPostType=='A') $imgURL = nxs_getPostImage($postID, 'thumbnail'); if ($gpPostType=='I') $imgURL = nxs_getPostImage($postID, 'full');
188
  $email = $options['gpUName']; $pass = substr($options['gpPass'], 0, 5)=='n5g9a'?nsx_doDecode(substr($options['gpPass'], 5)):$options['gpPass'];
189
  $extInfo = ' | PostID: '.$postID; $logNT = '<span style="color:#800000">Google+</span> - '.$options['nName'];
190
  $loginError = doConnectToGooglePlus2($email, $pass); if ($loginError!==false) {if ($postID=='0') echo $loginError; nxs_addToLog($logNT, 'E', '-=ERROR=- '.print_r($loginError, true)." - BAD USER/PASS", $extInfo); return "BAD USER/PASS";}
191
  $url = get_permalink($postID); if(trim($url)=='') $url = home_url();
192
  if ($gpPostType=='I') $lnk = array(); if ($gpPostType=='A') $lnk = doGetGoogleUrlInfo2($url); if (is_array($lnk) && $imgURL!='') $lnk['img'] = $imgURL; //prr($lnk);
193
+ if ($gpPostType=='I' && trim($ytUrl)!='') { $lnk['video'] = $ytUrl; }
194
  if (!empty($options['gpPageID'])) { $to = $options['gpPageID']; $ret = doPostToGooglePlus2($msg, $lnk, $to);}
195
  elseif (!empty($options['gpCommID'])) $ret = doPostToGooglePlus2($msg, $lnk, '', $options['gpCommID']); else $ret = doPostToGooglePlus2($msg, $lnk); //prr($ret);
196
  if ($ret=='OK') $ret = array("code"=>"OK", "post_id"=>'');
197
  if ( (!is_array($ret)) && $ret!='OK') { if ($postID=='0') prr($ret); nxs_addToLog($logNT, 'E', '-=ERROR=- '.print_r($ret, true), $extInfo);}
198
+ else if ($postID=='0') { nxs_addToLog($logNT, 'M', 'OK - TEST Message Posted '); echo _e('OK - Message Posted, please see your Google+ Page', 'nxs_snap'); } else
199
  { nxs_metaMarkAsPosted($postID, 'GP', $options['ii'], array('isPosted'=>'1', 'pgID'=>$ret['post_id'], 'pDate'=>date('Y-m-d H:i:s'))); nxs_addToLog($logNT, 'M', 'OK - Message Posted ', $extInfo); }
200
  if ($ret['code']=='OK') return 200; else return $ret;
201
  }
inc-cl/ip.php ADDED
@@ -0,0 +1,186 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ //## NextScripts Facebook Connection Class
3
+ $nxs_snapAvNts[] = array('code'=>'IP', 'lcode'=>'ip', 'name'=>'Instapaper');
4
+
5
+ if (!class_exists("nxs_snapClassIP")) { class nxs_snapClassIP {
6
+ //#### Show Common Settings
7
+ function showGenNTSettings($ntOpts){ global $nxs_plurl; $ntInfo = array('code'=>'IP', 'lcode'=>'ip', 'name'=>'Instapaper', 'defNName'=>'ipUName', 'tstReq' => false); ?>
8
+ <div class="nxs_box">
9
+ <div class="nxs_box_header">
10
+ <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']; ?>
11
+ <?php $cbo = count($ntOpts); ?> <?php wp_nonce_field( 'ns'.$ntInfo['code'], 'ns'.$ntInfo['code'].'_wpnonce' ); ?>
12
+ <?php if ($cbo>1){ ?><div class="nsBigText"><?php echo "(".($cbo=='0'?'No':$cbo)." "; _e('accounts', 'nxs_snap'); echo ")"; ?></div><?php } ?>
13
+ </div>
14
+ </div>
15
+ <div class="nxs_box_inside">
16
+ <?php foreach ($ntOpts as $indx=>$pbo){ if (trim($pbo['nName']=='')) $pbo['nName'] = $pbo[$ntInfo['defNName']]; ?>
17
+ <p style="margin:0px;margin-left:5px;">
18
+ <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"; ?> />
19
+ <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>
20
+ &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;
21
+ <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>
22
+ </p><?php $this->showNTSettings($indx, $pbo);
23
+ }?>
24
+ </div>
25
+ </div> <?php
26
+ }
27
+ //#### Show NEW Settings Page
28
+ function showNewNTSettings($mgpo){ $gpo = array('nName'=>'', 'doIP'=>'1', 'ipUName'=>'', 'ipPageID'=>'', 'ipAttch'=>'', 'ipPass'=>''); $this->showNTSettings($mgpo, $gpo, true);}
29
+ //#### Show Unit Settings
30
+ function showNTSettings($ii, $gpo, $isNew=false){ global $nxs_plurl; ?>
31
+ <div id="doIP<?php echo $ii; ?>Div" class="insOneDiv<?php if ($isNew) echo " clNewNTSets"; ?>" style="max-width: 1000px; background-color: #EBF4FB; background-image: url(<?php echo $nxs_plurl; ?>img/ip-bg.png); background-position:90% 10%; background-repeat: no-repeat; margin: 10px; border: 1px solid #808080; padding: 10px; display:none;"> <input type="hidden" name="apDoSIP<?php echo $ii; ?>" value="0" id="apDoSIP<?php echo $ii; ?>" />
32
+
33
+ <div class="nsx_iconedTitle" style="float: right; background-image: url(<?php echo $nxs_plurl; ?>img/ip16.png);"><a style="font-size: 12px;" target="_blank" href="http://www.nextscripts.com/setup-installation-instapaper-social-networks-auto-poster-wordpress/"><?php $nType="Instapaper"; printf( __( 'Detailed %s Installation/Configuration Instructions', 'nxs_snap' ), $nType); ?></a></div>
34
+
35
+ <div style="width:100%;"><strong><?php _e('Account Nickname', 'nxs_snap'); ?>:</strong> <i><?php _e('Just so you can easely identify it', 'nxs_snap'); ?></i> </div><input name="ip[<?php echo $ii; ?>][nName]" id="ipnName<?php echo $ii; ?>" style="font-weight: bold; color: #005800; border: 1px solid #ACACAC; width: 40%;" value="<?php _e(apply_filters('format_to_edit',htmlentities($gpo['nName'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" /><br/>
36
+ <?php echo nxs_addQTranslSel('ip', $ii, $gpo['qTLng']); ?><?php echo nxs_addPostingDelaySel('ip', $ii, $gpo['nHrs'], $gpo['nMin']); ?>
37
+
38
+ <?php if (!$isNew) { ?>
39
+ <div style="width:100%;"><strong><?php _e('Categories', 'nxs_snap'); ?>:</strong>
40
+ <input value="0" id="catSelA<?php echo $ii; ?>" type="radio" name="ip[<?php echo $ii; ?>][catSel]" <?php if ((int)$gpo['catSel'] != 1) echo "checked"; ?> /> All
41
+ <input value="1" id="catSelSIP<?php echo $ii; ?>" type="radio" name="ip[<?php echo $ii; ?>][catSel]" <?php if ((int)$gpo['catSel'] == 1) echo "checked"; ?> /> <a href="#" style="text-decoration: none;" class="showCats" id="nxs_SCA_IP<?php echo $ii; ?>" onclick="jQuery('#catSelSIP<?php echo $ii; ?>').attr('checked', true); jQuery('#tmpCatSelNT').val('IP<?php echo $ii; ?>'); nxs_markCats( jQuery('#nxs_SC_IP<?php echo $ii; ?>').val() ); jQuery('#showCatSel').bPopup({ modalClose: false, appendTo: '#nsStForm', opacity: 0.6, follow: [false, false], position: [75, 'auto']}); return false;">Selected<?php if ($gpo['catSelEd']!='') echo "[".(substr_count($gpo['catSelEd'], ",")+1)."]"; ?></a>
42
+ <input type="hidden" name="ip[<?php echo $ii; ?>][catSelEd]" id="nxs_SC_IP<?php echo $ii; ?>" value="<?php echo $gpo['catSelEd']; ?>" />
43
+ <br/><i><?php _e('Only selected categories will be autoposted to this account', 'nxs_snap'); ?></i></div>
44
+ <br/>
45
+ <?php } ?>
46
+
47
+ <div style="width:100%;"><strong>Instapaper Username:</strong> </div><input name="ip[<?php echo $ii; ?>][apIPUName]" id="apIPUName" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit',htmlentities($gpo['ipUName'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" />
48
+ <div style="width:100%;"><strong>Instapaper Password:</strong> </div><input name="ip[<?php echo $ii; ?>][apIPPass]" id="apIPPass" type="password" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities(substr($gpo['ipPass'], 0, 5)=='n5g9a'?nsx_doDecode(substr($gpo['ipPass'], 5)):$gpo['ipPass'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" /> <br/>
49
+
50
+ <?php if ($isNew) { ?> <input type="hidden" name="ip[<?php echo $ii; ?>][apDoIP]" value="1" id="apDoNewIP<?php echo $ii; ?>" /> <?php } ?>
51
+ <br/>
52
+
53
+ <div id="altFormat" style="">
54
+ <div style="width:100%;"><strong id="altFormatText"><?php _e('Post Title Format', 'nxs_snap'); ?></strong> (<a href="#" id="apIPTMsgFrmt<?php echo $ii; ?>HintInfo" onclick="mxs_showHideFrmtInfo('apIPTMsgFrmt<?php echo $ii; ?>'); return false;"><?php _e('Show format info', 'nxs_snap'); ?></a>)</div>
55
+
56
+ <input name="ip[<?php echo $ii; ?>][apIPMsgTFrmt]" id="apIPMsgTFrmt" style="width: 50%;" value="<?php if ($isNew) echo "%TITLE%"; else _e(apply_filters('format_to_edit',htmlentities($gpo['ipMsgTFormat'], ENT_COMPAT, "UTF-8")), 'nxs_snap'); ?>" onfocus="mxs_showFrmtInfo('apIPTMsgFrmt<?php echo $ii; ?>');" /><?php nxs_doShowHint("apIPTMsgFrmt".$ii); ?>
57
+ </div>
58
+
59
+ <div id="altFormat" style="">
60
+ <div style="width:100%;"><strong id="altFormatText"><?php _e('Post Text Format', 'nxs_snap'); ?></strong> (<a href="#" id="apIPMsgFrmt<?php echo $ii; ?>HintInfo" onclick="mxs_showHideFrmtInfo('apIPMsgFrmt<?php echo $ii; ?>'); return false;"><?php _e('Show format info', 'nxs_snap'); ?></a>)</div>
61
+ <input name="ip[<?php echo $ii; ?>][apIPMsgFrmt]" id="apIPMsgFrmt" style="width: 50%;" value="<?php if ($isNew) echo "%TEXT%"; else _e(apply_filters('format_to_edit', htmlentities($gpo['ipMsgFormat'], ENT_COMPAT, "UTF-8")), 'nxs_snap'); ?>" onfocus="mxs_showFrmtInfo('apIPMsgFrmt<?php echo $ii; ?>');" /><?php nxs_doShowHint("apIPMsgFrmt".$ii); ?>
62
+ </div><br/>
63
+
64
+ <?php if ($gpo['ipPass']!='') { ?>
65
+ <?php wp_nonce_field( 'rePostToIP', 'rePostToIP_wpnonce' ); ?>
66
+ <b><?php _e('Test your settings', 'nxs_snap'); ?>:</b>&nbsp;&nbsp;&nbsp; <a href="#" class="NXSButton" onclick="testPost('IP', '<?php echo $ii; ?>'); return false;"><?php printf( __( 'Submit Test Post to %s', 'nxs_snap' ), $nType); ?></a>
67
+
68
+ <?php }
69
+
70
+ ?><div class="submit"><input type="submit" class="button-primary" name="update_NS_SNAutoPoster_settings" value="<?php _e('Update Settings', 'nxs_snap') ?>" /></div></div><?php
71
+ }
72
+ //#### Set Unit Settings from POST
73
+ function setNTSettings($post, $options){ global $nxs_snapThisPageUrl; $code = 'IP'; $lcode = 'ip';
74
+ foreach ($post as $ii => $pval){
75
+ if (isset($pval['apIPUName']) && $pval['apIPUName']!=''){ if (!isset($options[$ii])) $options[$ii] = array();
76
+ if (isset($pval['apIPUName'])) $options[$ii]['ipUName'] = trim($pval['apIPUName']);
77
+ if (isset($pval['nName'])) $options[$ii]['nName'] = trim($pval['nName']);
78
+ if (isset($pval['apIPPass'])) $options[$ii]['ipPass'] = 'n5g9a'.nsx_doEncode($pval['apIPPass']); else $options[$ii]['ipPass'] = '';
79
+
80
+ if (isset($pval['catSel'])) $options[$ii]['catSel'] = trim($pval['catSel']);
81
+ if ($options[$ii]['catSel']=='1' && trim($pval['catSelEd'])!='') $options[$ii]['catSelEd'] = trim($pval['catSelEd']); else $options[$ii]['catSelEd'] = '';
82
+
83
+ if (isset($pval['apIPMsgFrmt'])) $options[$ii]['ipMsgFormat'] = trim($pval['apIPMsgFrmt']);
84
+ if (isset($pval['apIPMsgTFrmt'])) $options[$ii]['ipMsgTFormat'] = trim($pval['apIPMsgTFrmt']);
85
+ if (isset($pval['apDoIP'])) $options[$ii]['doIP'] = $pval['apDoIP']; else $options[$ii]['doIP'] = 0;
86
+ if (isset($pval['delayHrs'])) $options[$ii]['nHrs'] = trim($pval['delayHrs']); if (isset($pval['delayMin'])) $options[$ii]['nMin'] = trim($pval['delayMin']);
87
+ if (isset($pval['qTLng'])) $options[$ii]['qTLng'] = trim($pval['qTLng']);
88
+ }
89
+ } return $options;
90
+ }
91
+ //#### Show Post->Edit Meta Box Settings
92
+ function showEdPostNTSettings($ntOpts, $post){ global $nxs_plurl; $post_id = $post->ID;
93
+ foreach($ntOpts as $ii=>$ntOpt) { $pMeta = maybe_unserialize(get_post_meta($post_id, 'snapIP', true)); if (is_array($pMeta)) $ntOpt = $this->adjMetaOpt($ntOpt, $pMeta[$ii]);
94
+ $doIP = $ntOpt['doIP'] && (is_array($pMeta) || $ntOpt['catSel']!='1');
95
+ $isAvailIP = $ntOpt['ipUName']!='' && $ntOpt['ipPass']!=''; $ipMsgFormat = htmlentities($ntOpt['ipMsgFormat'], ENT_COMPAT, "UTF-8"); $ipMsgTFormat = htmlentities($ntOpt['ipMsgTFormat'], ENT_COMPAT, "UTF-8");
96
+ ?>
97
+ <tr><th style="text-align:left;" colspan="2"><?php if ( $ntOpt['catSel']=='1' && trim($ntOpt['catSelEd'])!='' ) { ?> <input type="hidden" class="nxs_SC" id="nxs_SC_IP<?php echo $ii; ?>" value="<?php echo $ntOpt['catSelEd']; ?>" /> <?php } ?>
98
+ <?php if ($isAvailIP) { ?><input class="nxsGrpDoChb" value="1" id="doIP<?php echo $ii; ?>" <?php if ($post->post_status == "publish") echo 'disabled="disabled"';?> type="checkbox" name="ip[<?php echo $ii; ?>][doIP]" <?php if (($post->post_status == "publish" && $ntOpt['isPosted'] == '1') || ($post->post_status != "publish" && ((int)$doIP == 1)) ) echo 'checked="checked" title="def"'; ?> /> <?php } ?>
99
+
100
+ <div class="nsx_iconedTitle" style="display: inline; font-size: 13px; background-image: url(<?php echo $nxs_plurl; ?>img/ip16.png);">Instapaper - <?php _e('publish to', 'nxs_snap') ?> (<i style="color: #005800;"><?php echo $ntOpt['nName']; ?></i>)</div></th> <td><?php //## Only show RePost button if the post is "published"
101
+ if ($post->post_status == "publish" && $isAvailIP) { ?><input alt="<?php echo $ii; ?>" style="float: right;" onmouseout="hidePopShAtt('SV');" onmouseover="showPopShAtt('SV', event);" onclick="return false;" type="button" class="button" name="rePostToIP_repostButton" id="rePostToIP_button" value="<?php _e('Repost to Instapaper', 'nxs_snap') ?>" />
102
+ <?php wp_nonce_field( 'rePostToIP', 'rePostToIP_wpnonce' ); } ?>
103
+
104
+ <?php if (is_array($pMeta) && is_array($pMeta[$ii]) && isset($pMeta[$ii]['pgID']) ) {
105
+ ?> <span id="pstdIP<?php echo $ii; ?>" style="float: right; padding-top: 4px; padding-right: 10px;">
106
+ <a style="font-size: 10px;" href="http://www.instapaper.com/u" target="_blank"><?php $nType="Instapaper"; printf( __( 'Posted on', 'nxs_snap' ), $nType); ?> <?php echo (isset($pMeta[$ii]['pDate']) && $pMeta[$ii]['pDate']!='')?(" (".$pMeta[$ii]['pDate'].")"):""; ?></a>
107
+ </span><?php } ?>
108
+
109
+ </td></tr>
110
+
111
+ <?php if (!$isAvailIP) { ?><tr><th scope="row" style="text-align:right; width:150px; padding-top: 5px; padding-right:10px;"></th> <td><b>Setup your Instapaper Account to AutoPost to Instapaper</b>
112
+ <?php } elseif ($post->post_status != "pubZlish") { ?>
113
+
114
+ <tr id="altFormat1" style=""><th scope="row" style="text-align:right; width:60px; padding-right:10px;"><?php _e('Title Format:', 'nxs_snap') ?></th>
115
+ <td><input value="<?php echo $ipMsgTFormat ?>" type="text" name="ip[<?php echo $ii; ?>][SNAPformatT]" style="width:60%;max-width: 610px;" onfocus="jQuery('.nxs_FRMTHint').hide();mxs_showFrmtInfo('apIPTMsgFrmt<?php echo $ii; ?>');"/><?php nxs_doShowHint("apIPTMsgFrmt".$ii); ?></td></tr>
116
+
117
+ <tr id="altFormat1" style=""><th scope="row" style="text-align:right; width:60px; padding-right:10px;"><?php _e('Text Format:', 'nxs_snap') ?></th>
118
+ <td><input value="<?php echo $ipMsgFormat ?>" type="text" name="ip[<?php echo $ii; ?>][SNAPformat]" style="width:60%;max-width: 610px;" onfocus="jQuery('.nxs_FRMTHint').hide();mxs_showFrmtInfo('apIPMsgFrmt<?php echo $ii; ?>');"/><?php nxs_doShowHint("apIPMsgFrmt".$ii); ?></td></tr>
119
+ <?php }
120
+ }
121
+ }
122
+ //#### Save Meta Tags to the Post
123
+ function adjMetaOpt($optMt, $pMeta){ if (isset($pMeta['isPosted'])) $optMt['isPosted'] = $pMeta['isPosted']; else $optMt['isPosted'] = '';
124
+ if (isset($pMeta['SNAPformat'])) $optMt['ipMsgFormat'] = $pMeta['SNAPformat'];
125
+ if (isset($pMeta['SNAPformatT'])) $optMt['ipMsgTFormat'] = $pMeta['SNAPformatT'];
126
+ if (isset($pMeta['doIP'])) $optMt['doIP'] = $pMeta['doIP'] == 1?1:0; else { if (isset($pMeta['SNAPformat'])) $optMt['doIP'] = 0; }
127
+ if (isset($pMeta['SNAPincludeIP']) && $pMeta['SNAPincludeIP'] == '1' ) $optMt['doIP'] = 1;
128
+ return $optMt;
129
+ }
130
+ }}
131
+ if (!function_exists("nxs_rePostToIP_ajax")) {
132
+ function nxs_rePostToIP_ajax() { check_ajax_referer('rePostToIP'); $postID = $_POST['id']; $options = get_option('NS_SNAutoPoster');
133
+ foreach ($options['ip'] as $ii=>$two) if ($ii==$_POST['nid']) { $two['ii'] = $ii; $two['pType'] = 'aj'; //if ($two['gpPageID'].$two['gpUName']==$_POST['nid']) {
134
+ $gppo = get_post_meta($postID, 'snapIP', true); $gppo = maybe_unserialize($gppo);// prr($gppo);
135
+ if (is_array($gppo) && isset($gppo[$ii]) && is_array($gppo[$ii])){ $ntClInst = new nxs_snapClassIP(); $two = $ntClInst->adjMetaOpt($two, $gppo[$ii]);}
136
+ $result = nxs_doPublishToIP($postID, $two); if ($result == 200) die("Successfully sent your post to Instapaper."); else die($result);
137
+ }
138
+ }
139
+ }
140
+
141
+ if (!function_exists("nxs_getIPHeaders")) { function nxs_getIPHeaders($up){ $hdrsArr = array();
142
+ $hdrsArr['Cache-Control']='no-cache'; $hdrsArr['Connection']='keep-alive';
143
+ $hdrsArr['User-Agent']='SNAP for Wordpress; Ver '.NextScripts_SNAP_Version;
144
+ $hdrsArr['Accept']='text/html, application/xhtml+xml, */*'; $hdrsArr['DNT']='1';
145
+ $hdrsArr['Authorization'] = 'Basic ' . base64_encode("$up");
146
+ $hdrsArr['Accept-Encoding']='gzip,deflate'; $hdrsArr['Accept-Language']='en-US,en;q=0.8'; $hdrsArr['Accept-Charset']='ISO-8859-1,utf-8;q=0.7,*;q=0.3'; return $hdrsArr;
147
+ }}
148
+
149
+ if (!function_exists("nxs_doPublishToIP")) { //## Second Function to Post to IP
150
+ function nxs_doPublishToIP($postID, $options){ $ntCd = 'IP'; $ntCdL = 'ip'; $ntNm = 'Instapaper';
151
+
152
+ $ii = $options['ii']; if (!isset($options['pType'])) $options['pType'] = 'im'; if ($options['pType']=='sh') sleep(rand(1, 10)); $snap_ap = get_post_meta($postID, 'snap'.$ntCd, true); $snap_ap = maybe_unserialize($snap_ap);
153
+ if ($options['pType']!='aj' && is_array($snap_ap) && (nxs_chArrVar($snap_ap[$ii], 'isPosted', '1') || nxs_chArrVar($snap_ap[$ii], 'isPrePosted', '1'))) {
154
+ nxs_addToLog($ntCd.' - '.$options['nName'], 'E', '-=Duplicate=- Post ID:'.$postID, 'Not posted. No reason for posting duplicate'); return;
155
+ }
156
+
157
+ if ($postID=='0') { echo "Testing ... <br/><br/>"; $link = home_url(); $msgT = 'Test Link from '.$link; } else { $post = get_post($postID); if(!$post) return; $link = get_permalink($postID);
158
+ $msgFormat = $options['ipMsgFormat']; $msgTFormat = $options['ipMsgTFormat']; $msgT = nsFormatMessage($msgTFormat, $postID); $msg = nsFormatMessage($msgFormat, $postID);
159
+ nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPrePosted'=>'1'));
160
+ }
161
+ $dusername = $options['ipUName']; $pass = (substr($options['ipPass'], 0, 5)=='n5g9a'?nsx_doDecode(substr($options['ipPass'], 5)):$options['ipPass']);
162
+ $link = urlencode($link); $desc = urlencode(substr($msgT, 0, 250)); $ext = urlencode(substr($msg, 0, 1000));
163
+ $extInfo = ' | PostID: '.$postID." - ".$post->post_title; $logNT = '<span style="color:#000080">Instapaper</span> - '.$options['nName'];
164
+ $t = wp_get_post_tags($postID); $tggs = array(); foreach ($t as $tagA) {$tggs[] = $tagA->name;} $tags = urlencode(implode(',',$tggs)); $tags = str_replace(' ','+',$tags);
165
+ $apicall = "https://www.instapaper.com/api/add?red=api&url=$link&title=$desc&selection=$ext";
166
+ $hdrsArr = nxs_getIPHeaders($dusername.':'.$pass); $cnt = wp_remote_get( $apicall, array( 'method' => 'GET', 'timeout' => 45, 'redirection' => 0, 'headers' => $hdrsArr) );// prr($cnt);
167
+
168
+ if(is_wp_error($cnt)) { $error_string = $cnt->get_error_message(); if (stripos($error_string, ' timed out')!==false) { sleep(10);
169
+ $cnt = wp_remote_get( $apicall, array( 'method' => 'GET', 'timeout' => 45, 'redirection' => 0, 'headers' => $hdrsArr) );}
170
+ }
171
+ if(is_wp_error($cnt)) {
172
+ $ret = 'Something went wrong - '.""; nxs_addToLog($logNT, 'E', '-=ERROR=- '.$ret. "ERR: ".print_r($cnt, true), $extInfo);
173
+ } else {
174
+ if (is_array($cnt) && stripos($cnt['body'],'201')!==false)
175
+ { $ret = 'OK'; nxs_metaMarkAsPosted($postID, 'IP', $options['ii'], array('isPosted'=>'1', 'pgID'=>'IP', 'pDate'=>date('Y-m-d H:i:s'))); nxs_addToLog($logNT, 'M', 'OK - Message Posted ', $extInfo); }
176
+ elseif (is_array($cnt) && $cnt['body']=='<?xml version="1.0" encoding="UTF-8"?>') { $ret = 'It looks like Instapaper API is Down'; nxs_addToLog($logNT, 'M', 'It looks like Instapaper API is Down', $extInfo); }
177
+ elseif (is_array($cnt) && stripos($cnt['body'],'item already exists')!==false) { $ret = '..All good, but this link has already been bookmarked..'; nxs_addToLog($logNT, 'M', 'All good, but this link has already been bookmarked', $extInfo); }
178
+ else { if ($cnt['response']['code']=='401') $ret = " Incorrect Username/Password "; else $ret = 'Something went wrong - '."https://$dusername:*********@$api/posts/add?&url=$link&description=$desc&extended=$ext&tags=$tags"; nxs_addToLog($logNT, 'E', '-=ERROR=- '.$ret. "ERR: ".print_r($cnt, true), $extInfo);
179
+ }
180
+ }
181
+ if ($ret!='OK') { if ($postID=='0') echo $ret; } else if ($postID=='0') { echo 'OK - Message Posted, please see your Instapaper Page. '; nxs_addToLog($logNT, 'M', 'OK - TEST Message Posted '); }
182
+ if ($ret == 'OK') return 200; else return $ret;
183
+
184
+ }
185
+ }
186
+ ?>
inc-cl/li.php CHANGED
@@ -27,7 +27,7 @@ $nxs_snapAvNts[] = array('code'=>'LI', 'lcode'=>'li', 'name'=>'LinkedIn');
27
 
28
  if (!class_exists("nxs_snapClassLI")) { class nxs_snapClassLI {
29
  //#### Show Common Settings
30
- function showGenNTSettings($ntOpts){ global $nxs_snapThisPageUrl, $nxs_plurl; $code = 'LI'; $lcode = 'li'; wp_nonce_field( 'ns'.$code, 'ns'.$code.'_wpnonce' );
31
 
32
  if ( isset($_GET['auth']) && $_GET['auth']=='li'){ require_once('apis/liOAuth.php'); $options = $ntOpts[$_GET['acc']];
33
 
@@ -36,7 +36,7 @@ if (!class_exists("nxs_snapClassLI")) { class nxs_snapClassLI {
36
  $li_oauth = new nsx_LinkedIn($api_key, $api_secret, $callback_url);
37
  $request_token = $li_oauth->getRequestToken(); //echo "####"; prr($request_token); die();
38
  $options['liOAuthToken'] = $request_token->key;
39
- $options['liOAuthTokenSecret'] = $request_token->secret; prr($li_oauth);
40
  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);
41
  echo '<script type="text/javascript">window.location = "'.$url.'"</script>'; break;
42
  default: echo '<br/><b style="color:red">Could not connect to LinkedIn. Refresh the page or try again later.</b>'; die();
@@ -54,36 +54,46 @@ if (!class_exists("nxs_snapClassLI")) { class nxs_snapClassLI {
54
  }
55
 
56
  ?>
57
- <hr/><div class="nsx_iconedTitle" style="background-image: url(<?php echo $nxs_plurl; ?>img/<?php echo $lcode; ?>16.png);">LinkedIn Settings: <?php $cfbo = count($ntOpts); $mfbo = 1+max(array_keys($ntOpts)); ?> <?php wp_nonce_field( 'nsFB', 'nsFB_wpnonce' ); ?>
58
- <div class="nsBigText">You have <?php echo $cfbo=='0'?'No':$cfbo; ?> LinkedIn account<?php if ($cfbo!=1){ ?>s<?php } ?> <!-- - <a href="#" class="NXSButton" onclick="doShowHideBlocks2('FB<?php echo $mfbo; ?>');return false;">Add new Facebook Account</a> --> </div></div>
59
- <?php // if (function_exists('nxs_doSMAS1')) nxs_doSMAS1($this, $mfbo); else nxs_doSMAS('LinkedIn', 'LI'.$mfbo); ?>
60
- <?php foreach ($ntOpts as $indx=>$pbo){ if (trim($pbo['nName']=='')) { $pbo['nName'] = $pbo['liUserInfo']; if($pbo['liPage']!='') $pbo['nName'] .= "Page: ".$pbo['liPage']; else $pbo['nName'] .= " Profile"; } ?>
61
- <p style="margin: 0px;margin-left: 5px;"><input value="1" id="apDoLI" name="li[<?php echo $indx; ?>][apDoLI]" type="checkbox" <?php if ((int)$pbo['doLI'] == 1) echo "checked"; ?> />
62
- <strong>Auto-publish your Posts to your LinkedIn <i style="color: #005800;"><?php if($pbo['nName']!='') echo "(".$pbo['nName'].")"; ?></i> </strong>
63
- &nbsp;&nbsp;<a id="doLI<?php echo $indx; ?>A" href="#" onclick="doShowHideBlocks2('LI<?php echo $indx; ?>');return false;">[Show Settings]</a>&nbsp;&nbsp;
64
- <a href="#" onclick="doDelAcct('li', '<?php echo $indx; ?>', '<?php if (isset($pbo['liUserInfo'])) echo $pbo['liUserInfo']; ?>');return false;">[Remove Account]</a>
65
- </p><?php $this->showNTSettings($indx, $pbo);
66
- } //## END LI Settings
 
 
 
 
 
 
 
 
 
 
67
  }
68
  //#### Show NEW Settings Page
69
  function showNewNTSettings($bo){ $po = array('nName'=>'', 'ulName'=>'', 'uPass'=>'', 'grpID'=>'', 'uPage'=>'', 'doLI'=>'1', 'liAPIKey'=>'', 'liAPISec'=>'', 'liUserInfo'=>'', 'liAttch'=>'1', 'liOAuthToken'=>'', 'liMsgFormat'=>'New post has been published on %SITENAME%' ); $this->showNTSettings($bo, $po, true);}
70
  //#### Show Unit Settings
71
  function showNTSettings($ii, $options, $isNew=false){ global $nxs_plurl,$nxs_snapThisPageUrl; if (!isset($options['liOK'])) $options['liOK'] = ''; ?>
72
- <div id="doLI<?php echo $ii; ?>Div" <?php if ($isNew){ ?>class="clNewNTSets"<?php } ?> style="max-width: 1000px; background-color: #EBF4FB; background-image: url(<?php echo $nxs_plurl; ?>img/li-bg.png); background-position:90% 10%; background-repeat: no-repeat; margin: 10px; border: 1px solid #808080; padding: 10px; <?php if ((isset($options['liAccessToken']) && $options['liAccessTokenSecret']!='') || $options['liOK']=='1' || $isNew) { ?>display:none;<?php } ?>"> <input type="hidden" name="apDoSLI<?php echo $ii; ?>" value="0" id="apDoSLI<?php echo $ii; ?>" />
73
  <?php if ($isNew) { ?> <input type="hidden" name="li[<?php echo $ii; ?>][apDoLI]" value="1" id="apDoNewLI<?php echo $ii; ?>" /> <?php } ?>
74
  <div id="doLI<?php echo $ii; ?>Div" style="margin-left: 10px;">
75
 
76
- <div class="nsx_iconedTitle" style="float: right; background-image: url(<?php echo $nxs_plurl; ?>img/li16.png);"><a style="font-size: 12px;" target="_blank" href="http://www.nextscripts.com/setup-installation-linkedin-social-networks-auto-poster-wordpress/">Detailed LinkedIn Installation/Configuration Instructions</a></div>
77
 
78
- <div style="width:100%;"><strong>Account Nickname:</strong> <i>Just so you can easely identify it</i> </div><input name="li[<?php echo $ii; ?>][nName]" id="linName<?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")), 'NS_SNAutoPoster') ?>" /><br/>
79
  <?php echo nxs_addQTranslSel('li', $ii, $options['qTLng']); ?><?php echo nxs_addPostingDelaySel('li', $ii, $options['nHrs'], $options['nMin']); ?>
80
 
81
  <?php if (!$isNew) { ?>
82
- <div style="width:100%;"><strong>Auto-Post Categories:</strong>
83
  <input value="0" id="catSelA<?php echo $ii; ?>" type="radio" name="li[<?php echo $ii; ?>][catSel]" <?php if ((int)$options['catSel'] != 1) echo "checked"; ?> /> All
84
  <input value="1" id="catSelSLI<?php echo $ii; ?>" type="radio" name="li[<?php echo $ii; ?>][catSel]" <?php if ((int)$options['catSel'] == 1) echo "checked"; ?> /> <a href="#" style="text-decoration: none;" class="showCats" id="nxs_SCA_LI<?php echo $ii; ?>" onclick="jQuery('#catSelSLI<?php echo $ii; ?>').attr('checked', true); jQuery('#tmpCatSelNT').val('LI<?php echo $ii; ?>'); nxs_markCats( jQuery('#nxs_SC_LI<?php echo $ii; ?>').val() ); jQuery('#showCatSel').bPopup({ modalClose: false, appendTo: '#nsStForm', opacity: 0.6, follow: [false, false], position: [75, 'auto']}); return false;">Selected<?php if ($options['catSelEd']!='') echo "[".(substr_count($options['catSelEd'], ",")+1)."]"; ?></a>
85
  <input type="hidden" name="li[<?php echo $ii; ?>][catSelEd]" id="nxs_SC_LI<?php echo $ii; ?>" value="<?php echo $options['catSelEd']; ?>" />
86
- </div>
87
  <br/>
88
  <?php } ?>
89
 
@@ -96,17 +106,17 @@ if (!class_exists("nxs_snapClassLI")) { class nxs_snapClassLI {
96
 
97
  <div class="subDiv" id="sub<?php echo $ii; ?>DivL" style="display: block;">
98
 
99
- <div style="width:100%;"><strong>Your LinkedIn API Key:</strong> </div><input name="li[<?php echo $ii; ?>][apLIAPIKey]" id="apLIAPIKey" style="width: 70%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['liAPIKey'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" />
100
- <div style="width:100%;"><strong>Your LinkedIn API Secret:</strong> </div><input name="li[<?php echo $ii; ?>][apLIAPISec]" id="apLIAPISec" style="width: 70%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['liAPISec'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" />
101
 
102
- <br/><br/><div style="width:100%;"><strong>Your LinkedIn Group ID:</strong><br/> Fill only if you are posting to LinkedIn Group. Leave empty to post to your profile. </div><input name="li[<?php echo $ii; ?>][grpID]" id="" style="width: 70%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['grpID'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" />
103
 
104
  <br/><br/>
105
  <?php
106
  if($options['liAPIKey']=='') { ?>
107
  <b>Authorize Your LinkedIn Account</b>. Please save your settings and come back here to Authorize your account.
108
  <?php } else { if(isset($options['liAccessToken']) && isset($options['liAccessTokenSecret']) && $options['liAccessTokenSecret']!=='') { ?>
109
- Your LinkedIn Account has been authorized. <br/>User ID: <?php _e(apply_filters('format_to_edit', $options['liUserInfo']), 'NS_SNAutoPoster') ?>.
110
  <br/>You can Re- <?php } ?>
111
  <a href="<?php echo $nxs_snapThisPageUrl; ?>&auth=li&acc=<?php echo $ii; ?>">Authorize Your LinkedIn Account</a>
112
 
@@ -123,10 +133,10 @@ if (!class_exists("nxs_snapClassLI")) { class nxs_snapClassLI {
123
  <?php if (function_exists("doConnectToLinkedIn")) { ?>
124
 
125
  <div class="subDiv" id="sub<?php echo $ii; ?>DivN" style="display: block;"> <span style="color:#800000; font-size: 14px;"> <b>Beta</b>, please <a target="_blank" href="http://www.nextscripts.com/support/">report</a> any problems.</span><br/><br/>
126
- <div style="width:100%;"><strong>Your LinkedIn Page:</strong> Could be your company page or group page. Leave empty to post to your own profile.</div><input name="li[<?php echo $ii; ?>][uPage]" id="liuPage" style="width: 90%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['uPage'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" />
127
  <br/>
128
- <div style="width:100%;"><strong>Your LinkedIn Username/Email:</strong> </div><input name="li[<?php echo $ii; ?>][ulName]" id="liulName" style="width: 70%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['ulName'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" />
129
- <div style="width:100%;"><strong>Your LinkedIn Password:</strong> </div><input type="password" name="li[<?php echo $ii; ?>][uPass]" id="liuPass" style="width: 75%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['uPass'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" />
130
 
131
  </div>
132
 
@@ -146,18 +156,21 @@ if (!class_exists("nxs_snapClassLI")) { class nxs_snapClassLI {
146
  <strong>Publish Posts to LinkedIn as an Attachment</strong>
147
  </p>
148
  <div id="altFormat" style="<?php if ((int)$options['liAttch'] == 1) echo "margin-left: 10px;"; ?> ">
149
- <div style="width:100%;"><strong id="altFormatText">Message Text Format:</strong>
150
  <p style="font-size: 11px; margin: 0px;">%SITENAME% - Inserts the Your Blog/Site Name. &nbsp; %TITLE% - Inserts the Title of your post. &nbsp; %URL% - Inserts the URL of your post. &nbsp; %IMG% - Inserts the featured image. &nbsp; %IMG% - Inserts the featured image. &nbsp; %TEXT% - Inserts the excerpt of your post. &nbsp; %FULLTEXT% - Inserts the body(text) of your post, %AUTHORNAME% - Inserts the author's name.</p>
151
- </div><input name="li[<?php echo $ii; ?>][apLIMsgFrmt]" id="apLIMsgFrmt" style="width: 50%;" value="<?php _e(apply_filters('format_to_edit',htmlentities($options['liMsgFormat'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" />
152
  </div><br/>
153
 
154
 
155
 
156
  <?php if($options['liAPIKey']!='' || (isset($options['uPass']) && $options['uPass']!='')) { ?>
157
  <?php wp_nonce_field( 'rePostToLI', 'rePostToLI_wpnonce' ); ?>
158
- <br/><b>Test your settings:</b>&nbsp;&nbsp;&nbsp; <a href="#" class="NXSButton" onclick="testPost('LI', '<?php echo $ii; ?>'); return false;">Submit Test Post to LinkedIn</a> <br/>
159
- <?php }?>
160
- <div class="submit"><input type="submit" class="button-primary" name="update_NS_SNAutoPoster_settings" value="<?php _e('Update Settings', 'NS_SNAutoPoster') ?>" /></div>
 
 
 
161
  </div>
162
  </div>
163
  <?php
@@ -189,20 +202,21 @@ if (!class_exists("nxs_snapClassLI")) { class nxs_snapClassLI {
189
  }
190
  //#### Show Post->Edit Meta Box Settings
191
  function showEdPostNTSettings($ntOpts, $post){ global $nxs_plurl; $post_id = $post->ID; //prr($ntOpts);
192
- foreach($ntOpts as $ii=>$options) { $pMeta = maybe_unserialize(get_post_meta($post_id, 'snapLI', true)); if (is_array($pMeta)) $options = $this->adjMetaOpt($options, $pMeta[$ii]); $doLI = $options['doLI'] && $options['catSel']!='1';
 
193
  $isAvailLI = (isset($options['liOAuthVerifier']) && $options['liOAuthVerifier']!='' && $options['liAccessTokenSecret']!='' && $options['liAccessToken']!='' && $options['liAPIKey']!='') || ($options['ulName']!=='' && $options['uPass']!=='');
194
  $isAttachLI = $options['liAttch']; $liMsgFormat = htmlentities($options['liMsgFormat'], ENT_COMPAT, "UTF-8");
195
  ?>
196
 
197
  <tr><th style="text-align:left;" colspan="2"><?php if ( $options['catSel']=='1' && trim($options['catSelEd'])!='' ) { ?> <input type="hidden" class="nxs_SC" id="nxs_SC_LI<?php echo $ii; ?>" value="<?php echo $options['catSelEd']; ?>" /> <?php } ?>
198
- <?php if ($isAvailLI) { ?><input class="nxsGrpDoChb" value="1" id="doLI<?php echo $ii; ?>" <?php if ($post->post_status == "publish") echo 'disabled="disabled"';?> type="checkbox" name="li[<?php echo $ii; ?>][SNAPincludeLI]" <?php if (($post->post_status == "publish" && $options['isPosted'] == '1') || ($post->post_status != "publish" && ((int)$doLI == 1)) ) echo 'checked="checked" title="def"'; ?> /> <?php } ?>
199
- <div class="nsx_iconedTitle" style="display: inline; font-size: 13px; background-image: url(<?php echo $nxs_plurl; ?>img/li16.png);">LinkedIn - publish to (<i style="color: #005800;"><?php echo $options['nName']; ?></i>)</div></th><td><?php //## Only show RePost button if the post is "published"
200
- if ($post->post_status == "publish" && $isAvailLI) { ?><input alt="<?php echo $ii; ?>" style="float: right;" onmouseout="hidePopShAtt('SV');" onmouseover="showPopShAtt('SV', event);" onclick="return false;" type="button" class="button" name="rePostToLI_repostButton" id="rePostToLI_button" value="<?php _e('Repost to LinkedIn', 're-post') ?>" />
201
  <?php wp_nonce_field( 'rePostToLI', 'rePostToLI_wpnonce' ); } ?>
202
 
203
  <?php if (is_array($pMeta) && is_array($pMeta[$ii]) && isset($pMeta[$ii]['pgID']) ) {
204
  ?> <span id="pstdLI<?php echo $ii; ?>" style="float: right;padding-top: 4px; padding-right: 10px;">
205
- <a style="font-size: 10px;" href="<?php if ($options['uPage']!='') echo $options['uPage']; else { echo "http://www.linkedin.com/profile/view?id=".CutFromTo("XWEXW".$pMeta[$ii]['pgID'], "XWEXW", ' - '); } ?>" target="_blank">Posted on LinkedIn <?php echo (isset($pMeta[$ii]['pDate']) && $pMeta[$ii]['pDate']!='')?(" (".$pMeta[$ii]['pDate'].")"):""; ?></a>
206
  </span><?php } ?>
207
 
208
  </td></tr>
@@ -213,7 +227,7 @@ if (!class_exists("nxs_snapClassLI")) { class nxs_snapClassLI {
213
  <input value="0" type="hidden" name="li[<?php echo $ii; ?>][AttachPost]"/>
214
  <input value="1" id="SNAP_AttachLI" onchange="doShowHideAltFormatX();" type="checkbox" name="li[<?php echo $ii; ?>][AttachPost]" <?php if ((int)$isAttachLI == 1) echo "checked"; ?> /> </th><td><strong>Publish Post to LinkedIn as Attachment</strong></td> </tr>
215
 
216
- <tr id="altFormat1" style=""><th scope="row" style="text-align:right; width:60px; padding-right:10px;"><?php _e('Message Format:', 'NS_SPAP') ?></th>
217
  <td><input value="<?php echo ($liMsgFormat); ?>" type="text" name="li[<?php echo $ii; ?>][SNAPformat]" style="width:60%;max-width: 610px;" onfocus="jQuery('.nxs_FRMTHint').hide();mxs_showFrmtInfo('apLIMsgFrmt<?php echo $ii; ?>');"/><?php nxs_doShowHint("apLIMsgFrmt".$ii); ?></td></tr>
218
 
219
  <?php }
@@ -223,7 +237,9 @@ if (!class_exists("nxs_snapClassLI")) { class nxs_snapClassLI {
223
  function adjMetaOpt($optMt, $pMeta){ if (isset($pMeta['isPosted'])) $optMt['isPosted'] = $pMeta['isPosted']; else $optMt['isPosted'] = '';
224
  if (isset($pMeta['SNAPformat'])) $optMt['liMsgFormat'] = $pMeta['SNAPformat']; if (trim($optMt['liMsgFormat'])=='') $optMt['liMsgFormat'] = '&nbsp;';
225
  if (isset($pMeta['AttachPost'])) $optMt['liAttch'] = $pMeta['AttachPost'] == 1?1:0; else { if (isset($pMeta['SNAPformat'])) $optMt['liAttch'] = 0; }
226
- if (isset($pMeta['SNAPincludeLI'])) $optMt['doLI'] = $pMeta['SNAPincludeLI'] == 1?1:0; else { if (isset($pMeta['SNAPformat'])) $optMt['doLI'] = 0; } return $optMt;
 
 
227
  }
228
  }}
229
 
@@ -274,6 +290,7 @@ if (!function_exists("nxs_doPublishToLI")) { //## Second Function to Post to LI
274
  //$liPostID = $linkedin->getCurrentShare(); prr($liPostID);
275
  $liPostID = $options['liUserInfo'];
276
  }
 
277
  if ($ret!='201') { if ($postID=='0') prr($ret); nxs_addToLog($logNT, 'E', '-=ERROR=- '.print_r($ret, true), $extInfo); }
278
  else if ($postID=='0') { echo 'OK - Linkedin status updated successfully'; nxs_addToLog($logNT, 'M', 'OK - TEST Message Posted '); } else
279
  { nxs_metaMarkAsPosted($postID, 'LI', $options['ii'], array('isPosted'=>'1', 'pgID'=>$liPostID, 'pDate'=>date('Y-m-d H:i:s'))); nxs_addToLog($logNT, 'M', 'OK - Message Posted ', $extInfo); }
27
 
28
  if (!class_exists("nxs_snapClassLI")) { class nxs_snapClassLI {
29
  //#### Show Common Settings
30
+ function showGenNTSettings($ntOpts){ global $nxs_snapThisPageUrl, $nxs_plurl; $ntInfo = array('code'=>'LI', 'lcode'=>'li', 'name'=>'LinkedIn+', 'defNName'=>'ulName', 'tstReq' => true);
31
 
32
  if ( isset($_GET['auth']) && $_GET['auth']=='li'){ require_once('apis/liOAuth.php'); $options = $ntOpts[$_GET['acc']];
33
 
36
  $li_oauth = new nsx_LinkedIn($api_key, $api_secret, $callback_url);
37
  $request_token = $li_oauth->getRequestToken(); //echo "####"; prr($request_token); die();
38
  $options['liOAuthToken'] = $request_token->key;
39
+ $options['liOAuthTokenSecret'] = $request_token->secret; // prr($li_oauth);
40
  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);
41
  echo '<script type="text/javascript">window.location = "'.$url.'"</script>'; break;
42
  default: echo '<br/><b style="color:red">Could not connect to LinkedIn. Refresh the page or try again later.</b>'; die();
54
  }
55
 
56
  ?>
57
+ <div class="nxs_box">
58
+ <div class="nxs_box_header">
59
+ <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']; ?>
60
+ <?php $cbo = count($ntOpts); ?> <?php wp_nonce_field( 'ns'.$ntInfo['code'], 'ns'.$ntInfo['code'].'_wpnonce' ); ?>
61
+ <?php if ($cbo>1){ ?><div class="nsBigText"><?php echo "(".($cbo=='0'?'No':$cbo)." "; _e('accounts', 'nxs_snap'); echo ")"; ?></div><?php } ?>
62
+ </div>
63
+ </div>
64
+ <div class="nxs_box_inside">
65
+ <?php foreach ($ntOpts as $indx=>$pbo){ if (trim($pbo['nName']=='')) $pbo['nName'] = $pbo[$ntInfo['defNName']];
66
+ if (!isset($pbo[$ntInfo['lcode'].'OK']) || $pbo[$ntInfo['lcode'].'OK']=='') $pbo[$ntInfo['lcode'].'OK'] = (isset($pbo['liAccessToken']) && $pbo['liAccessTokenSecret']!='')?'1':'';
67
+ ?>
68
+ <p style="margin:0px;margin-left:5px;">
69
+ <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"; ?> />
70
+ <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>
71
+ &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;
72
+ <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>
73
+ </p><?php $this->showNTSettings($indx, $pbo);
74
+ }?>
75
+ </div>
76
+ </div> <?php
77
  }
78
  //#### Show NEW Settings Page
79
  function showNewNTSettings($bo){ $po = array('nName'=>'', 'ulName'=>'', 'uPass'=>'', 'grpID'=>'', 'uPage'=>'', 'doLI'=>'1', 'liAPIKey'=>'', 'liAPISec'=>'', 'liUserInfo'=>'', 'liAttch'=>'1', 'liOAuthToken'=>'', 'liMsgFormat'=>'New post has been published on %SITENAME%' ); $this->showNTSettings($bo, $po, true);}
80
  //#### Show Unit Settings
81
  function showNTSettings($ii, $options, $isNew=false){ global $nxs_plurl,$nxs_snapThisPageUrl; if (!isset($options['liOK'])) $options['liOK'] = ''; ?>
82
+ <div id="doLI<?php echo $ii; ?>Div" class="insOneDiv<?php if ($isNew) echo " clNewNTSets"; ?>" style="background-image: url(<?php echo $nxs_plurl; ?>img/li-bg.png); background-position:90% 10%;"> <input type="hidden" name="apDoSLI<?php echo $ii; ?>" value="0" id="apDoSLI<?php echo $ii; ?>" />
83
  <?php if ($isNew) { ?> <input type="hidden" name="li[<?php echo $ii; ?>][apDoLI]" value="1" id="apDoNewLI<?php echo $ii; ?>" /> <?php } ?>
84
  <div id="doLI<?php echo $ii; ?>Div" style="margin-left: 10px;">
85
 
86
+ <div class="nsx_iconedTitle" style="float: right; background-image: url(<?php echo $nxs_plurl; ?>img/li16.png);"><a style="font-size: 12px;" target="_blank" href="http://www.nextscripts.com/setup-installation-linkedin-social-networks-auto-poster-wordpress/"><?php $nType="LinkedIn"; printf( __( 'Detailed %s Installation/Configuration Instructions' , 'nxs_snap'), $nType); ?></a></div>
87
 
88
+ <div style="width:100%;"><strong><?php _e('Account Nickname', 'nxs_snap'); ?>:</strong> <i><?php _e('Just so you can easely identify it', 'nxs_snap'); ?></i> </div><input name="li[<?php echo $ii; ?>][nName]" id="linName<?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")), 'nxs_snap') ?>" /><br/>
89
  <?php echo nxs_addQTranslSel('li', $ii, $options['qTLng']); ?><?php echo nxs_addPostingDelaySel('li', $ii, $options['nHrs'], $options['nMin']); ?>
90
 
91
  <?php if (!$isNew) { ?>
92
+ <div style="width:100%;"><strong><?php _e('Categories', 'nxs_snap'); ?>:</strong>
93
  <input value="0" id="catSelA<?php echo $ii; ?>" type="radio" name="li[<?php echo $ii; ?>][catSel]" <?php if ((int)$options['catSel'] != 1) echo "checked"; ?> /> All
94
  <input value="1" id="catSelSLI<?php echo $ii; ?>" type="radio" name="li[<?php echo $ii; ?>][catSel]" <?php if ((int)$options['catSel'] == 1) echo "checked"; ?> /> <a href="#" style="text-decoration: none;" class="showCats" id="nxs_SCA_LI<?php echo $ii; ?>" onclick="jQuery('#catSelSLI<?php echo $ii; ?>').attr('checked', true); jQuery('#tmpCatSelNT').val('LI<?php echo $ii; ?>'); nxs_markCats( jQuery('#nxs_SC_LI<?php echo $ii; ?>').val() ); jQuery('#showCatSel').bPopup({ modalClose: false, appendTo: '#nsStForm', opacity: 0.6, follow: [false, false], position: [75, 'auto']}); return false;">Selected<?php if ($options['catSelEd']!='') echo "[".(substr_count($options['catSelEd'], ",")+1)."]"; ?></a>
95
  <input type="hidden" name="li[<?php echo $ii; ?>][catSelEd]" id="nxs_SC_LI<?php echo $ii; ?>" value="<?php echo $options['catSelEd']; ?>" />
96
+ <br/><i><?php _e('Only selected categories will be autoposted to this account', 'nxs_snap'); ?></i></div>
97
  <br/>
98
  <?php } ?>
99
 
106
 
107
  <div class="subDiv" id="sub<?php echo $ii; ?>DivL" style="display: block;">
108
 
109
+ <div style="width:100%;"><strong>Your LinkedIn API Key:</strong> </div><input name="li[<?php echo $ii; ?>][apLIAPIKey]" id="apLIAPIKey" style="width: 70%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['liAPIKey'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" />
110
+ <div style="width:100%;"><strong>Your LinkedIn API Secret:</strong> </div><input name="li[<?php echo $ii; ?>][apLIAPISec]" id="apLIAPISec" style="width: 70%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['liAPISec'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" />
111
 
112
+ <br/><br/><div style="width:100%;"><strong>Your LinkedIn Group ID:</strong><br/> Fill only if you are posting to LinkedIn Group. Leave empty to post to your profile. </div><input name="li[<?php echo $ii; ?>][grpID]" id="" style="width: 70%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['grpID'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" />
113
 
114
  <br/><br/>
115
  <?php
116
  if($options['liAPIKey']=='') { ?>
117
  <b>Authorize Your LinkedIn Account</b>. Please save your settings and come back here to Authorize your account.
118
  <?php } else { if(isset($options['liAccessToken']) && isset($options['liAccessTokenSecret']) && $options['liAccessTokenSecret']!=='') { ?>
119
+ Your LinkedIn Account has been authorized. <br/>User ID: <?php _e(apply_filters('format_to_edit', $options['liUserInfo']), 'nxs_snap') ?>.
120
  <br/>You can Re- <?php } ?>
121
  <a href="<?php echo $nxs_snapThisPageUrl; ?>&auth=li&acc=<?php echo $ii; ?>">Authorize Your LinkedIn Account</a>
122
 
133
  <?php if (function_exists("doConnectToLinkedIn")) { ?>
134
 
135
  <div class="subDiv" id="sub<?php echo $ii; ?>DivN" style="display: block;"> <span style="color:#800000; font-size: 14px;"> <b>Beta</b>, please <a target="_blank" href="http://www.nextscripts.com/support/">report</a> any problems.</span><br/><br/>
136
+ <div style="width:100%;"><strong>Your LinkedIn Page URL:</strong> Could be your company page or group page. Leave empty to post to your own profile.</div><input name="li[<?php echo $ii; ?>][uPage]" id="liuPage" style="width: 90%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['uPage'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" />
137
  <br/>
138
+ <div style="width:100%;"><strong>Your LinkedIn Username/Email:</strong> </div><input name="li[<?php echo $ii; ?>][ulName]" id="liulName" style="width: 70%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['ulName'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" />
139
+ <div style="width:100%;"><strong>Your LinkedIn Password:</strong> </div><input type="password" name="li[<?php echo $ii; ?>][uPass]" id="liuPass" style="width: 75%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['uPass'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" />
140
 
141
  </div>
142
 
156
  <strong>Publish Posts to LinkedIn as an Attachment</strong>
157
  </p>
158
  <div id="altFormat" style="<?php if ((int)$options['liAttch'] == 1) echo "margin-left: 10px;"; ?> ">
159
+ <div style="width:100%;"><strong id="altFormatText"><?php _e('Message text Format', 'nxs_snap'); ?>:</strong>
160
  <p style="font-size: 11px; margin: 0px;">%SITENAME% - Inserts the Your Blog/Site Name. &nbsp; %TITLE% - Inserts the Title of your post. &nbsp; %URL% - Inserts the URL of your post. &nbsp; %IMG% - Inserts the featured image. &nbsp; %IMG% - Inserts the featured image. &nbsp; %TEXT% - Inserts the excerpt of your post. &nbsp; %FULLTEXT% - Inserts the body(text) of your post, %AUTHORNAME% - Inserts the author's name.</p>
161
+ </div><input name="li[<?php echo $ii; ?>][apLIMsgFrmt]" id="apLIMsgFrmt" style="width: 50%;" value="<?php _e(apply_filters('format_to_edit',htmlentities($options['liMsgFormat'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" />
162
  </div><br/>
163
 
164
 
165
 
166
  <?php if($options['liAPIKey']!='' || (isset($options['uPass']) && $options['uPass']!='')) { ?>
167
  <?php wp_nonce_field( 'rePostToLI', 'rePostToLI_wpnonce' ); ?>
168
+ <br/><b><?php _e('Test your settings', 'nxs_snap'); ?>:</b>&nbsp;&nbsp;&nbsp; <a href="#" class="NXSButton" onclick="testPost('LI', '<?php echo $ii; ?>'); return false;"><?php printf( __( 'Submit Test Post to %s', 'nxs_snap' ), $nType); ?></a>
169
+
170
+ <?php if (!isset($options['liOK']) || $options['liOK']=='') { ?> <div class="blnkg">&lt;=== Click "Test" to finish setup ===</div> <?php } ?>
171
+
172
+ <br/><?php }?>
173
+ <div class="submit"><input type="submit" class="button-primary" name="update_NS_SNAutoPoster_settings" value="<?php _e('Update Settings', 'nxs_snap') ?>" /></div>
174
  </div>
175
  </div>
176
  <?php
202
  }
203
  //#### Show Post->Edit Meta Box Settings
204
  function showEdPostNTSettings($ntOpts, $post){ global $nxs_plurl; $post_id = $post->ID; //prr($ntOpts);
205
+ foreach($ntOpts as $ii=>$options) { $pMeta = maybe_unserialize(get_post_meta($post_id, 'snapLI', true)); if (is_array($pMeta)) $options = $this->adjMetaOpt($options, $pMeta[$ii]);
206
+ $doLI = $options['doLI'] && (is_array($pMeta) || $options['catSel']!='1');
207
  $isAvailLI = (isset($options['liOAuthVerifier']) && $options['liOAuthVerifier']!='' && $options['liAccessTokenSecret']!='' && $options['liAccessToken']!='' && $options['liAPIKey']!='') || ($options['ulName']!=='' && $options['uPass']!=='');
208
  $isAttachLI = $options['liAttch']; $liMsgFormat = htmlentities($options['liMsgFormat'], ENT_COMPAT, "UTF-8");
209
  ?>
210
 
211
  <tr><th style="text-align:left;" colspan="2"><?php if ( $options['catSel']=='1' && trim($options['catSelEd'])!='' ) { ?> <input type="hidden" class="nxs_SC" id="nxs_SC_LI<?php echo $ii; ?>" value="<?php echo $options['catSelEd']; ?>" /> <?php } ?>
212
+ <?php if ($isAvailLI) { ?><input class="nxsGrpDoChb" value="1" id="doLI<?php echo $ii; ?>" <?php if ($post->post_status == "publish") echo 'disabled="disabled"';?> type="checkbox" name="li[<?php echo $ii; ?>][doLI]" <?php if (($post->post_status == "publish" && $options['isPosted'] == '1') || ($post->post_status != "publish" && ((int)$doLI == 1)) ) echo 'checked="checked" title="def"'; ?> /> <?php } ?>
213
+ <div class="nsx_iconedTitle" style="display: inline; font-size: 13px; background-image: url(<?php echo $nxs_plurl; ?>img/li16.png);">LinkedIn - <?php _e('publish to', 'nxs_snap') ?> (<i style="color: #005800;"><?php echo $options['nName']; ?></i>)</div></th><td><?php //## Only show RePost button if the post is "published"
214
+ if ($post->post_status == "publish" && $isAvailLI) { ?><input alt="<?php echo $ii; ?>" style="float: right;" onmouseout="hidePopShAtt('SV');" onmouseover="showPopShAtt('SV', event);" onclick="return false;" type="button" class="button" name="rePostToLI_repostButton" id="rePostToLI_button" value="<?php _e('Repost to LinkedIn', 'nxs_snap') ?>" />
215
  <?php wp_nonce_field( 'rePostToLI', 'rePostToLI_wpnonce' ); } ?>
216
 
217
  <?php if (is_array($pMeta) && is_array($pMeta[$ii]) && isset($pMeta[$ii]['pgID']) ) {
218
  ?> <span id="pstdLI<?php echo $ii; ?>" style="float: right;padding-top: 4px; padding-right: 10px;">
219
+ <a style="font-size: 10px;" href="<?php if ($options['uPage']!='') echo $options['uPage']; else { echo $pMeta[$ii]['pgID']; } ?>" target="_blank"><?php $nType="LinkedIn"; printf( __( 'Posted on', 'nxs_snap' ), $nType); ?> <?php echo (isset($pMeta[$ii]['pDate']) && $pMeta[$ii]['pDate']!='')?(" (".$pMeta[$ii]['pDate'].")"):""; ?></a>
220
  </span><?php } ?>
221
 
222
  </td></tr>
227
  <input value="0" type="hidden" name="li[<?php echo $ii; ?>][AttachPost]"/>
228
  <input value="1" id="SNAP_AttachLI" onchange="doShowHideAltFormatX();" type="checkbox" name="li[<?php echo $ii; ?>][AttachPost]" <?php if ((int)$isAttachLI == 1) echo "checked"; ?> /> </th><td><strong>Publish Post to LinkedIn as Attachment</strong></td> </tr>
229
 
230
+ <tr id="altFormat1" style=""><th scope="row" style="text-align:right; width:60px; padding-right:10px;"><?php _e('Message Format:', 'nxs_snap') ?></th>
231
  <td><input value="<?php echo ($liMsgFormat); ?>" type="text" name="li[<?php echo $ii; ?>][SNAPformat]" style="width:60%;max-width: 610px;" onfocus="jQuery('.nxs_FRMTHint').hide();mxs_showFrmtInfo('apLIMsgFrmt<?php echo $ii; ?>');"/><?php nxs_doShowHint("apLIMsgFrmt".$ii); ?></td></tr>
232
 
233
  <?php }
237
  function adjMetaOpt($optMt, $pMeta){ if (isset($pMeta['isPosted'])) $optMt['isPosted'] = $pMeta['isPosted']; else $optMt['isPosted'] = '';
238
  if (isset($pMeta['SNAPformat'])) $optMt['liMsgFormat'] = $pMeta['SNAPformat']; if (trim($optMt['liMsgFormat'])=='') $optMt['liMsgFormat'] = '&nbsp;';
239
  if (isset($pMeta['AttachPost'])) $optMt['liAttch'] = $pMeta['AttachPost'] == 1?1:0; else { if (isset($pMeta['SNAPformat'])) $optMt['liAttch'] = 0; }
240
+ if (isset($pMeta['doLI'])) $optMt['doLI'] = $pMeta['doLI'] == 1?1:0; else { if (isset($pMeta['SNAPformat'])) $optMt['doLI'] = 0; }
241
+ if (isset($pMeta['SNAPincludeLI']) && $pMeta['SNAPincludeLI'] == '1' ) $optMt['doLI'] = 1;
242
+ return $optMt;
243
  }
244
  }}
245
 
290
  //$liPostID = $linkedin->getCurrentShare(); prr($liPostID);
291
  $liPostID = $options['liUserInfo'];
292
  }
293
+ if (stripos($ret, 'update-url')!==false) { $liPostID = CutFromTo($ret, '<update-url>','</update-url>'); $ret = '201'; }
294
  if ($ret!='201') { if ($postID=='0') prr($ret); nxs_addToLog($logNT, 'E', '-=ERROR=- '.print_r($ret, true), $extInfo); }
295
  else if ($postID=='0') { echo 'OK - Linkedin status updated successfully'; nxs_addToLog($logNT, 'M', 'OK - TEST Message Posted '); } else
296
  { nxs_metaMarkAsPosted($postID, 'LI', $options['ii'], array('isPosted'=>'1', 'pgID'=>$liPostID, 'pDate'=>date('Y-m-d H:i:s'))); nxs_addToLog($logNT, 'M', 'OK - Message Posted ', $extInfo); }
inc-cl/lj.php CHANGED
@@ -4,78 +4,96 @@ $nxs_snapAvNts[] = array('code'=>'LJ', 'lcode'=>'lj', 'name'=>'LiveJournal');
4
 
5
  if (!class_exists("nxs_snapClassLJ")) { class nxs_snapClassLJ {
6
  //#### Show Common Settings
7
- function showGenNTSettings($ntOpts){ global $nxs_snapThisPageUrl, $nxs_plurl, $nxsOne; $code = 'LJ'; $lcode = 'lj'; wp_nonce_field( 'ns'.$code, 'ns'.$code.'_wpnonce' ); ?>
8
- <hr/><div class="nsx_iconedTitle" style="background-image: url(<?php echo $nxs_plurl; ?>img/<?php echo $lcode; ?>16.png);">LiveJournal Blog Settings:
9
- <?php $cgpo = count($ntOpts); $mgpo = 1+max(array_keys($ntOpts)); $nxsOne .= "&g=1"; ?>
10
- <div class="nsBigText">You have <?php echo $cgpo=='0'?'No':$cgpo; ?> Blog account<?php if ($cgpo!=1){ ?>s<?php } ?> </div></div>
11
- <?php //if (function_exists('nxs_doSMAS1')) nxs_doSMAS1($this, $mgpo); else nxs_doSMAS('Google+', 'GP'.$mgpo); ?>
12
- <?php foreach ($ntOpts as $indx=>$gpo){ if (trim($gpo['nName']=='')) $gpo['nName'] = str_ireplace('/xmlrpc.php','', str_ireplace('http://','', str_ireplace('https://','', $gpo['ljURL']))); ?>
13
- <p style="margin: 0px; margin-left: 5px;">
14
- <input value="1" id="apDoLJ" name="lj[<?php echo $indx; ?>][apDoLJ]"type="checkbox" <?php if ((int)$gpo['doLJ'] == 1) echo "checked"; ?> />
15
- <strong>Auto-publish your Posts to your Blog <i style="color: #005800;"><?php if($gpo['nName']!='') echo "(".$gpo['nName'].")"; ?></i></strong>
16
- &nbsp;&nbsp;<a id="doLJ<?php echo $indx; ?>A" href="#" onclick="doShowHideBlocks2('LJ<?php echo $indx; ?>');return false;">[Show Settings]</a> &nbsp;&nbsp;
17
- <a href="#" onclick="doDelAcct('lj','<?php echo $indx; ?>', '<?php echo $gpo['ljUName']; ?>');return false;">[Remove Account]</a>
18
- </p>
19
- <?php $this->showNTSettings($indx, $gpo);
20
- } ?>
21
- <?php
22
- }
 
 
 
 
23
  //#### Show NEW Settings Page
24
  function showNewNTSettings($mgpo){ $gpo = array('nName'=>'', 'doLJ'=>'1', 'ljUName'=>'', 'ljPageID'=>'', 'ljAttch'=>'', 'ljPass'=>'', 'ljURL'=>''); $this->showNTSettings($mgpo, $gpo, true);}
25
  //#### Show Unit Settings
26
  function showNTSettings($ii, $gpo, $isNew=false){ global $nxs_plurl; ?>
27
- <div id="doLJ<?php echo $ii; ?>Div" <?php if ($isNew){ ?>class="clNewNTSets"<?php } ?> style="max-width: 1000px; background-color: #EBF4FB; background-image: url(<?php echo $nxs_plurl; ?>img/lj-bg.png); background-position:90% 10%; background-repeat: no-repeat; margin: 10px; border: 1px solid #808080; padding: 10px; display:none;"> <input type="hidden" name="apDoSLJ<?php echo $ii; ?>" value="0" id="apDoSLJ<?php echo $ii; ?>" />
28
 
29
- <div class="nsx_iconedTitle" style="float: right; background-image: url(<?php echo $nxs_plurl; ?>img/lj16.png);"><a style="font-size: 12px;" target="_blank" href="http://www.nextscripts.com/setup-installation-livejournal-social-networks-auto-poster-for-wordpress/">Detailed LiveJournal Installation/Configuration Instructions</a></div>
30
- <?php if ($isNew){ ?> <br/>You can setup LiveJournal blog.<br/><br/> <?php } ?>
31
 
32
- <div style="width:100%;"><strong>Account Nickname:</strong> <i>Just so you can easely identify it</i> </div><input name="lj[<?php echo $ii; ?>][nName]" id="ljnName<?php echo $ii; ?>" style="font-weight: bold; color: #005800; border: 1px solid #ACACAC; width: 40%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($gpo['nName'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" /><br/>
33
  <?php echo nxs_addQTranslSel('lj', $ii, $gpo['qTLng']); ?><?php echo nxs_addPostingDelaySel('lj', $ii, $gpo['nHrs'], $gpo['nMin']); ?>
34
 
35
  <?php if (!$isNew) { ?>
36
- <div style="width:100%;"><strong>Auto-Post Categories:</strong>
37
  <input value="0" id="catSelA<?php echo $ii; ?>" type="radio" name="lj[<?php echo $ii; ?>][catSel]" <?php if ((int)$gpo['catSel'] != 1) echo "checked"; ?> /> All
38
  <input value="1" id="catSelSLJ<?php echo $ii; ?>" type="radio" name="lj[<?php echo $ii; ?>][catSel]" <?php if ((int)$gpo['catSel'] == 1) echo "checked"; ?> /> <a href="#" style="text-decoration: none;" class="showCats" id="nxs_SCA_LJ<?php echo $ii; ?>" onclick="jQuery('#catSelSLJ<?php echo $ii; ?>').attr('checked', true); jQuery('#tmpCatSelNT').val('LJ<?php echo $ii; ?>'); nxs_markCats( jQuery('#nxs_SC_LJ<?php echo $ii; ?>').val() ); jQuery('#showCatSel').bPopup({ modalClose: false, appendTo: '#nsStForm', opacity: 0.6, follow: [false, false], position: [75, 'auto']}); return false;">Selected<?php if ($gpo['catSelEd']!='') echo "[".(substr_count($gpo['catSelEd'], ",")+1)."]"; ?></a>
39
  <input type="hidden" name="lj[<?php echo $ii; ?>][catSelEd]" id="nxs_SC_LJ<?php echo $ii; ?>" value="<?php echo $gpo['catSelEd']; ?>" />
40
- </div>
41
  <?php } ?>
42
- <div style="width:100%;"><br/><strong>LiveJournal Username:</strong> </div><input name="lj[<?php echo $ii; ?>][apLJUName]" id="apLJUName" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($gpo['ljUName'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" />
43
- <div style="width:100%;"><strong>LiveJournal Password:</strong> </div><input name="lj[<?php echo $ii; ?>][apLJPass]" id="apLJPass" type="password" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities(substr($gpo['ljPass'], 0, 5)=='n5g9a'?nsx_doDecode(substr($gpo['ljPass'], 5)):$gpo['ljPass'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" /> <br/>
 
 
 
 
 
 
 
 
 
 
 
44
 
45
  <?php if ($isNew) { ?> <input type="hidden" name="lj[<?php echo $ii; ?>][apDoLJ]" value="1" id="apDoNewLJ<?php echo $ii; ?>" /> <?php } ?>
46
 
47
- <br/><strong id="altFormatText">Post Title and Post Text Formats</strong>
48
- <p style="font-size: 11px; margin: 0px;">%SITENAME% - Inserts the Your Blog/Site Name. &nbsp; %TITLE% - Inserts the Title of your post. &nbsp; %URL% - Inserts the URL of your post. &nbsp; %TEXT% - Inserts the excerpt of your post. &nbsp; %FULLTEXT% - Inserts the body(text) of your post, %AUTHORNAME% - Inserts the author's name.</p>
49
  <div id="altFormat" style="">
50
- <div style="width:100%;"><strong id="altFormatText">Post Title Format</strong>
51
- </div><input name="lj[<?php echo $ii; ?>][apLJMsgTFrmt]" id="apLJMsgTFrmt" style="width: 50%;" value="<?php if ($isNew) echo "%TITLE%"; else _e(apply_filters('format_to_edit', htmlentities($gpo['ljMsgTFormat'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster'); ?>" />
52
  </div>
53
  <div id="altFormat" style="">
54
- <div style="width:100%;"><strong id="altFormatText">Post Text Format</strong>
55
- </div><input name="lj[<?php echo $ii; ?>][apLJMsgFrmt]" id="apLJMsgFrmt" style="width: 50%;" value="<?php if ($isNew) echo "%FULLTEXT%"; else _e(apply_filters('format_to_edit', htmlentities($gpo['ljMsgFormat'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster'); ?>" />
56
  </div><br/>
57
 
58
  <?php if ($gpo['ljPass']!='') { ?>
59
  <?php wp_nonce_field( 'rePostToLJ', 'rePostToLJ_wpnonce' ); ?>
60
- <b>Test your settings:</b>&nbsp;&nbsp;&nbsp; <a href="#" class="NXSButton" onclick="testPost('LJ', '<?php echo $ii; ?>'); return false;">Submit Test Post to LiveJournal</a>
61
 
62
  <?php }
63
 
64
- ?><div class="submit"><input type="submit" class="button-primary" name="update_NS_SNAutoPoster_settings" value="<?php _e('Update Settings', 'NS_SNAutoPoster') ?>" /></div></div><?php
65
  }
66
  //#### Set Unit Settings from POST
67
  function setNTSettings($post, $options){ global $nxs_snapThisPageUrl; $code = 'LJ'; $lcode = 'lj';
68
  foreach ($post as $ii => $pval){
69
  if (isset($pval['apLJUName']) && $pval['apLJUName']!=''){ if (!isset($options[$ii])) $options[$ii] = array();
70
  if (isset($pval['nName'])) $options[$ii]['nName'] = trim($pval['nName']);
71
- if (isset($pval['apLJUName'])) $options[$ii]['ljUName'] = trim($pval['apLJUName']); $options[$ii]['ljURL'] = 'http://'.$options[$ii]['ljUName'].'.livejournal.com';
 
72
  if (isset($pval['apLJPass'])) $options[$ii]['ljPass'] = 'n5g9a'.nsx_doEncode($pval['apLJPass']); else $options[$ii]['ljPass'] = '';
73
  if (isset($pval['apLJMsgFrmt'])) $options[$ii]['ljMsgFormat'] = trim($pval['apLJMsgFrmt']);
74
  if (isset($pval['apLJMsgTFrmt'])) $options[$ii]['ljMsgTFormat'] = trim($pval['apLJMsgTFrmt']);
75
-
76
  if (isset($pval['catSel'])) $options[$ii]['catSel'] = trim($pval['catSel']);
77
  if ($options[$ii]['catSel']=='1' && trim($pval['catSelEd'])!='') $options[$ii]['catSelEd'] = trim($pval['catSelEd']); else $options[$ii]['catSelEd'] = '';
78
-
 
 
 
 
79
  if (isset($pval['apDoLJ'])) $options[$ii]['doLJ'] = $pval['apDoLJ']; else $options[$ii]['doLJ'] = 0;
80
  if (isset($pval['delayHrs'])) $options[$ii]['nHrs'] = trim($pval['delayHrs']); if (isset($pval['delayMin'])) $options[$ii]['nMin'] = trim($pval['delayMin']);
81
  if (isset($pval['qTLng'])) $options[$ii]['qTLng'] = trim($pval['qTLng']);
@@ -84,18 +102,19 @@ if (!class_exists("nxs_snapClassLJ")) { class nxs_snapClassLJ {
84
  }
85
  //#### Show Post->Edit Meta Box Settings
86
  function showEdPostNTSettings($ntOpts, $post){ global $nxs_plurl; $post_id = $post->ID;
87
- foreach($ntOpts as $ii=>$ntOpt) { $pMeta = maybe_unserialize(get_post_meta($post_id, 'snapLJ', true)); if (is_array($pMeta)) $ntOpt = $this->adjMetaOpt($ntOpt, $pMeta[$ii]); $doLJ = $ntOpt['doLJ'] && $ntOpt['catSel']!='1';
 
88
  $isAvailLJ = $ntOpt['ljUName']!='' && $ntOpt['ljPass']!=''; $ljMsgFormat = htmlentities($ntOpt['ljMsgFormat'], ENT_COMPAT, "UTF-8"); $ljMsgTFormat = htmlentities($ntOpt['ljMsgTFormat'], ENT_COMPAT, "UTF-8");
89
  ?>
90
  <tr><th style="text-align:left;" colspan="2"><?php if ( $ntOpt['catSel']=='1' && trim($ntOpt['catSelEd'])!='' ) { ?> <input type="hidden" class="nxs_SC" id="nxs_SC_LJ<?php echo $ii; ?>" value="<?php echo $ntOpt['catSelEd']; ?>" /> <?php } ?>
91
- <?php if ($isAvailLJ) { ?><input class="nxsGrpDoChb" value="1" id="doLJ<?php echo $ii; ?>" <?php if ($post->post_status == "publish") echo 'disabled="disabled"';?> type="checkbox" name="lj[<?php echo $ii; ?>][SNAPincludeLJ]" <?php if (($post->post_status == "publish" && $ntOpt['isPosted'] == '1') || ($post->post_status != "publish" && ((int)$doLJ == 1)) ) echo 'checked="checked" title="def"'; ?> /> <?php } ?>
92
- <div class="nsx_iconedTitle" style="display: inline; font-size: 13px; background-image: url(<?php echo $nxs_plurl; ?>img/lj16.png);">LiveJournal - publish to (<i style="color: #005800;"><?php echo $ntOpt['nName']; ?></i>)</div></th> <td><?php //## Only show RePost button if the post is "published"
93
- if ($post->post_status == "publish" && $isAvailLJ) { ?><input alt="<?php echo $ii; ?>" style="float: right;" onmouseout="hidePopShAtt('SV');" onmouseover="shoLJopShAtt('SV', event);" onclick="return false;" type="button" class="button" name="rePostToLJ_repostButton" id="rePostToLJ_button" value="<?php _e('Repost to LiveJournal', 're-post') ?>" />
94
  <?php wp_nonce_field( 'rePostToLJ', 'rePostToLJ_wpnonce' ); } ?>
95
 
96
  <?php if (is_array($pMeta) && is_array($pMeta[$ii]) && isset($pMeta[$ii]['pgID']) ) {
97
  ?> <span id="pstdLJ<?php echo $ii; ?>" style="float: right;padding-top: 4px; padding-right: 10px;">
98
- <a style="font-size: 10px;" href="<?php echo $pMeta[$ii]['pgID']; ?>" target="_blank">Posted on LiveJournal <?php echo (isset($pMeta[$ii]['pDate']) && $pMeta[$ii]['pDate']!='')?(" (".$pMeta[$ii]['pDate'].")"):""; ?></a>
99
  </span><?php } ?>
100
 
101
  </td></tr>
@@ -103,10 +122,10 @@ if (!class_exists("nxs_snapClassLJ")) { class nxs_snapClassLJ {
103
  <?php if (!$isAvailLJ) { ?><tr><th scope="row" style="text-align:right; width:150px; padding-top: 5px; padding-right:10px;"></th> <td><b>Setup your LiveJournal Account to AutoPost to LiveJournal</b>
104
  <?php } elseif ($post->post_status != "puZblish") { ?>
105
 
106
- <tr id="altFormat1" style=""><th scope="row" style="text-align:right; width:60px; padding-right:10px;"><?php _e('Title Format:', 'NS_SPAP') ?></th>
107
  <td><input value="<?php echo $ljMsgTFormat ?>" type="text" name="lj[<?php echo $ii; ?>][SNAPformatT]" style="width:60%;max-width: 610px;" onfocus="jQuery('.nxs_FRMTHint').hide();mxs_showFrmtInfo('apLJTMsgFrmt<?php echo $ii; ?>');"/><?php nxs_doShowHint("apLJTMsgFrmt".$ii); ?></td></tr>
108
 
109
- <tr id="altFormat1" style=""><th scope="row" style="text-align:right; width:60px; padding-right:10px;"><?php _e('Text Format:', 'NS_SPAP') ?></th>
110
  <td><input value="<?php echo $ljMsgFormat ?>" type="text" name="lj[<?php echo $ii; ?>][SNAPformat]" style="width:60%;max-width: 610px;" onfocus="jQuery('.nxs_FRMTHint').hide();mxs_showFrmtInfo('apLJMsgFrmt<?php echo $ii; ?>');"/><?php nxs_doShowHint("apLJMsgFrmt".$ii); ?></td></tr>
111
 
112
  <?php }
@@ -116,7 +135,9 @@ if (!class_exists("nxs_snapClassLJ")) { class nxs_snapClassLJ {
116
  function adjMetaOpt($optMt, $pMeta){ if (isset($pMeta['isPosted'])) $optMt['isPosted'] = $pMeta['isPosted']; else $optMt['isPosted'] = '';
117
  if (isset($pMeta['SNAPformat'])) $optMt['ljMsgFormat'] = $pMeta['SNAPformat'];
118
  if (isset($pMeta['SNAPformatT'])) $optMt['ljMsgTFormat'] = $pMeta['SNAPformatT'];
119
- if (isset($pMeta['SNAPincludeLJ'])) $optMt['doLJ'] = $pMeta['SNAPincludeLJ'] == 1?1:0; else { if (isset($pMeta['SNAPformat'])) $optMt['doLJ'] = 0; } return $optMt;
 
 
120
  }
121
  }}
122
  if (!function_exists("nxs_rePostToLJ_ajax")) {
@@ -143,14 +164,15 @@ if (!function_exists("nxs_doPublishToLJ")) { //## Second Function to Post to LJ
143
  nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPrePosted'=>'1'));
144
  } //prr($msg); prr($msgFormat);
145
  //## Post
146
- require_once ('apis/xmlrpc-client.php'); $nxsToLJclient = new NXS_XMLRPC_Client('http://www.livejournal.com/interface/xmlrpc'); $nxsToLJclient->debug = false;
147
-
148
  $extInfo = ' | PostID: '.$postID." - ".$post->post_title; $logNT = '<span style="color:#2097EE">LJ</span> - '.$options['nName'];
149
 
150
  $date = time(); $year = date("Y", $date); $mon = date("m", $date); $day = date("d", $date); $hour = date("G", $date); $min = date("i", $date);
151
- $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);
152
- if (!$nxsToLJclient->query('LJ.XMLRPC.postevent', $nxsToLJContent)) { $ret = 'Something went wrong - '.$nxsToLJclient->getErrorCode().' : '.$nxsToLJclient->getErrorMessage();} else $ret = 'OK';
153
- $pid = $nxsToLJclient->getResponse(); if (is_array($pid)) $pid = $pid['url']; else { $ret = 'Something went wrong - '.print_r($pid, true);}
 
154
 
155
  if ($ret!='OK') { if ($postID=='0') echo $ret;
156
  nxs_addToLog($logNT, 'E', '-=ERROR=- '.print_r($ret, true), $extInfo);
4
 
5
  if (!class_exists("nxs_snapClassLJ")) { class nxs_snapClassLJ {
6
  //#### Show Common Settings
7
+ function showGenNTSettings($ntOpts){ global $nxs_plurl; $ntInfo = array('code'=>'LJ', 'lcode'=>'lj', 'name'=>'LiveJournal', 'defNName'=>'', 'tstReq' => false); ?>
8
+ <div class="nxs_box">
9
+ <div class="nxs_box_header">
10
+ <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']; ?>
11
+ <?php $cbo = count($ntOpts); ?> <?php wp_nonce_field( 'ns'.$ntInfo['code'], 'ns'.$ntInfo['code'].'_wpnonce' ); ?>
12
+ <?php if ($cbo>1){ ?><div class="nsBigText"><?php echo "(".($cbo=='0'?'No':$cbo)." "; _e('accounts', 'nxs_snap'); echo ")"; ?></div><?php } ?>
13
+ </div>
14
+ </div>
15
+ <div class="nxs_box_inside">
16
+ <?php foreach ($ntOpts as $indx=>$pbo){ if (trim($pbo['nName']=='')) $pbo['nName'] = str_ireplace('/xmlrpc.php','', str_ireplace('http://','', str_ireplace('https://','', $pbo['ljURL']))); ?>
17
+ <p style="margin:0px;margin-left:5px;">
18
+ <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"; ?> />
19
+ <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>
20
+ &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;
21
+ <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>
22
+ </p><?php $this->showNTSettings($indx, $pbo);
23
+ }?>
24
+ </div>
25
+ </div> <?php
26
+ }
27
  //#### Show NEW Settings Page
28
  function showNewNTSettings($mgpo){ $gpo = array('nName'=>'', 'doLJ'=>'1', 'ljUName'=>'', 'ljPageID'=>'', 'ljAttch'=>'', 'ljPass'=>'', 'ljURL'=>''); $this->showNTSettings($mgpo, $gpo, true);}
29
  //#### Show Unit Settings
30
  function showNTSettings($ii, $gpo, $isNew=false){ global $nxs_plurl; ?>
31
+ <div id="doLJ<?php echo $ii; ?>Div" class="insOneDiv<?php if ($isNew) echo " clNewNTSets"; ?>" style="background-image: url(<?php echo $nxs_plurl; ?>img/lj-bg.png); background-position:90% 10%;"> <input type="hidden" name="apDoSLJ<?php echo $ii; ?>" value="0" id="apDoSLJ<?php echo $ii; ?>" />
32
 
33
+ <div class="nsx_iconedTitle" style="float: right; background-image: url(<?php echo $nxs_plurl; ?>img/lj16.png);"><a style="font-size: 12px;" target="_blank" href="http://www.nextscripts.com/setup-installation-livejournal-social-networks-auto-poster-for-wordpress/"><?php $nType="LiveJournal"; printf( __( 'Detailed %s Installation/Configuration Instructions', 'nxs_snap' ), $nType); ?></a></div>
34
+ <?php if ($isNew){ ?> <br/><?php _e('You can setup LiveJournal blog.', 'nxs_snap'); ?><br/><br/> <?php } ?>
35
 
36
+ <div style="width:100%;"><strong><?php _e('Account Nickname', 'nxs_snap'); ?>:</strong> <i><?php _e('Just so you can easely identify it', 'nxs_snap'); ?></i> </div><input name="lj[<?php echo $ii; ?>][nName]" id="ljnName<?php echo $ii; ?>" style="font-weight: bold; color: #005800; border: 1px solid #ACACAC; width: 40%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($gpo['nName'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" /><br/>
37
  <?php echo nxs_addQTranslSel('lj', $ii, $gpo['qTLng']); ?><?php echo nxs_addPostingDelaySel('lj', $ii, $gpo['nHrs'], $gpo['nMin']); ?>
38
 
39
  <?php if (!$isNew) { ?>
40
+ <div style="width:100%;"><strong><?php _e('Categories', 'nxs_snap'); ?>:</strong>
41
  <input value="0" id="catSelA<?php echo $ii; ?>" type="radio" name="lj[<?php echo $ii; ?>][catSel]" <?php if ((int)$gpo['catSel'] != 1) echo "checked"; ?> /> All
42
  <input value="1" id="catSelSLJ<?php echo $ii; ?>" type="radio" name="lj[<?php echo $ii; ?>][catSel]" <?php if ((int)$gpo['catSel'] == 1) echo "checked"; ?> /> <a href="#" style="text-decoration: none;" class="showCats" id="nxs_SCA_LJ<?php echo $ii; ?>" onclick="jQuery('#catSelSLJ<?php echo $ii; ?>').attr('checked', true); jQuery('#tmpCatSelNT').val('LJ<?php echo $ii; ?>'); nxs_markCats( jQuery('#nxs_SC_LJ<?php echo $ii; ?>').val() ); jQuery('#showCatSel').bPopup({ modalClose: false, appendTo: '#nsStForm', opacity: 0.6, follow: [false, false], position: [75, 'auto']}); return false;">Selected<?php if ($gpo['catSelEd']!='') echo "[".(substr_count($gpo['catSelEd'], ",")+1)."]"; ?></a>
43
  <input type="hidden" name="lj[<?php echo $ii; ?>][catSelEd]" id="nxs_SC_LJ<?php echo $ii; ?>" value="<?php echo $gpo['catSelEd']; ?>" />
44
+ <br/><i><?php _e('Only selected categories will be autoposted to this account', 'nxs_snap'); ?></i></div>
45
  <?php } ?>
46
+ <div style="width:100%;"><br/><strong>LiveJournal Username:</strong> </div><input name="lj[<?php echo $ii; ?>][apLJUName]" id="apLJUName" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($gpo['ljUName'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" />
47
+ <div style="width:100%;"><strong>LiveJournal Password:</strong> </div><input name="lj[<?php echo $ii; ?>][apLJPass]" id="apLJPass" type="password" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities(substr($gpo['ljPass'], 0, 5)=='n5g9a'?nsx_doDecode(substr($gpo['ljPass'], 5)):$gpo['ljPass'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" /> <br/>
48
+
49
+ <div style="width:100%;"><br/><strong>Blog/Community URL or ID:</strong> Please specify the Blog or Community URL or ID. <i>Use this only if you are posting NOT to your own journal. </i></div>
50
+ <input name="lj[<?php echo $ii; ?>][commID]" id="commID" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($gpo['commID'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" />
51
+
52
+ <div style="width:100%;"><br/><strong>Website:</strong> Please select your website. <i>SNAP could also post to other LJ Engine Based sites like DreamWidth.org </i></div>
53
+
54
+ <select id="lj1delayHrs" name="lj[<?php echo $ii; ?>][ljSrv]"><option <?php if ( !isset($gpo['ljSrv']) || $gpo['ljSrv']=='' || $gpo['ljSrv']=='LJ') {?> selected="selected" <?php } ?> value="LJ">LiveJournal.com</option>
55
+ <option <?php if ( isset($gpo['ljSrv']) && $gpo['ljSrv']=='DW') {?> selected="selected" <?php } ?> value="DW">DreamWidth.org</option>
56
+ </select>
57
+
58
+ <br/>
59
 
60
  <?php if ($isNew) { ?> <input type="hidden" name="lj[<?php echo $ii; ?>][apDoLJ]" value="1" id="apDoNewLJ<?php echo $ii; ?>" /> <?php } ?>
61
 
62
+ <br/><strong id="altFormatText"><?php _e('Post Title and Post Text Formats', 'nxs_snap'); ?></strong>
 
63
  <div id="altFormat" style="">
64
+ <div style="width:100%;"><strong id="altFormatText"><?php _e('Post Title Format', 'nxs_snap'); ?></strong> (<a href="#" id="apLJMsgTFrmt<?php echo $ii; ?>HintInfo" onclick="mxs_showHideFrmtInfo('apLJMsgTFrmt<?php echo $ii; ?>'); return false;"><?php _e('Show format info', 'nxs_snap'); ?></a>)
65
+ </div><input name="lj[<?php echo $ii; ?>][apLJMsgTFrmt]" id="apLJMsgTFrmt<?php echo $ii; ?>" style="width: 50%;" value="<?php if ($isNew) echo "%TITLE%"; else _e(apply_filters('format_to_edit', htmlentities($gpo['ljMsgTFormat'], ENT_COMPAT, "UTF-8")), 'nxs_snap'); ?>" onfocus="mxs_showFrmtInfo('apLJMsgTFrmt<?php echo $ii; ?>');" /><?php nxs_doShowHint("apLJMsgTFrmt".$ii); ?>
66
  </div>
67
  <div id="altFormat" style="">
68
+ <div style="width:100%;"><strong id="altFormatText"><?php _e('Post Text Format', 'nxs_snap'); ?></strong> (<a href="#" id="apLJMsgFrmt<?php echo $ii; ?>HintInfo" onclick="mxs_showHideFrmtInfo('apLJMsgFrmt<?php echo $ii; ?>'); return false;"><?php _e('Show format info', 'nxs_snap'); ?></a>)
69
+ </div><input name="lj[<?php echo $ii; ?>][apLJMsgFrmt]" id="apLJMsgFrmt<?php echo $ii; ?>" style="width: 50%;" value="<?php if ($isNew) echo "%FULLTEXT%"; else _e(apply_filters('format_to_edit', htmlentities($gpo['ljMsgFormat'], ENT_COMPAT, "UTF-8")), 'nxs_snap'); ?>" onfocus="mxs_showFrmtInfo('apLJMsgFrmt<?php echo $ii; ?>');" /><?php nxs_doShowHint("apLJMsgFrmt".$ii); ?>
70
  </div><br/>
71
 
72
  <?php if ($gpo['ljPass']!='') { ?>
73
  <?php wp_nonce_field( 'rePostToLJ', 'rePostToLJ_wpnonce' ); ?>
74
+ <b><?php _e('Test your settings', 'nxs_snap'); ?>:</b>&nbsp;&nbsp;&nbsp; <a href="#" class="NXSButton" onclick="testPost('LJ', '<?php echo $ii; ?>'); return false;"><?php printf( __( 'Submit Test Post to %s', 'nxs_snap' ), $nType); ?></a>
75
 
76
  <?php }
77
 
78
+ ?><div class="submit"><input type="submit" class="button-primary" name="update_NS_SNAutoPoster_settings" value="<?php _e('Update Settings', 'nxs_snap') ?>" /></div></div><?php
79
  }
80
  //#### Set Unit Settings from POST
81
  function setNTSettings($post, $options){ global $nxs_snapThisPageUrl; $code = 'LJ'; $lcode = 'lj';
82
  foreach ($post as $ii => $pval){
83
  if (isset($pval['apLJUName']) && $pval['apLJUName']!=''){ if (!isset($options[$ii])) $options[$ii] = array();
84
  if (isset($pval['nName'])) $options[$ii]['nName'] = trim($pval['nName']);
85
+ if (isset($pval['ljSrv'])) $options[$ii]['ljSrv'] = trim($pval['ljSrv']); if ($options[$ii]['ljSrv']=='DW') $server = 'dreamwidth.org'; else $server = 'livejournal.com';
86
+ if (isset($pval['apLJUName'])) $options[$ii]['ljUName'] = trim($pval['apLJUName']); $options[$ii]['ljURL'] = 'http://'.$options[$ii]['ljUName'].$server;
87
  if (isset($pval['apLJPass'])) $options[$ii]['ljPass'] = 'n5g9a'.nsx_doEncode($pval['apLJPass']); else $options[$ii]['ljPass'] = '';
88
  if (isset($pval['apLJMsgFrmt'])) $options[$ii]['ljMsgFormat'] = trim($pval['apLJMsgFrmt']);
89
  if (isset($pval['apLJMsgTFrmt'])) $options[$ii]['ljMsgTFormat'] = trim($pval['apLJMsgTFrmt']);
 
90
  if (isset($pval['catSel'])) $options[$ii]['catSel'] = trim($pval['catSel']);
91
  if ($options[$ii]['catSel']=='1' && trim($pval['catSelEd'])!='') $options[$ii]['catSelEd'] = trim($pval['catSelEd']); else $options[$ii]['catSelEd'] = '';
92
+
93
+ if (isset($pval['commID'])) {
94
+ if (stripos($pval['commID'], '.')!==false) $pval['commID'] = CutFromTo($pval['commID'], '://', '.');
95
+ $options[$ii]['commID'] = trim($pval['commID']);
96
+ }
97
  if (isset($pval['apDoLJ'])) $options[$ii]['doLJ'] = $pval['apDoLJ']; else $options[$ii]['doLJ'] = 0;
98
  if (isset($pval['delayHrs'])) $options[$ii]['nHrs'] = trim($pval['delayHrs']); if (isset($pval['delayMin'])) $options[$ii]['nMin'] = trim($pval['delayMin']);
99
  if (isset($pval['qTLng'])) $options[$ii]['qTLng'] = trim($pval['qTLng']);
102
  }
103
  //#### Show Post->Edit Meta Box Settings
104
  function showEdPostNTSettings($ntOpts, $post){ global $nxs_plurl; $post_id = $post->ID;
105
+ foreach($ntOpts as $ii=>$ntOpt) { $pMeta = maybe_unserialize(get_post_meta($post_id, 'snapLJ', true)); if (is_array($pMeta)) $ntOpt = $this->adjMetaOpt($ntOpt, $pMeta[$ii]);
106
+ $doLJ = $ntOpt['doLJ'] && (is_array($pMeta) || $ntOpt['catSel']!='1');
107
  $isAvailLJ = $ntOpt['ljUName']!='' && $ntOpt['ljPass']!=''; $ljMsgFormat = htmlentities($ntOpt['ljMsgFormat'], ENT_COMPAT, "UTF-8"); $ljMsgTFormat = htmlentities($ntOpt['ljMsgTFormat'], ENT_COMPAT, "UTF-8");
108
  ?>
109
  <tr><th style="text-align:left;" colspan="2"><?php if ( $ntOpt['catSel']=='1' && trim($ntOpt['catSelEd'])!='' ) { ?> <input type="hidden" class="nxs_SC" id="nxs_SC_LJ<?php echo $ii; ?>" value="<?php echo $ntOpt['catSelEd']; ?>" /> <?php } ?>
110
+ <?php if ($isAvailLJ) { ?><input class="nxsGrpDoChb" value="1" id="doLJ<?php echo $ii; ?>" <?php if ($post->post_status == "publish") echo 'disabled="disabled"';?> type="checkbox" name="lj[<?php echo $ii; ?>][doLJ]" <?php if (($post->post_status == "publish" && $ntOpt['isPosted'] == '1') || ($post->post_status != "publish" && ((int)$doLJ == 1)) ) echo 'checked="checked" title="def"'; ?> /> <?php } ?>
111
+ <div class="nsx_iconedTitle" style="display: inline; font-size: 13px; background-image: url(<?php echo $nxs_plurl; ?>img/lj16.png);">LiveJournal - <?php _e('publish to', 'nxs_snap') ?> (<i style="color: #005800;"><?php echo $ntOpt['nName']; ?></i>)</div></th> <td><?php //## Only show RePost button if the post is "published"
112
+ if ($post->post_status == "publish" && $isAvailLJ) { ?><input alt="<?php echo $ii; ?>" style="float: right;" onmouseout="hidePopShAtt('SV');" onmouseover="shoLJopShAtt('SV', event);" onclick="return false;" type="button" class="button" name="rePostToLJ_repostButton" id="rePostToLJ_button" value="<?php _e('Repost to LiveJournal', 'nxs_snap') ?>" />
113
  <?php wp_nonce_field( 'rePostToLJ', 'rePostToLJ_wpnonce' ); } ?>
114
 
115
  <?php if (is_array($pMeta) && is_array($pMeta[$ii]) && isset($pMeta[$ii]['pgID']) ) {
116
  ?> <span id="pstdLJ<?php echo $ii; ?>" style="float: right;padding-top: 4px; padding-right: 10px;">
117
+ <a style="font-size: 10px;" href="<?php echo $pMeta[$ii]['pgID']; ?>" target="_blank"><?php $nType="LiveJournal"; printf( __( 'Posted on', 'nxs_snap' ), $nType); ?> <?php echo (isset($pMeta[$ii]['pDate']) && $pMeta[$ii]['pDate']!='')?(" (".$pMeta[$ii]['pDate'].")"):""; ?></a>
118
  </span><?php } ?>
119
 
120
  </td></tr>
122
  <?php if (!$isAvailLJ) { ?><tr><th scope="row" style="text-align:right; width:150px; padding-top: 5px; padding-right:10px;"></th> <td><b>Setup your LiveJournal Account to AutoPost to LiveJournal</b>
123
  <?php } elseif ($post->post_status != "puZblish") { ?>
124
 
125
+ <tr id="altFormat1" style=""><th scope="row" style="text-align:right; width:60px; padding-right:10px;"><?php _e('Title Format:', 'nxs_snap') ?></th>
126
  <td><input value="<?php echo $ljMsgTFormat ?>" type="text" name="lj[<?php echo $ii; ?>][SNAPformatT]" style="width:60%;max-width: 610px;" onfocus="jQuery('.nxs_FRMTHint').hide();mxs_showFrmtInfo('apLJTMsgFrmt<?php echo $ii; ?>');"/><?php nxs_doShowHint("apLJTMsgFrmt".$ii); ?></td></tr>
127
 
128
+ <tr id="altFormat1" style=""><th scope="row" style="text-align:right; width:60px; padding-right:10px;"><?php _e('Text Format:', 'nxs_snap') ?></th>
129
  <td><input value="<?php echo $ljMsgFormat ?>" type="text" name="lj[<?php echo $ii; ?>][SNAPformat]" style="width:60%;max-width: 610px;" onfocus="jQuery('.nxs_FRMTHint').hide();mxs_showFrmtInfo('apLJMsgFrmt<?php echo $ii; ?>');"/><?php nxs_doShowHint("apLJMsgFrmt".$ii); ?></td></tr>
130
 
131
  <?php }
135
  function adjMetaOpt($optMt, $pMeta){ if (isset($pMeta['isPosted'])) $optMt['isPosted'] = $pMeta['isPosted']; else $optMt['isPosted'] = '';
136
  if (isset($pMeta['SNAPformat'])) $optMt['ljMsgFormat'] = $pMeta['SNAPformat'];
137
  if (isset($pMeta['SNAPformatT'])) $optMt['ljMsgTFormat'] = $pMeta['SNAPformatT'];
138
+ if (isset($pMeta['doLJ'])) $optMt['doLJ'] = $pMeta['doLJ'] == 1?1:0; else { if (isset($pMeta['SNAPformat'])) $optMt['doLJ'] = 0; }
139
+ if (isset($pMeta['SNAPincludeLJ']) && $pMeta['SNAPincludeLJ'] == '1' ) $optMt['doLJ'] = 1;
140
+ return $optMt;
141
  }
142
  }}
143
  if (!function_exists("nxs_rePostToLJ_ajax")) {
164
  nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPrePosted'=>'1'));
165
  } //prr($msg); prr($msgFormat);
166
  //## Post
167
+ require_once ('apis/xmlrpc-client.php'); if ($options['ljSrv']=='DW') $server = 'dreamwidth.org'; else $server = 'livejournal.com';
168
+ $nxsToLJclient = new NXS_XMLRPC_Client('http://www.'.$server.'/interface/xmlrpc'); $nxsToLJclient->debug = false;
169
  $extInfo = ' | PostID: '.$postID." - ".$post->post_title; $logNT = '<span style="color:#2097EE">LJ</span> - '.$options['nName'];
170
 
171
  $date = time(); $year = date("Y", $date); $mon = date("m", $date); $day = date("d", $date); $hour = date("G", $date); $min = date("i", $date);
172
+ $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);
173
+ if ($options['commID']!='') $nxsToLJContent["usejournal"] = $options['commID'];
174
+ if (!$nxsToLJclient->query('LJ.XMLRPC.postevent', $nxsToLJContent)) { $ret = 'Something went wrong - '.$nxsToLJclient->getErrorCode().' : '.$nxsToLJclient->getErrorMessage();} else $ret = 'OK';
175
+ $pid = $nxsToLJclient->getResponse(); if (is_array($pid)) $pid = $pid['url']; else { $ret = 'Something went wrong - NO PID '.print_r($pid, true);}
176
 
177
  if ($ret!='OK') { if ($postID=='0') echo $ret;
178
  nxs_addToLog($logNT, 'E', '-=ERROR=- '.print_r($ret, true), $extInfo);
inc-cl/pk.php CHANGED
@@ -6,7 +6,7 @@ if (!class_exists("nxs_snapClassPK")) { class nxs_snapClassPK {
6
 
7
  function pkCats() { return '<option value="">:freestyle(None)</option><option value="loves">loves</option><option value="likes">likes</option><option value="shares">shares</option><option value="gives">gives</option><option value="hates">hates</option><option value="wants">wants</option><option value="wishes">wishes</option><option value="needs">needs</option><option value="will">will</option><option value="hopes">hopes</option><option value="asks">asks</option><option value="has">has</option><option value="was">was</option><option value="wonders">wonders</option><option value="feels on">feels</option><option value="thinks">thinks</option><option value="says">says</option><option value="is">is</option>';}
8
  //#### Show Common Settings
9
- function showGenNTSettings($ntOpts){ global $nxs_snapThisPageUrl, $nxs_plurl; $code = 'PK'; $lcode = 'pk'; wp_nonce_field( 'ns'.$code, 'ns'.$code.'_wpnonce' );
10
  if ( isset($_GET['auth']) && $_GET['auth']=='pk'){ require_once('apis/plurkOAuth.php'); $options = $ntOpts[$_GET['acc']];
11
  $consumer_key = $options['pkConsKey']; $consumer_secret = $options['pkConsSec'];
12
  $callback_url = $nxs_snapThisPageUrl."&auth=pka&acc=".$_GET['acc'];
@@ -42,43 +42,51 @@ if (!class_exists("nxs_snapClassPK")) { class nxs_snapClassPK {
42
  if ($options['pkPgID']!='') { echo '<br/><br/>All good?! Redirecting ..... <script type="text/javascript">window.location = "'.$nxs_snapThisPageUrl.'"</script>'; break; die();}
43
  else die("<span style='color:red;'>ERROR: Authorization Error: <span style='color:darkred; font-weight: bold;'>".$options['pkPgID']."</span></span>");
44
  }
45
- ?>
46
- <hr/><div class="nsx_iconedTitle" style="background-image: url(<?php echo $nxs_plurl; ?>img/<?php echo $lcode; ?>16.png);">Plurk Settings: <?php $cfbo = count($ntOpts); $mfbo = 1+max(array_keys($ntOpts)); ?> <?php wp_nonce_field( 'nsFB', 'nsFB_wpnonce' ); ?>
47
- <div class="nsBigText">You have <?php echo $cfbo=='0'?'No':$cfbo; ?> Plurk account<?php if ($cfbo!=1){ ?>s<?php } ?> <!-- - <a href="#" class="NXSButton" onclick="doShowHideBlocks2('FB<?php echo $mfbo; ?>');return false;">Add new Facebook Account</a> --> </div></div>
48
-
49
- <?php // if (function_exists('nxs_doSMAS1')) nxs_doSMAS1($this, $mfbo); else nxs_doSMAS('Plurk', 'TR'.$mfbo); ?>
50
- <?php foreach ($ntOpts as $indx=>$pbo){ if (trim($pbo['nName']=='')) $pbo['nName'] = str_ireplace('https://','', str_ireplace('http://','', $pbo['pkURL'])); ?>
51
- <p style="margin: 0px;margin-left: 5px;"><input value="1" id="apDoPK" name="pk[<?php echo $indx; ?>][apDoPK]" type="checkbox" <?php if ((int)$pbo['doPK'] == 1) echo "checked"; ?> />
52
- <strong>Auto-publish your Posts to your Plurk Blog <i style="color: #005800;"><?php if($pbo['nName']!='') echo "(".$pbo['nName'].")"; ?></i> </strong>
53
- &nbsp;&nbsp;<a id="doPK<?php echo $indx; ?>A" href="#" onclick="doShowHideBlocks2('PK<?php echo $indx; ?>');return false;">[Show Settings]</a>&nbsp;&nbsp;
54
- <a href="#" onclick="doDelAcct('pk', '<?php echo $indx; ?>', '<?php if (isset($pbo['pkURL'])) echo $pbo['pkURL']; ?>');return false;">[Remove Account]</a>
55
- </p><?php $this->showNTSettings($indx, $pbo);
56
- } //## END TR Settings
 
 
 
 
 
 
 
 
57
  }
58
  //#### Show NEW Settings Page
59
  function showNewNTSettings($bo){ $po = array('nName'=>'', 'doPK'=>'1', 'pkURL'=>'', 'pkPgID'=>'', 'pkConsKey'=>'', 'pkInclTags'=>'1', 'cImgURL'=>'R', 'pkConsSec'=>'', 'pkPostType'=>'T', 'pkDefImg'=>'', 'pkOAuthTokenSecret'=>'', 'pkAccessTocken'=>'', 'pkMsgFormat'=>'%TITLE% - %URL%'); $this->showNTSettings($bo, $po, true);}
60
  //#### Show Unit Settings
61
  function showNTSettings($ii, $options, $isNew=false){ global $nxs_plurl,$nxs_snapThisPageUrl; ?>
62
- <div id="doPK<?php echo $ii; ?>Div"<?php if ($isNew){ ?>class="clNewNTSets"<?php } ?> style="max-width: 1000px; background-color: #EBF4FB; background-image: url(<?php echo $nxs_plurl; ?>img/pk-bg.png); background-position:90% 10%; background-repeat: no-repeat; margin: 10px; border: 1px solid #808080; padding: 10px; <?php if ((isset($options['pkOAuthTokenSecret']) && $options['pkOAuthTokenSecret']!='')||$isNew) { ?>display:none;<?php } ?>"> <input type="hidden" name="apDoSPK<?php echo $ii; ?>" value="0" id="apDoSPK<?php echo $ii; ?>" />
63
  <?php if ($isNew) { ?> <input type="hidden" name="pk[<?php echo $ii; ?>][apDoPK]" value="1" id="apDoNewPK<?php echo $ii; ?>" /> <?php } ?>
64
 
65
- <div class="nsx_iconedTitle" style="float: right; background-image: url(<?php echo $nxs_plurl; ?>img/pk16.png);"><a style="font-size: 12px;" target="_blank" href="http://www.nextscripts.com/setup-installation-plurk-social-networks-auto-poster-wordpress/">Detailed Plurk Installation/Configuration Instructions</a></div>
66
 
67
- <div style="width:100%;"><strong>Account Nickname:</strong> <i>Just so you can easely identify it</i> </div><input name="pk[<?php echo $ii; ?>][nName]" id="pknName<?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")), 'NS_SNAutoPoster') ?>" /><br/>
68
  <?php echo nxs_addQTranslSel('pk', $ii, $options['qTLng']); ?><?php echo nxs_addPostingDelaySel('pk', $ii, $options['nHrs'], $options['nMin']); ?>
69
 
70
  <?php if (!$isNew) { ?>
71
- <div style="width:100%;"><strong>Auto-Post Categories:</strong>
72
  <input value="0" id="catSelA<?php echo $ii; ?>" type="radio" name="pk[<?php echo $ii; ?>][catSel]" <?php if ((int)$options['catSel'] != 1) echo "checked"; ?> /> All
73
  <input value="1" id="catSelSPK<?php echo $ii; ?>" type="radio" name="pk[<?php echo $ii; ?>][catSel]" <?php if ((int)$options['catSel'] == 1) echo "checked"; ?> /> <a href="#" style="text-decoration: none;" class="showCats" id="nxs_SCA_PK<?php echo $ii; ?>" onclick="jQuery('#catSelSPK<?php echo $ii; ?>').attr('checked', true); jQuery('#tmpCatSelNT').val('PK<?php echo $ii; ?>'); nxs_markCats( jQuery('#nxs_SC_PK<?php echo $ii; ?>').val() ); jQuery('#showCatSel').bPopup({ modalClose: false, appendTo: '#nsStForm', opacity: 0.6, follow: [false, false], position: [75, 'auto']}); return false;">Selected<?php if ($options['catSelEd']!='') echo "[".(substr_count($options['catSelEd'], ",")+1)."]"; ?></a>
74
  <input type="hidden" name="pk[<?php echo $ii; ?>][catSelEd]" id="nxs_SC_PK<?php echo $ii; ?>" value="<?php echo $options['catSelEd']; ?>" />
75
- </div>
76
  <br/>
77
  <?php } ?>
78
 
79
- <div style="width:100%;"><strong>Your Plurk URL:</strong> </div><input onchange="nxsPKURLVal(<?php echo $ii; ?>);" name="pk[<?php echo $ii; ?>][apPKURL]" id="apPKURL<?php echo $ii; ?>" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['pkURL'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" /><span style="color: #F00000;" id="apPKURLerr<?php echo $ii; ?>"></span>
80
- <div style="width:100%;"><strong>Your Plurk App Key:</strong> </div><input name="pk[<?php echo $ii; ?>][apPKConsKey]" id="apPKConsKey" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['pkConsKey'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" />
81
- <div style="width:100%;"><strong>Your Plurk App Secret:</strong> </div><input name="pk[<?php echo $ii; ?>][apPKConsSec]" id="apPKConsSec" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['pkConsSec'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" />
82
  <br/><br/>
83
 
84
  <div id="altFormat" style="">
@@ -94,16 +102,16 @@ if (!class_exists("nxs_snapClassPK")) { class nxs_snapClassPK {
94
  <p style="margin: 0px;"><input value="1" id="apLIAttch" type="checkbox" name="pk[<?php echo $ii; ?>][attchImg]" <?php if ((int)$options['attchImg'] == 1) echo "checked"; ?> /> <strong>Attach Image to Plurk Post</strong></p>
95
  <br/>
96
 
97
- <div style="width:100%;"><strong id="altFormatText">Post Text Format:</strong> (<a href="#" id="apPKMsgFrmt<?php echo $ii; ?>HintInfo" onclick="mxs_showHideFrmtInfo('apPKMsgFrmt<?php echo $ii; ?>'); return false;">Show format info</a>) </div>
98
 
99
- <input name="pk[<?php echo $ii; ?>][apPKMsgFrmt]" id="apPKMsgFrmt" style="width: 50%;" value="<?php if ($options['pkMsgFormat']!='') _e(apply_filters('format_to_edit', htmlentities($options['pkMsgFormat'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster'); else echo htmlentities("%TITLE% - %URL%"); ?>" onfocus="jQuery('#apPKMsgFrmt<?php echo $ii; ?>Hint').show();" /><br/>
100
  <?php nxs_doShowHint("apPKMsgFrmt".$ii); ?>
101
  <br/>
102
  <?php
103
  if($options['pkConsSec']=='') { ?>
104
  <b>Authorize Your Plurk Account</b>. Please save your settings and come back here to Authorize your account.
105
  <?php } else { if(isset($options['pkAccessTocken']) && isset($options['pkAccessTocken']['oauth_token_secret']) && $options['pkAccessTocken']['oauth_token_secret']!=='') { ?>
106
- Your Plurk Account has been authorized. Your display name: <?php _e(apply_filters('format_to_edit', htmlentities($options['pkPgID'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>.
107
  You can Re- <?php } ?>
108
  <a href="<?php echo $nxs_snapThisPageUrl;?>&auth=pk&acc=<?php echo $ii; ?>">Authorize Your Plurk Account</a>
109
  <?php if (!isset($options['pkOAuthTokenSecret']) || $options['pkOAuthTokenSecret']=='') { ?> <div class="blnkg">&lt;=== Authorize your account ===</div> <?php } ?>
@@ -112,9 +120,9 @@ if (!class_exists("nxs_snapClassPK")) { class nxs_snapClassPK {
112
 
113
  <?php if( isset($options['pkOAuthTokenSecret']) && $options['pkOAuthTokenSecret']!='') { ?>
114
  <?php wp_nonce_field( 'rePostToPK', 'rePostToPK_wpnonce' ); ?>
115
- <br/><br/><b>Test your settings:</b>&nbsp;&nbsp;&nbsp; <a href="#" class="NXSButton" onclick="testPost('PK', '<?php echo $ii; ?>'); return false;">Submit Test Post to Plurk</a> <br/><br/>
116
  <?php }?>
117
- <div class="submit"><input type="submit" class="button-primary" name="update_NS_SNAutoPoster_settings" value="<?php _e('Update Settings', 'NS_SNAutoPoster') ?>" /></div>
118
 
119
  </div>
120
  <?php
@@ -148,20 +156,21 @@ if (!class_exists("nxs_snapClassPK")) { class nxs_snapClassPK {
148
  }
149
  //#### Show Post->Edit Meta Box Settings
150
  function showEdPostNTSettings($ntOpts, $post){ global $nxs_plurl; $post_id = $post->ID;
151
- foreach($ntOpts as $ii=>$options) {$pMeta = maybe_unserialize(get_post_meta($post_id, 'snapPK', true)); if (is_array($pMeta)) $options = $this->adjMetaOpt($options, $pMeta[$ii]); $doPK = $options['doPK'] && $options['catSel']!='1';
 
152
  $isAvailPK = isset($options['pkAccessTocken']) && isset($options['pkAccessTocken']['oauth_token_secret']) && $options['pkAccessTocken']['oauth_token_secret']!=='';
153
  $pkMsgFormat = htmlentities($options['pkMsgFormat'], ENT_COMPAT, "UTF-8"); $pkMsgTFormat = htmlentities($options['pkMsgTFormat'], ENT_COMPAT, "UTF-8");
154
  ?>
155
 
156
  <tr><th style="text-align:left;" colspan="2"><?php if ( $options['catSel']=='1' && trim($options['catSelEd'])!='' ) { ?> <input type="hidden" class="nxs_SC" id="nxs_SC_PK<?php echo $ii; ?>" value="<?php echo $options['catSelEd']; ?>" /> <?php } ?>
157
- <?php if ($isAvailPK) { ?><input class="nxsGrpDoChb" value="1" id="doPK<?php echo $ii; ?>" <?php if ($post->post_status == "publish") echo 'disabled="disabled"';?> type="checkbox" name="pk[<?php echo $ii; ?>][SNAPincludePK]" <?php if (($post->post_status == "publish" && $options['isPosted'] == '1') || ($post->post_status != "publish" && ((int)$doPK == 1)) ) echo 'checked="checked" title="def"'; ?> /> <?php } ?>
158
- <div class="nsx_iconedTitle" style="display: inline; font-size: 13px; background-image: url(<?php echo $nxs_plurl; ?>img/pk16.png);">Plurk - publish to (<i style="color: #005800;"><?php echo $options['nName']; ?></i>) </div></th><td><?php //## Only show RePost button if the post is "published"
159
- if ($post->post_status == "publish" && $isAvailPK) { ?><input alt="<?php echo $ii; ?>" style="float: right;" onmouseout="hidePopShAtt('SV');" onmouseover="showPopShAtt('SV', event);" onclick="return false;" type="button" class="button" name="rePostToPK_repostButton" id="rePostToPK_button" value="<?php _e('Repost to Plurk', 're-post') ?>" />
160
  <?php wp_nonce_field( 'rePostToPK', 'rePostToPK_wpnonce' ); } ?>
161
 
162
  <?php if (is_array($pMeta) && is_array($pMeta[$ii]) && isset($pMeta[$ii]['pgID']) ) {
163
  ?> <span id="pstdPK<?php echo $ii; ?>" style="float: right;padding-top: 4px; padding-right: 10px;">
164
- <a style="font-size: 10px;" href="http://www.plurk.com/p/<?php echo base_convert($pMeta[$ii]['pgID'], 10, 36); ?>" target="_blank">Posted on Plurk <?php echo (isset($pMeta[$ii]['pDate']) && $pMeta[$ii]['pDate']!='')?(" (".$pMeta[$ii]['pDate'].")"):""; ?></a>
165
  </span><?php } ?>
166
 
167
  </td></tr>
@@ -179,7 +188,7 @@ if (!class_exists("nxs_snapClassPK")) { class nxs_snapClassPK {
179
  ?>
180
  </select></td></tr>
181
 
182
- <tr id="altFormat1" style=""><th scope="row" style="text-align:right; width:60px; padding-right:10px;"><?php _e('Text Format:', 'NS_SPAP') ?></th>
183
  <td><input value="<?php echo $pkMsgFormat ?>" type="text" name="pk[<?php echo $ii; ?>][SNAPformat]" style="width:60%;max-width: 610px;" onfocus="jQuery('.nxs_FRMTHint').hide();mxs_showFrmtInfo('apPKMsgFrmt<?php echo $ii; ?>');"/><?php nxs_doShowHint("apPKMsgFrmt".$ii); ?></td></tr>
184
 
185
  <?php }
@@ -190,7 +199,9 @@ if (!class_exists("nxs_snapClassPK")) { class nxs_snapClassPK {
190
  function adjMetaOpt($optMt, $pMeta){ if (isset($pMeta['isPosted'])) $optMt['isPosted'] = $pMeta['isPosted']; else $optMt['isPosted'] = '';
191
  if (isset($pMeta['SNAPformat'])) $optMt['pkMsgFormat'] = $pMeta['SNAPformat'];
192
  if (isset($pMeta['Cat'])) $optMt['pkCat'] = $pMeta['Cat'];
193
- if (isset($pMeta['SNAPincludePK'])) $optMt['doPK'] = $pMeta['SNAPincludePK'] == 1?1:0; else { if (isset($pMeta['SNAPformat'])) $optMt['doPK'] = 0; }return $optMt;
 
 
194
  }
195
  }}
196
 
@@ -264,7 +275,7 @@ if (!function_exists("nxs_doPublishToPK")) { //## Second Function to Post to TR
264
  if (is_array($postinfo) && isset($postinfo['plurk_id'])) $pkID = $postinfo['plurk_id'];
265
 
266
  $code = $tum_oauth->http_code;// echo "XX".print_r($code); prr($postinfo); // prr($msg); prr($postinfo); echo $code."VVVV"; die("|====");
267
- if ($code == 200) { if ($postID=='0') { nxs_addToLog($logNT, 'M', 'OK - TEST Message Posted '); echo 'OK - Message Posted, please see your Plurk Page. <br/> Result:'; prr($postinfo); }
268
  else { nxs_addToLog($logNT, 'M', 'OK - Message Posted ', $extInfo); nxs_metaMarkAsPosted($postID, 'PK', $options['ii'], array('isPosted'=>'1', 'pgID'=>$pkID, 'pDate'=>date('Y-m-d H:i:s'))); } }
269
  else { nxs_addToLog($logNT, 'E', '-=ERROR=- '.print_r($postinfo, true), $extInfo); if ($postID=='0') prr($postinfo); $code .= " ERROR: - ".$postinfo['error_text']; }
270
 
6
 
7
  function pkCats() { return '<option value="">:freestyle(None)</option><option value="loves">loves</option><option value="likes">likes</option><option value="shares">shares</option><option value="gives">gives</option><option value="hates">hates</option><option value="wants">wants</option><option value="wishes">wishes</option><option value="needs">needs</option><option value="will">will</option><option value="hopes">hopes</option><option value="asks">asks</option><option value="has">has</option><option value="was">was</option><option value="wonders">wonders</option><option value="feels on">feels</option><option value="thinks">thinks</option><option value="says">says</option><option value="is">is</option>';}
8
  //#### Show Common Settings
9
+ function showGenNTSettings($ntOpts){ global $nxs_snapThisPageUrl, $nxs_plurl; $ntInfo = array('code'=>'PK', 'lcode'=>'pk', 'name'=>'Plurk', 'defNName'=>'', 'tstReq' => true);
10
  if ( isset($_GET['auth']) && $_GET['auth']=='pk'){ require_once('apis/plurkOAuth.php'); $options = $ntOpts[$_GET['acc']];
11
  $consumer_key = $options['pkConsKey']; $consumer_secret = $options['pkConsSec'];
12
  $callback_url = $nxs_snapThisPageUrl."&auth=pka&acc=".$_GET['acc'];
42
  if ($options['pkPgID']!='') { echo '<br/><br/>All good?! Redirecting ..... <script type="text/javascript">window.location = "'.$nxs_snapThisPageUrl.'"</script>'; break; die();}
43
  else die("<span style='color:red;'>ERROR: Authorization Error: <span style='color:darkred; font-weight: bold;'>".$options['pkPgID']."</span></span>");
44
  }
45
+ global $nxs_plurl; ?>
46
+ <div class="nxs_box">
47
+ <div class="nxs_box_header">
48
+ <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']; ?>
49
+ <?php $cbo = count($ntOpts); ?> <?php wp_nonce_field( 'ns'.$ntInfo['code'], 'ns'.$ntInfo['code'].'_wpnonce' ); ?>
50
+ <?php if ($cbo>1){ ?><div class="nsBigText"><?php echo "(".($cbo=='0'?'No':$cbo)." "; _e('accounts', 'nxs_snap'); echo ")"; ?></div><?php } ?>
51
+ </div>
52
+ </div>
53
+ <div class="nxs_box_inside">
54
+ <?php foreach ($ntOpts as $indx=>$pbo){ if (trim($pbo['nName']=='')) $pbo['nName'] = str_ireplace('https://','', str_ireplace('http://','', $pbo['pkURL']));
55
+ if (!isset($pbo[$ntInfo['lcode'].'OK']) || $pbo[$ntInfo['lcode'].'OK']=='') $pbo[$ntInfo['lcode'].'OK'] = (isset($pbo['pkOAuthTokenSecret']) && $pbo['pkOAuthTokenSecret']!='')?'1':''; ?>
56
+ <p style="margin:0px;margin-left:5px;">
57
+ <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"; ?> />
58
+ <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>
59
+ &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;
60
+ <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>
61
+ </p><?php $this->showNTSettings($indx, $pbo);
62
+ }?>
63
+ </div>
64
+ </div> <?php
65
  }
66
  //#### Show NEW Settings Page
67
  function showNewNTSettings($bo){ $po = array('nName'=>'', 'doPK'=>'1', 'pkURL'=>'', 'pkPgID'=>'', 'pkConsKey'=>'', 'pkInclTags'=>'1', 'cImgURL'=>'R', 'pkConsSec'=>'', 'pkPostType'=>'T', 'pkDefImg'=>'', 'pkOAuthTokenSecret'=>'', 'pkAccessTocken'=>'', 'pkMsgFormat'=>'%TITLE% - %URL%'); $this->showNTSettings($bo, $po, true);}
68
  //#### Show Unit Settings
69
  function showNTSettings($ii, $options, $isNew=false){ global $nxs_plurl,$nxs_snapThisPageUrl; ?>
70
+ <div id="doPK<?php echo $ii; ?>Div" class="insOneDiv<?php if ($isNew) echo " clNewNTSets"; ?>" style="background-image: url(<?php echo $nxs_plurl; ?>img/pk-bg.png); background-position:90% 10%;"> <input type="hidden" name="apDoSPK<?php echo $ii; ?>" value="0" id="apDoSPK<?php echo $ii; ?>" />
71
  <?php if ($isNew) { ?> <input type="hidden" name="pk[<?php echo $ii; ?>][apDoPK]" value="1" id="apDoNewPK<?php echo $ii; ?>" /> <?php } ?>
72
 
73
+ <div class="nsx_iconedTitle" style="float: right; background-image: url(<?php echo $nxs_plurl; ?>img/pk16.png);"><a style="font-size: 12px;" target="_blank" href="http://www.nextscripts.com/setup-installation-plurk-social-networks-auto-poster-wordpress/"><?php $nType="Plurk"; printf( __( 'Detailed %s Installation/Configuration Instructions', 'nxs_snap' ), $nType); ?></a></div>
74
 
75
+ <div style="width:100%;"><strong><?php _e('Account Nickname', 'nxs_snap'); ?>:</strong> <i><?php _e('Just so you can easely identify it', 'nxs_snap'); ?></i> </div><input name="pk[<?php echo $ii; ?>][nName]" id="pknName<?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")), 'nxs_snap') ?>" /><br/>
76
  <?php echo nxs_addQTranslSel('pk', $ii, $options['qTLng']); ?><?php echo nxs_addPostingDelaySel('pk', $ii, $options['nHrs'], $options['nMin']); ?>
77
 
78
  <?php if (!$isNew) { ?>
79
+ <div style="width:100%;"><strong><?php _e('Categories', 'nxs_snap'); ?>:</strong>
80
  <input value="0" id="catSelA<?php echo $ii; ?>" type="radio" name="pk[<?php echo $ii; ?>][catSel]" <?php if ((int)$options['catSel'] != 1) echo "checked"; ?> /> All
81
  <input value="1" id="catSelSPK<?php echo $ii; ?>" type="radio" name="pk[<?php echo $ii; ?>][catSel]" <?php if ((int)$options['catSel'] == 1) echo "checked"; ?> /> <a href="#" style="text-decoration: none;" class="showCats" id="nxs_SCA_PK<?php echo $ii; ?>" onclick="jQuery('#catSelSPK<?php echo $ii; ?>').attr('checked', true); jQuery('#tmpCatSelNT').val('PK<?php echo $ii; ?>'); nxs_markCats( jQuery('#nxs_SC_PK<?php echo $ii; ?>').val() ); jQuery('#showCatSel').bPopup({ modalClose: false, appendTo: '#nsStForm', opacity: 0.6, follow: [false, false], position: [75, 'auto']}); return false;">Selected<?php if ($options['catSelEd']!='') echo "[".(substr_count($options['catSelEd'], ",")+1)."]"; ?></a>
82
  <input type="hidden" name="pk[<?php echo $ii; ?>][catSelEd]" id="nxs_SC_PK<?php echo $ii; ?>" value="<?php echo $options['catSelEd']; ?>" />
83
+ <br/><i><?php _e('Only selected categories will be autoposted to this account', 'nxs_snap'); ?></i></div>
84
  <br/>
85
  <?php } ?>
86
 
87
+ <div style="width:100%;"><strong>Your Plurk URL:</strong> </div><input onchange="nxsPKURLVal(<?php echo $ii; ?>);" name="pk[<?php echo $ii; ?>][apPKURL]" id="apPKURL<?php echo $ii; ?>" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['pkURL'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" /><span style="color: #F00000;" id="apPKURLerr<?php echo $ii; ?>"></span>
88
+ <div style="width:100%;"><strong>Your Plurk App Key:</strong> </div><input name="pk[<?php echo $ii; ?>][apPKConsKey]" id="apPKConsKey" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['pkConsKey'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" />
89
+ <div style="width:100%;"><strong>Your Plurk App Secret:</strong> </div><input name="pk[<?php echo $ii; ?>][apPKConsSec]" id="apPKConsSec" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['pkConsSec'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" />
90
  <br/><br/>
91
 
92
  <div id="altFormat" style="">
102
  <p style="margin: 0px;"><input value="1" id="apLIAttch" type="checkbox" name="pk[<?php echo $ii; ?>][attchImg]" <?php if ((int)$options['attchImg'] == 1) echo "checked"; ?> /> <strong>Attach Image to Plurk Post</strong></p>
103
  <br/>
104
 
105
+ <div style="width:100%;"><strong id="altFormatText"><?php _e('Post Text Format', 'nxs_snap'); ?>:</strong> (<a href="#" id="apPKMsgFrmt<?php echo $ii; ?>HintInfo" onclick="mxs_showHideFrmtInfo('apPKMsgFrmt<?php echo $ii; ?>'); return false;"><?php _e('Show format info', 'nxs_snap'); ?></a>) </div>
106
 
107
+ <input name="pk[<?php echo $ii; ?>][apPKMsgFrmt]" id="apPKMsgFrmt" style="width: 50%;" value="<?php if ($options['pkMsgFormat']!='') _e(apply_filters('format_to_edit', htmlentities($options['pkMsgFormat'], ENT_COMPAT, "UTF-8")), 'nxs_snap'); else echo htmlentities("%TITLE% - %URL%"); ?>" onfocus="jQuery('#apPKMsgFrmt<?php echo $ii; ?>Hint').show();" /><br/>
108
  <?php nxs_doShowHint("apPKMsgFrmt".$ii); ?>
109
  <br/>
110
  <?php
111
  if($options['pkConsSec']=='') { ?>
112
  <b>Authorize Your Plurk Account</b>. Please save your settings and come back here to Authorize your account.
113
  <?php } else { if(isset($options['pkAccessTocken']) && isset($options['pkAccessTocken']['oauth_token_secret']) && $options['pkAccessTocken']['oauth_token_secret']!=='') { ?>
114
+ Your Plurk Account has been authorized. Your display name: <?php _e(apply_filters('format_to_edit', htmlentities($options['pkPgID'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>.
115
  You can Re- <?php } ?>
116
  <a href="<?php echo $nxs_snapThisPageUrl;?>&auth=pk&acc=<?php echo $ii; ?>">Authorize Your Plurk Account</a>
117
  <?php if (!isset($options['pkOAuthTokenSecret']) || $options['pkOAuthTokenSecret']=='') { ?> <div class="blnkg">&lt;=== Authorize your account ===</div> <?php } ?>
120
 
121
  <?php if( isset($options['pkOAuthTokenSecret']) && $options['pkOAuthTokenSecret']!='') { ?>
122
  <?php wp_nonce_field( 'rePostToPK', 'rePostToPK_wpnonce' ); ?>
123
+ <br/><br/><b><?php _e('Test your settings', 'nxs_snap'); ?>:</b>&nbsp;&nbsp;&nbsp; <a href="#" class="NXSButton" onclick="testPost('PK', '<?php echo $ii; ?>'); return false;"><?php printf( __( 'Submit Test Post to %s', 'nxs_snap' ), $nType); ?></a> <br/><br/>
124
  <?php }?>
125
+ <div class="submit"><input type="submit" class="button-primary" name="update_NS_SNAutoPoster_settings" value="<?php _e('Update Settings', 'nxs_snap') ?>" /></div>
126
 
127
  </div>
128
  <?php
156
  }
157
  //#### Show Post->Edit Meta Box Settings
158
  function showEdPostNTSettings($ntOpts, $post){ global $nxs_plurl; $post_id = $post->ID;
159
+ foreach($ntOpts as $ii=>$options) {$pMeta = maybe_unserialize(get_post_meta($post_id, 'snapPK', true)); if (is_array($pMeta)) $options = $this->adjMetaOpt($options, $pMeta[$ii]);
160
+ $doPK = $options['doPK'] && (is_array($pMeta) || $options['catSel']!='1');
161
  $isAvailPK = isset($options['pkAccessTocken']) && isset($options['pkAccessTocken']['oauth_token_secret']) && $options['pkAccessTocken']['oauth_token_secret']!=='';
162
  $pkMsgFormat = htmlentities($options['pkMsgFormat'], ENT_COMPAT, "UTF-8"); $pkMsgTFormat = htmlentities($options['pkMsgTFormat'], ENT_COMPAT, "UTF-8");
163
  ?>
164
 
165
  <tr><th style="text-align:left;" colspan="2"><?php if ( $options['catSel']=='1' && trim($options['catSelEd'])!='' ) { ?> <input type="hidden" class="nxs_SC" id="nxs_SC_PK<?php echo $ii; ?>" value="<?php echo $options['catSelEd']; ?>" /> <?php } ?>
166
+ <?php if ($isAvailPK) { ?><input class="nxsGrpDoChb" value="1" id="doPK<?php echo $ii; ?>" <?php if ($post->post_status == "publish") echo 'disabled="disabled"';?> type="checkbox" name="pk[<?php echo $ii; ?>][doPK]" <?php if (($post->post_status == "publish" && $options['isPosted'] == '1') || ($post->post_status != "publish" && ((int)$doPK == 1)) ) echo 'checked="checked" title="def"'; ?> /> <?php } ?>
167
+ <div class="nsx_iconedTitle" style="display: inline; font-size: 13px; background-image: url(<?php echo $nxs_plurl; ?>img/pk16.png);">Plurk - <?php _e('publish to', 'nxs_snap') ?> (<i style="color: #005800;"><?php echo $options['nName']; ?></i>) </div></th><td><?php //## Only show RePost button if the post is "published"
168
+ if ($post->post_status == "publish" && $isAvailPK) { ?><input alt="<?php echo $ii; ?>" style="float: right;" onmouseout="hidePopShAtt('SV');" onmouseover="showPopShAtt('SV', event);" onclick="return false;" type="button" class="button" name="rePostToPK_repostButton" id="rePostToPK_button" value="<?php _e('Repost to Plurk', 'nxs_snap') ?>" />
169
  <?php wp_nonce_field( 'rePostToPK', 'rePostToPK_wpnonce' ); } ?>
170
 
171
  <?php if (is_array($pMeta) && is_array($pMeta[$ii]) && isset($pMeta[$ii]['pgID']) ) {
172
  ?> <span id="pstdPK<?php echo $ii; ?>" style="float: right;padding-top: 4px; padding-right: 10px;">
173
+ <a style="font-size: 10px;" href="http://www.plurk.com/p/<?php echo base_convert($pMeta[$ii]['pgID'], 10, 36); ?>" target="_blank"><?php $nType="Plurk"; printf( __( 'Posted on', 'nxs_snap' ), $nType); ?> <?php echo (isset($pMeta[$ii]['pDate']) && $pMeta[$ii]['pDate']!='')?(" (".$pMeta[$ii]['pDate'].")"):""; ?></a>
174
  </span><?php } ?>
175
 
176
  </td></tr>
188
  ?>
189
  </select></td></tr>
190
 
191
+ <tr id="altFormat1" style=""><th scope="row" style="text-align:right; width:60px; padding-right:10px;"><?php _e('Text Format:', 'nxs_snap') ?></th>
192
  <td><input value="<?php echo $pkMsgFormat ?>" type="text" name="pk[<?php echo $ii; ?>][SNAPformat]" style="width:60%;max-width: 610px;" onfocus="jQuery('.nxs_FRMTHint').hide();mxs_showFrmtInfo('apPKMsgFrmt<?php echo $ii; ?>');"/><?php nxs_doShowHint("apPKMsgFrmt".$ii); ?></td></tr>
193
 
194
  <?php }
199
  function adjMetaOpt($optMt, $pMeta){ if (isset($pMeta['isPosted'])) $optMt['isPosted'] = $pMeta['isPosted']; else $optMt['isPosted'] = '';
200
  if (isset($pMeta['SNAPformat'])) $optMt['pkMsgFormat'] = $pMeta['SNAPformat'];
201
  if (isset($pMeta['Cat'])) $optMt['pkCat'] = $pMeta['Cat'];
202
+ if (isset($pMeta['doPK'])) $optMt['doPK'] = $pMeta['doPK'] == 1?1:0; else { if (isset($pMeta['SNAPformat'])) $optMt['doPK'] = 0; }
203
+ if (isset($pMeta['SNAPincludePK']) && $pMeta['SNAPincludePK'] == '1' ) $optMt['doPK'] = 1;
204
+ return $optMt;
205
  }
206
  }}
207
 
275
  if (is_array($postinfo) && isset($postinfo['plurk_id'])) $pkID = $postinfo['plurk_id'];
276
 
277
  $code = $tum_oauth->http_code;// echo "XX".print_r($code); prr($postinfo); // prr($msg); prr($postinfo); echo $code."VVVV"; die("|====");
278
+ if ($code == 200) { if ($postID=='0') { nxs_addToLog($logNT, 'M', 'OK - TEST Message Posted '); echo 'OK - Message Posted, please see your Plurk Page. <br/> Result:'; }
279
  else { nxs_addToLog($logNT, 'M', 'OK - Message Posted ', $extInfo); nxs_metaMarkAsPosted($postID, 'PK', $options['ii'], array('isPosted'=>'1', 'pgID'=>$pkID, 'pDate'=>date('Y-m-d H:i:s'))); } }
280
  else { nxs_addToLog($logNT, 'E', '-=ERROR=- '.print_r($postinfo, true), $extInfo); if ($postID=='0') prr($postinfo); $code .= " ERROR: - ".$postinfo['error_text']; }
281
 
inc-cl/pn.php CHANGED
@@ -4,32 +4,32 @@ $nxs_snapAvNts[] = array('code'=>'PN', 'lcode'=>'pn', 'name'=>'Pinterest');
4
 
5
  if (!class_exists("nxs_snapClassPN")) { class nxs_snapClassPN {
6
  //#### Show Common Settings
7
- function showGenNTSettings($ntOpts){ global $nxs_snapThisPageUrl, $nxs_plurl, $nxsOne; $code = 'PN'; $lcode = 'pn'; wp_nonce_field( 'ns'.$code, 'ns'.$code.'_wpnonce' ); ?>
8
- <hr/><div class="nsx_iconedTitle" style="background-image: url(<?php echo $nxs_plurl; ?>img/<?php echo $lcode; ?>16.png);">Pinterest Settings
9
-
10
- <?php if(!function_exists('doPostToPinterest')) {?></div> Pinterest doesn't have a built-in API for automated posts yet. <br/>You need to get a special <a target="_blank" href="http://www.nextscripts.com/pinterest-automated-posting">library module</a> to be able to publish your content to Pinterest. <br/><br/>
11
-
12
- <?php } else {
13
- $cgpo = count($ntOpts); $mgpo = 1+max(array_keys($ntOpts)); $nxsOne .= "&p=1"; ?>
14
- <div class="nsBigText">You have <?php echo $cgpo=='0'?'No':$cgpo; ?> Pinterest account<?php if ($cgpo!=1){ ?>s<?php } ?> <!--- <a href="#" class="NXSButton" onclick="doShowHideBlocks2('PN<?php echo $mgpo; ?>');return false;">Add new Google+ Account</a> --> </div> </div>
15
- <?php // if (function_exists('nxs_doSMAS1')) nxs_doSMAS1($this, $mgpo); else nxs_doSMAS('Pinterest', 'PN'.$mgpo); ?>
16
- <?php foreach ($ntOpts as $indx=>$po){ if (trim($po['nName']=='')) { $po['nName'] = $po['pnUName']." Pinterest"; if($po['pnBoard']!='') $po['nName'] .= " Board: ".$po['pnBoard']; else $po['nName'] .= " Profile"; } ?>
17
- <p style="margin: 0px;margin-left: 5px;">
18
- <input value="1" id="apDoPN" name="pn[<?php echo $indx; ?>][apDoPN]" type="checkbox" <?php if ((int)$po['doPN'] == 1) echo "checked"; ?> />
19
- <strong>Auto-publish your Posts to your <i style="color: #005800;"><?php if($po['nName']!='') echo "(".$po['nName'].")"; ?></i> </strong>
20
- &nbsp;&nbsp;<a id="doPN<?php echo $indx; ?>A" href="#" onclick="doShowHideBlocks2('PN<?php echo $indx; ?>');return false;">[Show Settings]</a> &nbsp;&nbsp;
21
- <a href="#" onclick="doDelAcct('pn','<?php echo $indx; ?>', '<?php echo $po['pnUName']; ?>');return false;">[Remove Account]</a>
22
- </p>
23
- <?php $this->showNTSettings($indx, $po);
24
- } ?>
25
-
26
- <?php }
27
  }
28
  //#### Show NEW Settings Page
29
  function showNewNTSettings($mgpo){ $po = array('nName'=>'', 'doPN'=>'1', 'pnUName'=>'', 'pnBoard'=>'', 'gpAttch'=>'', 'pnPass'=>'', 'pnDefImg'=>'', 'pnMsgFormat'=>'', 'pnBoard'=>'', 'pnBoardsList'=>'', 'doPN'=>1); $this->showNTSettings($mgpo, $po, true);}
30
  //#### Show Unit Settings
31
  function showNTSettings($ii, $options, $isNew=false){ global $nxs_plurl; ?>
32
- <div id="doPN<?php echo $ii; ?>Div" <?php if ($isNew){ ?>class="clNewNTSets"<?php } ?> style="max-width: 1000px; background-color: #EBF4FB; background-image: url(<?php echo $nxs_plurl; ?>img/pn-bg.png); background-position:90% 10%; background-repeat: no-repeat; margin: 10px; border: 1px solid #808080; padding: 10px; display:none;"> <input type="hidden" name="apDoSPN<?php echo $ii; ?>" value="0" id="apDoSPN<?php echo $ii; ?>" />
33
 
34
  <?php if(!function_exists('doPostToPinterest')) {?><span style="color:#580000; font-size: 16px;"><br/><br/>
35
  <b>Pinterest API Library not found</b>
@@ -38,24 +38,24 @@ if (!class_exists("nxs_snapClassPN")) { class nxs_snapClassPN {
38
  <?php return; }; ?>
39
 
40
 
41
- <div id="doPN<?php echo $ii; ?>Div" style="margin-left: 10px;"> <div class="nsx_iconedTitle" style="float: right; background-image: url(<?php echo $nxs_plurl; ?>img/pn16.png);"><a style="font-size: 12px;" target="_blank" href="http://www.nextscripts.com/setup-installation-pinterest-social-networks-auto-poster-wordpress/">Detailed Pinterest Installation/Configuration Instructions</a></div>
42
- <div style="width:100%;"><strong>Account Nickname:</strong> <i>Just so you can easely identify it</i> </div><input name="pn[<?php echo $ii; ?>][nName]" id="pnnName<?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")), 'NS_SNAutoPoster') ?>" /><br/>
43
  <?php echo nxs_addQTranslSel('pn', $ii, $options['qTLng']); ?><?php echo nxs_addPostingDelaySel('pn', $ii, $options['nHrs'], $options['nMin']); ?>
44
 
45
  <?php if (!$isNew) { ?>
46
- <div style="width:100%;"><strong>Auto-Post Categories:</strong>
47
  <input value="0" id="catSelA<?php echo $ii; ?>" type="radio" name="pn[<?php echo $ii; ?>][catSel]" <?php if ((int)$options['catSel'] != 1) echo "checked"; ?> /> All
48
  <input value="1" id="catSelSPN<?php echo $ii; ?>" type="radio" name="pn[<?php echo $ii; ?>][catSel]" <?php if ((int)$options['catSel'] == 1) echo "checked"; ?> /> <a href="#" style="text-decoration: none;" class="showCats" id="nxs_SCA_PN<?php echo $ii; ?>" onclick="jQuery('#catSelSPN<?php echo $ii; ?>').attr('checked', true); jQuery('#tmpCatSelNT').val('PN<?php echo $ii; ?>'); nxs_markCats( jQuery('#nxs_SC_PN<?php echo $ii; ?>').val() ); jQuery('#showCatSel').bPopup({ modalClose: false, appendTo: '#nsStForm', opacity: 0.6, follow: [false, false], position: [75, 'auto']}); return false;">Selected<?php if ($options['catSelEd']!='') echo "[".(substr_count($options['catSelEd'], ",")+1)."]"; ?></a>
49
  <input type="hidden" name="pn[<?php echo $ii; ?>][catSelEd]" id="nxs_SC_PN<?php echo $ii; ?>" value="<?php echo $options['catSelEd']; ?>" />
50
- </div>
51
  <br/>
52
  <?php } ?>
53
 
54
- <div style="width:100%;"><strong>Pinterest Email:</strong> </div><input name="pn[<?php echo $ii; ?>][apPNUName]" id="apPNUName<?php echo $ii; ?>" class="apPNUName<?php echo $ii; ?>" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['pnUName'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" />
55
- <div style="width:100%;"><strong>Pinterest Password:</strong> </div><input name="pn[<?php echo $ii; ?>][apPNPass]" id="apPNPass<?php echo $ii; ?>" type="password" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities(substr($options['pnPass'], 0, 5)=='g9c1a'?nsx_doDecode(substr($options['pnPass'], 5)):$options['pnPass'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" /> <br/>
56
  <div style="width:100%;"><strong>Default Image to Pin:</strong>
57
  <p style="font-size: 11px; margin: 0px;">If your post missing Featured Image this will be used instead.</p>
58
- </div><input name="pn[<?php echo $ii; ?>][apPNDefImg]" id="apPNDefImg" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['pnDefImg'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" />
59
  <br/><br/>
60
 
61
  <div style="width:100%;"><strong>Board:</strong>
@@ -63,7 +63,8 @@ if (!class_exists("nxs_snapClassPN")) { class nxs_snapClassPN {
63
  </div>
64
  <?php wp_nonce_field( 'getBoards', 'getBoards_wpnonce' ); ?><img id="pnLoadingImg<?php echo $ii; ?>" style="display: none;" src='<?php echo $nxs_plurl; ?>img/ajax-loader-sm.gif' />
65
  <select name="pn[<?php echo $ii; ?>][apPNBoard]" id="apPNBoard<?php echo $ii; ?>">
66
- <?php if ($options['pnBoardsList']!=''){ $gPNBoards = $options['pnBoardsList']; if ($options['pnBoard']!='') $gPNBoards = str_replace($options['pnBoard'].'"', $options['pnBoard'].'" selected="selected"', $gPNBoards); echo $gPNBoards;} else { ?>
 
67
  <option value="0">None(Click above to retrieve your boards)</option>
68
  <?php } ?>
69
  </select>
@@ -72,18 +73,18 @@ if (!class_exists("nxs_snapClassPN")) { class nxs_snapClassPN {
72
 
73
 
74
  <div id="altFormat" style="">
75
- <div style="width:100%;"><strong id="altFormatText">Message Text Format:</strong> <a href="#" id="apPNMsgFrmt<?php echo $ii; ?>HintInfo" onclick="mxs_showHideFrmtInfo('apPNMsgFrmt<?php echo $ii; ?>'); return false;">Show format info</a>
76
- </div><input name="pn[<?php echo $ii; ?>][apPNMsgFrmt]" id="apPNMsgFrmt" style="width: 50%;" value="<?php if ($options['pnMsgFormat']!='') _e(apply_filters('format_to_edit', htmlentities($options['pnMsgFormat'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster'); else echo "%TITLE% - %URL%"; ?>" onfocus="mxs_showFrmtInfo('apPNMsgFrmt<?php echo $ii; ?>');" />
77
 
78
  <?php nxs_doShowHint("apPNMsgFrmt".$ii); ?>
79
  </div><br/>
80
  <?php if ($isNew) { ?> <input type="hidden" name="pn[<?php echo $ii; ?>][apDoPN]" value="1" id="apDoNewPN<?php echo $ii; ?>" /> <?php } ?>
81
  <?php if ($options['pnPass']!='') { ?>
82
  <?php wp_nonce_field( 'rePostToPN', 'rePostToPN_wpnonce' ); ?>
83
- <b>Test your settings:</b>&nbsp;&nbsp;&nbsp; <a href="#" class="NXSButton" onclick="testPost('PN', '<?php echo $ii; ?>'); return false;">Submit Test Post to Pinterest</a>
84
  <?php } ?>
85
 
86
- <div class="submit"><input type="submit" class="button-primary" name="update_NS_SNAutoPoster_settings" value="<?php _e('Update Settings', 'NS_SNAutoPoster') ?>" /></div>
87
  </div>
88
  </div>
89
  <?php
@@ -110,18 +111,19 @@ if (!class_exists("nxs_snapClassPN")) { class nxs_snapClassPN {
110
  }
111
  //#### Show Post->Edit Meta Box Settings
112
  function showEdPostNTSettings($ntOpts, $post){ global $nxs_plurl; $post_id = $post->ID;
113
- foreach($ntOpts as $ii=>$ntOpt) { $pMeta = maybe_unserialize(get_post_meta($post_id, 'snapPN', true)); if (is_array($pMeta)) $ntOpt = $this->adjMetaOpt($ntOpt, $pMeta[$ii]); $doPN = $ntOpt['doPN'] && $ntOpt['catSel']!='1';
 
114
  $isAvailPN = $ntOpt['pnUName']!='' && $ntOpt['pnPass']!=''; $pnMsgFormat = htmlentities($ntOpt['pnMsgFormat'], ENT_COMPAT, "UTF-8");
115
  ?>
116
  <tr><th style="text-align:left;" colspan="2"><?php if ( $ntOpt['catSel']=='1' && trim($ntOpt['catSelEd'])!='' ) { ?> <input type="hidden" class="nxs_SC" id="nxs_SC_PN<?php echo $ii; ?>" value="<?php echo $ntOpt['catSelEd']; ?>" /> <?php } ?>
117
- <?php if ($isAvailPN) { ?><input class="nxsGrpDoChb" value="1" id="doPN<?php echo $ii; ?>" <?php if ($post->post_status == "publish") echo 'disabled="disabled"';?> type="checkbox" name="pn[<?php echo $ii; ?>][SNAPincludePN]" <?php if (($post->post_status == "publish" && $ntOpt['isPosted'] == '1') || ($post->post_status != "publish" && ((int)$doPN == 1)) ) echo 'checked="checked" title="def"'; ?> /> <?php } ?>
118
- <div class="nsx_iconedTitle" style="display: inline; font-size: 13px; background-image: url(<?php echo $nxs_plurl; ?>img/pn16.png);">Pinterest - publish to (<i style="color: #005800;"><?php echo $ntOpt['nName']; ?></i>)</div></th> <td><?php //## Only show RePost button if the post is "published"
119
- if ($post->post_status == "publish" && $isAvailPN) { ?><input alt="<?php echo $ii; ?>" style="float: right;" onmouseout="hidePopShAtt('SV');" onmouseover="showPopShAtt('SV', event);" onclick="return false;" type="button" class="button" name="rePostToPN_repostButton" id="rePostToPN_button" value="<?php _e('Repost to Pinterest', 're-post') ?>" />
120
  <?php wp_nonce_field( 'rePostToPN', 'rePostToPN_wpnonce' ); } ?>
121
 
122
  <?php if (is_array($pMeta) && is_array($pMeta[$ii]) && isset($pMeta[$ii]['pgID']) ) {
123
  ?> <span id="pstdPN<?php echo $ii; ?>" style="float: right;padding-top: 4px; padding-right: 10px;">
124
- <a style="font-size: 10px;" href="http://pinterest.com<?php echo $pMeta[$ii]['pgID']; ?>" target="_blank">Posted on Pinterest <?php echo (isset($pMeta[$ii]['pDate']) && $pMeta[$ii]['pDate']!='')?(" (".$pMeta[$ii]['pDate'].")"):""; ?></a>
125
  </span><?php } ?>
126
 
127
  </td></tr>
@@ -131,13 +133,14 @@ if (!class_exists("nxs_snapClassPN")) { class nxs_snapClassPN {
131
 
132
  <tr><th scope="row" style="text-align:right; width:150px; padding-top: 5px; padding-right:10px;">Select Board</th>
133
  <td><select name="pn[<?php echo $ii; ?>][apPNBoard]" id="apPNBoard">
134
- <?php if ($ntOpt['pnBoardsList']!=''){ $gPNBoards = $ntOpt['pnBoardsList']; if ($ntOpt['pnBoard']!='') $gPNBoards = str_replace($ntOpt['pnBoard'].'"', $ntOpt['pnBoard'].'" selected="selected"', $gPNBoards); echo $gPNBoards;} else { ?>
 
135
  <option value="0">None(Click above to retrieve your boards)</option>
136
  <?php } ?>
137
  </select></td>
138
  </tr>
139
 
140
- <tr id="altFormat1" style=""><th scope="row" style="text-align:right; width:60px; padding-right:10px;"><?php _e('Text Message Format:', 'NS_SPAP') ?></th>
141
  <td><input value="<?php echo $pnMsgFormat ?>" type="text" name="pn[<?php echo $ii; ?>][SNAPformat]" style="width:60%;max-width: 610px;" onfocus="jQuery('.nxs_FRMTHint').hide();mxs_showFrmtInfo('apPNMsgFrmt<?php echo $ii; ?>');"/><?php nxs_doShowHint("apPNMsgFrmt".$ii); ?></td></tr>
142
 
143
  <?php }
@@ -146,8 +149,10 @@ if (!class_exists("nxs_snapClassPN")) { class nxs_snapClassPN {
146
  //#### Save Meta Tags to the Post
147
  function adjMetaOpt($optMt, $pMeta){ if (isset($pMeta['isPosted'])) $optMt['isPosted'] = $pMeta['isPosted']; else $optMt['isPosted'] = '';
148
  if (isset($pMeta['SNAPformat'])) $optMt['pnMsgFormat'] = $pMeta['SNAPformat'];
149
- if (isset($pMeta['SNAPincludePN'])) $optMt['doPN'] = $pMeta['SNAPincludePN'] == 1?1:0; else { if (isset($pMeta['SNAPformat'])) $optMt['doPN'] = 0; }
150
- if (isset($pMeta['apPNBoard'])) $optMt['pnBoard'] = $pMeta['apPNBoard']; return $optMt;
 
 
151
  }
152
  }}
153
  if (!function_exists("nxs_rePostToPN_ajax")) {
@@ -174,7 +179,7 @@ if (!function_exists("nxs_doPublishToPN")) { //## Second Function to Post to G+
174
  if ($options['pnDefImg']!='') $imgURL = $options['pnDefImg']; else $imgURL ="http://direct.gtln.us/img/nxs/NextScriptsLogoT.png";
175
  }
176
  else { $post = get_post($postID); if(!$post) return; $pnMsgFormat = $options['pnMsgFormat']; $msg = nsFormatMessage($pnMsgFormat, $postID); $link = get_permalink($postID);
177
- nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPrePosted'=>'1')); $imgURL = nxs_getPostImage($postID, 'large', $options['ogImgDef']); //echo $imgURL."######"; // echo "WW".$postID."|";
178
  if ($isAttachVid=='1') { $vids = nsFindVidsInPost($post); if (count($vids)>0) { $vidURL = 'http://www.youtube.com/v/'.$vids[0]; $imgURL = 'http://img.youtube.com/vi/'.$vids[0].'/0.jpg'; }}
179
  }
180
  $email = $options['pnUName']; $boardID = $options['pnBoard']; $pass = substr($options['pnPass'], 0, 5)=='g9c1a'?nsx_doDecode(substr($options['pnPass'], 5)):$options['pnPass'];// prr($boardID); prr($_POST); die();
4
 
5
  if (!class_exists("nxs_snapClassPN")) { class nxs_snapClassPN {
6
  //#### Show Common Settings
7
+ function showGenNTSettings($ntOpts){ global $nxs_plurl; $ntInfo = array('code'=>'PN', 'lcode'=>'pn', 'name'=>'Pinterest', 'defNName'=>'pnUName', 'tstReq' => false); ?>
8
+ <div class="nxs_box">
9
+ <div class="nxs_box_header">
10
+ <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']; ?>
11
+ <?php $cbo = count($ntOpts); ?> <?php wp_nonce_field( 'ns'.$ntInfo['code'], 'ns'.$ntInfo['code'].'_wpnonce' ); ?>
12
+ <?php if ($cbo>1){ ?><div class="nsBigText"><?php echo "(".($cbo=='0'?'No':$cbo)." "; _e('accounts', 'nxs_snap'); echo ")"; ?></div><?php } ?>
13
+ </div>
14
+ </div>
15
+ <div class="nxs_box_inside">
16
+ <?php if(!function_exists('doPostToPinterest')) {?> Pinterest doesn't have a built-in API for automated posts yet. <br/>You need to get a special <a target="_blank" href="http://www.nextscripts.com/pinterest-automated-posting">library module</a> to be able to publish your content to Pinterest.
17
+ <?php } else foreach ($ntOpts as $indx=>$pbo){ if (trim($pbo['nName']=='')) $pbo['nName'] = $pbo[$ntInfo['defNName']]; ?>
18
+ <p style="margin:0px;margin-left:5px;">
19
+ <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"; ?> />
20
+ <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>
21
+ &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;
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', 'nxs_snap'); ?>]</a>
23
+ </p><?php $this->showNTSettings($indx, $pbo);
24
+ } ?>
25
+ </div>
26
+ </div> <?php
27
  }
28
  //#### Show NEW Settings Page
29
  function showNewNTSettings($mgpo){ $po = array('nName'=>'', 'doPN'=>'1', 'pnUName'=>'', 'pnBoard'=>'', 'gpAttch'=>'', 'pnPass'=>'', 'pnDefImg'=>'', 'pnMsgFormat'=>'', 'pnBoard'=>'', 'pnBoardsList'=>'', 'doPN'=>1); $this->showNTSettings($mgpo, $po, true);}
30
  //#### Show Unit Settings
31
  function showNTSettings($ii, $options, $isNew=false){ global $nxs_plurl; ?>
32
+ <div id="doPN<?php echo $ii; ?>Div" class="insOneDiv<?php if ($isNew) echo " clNewNTSets"; ?>" style="background-image: url(<?php echo $nxs_plurl; ?>img/pn-bg.png); background-position:90% 10%;"> <input type="hidden" name="apDoSPN<?php echo $ii; ?>" value="0" id="apDoSPN<?php echo $ii; ?>" />
33
 
34
  <?php if(!function_exists('doPostToPinterest')) {?><span style="color:#580000; font-size: 16px;"><br/><br/>
35
  <b>Pinterest API Library not found</b>
38
  <?php return; }; ?>
39
 
40
 
41
+ <div id="doPN<?php echo $ii; ?>Div" style="margin-left: 10px;"> <div class="nsx_iconedTitle" style="float: right; background-image: url(<?php echo $nxs_plurl; ?>img/pn16.png);"><a style="font-size: 12px;" target="_blank" href="http://www.nextscripts.com/setup-installation-pinterest-social-networks-auto-poster-wordpress/"><?php $nType="Pinterest"; printf( __( 'Detailed %s Installation/Configuration Instructions', 'nxs_snap' ), $nType); ?></a></div>
42
+ <div style="width:100%;"><strong><?php _e('Account Nickname', 'nxs_snap'); ?>:</strong> <i><?php _e('Just so you can easely identify it', 'nxs_snap'); ?></i> </div><input name="pn[<?php echo $ii; ?>][nName]" id="pnnName<?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")), 'nxs_snap') ?>" /><br/>
43
  <?php echo nxs_addQTranslSel('pn', $ii, $options['qTLng']); ?><?php echo nxs_addPostingDelaySel('pn', $ii, $options['nHrs'], $options['nMin']); ?>
44
 
45
  <?php if (!$isNew) { ?>
46
+ <div style="width:100%;"><strong><?php _e('Categories', 'nxs_snap'); ?>:</strong>
47
  <input value="0" id="catSelA<?php echo $ii; ?>" type="radio" name="pn[<?php echo $ii; ?>][catSel]" <?php if ((int)$options['catSel'] != 1) echo "checked"; ?> /> All
48
  <input value="1" id="catSelSPN<?php echo $ii; ?>" type="radio" name="pn[<?php echo $ii; ?>][catSel]" <?php if ((int)$options['catSel'] == 1) echo "checked"; ?> /> <a href="#" style="text-decoration: none;" class="showCats" id="nxs_SCA_PN<?php echo $ii; ?>" onclick="jQuery('#catSelSPN<?php echo $ii; ?>').attr('checked', true); jQuery('#tmpCatSelNT').val('PN<?php echo $ii; ?>'); nxs_markCats( jQuery('#nxs_SC_PN<?php echo $ii; ?>').val() ); jQuery('#showCatSel').bPopup({ modalClose: false, appendTo: '#nsStForm', opacity: 0.6, follow: [false, false], position: [75, 'auto']}); return false;">Selected<?php if ($options['catSelEd']!='') echo "[".(substr_count($options['catSelEd'], ",")+1)."]"; ?></a>
49
  <input type="hidden" name="pn[<?php echo $ii; ?>][catSelEd]" id="nxs_SC_PN<?php echo $ii; ?>" value="<?php echo $options['catSelEd']; ?>" />
50
+ <br/><i><?php _e('Only selected categories will be autoposted to this account', 'nxs_snap'); ?></i></div>
51
  <br/>
52
  <?php } ?>
53
 
54
+ <div style="width:100%;"><strong>Pinterest Email:</strong> </div><input name="pn[<?php echo $ii; ?>][apPNUName]" id="apPNUName<?php echo $ii; ?>" class="apPNUName<?php echo $ii; ?>" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['pnUName'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" />
55
+ <div style="width:100%;"><strong>Pinterest Password:</strong> </div><input name="pn[<?php echo $ii; ?>][apPNPass]" id="apPNPass<?php echo $ii; ?>" type="password" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities(substr($options['pnPass'], 0, 5)=='g9c1a'?nsx_doDecode(substr($options['pnPass'], 5)):$options['pnPass'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" /> <br/>
56
  <div style="width:100%;"><strong>Default Image to Pin:</strong>
57
  <p style="font-size: 11px; margin: 0px;">If your post missing Featured Image this will be used instead.</p>
58
+ </div><input name="pn[<?php echo $ii; ?>][apPNDefImg]" id="apPNDefImg" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['pnDefImg'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" />
59
  <br/><br/>
60
 
61
  <div style="width:100%;"><strong>Board:</strong>
63
  </div>
64
  <?php wp_nonce_field( 'getBoards', 'getBoards_wpnonce' ); ?><img id="pnLoadingImg<?php echo $ii; ?>" style="display: none;" src='<?php echo $nxs_plurl; ?>img/ajax-loader-sm.gif' />
65
  <select name="pn[<?php echo $ii; ?>][apPNBoard]" id="apPNBoard<?php echo $ii; ?>">
66
+ <?php if ($options['pnBoardsList']!=''){ $gPNBoards = $options['pnBoardsList']; if ( base64_encode(base64_decode($gPNBoards)) === $gPNBoards) $gPNBoards = base64_decode($gPNBoards);
67
+ if ($options['pnBoard']!='') $gPNBoards = str_replace($options['pnBoard'].'"', $options['pnBoard'].'" selected="selected"', $gPNBoards); echo $gPNBoards;} else { ?>
68
  <option value="0">None(Click above to retrieve your boards)</option>
69
  <?php } ?>
70
  </select>
73
 
74
 
75
  <div id="altFormat" style="">
76
+ <div style="width:100%;"><strong id="altFormatText"><?php _e('Message text Format', 'nxs_snap'); ?>:</strong> <a href="#" id="apPNMsgFrmt<?php echo $ii; ?>HintInfo" onclick="mxs_showHideFrmtInfo('apPNMsgFrmt<?php echo $ii; ?>'); return false;"><?php _e('Show format info', 'nxs_snap'); ?></a>
77
+ </div><input name="pn[<?php echo $ii; ?>][apPNMsgFrmt]" id="apPNMsgFrmt" style="width: 50%;" value="<?php if ($options['pnMsgFormat']!='') _e(apply_filters('format_to_edit', htmlentities($options['pnMsgFormat'], ENT_COMPAT, "UTF-8")), 'nxs_snap'); else echo "%TITLE% - %URL%"; ?>" onfocus="mxs_showFrmtInfo('apPNMsgFrmt<?php echo $ii; ?>');" />
78
 
79
  <?php nxs_doShowHint("apPNMsgFrmt".$ii); ?>
80
  </div><br/>
81
  <?php if ($isNew) { ?> <input type="hidden" name="pn[<?php echo $ii; ?>][apDoPN]" value="1" id="apDoNewPN<?php echo $ii; ?>" /> <?php } ?>
82
  <?php if ($options['pnPass']!='') { ?>
83
  <?php wp_nonce_field( 'rePostToPN', 'rePostToPN_wpnonce' ); ?>
84
+ <b><?php _e('Test your settings', 'nxs_snap'); ?>:</b>&nbsp;&nbsp;&nbsp; <a href="#" class="NXSButton" onclick="testPost('PN', '<?php echo $ii; ?>'); return false;"><?php printf( __( 'Submit Test Post to %s', 'nxs_snap' ), $nType); ?></a>
85
  <?php } ?>
86
 
87
+ <div class="submit"><input type="submit" class="button-primary" name="update_NS_SNAutoPoster_settings" value="<?php _e('Update Settings', 'nxs_snap') ?>" /></div>
88
  </div>
89
  </div>
90
  <?php
111
  }
112
  //#### Show Post->Edit Meta Box Settings
113
  function showEdPostNTSettings($ntOpts, $post){ global $nxs_plurl; $post_id = $post->ID;
114
+ foreach($ntOpts as $ii=>$ntOpt) { $pMeta = maybe_unserialize(get_post_meta($post_id, 'snapPN', true)); if (is_array($pMeta)) $ntOpt = $this->adjMetaOpt($ntOpt, $pMeta[$ii]);
115
+ $doPN = $ntOpt['doPN'] && (is_array($pMeta) || $ntOpt['catSel']!='1');
116
  $isAvailPN = $ntOpt['pnUName']!='' && $ntOpt['pnPass']!=''; $pnMsgFormat = htmlentities($ntOpt['pnMsgFormat'], ENT_COMPAT, "UTF-8");
117
  ?>
118
  <tr><th style="text-align:left;" colspan="2"><?php if ( $ntOpt['catSel']=='1' && trim($ntOpt['catSelEd'])!='' ) { ?> <input type="hidden" class="nxs_SC" id="nxs_SC_PN<?php echo $ii; ?>" value="<?php echo $ntOpt['catSelEd']; ?>" /> <?php } ?>
119
+ <?php if ($isAvailPN) { ?><input class="nxsGrpDoChb" value="1" id="doPN<?php echo $ii; ?>" <?php if ($post->post_status == "publish") echo 'disabled="disabled"';?> type="checkbox" name="pn[<?php echo $ii; ?>][doPN]" <?php if (($post->post_status == "publish" && $ntOpt['isPosted'] == '1') || ($post->post_status != "publish" && ((int)$doPN == 1)) ) echo 'checked="checked" title="def"'; ?> /> <?php } ?>
120
+ <div class="nsx_iconedTitle" style="display: inline; font-size: 13px; background-image: url(<?php echo $nxs_plurl; ?>img/pn16.png);">Pinterest - <?php _e('publish to', 'nxs_snap') ?> (<i style="color: #005800;"><?php echo $ntOpt['nName']; ?></i>)</div></th> <td><?php //## Only show RePost button if the post is "published"
121
+ if ($post->post_status == "publish" && $isAvailPN) { ?><input alt="<?php echo $ii; ?>" style="float: right;" onmouseout="hidePopShAtt('SV');" onmouseover="showPopShAtt('SV', event);" onclick="return false;" type="button" class="button" name="rePostToPN_repostButton" id="rePostToPN_button" value="<?php _e('Repost to Pinterest', 'nxs_snap') ?>" />
122
  <?php wp_nonce_field( 'rePostToPN', 'rePostToPN_wpnonce' ); } ?>
123
 
124
  <?php if (is_array($pMeta) && is_array($pMeta[$ii]) && isset($pMeta[$ii]['pgID']) ) {
125
  ?> <span id="pstdPN<?php echo $ii; ?>" style="float: right;padding-top: 4px; padding-right: 10px;">
126
+ <a style="font-size: 10px;" href="http://pinterest.com<?php echo $pMeta[$ii]['pgID']; ?>" target="_blank"><?php $nType="Pinterest"; printf( __( 'Posted on', 'nxs_snap' ), $nType); ?> <?php echo (isset($pMeta[$ii]['pDate']) && $pMeta[$ii]['pDate']!='')?(" (".$pMeta[$ii]['pDate'].")"):""; ?></a>
127
  </span><?php } ?>
128
 
129
  </td></tr>
133
 
134
  <tr><th scope="row" style="text-align:right; width:150px; padding-top: 5px; padding-right:10px;">Select Board</th>
135
  <td><select name="pn[<?php echo $ii; ?>][apPNBoard]" id="apPNBoard">
136
+ <?php if ($ntOpt['pnBoardsList']!=''){ $gPNBoards = $ntOpt['pnBoardsList']; if ( base64_encode(base64_decode($gPNBoards)) === $gPNBoards) $gPNBoards = base64_decode($gPNBoards);
137
+ if ($ntOpt['pnBoard']!='') $gPNBoards = str_replace($ntOpt['pnBoard'].'"', $ntOpt['pnBoard'].'" selected="selected"', $gPNBoards); echo $gPNBoards;} else { ?>
138
  <option value="0">None(Click above to retrieve your boards)</option>
139
  <?php } ?>
140
  </select></td>
141
  </tr>
142
 
143
+ <tr id="altFormat1" style=""><th scope="row" style="text-align:right; width:60px; padding-right:10px;"><?php _e('Text Message Format:', 'nxs_snap') ?></th>
144
  <td><input value="<?php echo $pnMsgFormat ?>" type="text" name="pn[<?php echo $ii; ?>][SNAPformat]" style="width:60%;max-width: 610px;" onfocus="jQuery('.nxs_FRMTHint').hide();mxs_showFrmtInfo('apPNMsgFrmt<?php echo $ii; ?>');"/><?php nxs_doShowHint("apPNMsgFrmt".$ii); ?></td></tr>
145
 
146
  <?php }
149
  //#### Save Meta Tags to the Post
150
  function adjMetaOpt($optMt, $pMeta){ if (isset($pMeta['isPosted'])) $optMt['isPosted'] = $pMeta['isPosted']; else $optMt['isPosted'] = '';
151
  if (isset($pMeta['SNAPformat'])) $optMt['pnMsgFormat'] = $pMeta['SNAPformat'];
152
+ if (isset($pMeta['doPN'])) $optMt['doPN'] = $pMeta['doPN'] == 1?1:0; else { if (isset($pMeta['SNAPformat'])) $optMt['doPN'] = 0; }
153
+ if (isset($pMeta['apPNBoard']) && $pMeta['apPNBoard']!='' && $pMeta['apPNBoard']!='0') $optMt['pnBoard'] = $pMeta['apPNBoard'];
154
+ if (isset($pMeta['SNAPincludePN']) && $pMeta['SNAPincludePN'] == '1' ) $optMt['doPN'] = 1;
155
+ return $optMt;
156
  }
157
  }}
158
  if (!function_exists("nxs_rePostToPN_ajax")) {
179
  if ($options['pnDefImg']!='') $imgURL = $options['pnDefImg']; else $imgURL ="http://direct.gtln.us/img/nxs/NextScriptsLogoT.png";
180
  }
181
  else { $post = get_post($postID); if(!$post) return; $pnMsgFormat = $options['pnMsgFormat']; $msg = nsFormatMessage($pnMsgFormat, $postID); $link = get_permalink($postID);
182
+ nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPrePosted'=>'1')); $imgURL = nxs_getPostImage($postID, 'large', $options['pnDefImg']); //prr($options); echo $imgURL."######"; // echo "WW".$postID."|";
183
  if ($isAttachVid=='1') { $vids = nsFindVidsInPost($post); if (count($vids)>0) { $vidURL = 'http://www.youtube.com/v/'.$vids[0]; $imgURL = 'http://img.youtube.com/vi/'.$vids[0].'/0.jpg'; }}
184
  }
185
  $email = $options['pnUName']; $boardID = $options['pnBoard']; $pass = substr($options['pnPass'], 0, 5)=='g9c1a'?nsx_doDecode(substr($options['pnPass'], 5)):$options['pnPass'];// prr($boardID); prr($_POST); die();
inc-cl/su.php CHANGED
@@ -4,21 +4,25 @@ $nxs_snapAvNts[] = array('code'=>'SU', 'lcode'=>'su', 'name'=>'StumbleUpon');
4
 
5
  if (!class_exists("nxs_snapClassSU")) { class nxs_snapClassSU {
6
  //#### Show Common Settings
7
- function showGenNTSettings($ntOpts){ global $nxs_snapThisPageUrl, $nxs_plurl, $nxsOne; $code = 'SU'; $lcode = 'su'; wp_nonce_field( 'ns'.$code, 'ns'.$code.'_wpnonce' ); ?>
8
- <hr/><div class="nsx_iconedTitle" style="background-image: url(<?php echo $nxs_plurl; ?>img/<?php echo $lcode; ?>16.png);">StumbleUpon Settings:
9
- <?php $cgpo = count($ntOpts); $mgpo = 1+max(array_keys($ntOpts)); $nxsOne .= "&g=1"; ?>
10
- <div class="nsBigText">You have <?php echo $cgpo=='0'?'No':$cgpo; ?> StumbleUpon account<?php if ($cgpo!=1){ ?>s<?php } ?> </div></div>
11
- <?php //if (function_exists('nxs_doSMAS1')) nxs_doSMAS1($this, $mgpo); else nxs_doSMAS('Google+', 'GP'.$mgpo); ?>
12
- <?php foreach ($ntOpts as $indx=>$options){ if (trim($options['nName']=='')) $options['nName'] =$options['suUName']; ?>
13
- <p style="margin: 0px;margin-left: 5px;">
14
- <input value="1" id="apDoSU" name="su[<?php echo $indx; ?>][apDoSU]" onchange="doShowHideBlocks('SU');" type="checkbox" <?php if ((int)$options['doSU'] == 1) echo "checked"; ?> />
15
- <strong>Auto-publish your Posts to your StumbleUpon Account <i style="color: #005800;"><?php if($options['nName']!='') echo "(".$options['nName'].")"; ?></i> </strong>
16
- &nbsp;&nbsp;<a id="doSU<?php echo $indx; ?>A" href="#" onclick="doShowHideBlocks2('SU<?php echo $indx; ?>');return false;">[Show Settings]</a> &nbsp;&nbsp;
17
- <a href="#" onclick="doDelAcct('su','<?php echo $indx; ?>', '<?php echo $options['suUName']; ?>');return false;">[Remove Account]</a>
18
- </p>
19
- <?php $this->showNTSettings($indx, $options);
20
- } ?>
21
- <?php
 
 
 
 
22
  }
23
  //#### Show NEW Settings Page
24
  function showNewNTSettings($mgpo){ $options = array('nName'=>'', 'doSU'=>'1', 'suUName'=>'', 'suInclTags'=>'1', 'suAttch'=>'', 'suPass'=>''); $this->showNTSettings($mgpo, $options, true);}
@@ -26,24 +30,24 @@ if (!class_exists("nxs_snapClassSU")) { class nxs_snapClassSU {
26
  function suCats() { return '<option value="A.I.">A.I.</option><option value="AIDS">AIDS</option><option value="Accounting">Accounting</option><option value="Acting">Acting</option><option value="Action Movies">Action Movies</option><option value="Activism">Activism</option><option value="Adult Humor">Adult Humor</option><option value="Advertising">Advertising</option><option value="Africa">Africa</option><option value="African Americans">African Americans</option><option value="Aging">Aging</option><option value="Agriculture">Agriculture</option><option value="Alcoholic Drinks">Alcoholic Drinks</option><option value="Alternative Energy">Alternative Energy</option><option value="Alternative Health">Alternative Health</option><option value="Alternative News">Alternative News</option><option value="Alternative Rock">Alternative Rock</option><option value="Amateur Radio">Amateur Radio</option><option value="Ambient Music">Ambient Music</option><option value="American Football">American Football</option><option value="American History">American History</option><option value="American Lit.">American Lit.</option><option value="Anarchism">Anarchism</option><option value="Anatomy">Anatomy</option><option value="Ancient History">Ancient History</option><option value="Animals">Animals</option><option value="Animation">Animation</option><option value="Anime">Anime</option><option value="Anthropology">Anthropology</option><option value="Antiaging">Antiaging</option><option value="Antiques">Antiques</option><option value="Archaeology">Archaeology</option><option value="Architecture">Architecture</option><option value="Art History">Art History</option><option value="Arthritis">Arthritis</option><option value="Arts">Arts</option><option value="Asia">Asia</option><option value="Asthma">Asthma</option><option value="Astrology/Psychics">Astrology/Psychics</option><option value="Astronomy">Astronomy</option><option value="Atheist/Agnostic">Atheist/Agnostic</option><option value="Audio Equipment">Audio Equipment</option><option value="Australia">Australia</option><option value="Aviation/Aerospace">Aviation/Aerospace</option><option value="BDSM">BDSM</option><option value="Babes">Babes</option><option value="Babies">Babies</option><option value="Badminton">Badminton</option><option value="Ballet">Ballet</option><option value="Banking">Banking</option><option value="Bargains/Coupons">Bargains/Coupons</option><option value="Baseball">Baseball</option><option value="Basketball">Basketball</option><option value="Beauty">Beauty</option><option value="Beer">Beer</option><option value="Beverages">Beverages</option><option value="Bicycling">Bicycling</option><option value="Billiards">Billiards</option><option value="Biographies">Biographies</option><option value="Biology">Biology</option><option value="Biomechanics">Biomechanics</option><option value="Biotech">Biotech</option><option value="Bird Watching">Bird Watching</option><option value="Birds">Birds</option><option value="Bisexual Culture">Bisexual Culture</option><option value="Bisexual Sex">Bisexual Sex</option><option value="Bizarre/Oddities">Bizarre/Oddities</option><option value="Blues music">Blues music</option><option value="Board Games">Board Games</option><option value="Boating">Boating</option><option value="Bodybuilding">Bodybuilding</option><option value="Books">Books</option><option value="Botany">Botany</option><option value="Bowling">Bowling</option><option value="Boxing">Boxing</option><option value="Brain Disorders">Brain Disorders</option><option value="Brazil">Brazil</option><option value="British Literature">British Literature</option><option value="Britpop">Britpop</option><option value="Buddhism">Buddhism</option><option value="Business">Business</option><option value="C.A.D.">C.A.D.</option><option value="Camping">Camping</option><option value="Canada">Canada</option><option value="Cancer">Cancer</option><option value="Canoeing/Kayaking">Canoeing/Kayaking</option><option value="Capitalism">Capitalism</option><option value="Car Parts">Car Parts</option><option value="Card Games">Card Games</option><option value="Career planning">Career planning</option><option value="Caribbean">Caribbean</option><option value="Cars">Cars</option><option value="Cartoons">Cartoons</option><option value="Catholic">Catholic</option><option value="Cats">Cats</option><option value="Celebrities">Celebrities</option><option value="Cell Phones">Cell Phones</option><option value="Celtic Music">Celtic Music</option><option value="Central America">Central America</option><option value="Chaos/Complexity">Chaos/Complexity</option><option value="Cheerleading">Cheerleading</option><option value="Chemical Eng.">Chemical Eng.</option><option value="Chemistry">Chemistry</option><option value="Chess">Chess</option><option value="Children\'s Books">Children\'s Books</option><option value="China">China</option><option value="Christian Music">Christian Music</option><option value="Christianity">Christianity</option><option value="Christmas">Christmas</option><option value="Cigars">Cigars</option><option value="Civil Engineering">Civil Engineering</option><option value="Classic Films">Classic Films</option><option value="Classic Rock">Classic Rock</option><option value="Classical Music">Classical Music</option><option value="Classical Studies">Classical Studies</option><option value="Climbing">Climbing</option><option value="Clothing">Clothing</option><option value="Coffee">Coffee</option><option value="Cognitive Science">Cognitive Science</option><option value="Cold War">Cold War</option><option value="Collecting">Collecting</option><option value="Comedy Movies">Comedy Movies</option><option value="Comic Books">Comic Books</option><option value="Communism">Communism</option><option value="Computer Graphics">Computer Graphics</option><option value="Computer Hardware">Computer Hardware</option><option value="Computer Science">Computer Science</option><option value="Computer Security">Computer Security</option><option value="Computers">Computers</option><option value="Conservative Politics">Conservative Politics</option><option value="Conspiracies">Conspiracies</option><option value="Construction">Construction</option><option value="Consumer Info">Consumer Info</option><option value="Continuing Education">Continuing Education</option><option value="Counterculture">Counterculture</option><option value="Country music">Country music</option><option value="Crafts">Crafts</option><option value="Cricket">Cricket</option><option value="Crime">Crime</option><option value="Crochet">Crochet</option><option value="Cult Films">Cult Films</option><option value="Culture/Ethnicity">Culture/Ethnicity</option><option value="Cyberculture">Cyberculture</option><option value="DJ\'s/Mixing">DJ\'s/Mixing</option><option value="Dance Music">Dance Music</option><option value="Dancing">Dancing</option><option value="Databases">Databases</option><option value="Dating Tips">Dating Tips</option><option value="Daytrading">Daytrading</option><option value="Dentistry">Dentistry</option><option value="Design">Design</option><option value="Desktop Publishing">Desktop Publishing</option><option value="Diabetes">Diabetes</option><option value="Disabilities">Disabilities</option><option value="Disco">Disco</option><option value="Divorce">Divorce</option><option value="Doctors/Surgeons">Doctors/Surgeons</option><option value="Dogs">Dogs</option><option value="Dolls/Puppets">Dolls/Puppets</option><option value="Drama Movies">Drama Movies</option><option value="Drawing">Drawing</option><option value="Drugs">Drugs</option><option value="Drum\'n\'Bass">Drum\'n\'Bass</option><option value="Eastern Studies">Eastern Studies</option><option value="Eating Disorders">Eating Disorders</option><option value="Ecology">Ecology</option><option value="Ecommerce">Ecommerce</option><option value="Economics">Economics</option><option value="Education">Education</option><option value="Electrical Eng.">Electrical Eng.</option><option value="Electronic Devices">Electronic Devices</option><option value="Electronic Parts">Electronic Parts</option><option value="Electronica/IDM">Electronica/IDM</option><option value="Embedded Systems">Embedded Systems</option><option value="Encryption">Encryption</option><option value="Energy Industry">Energy Industry</option><option value="Entertaining Guests">Entertaining Guests</option><option value="Entrepreneurship">Entrepreneurship</option><option value="Environment">Environment</option><option value="Equestrian/Horses">Equestrian/Horses</option><option value="Ergonomics">Ergonomics</option><option value="Erotic Literature">Erotic Literature</option><option value="Ethics">Ethics</option><option value="Ethnic Music">Ethnic Music</option><option value="Europe">Europe</option><option value="Evolution">Evolution</option><option value="Exotic Pets">Exotic Pets</option><option value="Extreme Sports">Extreme Sports</option><option value="Facebook">Facebook</option><option value="Family">Family</option><option value="Fantasy Books">Fantasy Books</option><option value="Fashion">Fashion</option><option value="Feminism">Feminism</option><option value="Fetish Sexuality">Fetish Sexuality</option><option value="Figure Skating">Figure Skating</option><option value="Film Noir">Film Noir</option><option value="Filmmaking">Filmmaking</option><option value="Financial planning">Financial planning</option><option value="Fine Arts">Fine Arts</option><option value="Firefox">Firefox</option><option value="Fish">Fish</option><option value="Fishing">Fishing</option><option value="Fitness">Fitness</option><option value="Flyfishing">Flyfishing</option><option value="Folk music">Folk music</option><option value="Food/Cooking">Food/Cooking</option><option value="For Kids">For Kids</option><option value="Foreign Films">Foreign Films</option><option value="Forensics">Forensics</option><option value="Forestry">Forestry</option><option value="Forums">Forums</option><option value="France">France</option><option value="Funk">Funk</option><option value="Futurism">Futurism</option><option value="Gadgets">Gadgets</option><option value="Gambling">Gambling</option><option value="Gardening">Gardening</option><option value="Gay Culture">Gay Culture</option><option value="Gay Sex">Gay Sex</option><option value="Genealogy">Genealogy</option><option value="Genetics">Genetics</option><option value="Geography">Geography</option><option value="Geoscience">Geoscience</option><option value="Germany">Germany</option><option value="Glaucoma">Glaucoma</option><option value="Golf">Golf</option><option value="Gospel music">Gospel music</option><option value="Goth Culture">Goth Culture</option><option value="Government">Government</option><option value="Graphic Design">Graphic Design</option><option value="Guitar">Guitar</option><option value="Guns">Guns</option><option value="Gymnastics">Gymnastics</option><option value="Hacking">Hacking</option><option value="Health">Health</option><option value="Heart Conditions">Heart Conditions</option><option value="Heavy metal">Heavy metal</option><option value="Hedonism">Hedonism</option><option value="Hentai Anime">Hentai Anime</option><option value="Hiking">Hiking</option><option value="Hinduism">Hinduism</option><option value="HipHop/Rap">HipHop/Rap</option><option value="History">History</option><option value="Hockey">Hockey</option><option value="Home Business">Home Business</option><option value="Home Improvement">Home Improvement</option><option value="Homebrewing">Homebrewing</option><option value="Homemaking">Homemaking</option><option value="Homeschooling">Homeschooling</option><option value="Horror Movies">Horror Movies</option><option value="Hotels">Hotels</option><option value="House music">House music</option><option value="Humanitarianism">Humanitarianism</option><option value="Humanities">Humanities</option><option value="Humor">Humor</option><option value="Hunting">Hunting</option><option value="IT">IT</option><option value="Independent Film">Independent Film</option><option value="India">India</option><option value="Indie Rock/Pop">Indie Rock/Pop</option><option value="Industrial Design">Industrial Design</option><option value="Industrial Music">Industrial Music</option><option value="Instant Messaging">Instant Messaging</option><option value="Insurance">Insurance</option><option value="Int\'l Development">Int\'l Development</option><option value="Interior Design">Interior Design</option><option value="Internet">Internet</option><option value="Internet Tools">Internet Tools</option><option value="Investing">Investing</option><option value="Ipod">Ipod</option><option value="Iraq">Iraq</option><option value="Ireland">Ireland</option><option value="Islam">Islam</option><option value="Israel">Israel</option><option value="Italy">Italy</option><option value="Japan">Japan</option><option value="Java">Java</option><option value="Jazz">Jazz</option><option value="Jewelry">Jewelry</option><option value="Journalism">Journalism</option><option value="Judaism">Judaism</option><option value="Karaoke">Karaoke</option><option value="Kids">Kids</option><option value="Kinesiology">Kinesiology</option><option value="Knitting">Knitting</option><option value="Korea">Korea</option><option value="Landscaping">Landscaping</option><option value="Latin Music">Latin Music</option><option value="Law">Law</option><option value="Learning Disorders">Learning Disorders</option><option value="Lefthanded">Lefthanded</option><option value="Lesbian Culture">Lesbian Culture</option><option value="Lesbian Sex">Lesbian Sex</option><option value="Liberal Politics">Liberal Politics</option><option value="Liberties/Rights">Liberties/Rights</option><option value="Library Resources">Library Resources</option><option value="Lingerie">Lingerie</option><option value="Linguistics">Linguistics</option><option value="Linux/Unix">Linux/Unix</option><option value="Literature">Literature</option><option value="Live Theatre">Live Theatre</option><option value="Logic">Logic</option><option value="Lounge Music">Lounge Music</option><option value="Luxury">Luxury</option><option value="MacOS">MacOS</option><option value="Machinery">Machinery</option><option value="Magic/Illusions">Magic/Illusions</option><option value="Management/HR">Management/HR</option><option value="Manufacturing">Manufacturing</option><option value="Marine Biology">Marine Biology</option><option value="Marketing">Marketing</option><option value="Married Life">Married Life</option><option value="Martial Arts">Martial Arts</option><option value="Matchmaking">Matchmaking</option><option value="Mathematics">Mathematics</option><option value="Mechanical Eng.">Mechanical Eng.</option><option value="Medical Science">Medical Science</option><option value="Medieval History">Medieval History</option><option value="Memorabilia">Memorabilia</option><option value="Men\'s Issues">Men\'s Issues</option><option value="Mental Health">Mental Health</option><option value="Meteorology">Meteorology</option><option value="Mexico">Mexico</option><option value="Microbiology">Microbiology</option><option value="Middle East">Middle East</option><option value="Military">Military</option><option value="Mining/Metallurgy">Mining/Metallurgy</option><option value="Mobile Computing">Mobile Computing</option><option value="Mormon">Mormon</option><option value="Motor Sports">Motor Sports</option><option value="Motorcycles">Motorcycles</option><option value="Movies">Movies</option><option value="Multimedia">Multimedia</option><option value="Music">Music</option><option value="Music Composition">Music Composition</option><option value="Music Instruments">Music Instruments</option><option value="Music Theory">Music Theory</option><option value="Musicals">Musicals</option><option value="Musician Resources">Musician Resources</option><option value="Mutual Funds">Mutual Funds</option><option value="Mystery Novels">Mystery Novels</option><option value="Mythology">Mythology</option><option value="Nanotech">Nanotech</option><option value="Native Americans">Native Americans</option><option value="Nature">Nature</option><option value="Netherlands">Netherlands</option><option value="Network Security">Network Security</option><option value="Neuroscience">Neuroscience</option><option value="New Age">New Age</option><option value="New York">New York</option><option value="News(General)">News(General)</option><option value="Nightlife">Nightlife</option><option value="Nonprofit/Charity">Nonprofit/Charity</option><option value="Nuclear Science">Nuclear Science</option><option value="Nude Art">Nude Art</option><option value="Nursing">Nursing</option><option value="Nutrition">Nutrition</option><option value="Oceania">Oceania</option><option value="Oldies Music">Oldies Music</option><option value="Online Games">Online Games</option><option value="Open Source">Open Source</option><option value="Opera">Opera</option><option value="Operating Systems">Operating Systems</option><option value="Options/Futures">Options/Futures</option><option value="Orthodox">Orthodox</option><option value="Outdoors">Outdoors</option><option value="P2P">P2P</option><option value="PHP">PHP</option><option value="Paganism">Paganism</option><option value="Painting">Painting</option><option value="Paleontology">Paleontology</option><option value="Paranormal">Paranormal</option><option value="Parenting">Parenting</option><option value="Percussion">Percussion</option><option value="Performing Arts">Performing Arts</option><option value="Peripheral Devices">Peripheral Devices</option><option value="Perl">Perl</option><option value="Personal Sites">Personal Sites</option><option value="Petroleum">Petroleum</option><option value="Pets">Pets</option><option value="Pharmacology">Pharmacology</option><option value="Philosophy">Philosophy</option><option value="Photo Gear">Photo Gear</option><option value="Photography">Photography</option><option value="Photoshop">Photoshop</option><option value="Physical Therapy">Physical Therapy</option><option value="Physics">Physics</option><option value="Physiology">Physiology</option><option value="Poetry">Poetry</option><option value="Poker">Poker</option><option value="Political Science">Political Science</option><option value="Politics">Politics</option><option value="Pop music">Pop music</option><option value="Pornography">Pornography</option><option value="Postmodernism">Postmodernism</option><option value="Pregnancy/Birth">Pregnancy/Birth</option><option value="Programming">Programming</option><option value="Protestant">Protestant</option><option value="Proxy">Proxy</option><option value="Psychiatry">Psychiatry</option><option value="Psychology">Psychology</option><option value="Punk Rock">Punk Rock</option><option value="Puzzles">Puzzles</option><option value="Quilting">Quilting</option><option value="Quizzes">Quizzes</option><option value="Quotes">Quotes</option><option value="Racquetball">Racquetball</option><option value="Radio Broadcasts">Radio Broadcasts</option><option value="Rave Culture">Rave Culture</option><option value="Real Estate">Real Estate</option><option value="Recording Gear">Recording Gear</option><option value="Reggae">Reggae</option><option value="Relationships">Relationships</option><option value="Religion">Religion</option><option value="Research">Research</option><option value="Restaurants">Restaurants</option><option value="Restoration">Restoration</option><option value="Robotics">Robotics</option><option value="Rock music">Rock music</option><option value="Rodeo">Rodeo</option><option value="Roleplaying Games">Roleplaying Games</option><option value="Romance Novels">Romance Novels</option><option value="Rugby">Rugby</option><option value="Running">Running</option><option value="Russia">Russia</option><option value="SEO">SEO</option><option value="Sailing">Sailing</option><option value="Satire">Satire</option><option value="Science">Science</option><option value="Science Fiction">Science Fiction</option><option value="Scientology">Scientology</option><option value="Scouting">Scouting</option><option value="Scrapbooking">Scrapbooking</option><option value="Scuba Diving">Scuba Diving</option><option value="Sculpting">Sculpting</option><option value="Search">Search</option><option value="Self Improvement">Self Improvement</option><option value="Semiconductors">Semiconductors</option><option value="Senior Citizens">Senior Citizens</option><option value="Sewing">Sewing</option><option value="Sex Industry">Sex Industry</option><option value="Sex Toys">Sex Toys</option><option value="Sexual Health">Sexual Health</option><option value="Sexuality">Sexuality</option><option value="Shakespeare">Shakespeare</option><option value="Shareware">Shareware</option><option value="Shopping">Shopping</option><option value="Skateboarding">Skateboarding</option><option value="Skiing">Skiing</option><option value="Skydiving">Skydiving</option><option value="Snowboarding">Snowboarding</option><option value="Soap Operas">Soap Operas</option><option value="Soccer">Soccer</option><option value="Socialism">Socialism</option><option value="Sociology">Sociology</option><option value="Software">Software</option><option value="Songwriting">Songwriting</option><option value="Soul/R&amp;B">Soul/R&amp;B</option><option value="Soundtracks">Soundtracks</option><option value="South America">South America</option><option value="Space Exploration">Space Exploration</option><option value="Spain">Spain</option><option value="Spas">Spas</option><option value="Spirituality">Spirituality</option><option value="Sports(General)">Sports(General)</option><option value="Squash">Squash</option><option value="Statistics">Statistics</option><option value="StumbleUpon">StumbleUpon</option><option value="Subculture">Subculture</option><option value="Substance Abuse">Substance Abuse</option><option value="Sufism">Sufism</option><option value="Sunni">Sunni</option><option value="Supercomputing">Supercomputing</option><option value="Surfing">Surfing</option><option value="Survivalist">Survivalist</option><option value="Swimming">Swimming</option><option value="Swingers">Swingers</option><option value="Tattoos/Piercing">Tattoos/Piercing</option><option value="Taxation">Taxation</option><option value="Tea">Tea</option><option value="Techno">Techno</option><option value="Technology">Technology</option><option value="Teen Life">Teen Life</option><option value="Teen Parenting">Teen Parenting</option><option value="Telecom">Telecom</option><option value="Television">Television</option><option value="Tennis">Tennis</option><option value="Terrorism">Terrorism</option><option value="Toys">Toys</option><option value="Track/Field">Track/Field</option><option value="Trains/Railroads">Trains/Railroads</option><option value="Trance">Trance</option><option value="Transexual Sex">Transexual Sex</option><option value="Transportation">Transportation</option><option value="Travel">Travel</option><option value="TripHop/Downtempo">TripHop/Downtempo</option><option value="UFOs">UFOs</option><option value="UK">UK</option><option value="USA">USA</option><option value="University/College">University/College</option><option value="Vegetarian">Vegetarian</option><option value="Video Equipment">Video Equipment</option><option value="Video Games">Video Games</option><option value="Vintage Cars">Vintage Cars</option><option value="Virtual Reality">Virtual Reality</option><option value="Vocal Music">Vocal Music</option><option value="Volleyball">Volleyball</option><option value="Water Sports">Water Sports</option><option value="Web Development">Web Development</option><option value="Webhosting">Webhosting</option><option value="Weblogs">Weblogs</option><option value="Weddings">Weddings</option><option value="Weight Loss">Weight Loss</option><option value="Wicca">Wicca</option><option value="Windows">Windows</option><option value="Windows Dev">Windows Dev</option><option value="Windsurfing">Windsurfing</option><option value="Wine">Wine</option><option value="Women\'s Issues">Women\'s Issues</option><option value="Woodworking">Woodworking</option><option value="Wrestling">Wrestling</option><option value="Writing">Writing</option><option value="Yoga">Yoga</option><option value="Zoology">Zoology</option>'; }
27
  //#### Show Unit Settings
28
  function showNTSettings($ii, $options, $isNew=false){ global $nxs_plurl; ?>
29
- <div id="doSU<?php echo $ii; ?>Div" <?php if ($isNew){ ?>class="clNewNTSets"<?php } ?> style="max-width: 1000px; background-color: #EBF4FB; background-image: url(<?php echo $nxs_plurl; ?>img/su-bg.png); background-position:90% 10%; background-repeat: no-repeat; margin: 10px; border: 1px solid #808080; padding: 10px; display:none;"> <input type="hidden" name="apDoSSU<?php echo $ii; ?>" value="0" id="apDoSSU<?php echo $ii; ?>" />
30
 
31
- <div class="nsx_iconedTitle" style="float: right; background-image: url(<?php echo $nxs_plurl; ?>img/su16.png);"><a style="font-size: 12px;" target="_blank" href="http://www.nextscripts.com/setup-installation-stumbleupon-social-networks-auto-poster-wordpress/">Detailed StumbleUpon Installation/Configuration Instructions</a></div>
32
 
33
- <div style="width:100%;"><strong>Account Nickname:</strong> <i>Just so you can easely identify it</i> </div><input name="su[<?php echo $ii; ?>][nName]" id="sunName<?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")), 'NS_SNAutoPoster') ?>" /><br/>
34
  <?php echo nxs_addQTranslSel('su', $ii, $options['qTLng']); ?><?php echo nxs_addPostingDelaySel('su', $ii, $options['nHrs'], $options['nMin']); ?>
35
 
36
  <?php if (!$isNew) { ?>
37
- <div style="width:100%;"><strong>Auto-Post Categories:</strong>
38
  <input value="0" id="catSelA<?php echo $ii; ?>" type="radio" name="su[<?php echo $ii; ?>][catSel]" <?php if ((int)$options['catSel'] != 1) echo "checked"; ?> /> All
39
  <input value="1" id="catSelSSU<?php echo $ii; ?>" type="radio" name="su[<?php echo $ii; ?>][catSel]" <?php if ((int)$options['catSel'] == 1) echo "checked"; ?> /> <a href="#" style="text-decoration: none;" class="showCats" id="nxs_SCA_SU<?php echo $ii; ?>" onclick="jQuery('#catSelSSU<?php echo $ii; ?>').attr('checked', true); jQuery('#tmpCatSelNT').val('SU<?php echo $ii; ?>'); nxs_markCats( jQuery('#nxs_SC_SU<?php echo $ii; ?>').val() ); jQuery('#showCatSel').bPopup({ modalClose: false, appendTo: '#nsStForm', opacity: 0.6, follow: [false, false], position: [75, 'auto']}); return false;">Selected<?php if ($options['catSelEd']!='') echo "[".(substr_count($options['catSelEd'], ",")+1)."]"; ?></a>
40
  <input type="hidden" name="su[<?php echo $ii; ?>][catSelEd]" id="nxs_SC_SU<?php echo $ii; ?>" value="<?php echo $options['catSelEd']; ?>" />
41
- </div>
42
  <br/>
43
  <?php } ?>
44
 
45
- <div style="width:100%;"><strong>StumbleUpon Username:</strong> </div><input name="su[<?php echo $ii; ?>][apSUUName]" id="apSUUName" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['suUName'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" />
46
- <div style="width:100%;"><strong>StumbleUpon Password:</strong> </div><input name="su[<?php echo $ii; ?>][apSUPass]" id="apSUPass" type="password" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities(substr($options['suPass'], 0, 5)=='n5g9a'?nsx_doDecode(substr($options['suPass'], 5)):$options['suPass'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" /> <br/>
47
 
48
  <?php if ($isNew) { ?> <input type="hidden" name="su[<?php echo $ii; ?>][apDoSU]" value="1" id="apDoNewSU<?php echo $ii; ?>" /> <?php } ?>
49
  <br/>
@@ -53,7 +57,7 @@ if (!class_exists("nxs_snapClassSU")) { class nxs_snapClassSU {
53
 
54
  <select name="su[<?php echo $ii; ?>][apSUCat]" id="apSUCat<?php echo $ii; ?>"><option value="error" selected="selected" disabled="">Select default StumbleUpon Category</option>
55
  <?php $suCats = $this->suCats();
56
- if (isset($options['suCat']) && $options['suCat']!='') $suCats = str_replace($options['suCat'].'"', $options['suCat'].'" selected="selected"', $suCats); echo $suCats;
57
 
58
  ?>
59
  </select>
@@ -65,17 +69,17 @@ if (!class_exists("nxs_snapClassSU")) { class nxs_snapClassSU {
65
  </p>
66
 
67
  <div id="altFormat" style="">
68
- <div style="width:100%;"><strong id="altFormatText">Post Text Format</strong> (<a href="#" id="apSUMsgFrmt<?php echo $ii; ?>HintInfo" onclick="mxs_showHideFrmtInfo('apSUMsgFrmt<?php echo $ii; ?>'); return false;">Show format info</a>)</div>
69
- <input name="su[<?php echo $ii; ?>][apSUMsgFrmt]" id="apSUMsgFrmt" style="width: 50%;" value="<?php if ($isNew) echo "%TITLE% - %TEXT%"; else _e(apply_filters('format_to_edit', htmlentities($options['suMsgFormat'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster'); ?>" onfocus="mxs_showFrmtInfo('apSUMsgFrmt<?php echo $ii; ?>');" /><?php nxs_doShowHint("apSUMsgFrmt".$ii); ?>
70
  </div><br/>
71
 
72
  <?php if ($options['suPass']!='') { ?>
73
  <?php wp_nonce_field( 'rePostToSU', 'rePostToSU_wpnonce' ); ?>
74
- <b>Test your settings:</b>&nbsp;&nbsp;&nbsp; <a href="#" class="NXSButton" onclick="testPost('SU', '<?php echo $ii; ?>'); return false;">Submit Test Post to StumbleUpon</a>
75
 
76
  <?php }
77
 
78
- ?><div class="submit"><input type="submit" class="button-primary" name="update_NS_SNAutoPoster_settings" value="<?php _e('Update Settings', 'NS_SNAutoPoster') ?>" /></div></div><?php
79
  }
80
  //#### Set Unit Settings from POST
81
  function setNTSettings($post, $options){ global $nxs_snapThisPageUrl; $code = 'SU'; $lcode = 'su';
@@ -100,20 +104,21 @@ if (!class_exists("nxs_snapClassSU")) { class nxs_snapClassSU {
100
  }
101
  //#### Show Post->Edit Meta Box Settings
102
  function showEdPostNTSettings($ntOpts, $post){ global $nxs_plurl; $post_id = $post->ID;
103
- foreach($ntOpts as $ii=>$ntOpt) { $pMeta = maybe_unserialize(get_post_meta($post_id, 'snapSU', true)); if (is_array($pMeta)) $ntOpt = $this->adjMetaOpt($ntOpt, $pMeta[$ii]); $doSU = $ntOpt['doSU'] && $ntOpt['catSel']!='1';
 
104
  $isAvailSU = $ntOpt['suUName']!='' && $ntOpt['suPass']!=''; $suMsgFormat = htmlentities($ntOpt['suMsgFormat'], ENT_COMPAT, "UTF-8"); $suMsgTFormat = htmlentities($ntOpt['suMsgTFormat'], ENT_COMPAT, "UTF-8");
105
  ?>
106
  <tr><th style="text-align:left;" colspan="2"><?php if ( $ntOpt['catSel']=='1' && trim($ntOpt['catSelEd'])!='' ) { ?> <input type="hidden" class="nxs_SC" id="nxs_SC_SU<?php echo $ii; ?>" value="<?php echo $ntOpt['catSelEd']; ?>" /> <?php } ?>
107
- <?php if ($isAvailSU) { ?><input class="nxsGrpDoChb" value="1" id="doSU<?php echo $ii; ?>" <?php if ($post->post_status == "publish") echo 'disabled="disabled"';?> type="checkbox" name="su[<?php echo $ii; ?>][SNAPincludeSU]" <?php if (($post->post_status == "publish" && $ntOpt['isPosted'] == '1') || ($post->post_status != "publish" && ((int)$doSU == 1)) ) echo 'checked="checked" title="def"'; ?> /> <?php } ?>
108
 
109
- <div class="nsx_iconedTitle" style="display: inline; font-size: 13px; background-image: url(<?php echo $nxs_plurl; ?>img/su16.png);">StumbleUpon - publish to (<i style="color: #005800;"><?php echo $ntOpt['nName']; ?></i>)</div></th> <td><?php //## Only show RePost button if the post is "published"
110
- if ($post->post_status == "publish" && $isAvailSU) { ?><input alt="<?php echo $ii; ?>" style="float: right;" onmouseout="hidePopShAtt('SV');" onmouseover="showPopShAtt('SV', event);" onclick="return false;" type="button" class="button" name="rePostToSU_repostButton" id="rePostToSU_button" value="<?php _e('Repost to StumbleUpon', 're-post') ?>" />
111
  <?php wp_nonce_field( 'rePostToSU', 'rePostToSU_wpnonce' ); } ?>
112
 
113
  <?php if (is_array($pMeta) && is_array($pMeta[$ii]) && isset($pMeta[$ii]['pgID']) ) {
114
 
115
  ?> <span id="pstdSU<?php echo $ii; ?>" style="float: right;padding-top: 4px; padding-right: 10px;">
116
- <a style="font-size: 10px;" href="http://www.stumbleupon.com/content/<?php echo $pMeta[$ii]['pgID']; ?>" target="_blank">Posted on Stumbleupon <?php echo (isset($pMeta[$ii]['pDate']) && $pMeta[$ii]['pDate']!='')?(" (".$pMeta[$ii]['pDate'].")"):""; ?></a>
117
  </span><?php } ?>
118
  </td></tr>
119
 
@@ -131,7 +136,7 @@ if (!class_exists("nxs_snapClassSU")) { class nxs_snapClassSU {
131
 
132
  </div> </td></tr>
133
 
134
- <tr id="altFormat1" style=""><th scope="row" style="text-align:right; width:60px; padding-right:10px;"><?php _e('Text Format:', 'NS_SPAP') ?></th>
135
  <td><input value="<?php echo $suMsgFormat ?>" type="text" name="su[<?php echo $ii; ?>][SNAPformat]" style="width:60%;max-width: 610px;" onfocus="jQuery('.nxs_FRMTHint').hide();mxs_showFrmtInfo('apSUMsgFrmt<?php echo $ii; ?>');"/><?php nxs_doShowHint("apSUMsgFrmt".$ii); ?></td></tr>
136
  <?php }
137
  }
@@ -141,7 +146,9 @@ if (!class_exists("nxs_snapClassSU")) { class nxs_snapClassSU {
141
  if (isset($pMeta['nsfw'])) $optMt['nsfw'] = $pMeta['nsfw'];
142
  if (isset($pMeta['SNAPformat'])) $optMt['suMsgFormat'] = $pMeta['SNAPformat'];
143
  if (isset($pMeta['apSUCat'])) $optMt['suCat'] = $pMeta['apSUCat'];
144
- if (isset($pMeta['SNAPincludeSU'])) $optMt['doSU'] = $pMeta['SNAPincludeSU'] == 1?1:0; else { if (isset($pMeta['SNAPformat'])) $optMt['doSU'] = 0; } return $optMt;
 
 
145
  }
146
  }}
147
  if (!function_exists("nxs_rePostToSU_ajax")) {
@@ -154,11 +161,13 @@ if (!function_exists("nxs_rePostToSU_ajax")) {
154
  }
155
  }
156
 
157
- if (!function_exists("nxs_getSUHeaders")) { function nxs_getSUHeaders($ref, $post=false){ $hdrsArr = array();
158
- $hdrsArr['X-Requested-With']='XMLHttpRequest'; $hdrsArr['Connection']='keep-alive'; $hdrsArr['Referer']=$ref;
159
- $hdrsArr['User-Agent']='Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.45 Safari/537.17';
 
160
  if($post) $hdrsArr['Content-Type']='application/x-www-form-urlencoded';
161
- $hdrsArr['Accept']='application/json, text/javascript, */*; q=0.01'; $hdrsArr['Origin']='http://www.stumbleupon.com';
 
162
  $hdrsArr['Accept-Encoding']='gzip,deflate,sdch'; $hdrsArr['Accept-Language']='en-US,en;q=0.8'; $hdrsArr['Accept-Charset']='ISO-8859-1,utf-8;q=0.7,*;q=0.3'; return $hdrsArr;
163
  }}
164
  if (!function_exists("nxs_doCheckSU")) {function nxs_doCheckSU(){ global $nxs_suCkArray; $hdrsArr = nxs_getSUHeaders('https://www.stumbleupon.com/submit'); $ckArr = $nxs_suCkArray;
@@ -173,7 +182,8 @@ if (!function_exists("nxs_doCheckSU")) {function nxs_doCheckSU(){ global $nxs_su
173
  return false;
174
  }}
175
  if (!function_exists("nxs_doConnectToSU")) { function nxs_doConnectToSU($u, $p){ global $nxs_suCkArray; $hdrsArr = nxs_getSUHeaders('https://www.stumbleupon.com/login', true); // echo "LOGGIN";
176
- $response = wp_remote_get('https://www.stumbleupon.com/login'); $contents = $response['body']; //$response['body'] = htmlentities($response['body']); prr($response); die();
 
177
  $ckArr = $response['cookies'];
178
  $frmTxt = CutFromTo($contents, '<form id="login-form"','</form>'); $md = array(); $flds = array();// prr($frmTxt);
179
  while (stripos($frmTxt, '<input')!==false){ $inpField = trim(CutFromTo($frmTxt,'<input', '>')); $name = trim(CutFromTo($inpField,'name="', '"'));
@@ -187,33 +197,33 @@ if (!function_exists("nxs_doConnectToSU")) { function nxs_doConnectToSU($u, $p)
187
  if ($resp['_success']=='1') { $ckArr = nxsMergeArraysOV($ckArr, $r2['cookies']); $nxs_suCkArray = $ckArr; return false; } elseif (isset($resp['_reason'])) { return $resp['_reason']; } else return "ERROR";
188
  }}
189
  if (!function_exists("nxs_doPostToSU")) { function nxs_doPostToSU($msg, $lnk, $cat, $tags, $nsfw=false){ global $nxs_suCkArray; $r2 = wp_remote_get($lnk);
190
- $hdrsArr = nxs_getSUHeaders('http://www.stumbleupon.com/submit'); $ckArr = $nxs_suCkArray;
191
- $response = wp_remote_get('http://www.stumbleupon.com/submit', array( 'method' => 'GET', 'timeout' => 45, 'redirection' => 0, 'headers' => $hdrsArr, 'cookies' => $ckArr));
192
  $ckArr2 = nxsMergeArraysOV($ckArr, $response['cookies']); //$nxs_suCkArray = $ckArr;
193
 
194
  $contents = $response['body']; //$response['body'] = htmlentities($response['body']); prr($response);
195
  //$ckArr = nxsMergeArraysOV($ckArr, $response['cookies']);
196
- $hdrsArr = nxs_getSUHeaders('http://www.stumbleupon.com/submit', true);
197
  $frmTxt = CutFromTo($contents, '<form method="post" id="submit-form"','</form>'); $md = array(); $flds = array(); // prr($contents);
198
  while (stripos($frmTxt, '<input')!==false){ $inpField = trim(CutFromTo($frmTxt,'<input', '>')); $name = trim(CutFromTo($inpField,'name="', '"'));
199
  if ( stripos($inpField, '"hidden"')!==false && $name!='' && !in_array($name, $md)) { $md[] = $name; $val = trim(CutFromTo($inpField,'value="', '"')); $flds[$name]= $val; $mids .= "&".$name."=".$val;}
200
  $frmTxt = substr($frmTxt, stripos($frmTxt, '<input')+8);
201
  } $flds['url'] = $lnk; $flds['review'] = $msg; $flds['tags'] = $cat; $flds['nsfw'] = $nsfw?'true':'false'; $flds['user-tags'] = $tags; $flds['_output'] = 'Json'; $flds['_method'] = 'create'; $flds['language'] = 'EN';
202
 
203
- $r2 = wp_remote_post('http://www.stumbleupon.com/submit', array('method' => 'POST', 'timeout' => 45, 'redirection' => 0, 'headers' => $hdrsArr, 'body' => $flds, 'cookies' => $ckArr));
204
  $resp = json_decode($r2['body'], true); // prr($flds); prr($resp); //nxs_addToLog('SU', 'E', '-=DBG=- '.print_r($resp, true)." - #####", $extInfo);
205
 
206
  if (stripos($resp['_reason'][0]['message'], 'Failed to add URL')!==false) { sleep(5);
207
- $r2 = wp_remote_post('http://www.stumbleupon.com/submit', array('method' => 'POST', 'timeout' => 45, 'redirection' => 0, 'headers' => $hdrsArr, 'body' => $flds, 'cookies' => $ckArr));
208
  $resp = json_decode($r2['body'], true); // prr($flds); prr($resp); //nxs_addToLog('SU', 'E', '-=DBG=- '.print_r($resp, true)." - #####", $extInfo);
209
  }
210
 
211
  if (stripos($resp['_error'], 'Invalid token')!==false) { // In case we got the Wrong Cookies
212
- $r2 = wp_remote_post('http://www.stumbleupon.com/submit', array('method' => 'POST', 'timeout' => 45, 'redirection' => 0, 'headers' => $hdrsArr, 'body' => $flds, 'cookies' => $ckArr2));
213
  $resp = json_decode($r2['body'], true); // prr($flds); prr($resp); //nxs_addToLog('SU', 'E', '-=DBG=- '.print_r($resp, true)." - #####", $extInfo);
214
 
215
  if (stripos($resp['_reason'][0]['message'], 'Failed to add URL')!==false) { sleep(5);
216
- $r2 = wp_remote_post('http://www.stumbleupon.com/submit', array('method' => 'POST', 'timeout' => 45, 'redirection' => 0, 'headers' => $hdrsArr, 'body' => $flds, 'cookies' => $ckArr2));
217
  $resp = json_decode($r2['body'], true); // prr($flds); prr($resp); //nxs_addToLog('SU', 'E', '-=DBG=- '.print_r($resp, true)." - #####", $extInfo);
218
  }
219
  }
4
 
5
  if (!class_exists("nxs_snapClassSU")) { class nxs_snapClassSU {
6
  //#### Show Common Settings
7
+ function showGenNTSettings($ntOpts){ global $nxs_plurl; $ntInfo = array('code'=>'SU', 'lcode'=>'su', 'name'=>'StumbleUpon', 'defNName'=>'suUName', 'tstReq' => false); ?>
8
+ <div class="nxs_box">
9
+ <div class="nxs_box_header">
10
+ <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']; ?>
11
+ <?php $cbo = count($ntOpts); ?> <?php wp_nonce_field( 'ns'.$ntInfo['code'], 'ns'.$ntInfo['code'].'_wpnonce' ); ?>
12
+ <?php if ($cbo>1){ ?><div class="nsBigText"><?php echo "(".($cbo=='0'?'No':$cbo)." "; _e('accounts', 'nxs_snap'); echo ")"; ?></div><?php } ?>
13
+ </div>
14
+ </div>
15
+ <div class="nxs_box_inside">
16
+ <?php foreach ($ntOpts as $indx=>$pbo){ if (trim($pbo['nName']=='')) $pbo['nName'] = $pbo[$ntInfo['defNName']]; ?>
17
+ <p style="margin:0px;margin-left:5px;">
18
+ <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"; ?> />
19
+ <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>
20
+ &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;
21
+ <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>
22
+ </p><?php $this->showNTSettings($indx, $pbo);
23
+ }?>
24
+ </div>
25
+ </div> <?php
26
  }
27
  //#### Show NEW Settings Page
28
  function showNewNTSettings($mgpo){ $options = array('nName'=>'', 'doSU'=>'1', 'suUName'=>'', 'suInclTags'=>'1', 'suAttch'=>'', 'suPass'=>''); $this->showNTSettings($mgpo, $options, true);}
30
  function suCats() { return '<option value="A.I.">A.I.</option><option value="AIDS">AIDS</option><option value="Accounting">Accounting</option><option value="Acting">Acting</option><option value="Action Movies">Action Movies</option><option value="Activism">Activism</option><option value="Adult Humor">Adult Humor</option><option value="Advertising">Advertising</option><option value="Africa">Africa</option><option value="African Americans">African Americans</option><option value="Aging">Aging</option><option value="Agriculture">Agriculture</option><option value="Alcoholic Drinks">Alcoholic Drinks</option><option value="Alternative Energy">Alternative Energy</option><option value="Alternative Health">Alternative Health</option><option value="Alternative News">Alternative News</option><option value="Alternative Rock">Alternative Rock</option><option value="Amateur Radio">Amateur Radio</option><option value="Ambient Music">Ambient Music</option><option value="American Football">American Football</option><option value="American History">American History</option><option value="American Lit.">American Lit.</option><option value="Anarchism">Anarchism</option><option value="Anatomy">Anatomy</option><option value="Ancient History">Ancient History</option><option value="Animals">Animals</option><option value="Animation">Animation</option><option value="Anime">Anime</option><option value="Anthropology">Anthropology</option><option value="Antiaging">Antiaging</option><option value="Antiques">Antiques</option><option value="Archaeology">Archaeology</option><option value="Architecture">Architecture</option><option value="Art History">Art History</option><option value="Arthritis">Arthritis</option><option value="Arts">Arts</option><option value="Asia">Asia</option><option value="Asthma">Asthma</option><option value="Astrology/Psychics">Astrology/Psychics</option><option value="Astronomy">Astronomy</option><option value="Atheist/Agnostic">Atheist/Agnostic</option><option value="Audio Equipment">Audio Equipment</option><option value="Australia">Australia</option><option value="Aviation/Aerospace">Aviation/Aerospace</option><option value="BDSM">BDSM</option><option value="Babes">Babes</option><option value="Babies">Babies</option><option value="Badminton">Badminton</option><option value="Ballet">Ballet</option><option value="Banking">Banking</option><option value="Bargains/Coupons">Bargains/Coupons</option><option value="Baseball">Baseball</option><option value="Basketball">Basketball</option><option value="Beauty">Beauty</option><option value="Beer">Beer</option><option value="Beverages">Beverages</option><option value="Bicycling">Bicycling</option><option value="Billiards">Billiards</option><option value="Biographies">Biographies</option><option value="Biology">Biology</option><option value="Biomechanics">Biomechanics</option><option value="Biotech">Biotech</option><option value="Bird Watching">Bird Watching</option><option value="Birds">Birds</option><option value="Bisexual Culture">Bisexual Culture</option><option value="Bisexual Sex">Bisexual Sex</option><option value="Bizarre/Oddities">Bizarre/Oddities</option><option value="Blues music">Blues music</option><option value="Board Games">Board Games</option><option value="Boating">Boating</option><option value="Bodybuilding">Bodybuilding</option><option value="Books">Books</option><option value="Botany">Botany</option><option value="Bowling">Bowling</option><option value="Boxing">Boxing</option><option value="Brain Disorders">Brain Disorders</option><option value="Brazil">Brazil</option><option value="British Literature">British Literature</option><option value="Britpop">Britpop</option><option value="Buddhism">Buddhism</option><option value="Business">Business</option><option value="C.A.D.">C.A.D.</option><option value="Camping">Camping</option><option value="Canada">Canada</option><option value="Cancer">Cancer</option><option value="Canoeing/Kayaking">Canoeing/Kayaking</option><option value="Capitalism">Capitalism</option><option value="Car Parts">Car Parts</option><option value="Card Games">Card Games</option><option value="Career planning">Career planning</option><option value="Caribbean">Caribbean</option><option value="Cars">Cars</option><option value="Cartoons">Cartoons</option><option value="Catholic">Catholic</option><option value="Cats">Cats</option><option value="Celebrities">Celebrities</option><option value="Cell Phones">Cell Phones</option><option value="Celtic Music">Celtic Music</option><option value="Central America">Central America</option><option value="Chaos/Complexity">Chaos/Complexity</option><option value="Cheerleading">Cheerleading</option><option value="Chemical Eng.">Chemical Eng.</option><option value="Chemistry">Chemistry</option><option value="Chess">Chess</option><option value="Children\'s Books">Children\'s Books</option><option value="China">China</option><option value="Christian Music">Christian Music</option><option value="Christianity">Christianity</option><option value="Christmas">Christmas</option><option value="Cigars">Cigars</option><option value="Civil Engineering">Civil Engineering</option><option value="Classic Films">Classic Films</option><option value="Classic Rock">Classic Rock</option><option value="Classical Music">Classical Music</option><option value="Classical Studies">Classical Studies</option><option value="Climbing">Climbing</option><option value="Clothing">Clothing</option><option value="Coffee">Coffee</option><option value="Cognitive Science">Cognitive Science</option><option value="Cold War">Cold War</option><option value="Collecting">Collecting</option><option value="Comedy Movies">Comedy Movies</option><option value="Comic Books">Comic Books</option><option value="Communism">Communism</option><option value="Computer Graphics">Computer Graphics</option><option value="Computer Hardware">Computer Hardware</option><option value="Computer Science">Computer Science</option><option value="Computer Security">Computer Security</option><option value="Computers">Computers</option><option value="Conservative Politics">Conservative Politics</option><option value="Conspiracies">Conspiracies</option><option value="Construction">Construction</option><option value="Consumer Info">Consumer Info</option><option value="Continuing Education">Continuing Education</option><option value="Counterculture">Counterculture</option><option value="Country music">Country music</option><option value="Crafts">Crafts</option><option value="Cricket">Cricket</option><option value="Crime">Crime</option><option value="Crochet">Crochet</option><option value="Cult Films">Cult Films</option><option value="Culture/Ethnicity">Culture/Ethnicity</option><option value="Cyberculture">Cyberculture</option><option value="DJ\'s/Mixing">DJ\'s/Mixing</option><option value="Dance Music">Dance Music</option><option value="Dancing">Dancing</option><option value="Databases">Databases</option><option value="Dating Tips">Dating Tips</option><option value="Daytrading">Daytrading</option><option value="Dentistry">Dentistry</option><option value="Design">Design</option><option value="Desktop Publishing">Desktop Publishing</option><option value="Diabetes">Diabetes</option><option value="Disabilities">Disabilities</option><option value="Disco">Disco</option><option value="Divorce">Divorce</option><option value="Doctors/Surgeons">Doctors/Surgeons</option><option value="Dogs">Dogs</option><option value="Dolls/Puppets">Dolls/Puppets</option><option value="Drama Movies">Drama Movies</option><option value="Drawing">Drawing</option><option value="Drugs">Drugs</option><option value="Drum\'n\'Bass">Drum\'n\'Bass</option><option value="Eastern Studies">Eastern Studies</option><option value="Eating Disorders">Eating Disorders</option><option value="Ecology">Ecology</option><option value="Ecommerce">Ecommerce</option><option value="Economics">Economics</option><option value="Education">Education</option><option value="Electrical Eng.">Electrical Eng.</option><option value="Electronic Devices">Electronic Devices</option><option value="Electronic Parts">Electronic Parts</option><option value="Electronica/IDM">Electronica/IDM</option><option value="Embedded Systems">Embedded Systems</option><option value="Encryption">Encryption</option><option value="Energy Industry">Energy Industry</option><option value="Entertaining Guests">Entertaining Guests</option><option value="Entrepreneurship">Entrepreneurship</option><option value="Environment">Environment</option><option value="Equestrian/Horses">Equestrian/Horses</option><option value="Ergonomics">Ergonomics</option><option value="Erotic Literature">Erotic Literature</option><option value="Ethics">Ethics</option><option value="Ethnic Music">Ethnic Music</option><option value="Europe">Europe</option><option value="Evolution">Evolution</option><option value="Exotic Pets">Exotic Pets</option><option value="Extreme Sports">Extreme Sports</option><option value="Facebook">Facebook</option><option value="Family">Family</option><option value="Fantasy Books">Fantasy Books</option><option value="Fashion">Fashion</option><option value="Feminism">Feminism</option><option value="Fetish Sexuality">Fetish Sexuality</option><option value="Figure Skating">Figure Skating</option><option value="Film Noir">Film Noir</option><option value="Filmmaking">Filmmaking</option><option value="Financial planning">Financial planning</option><option value="Fine Arts">Fine Arts</option><option value="Firefox">Firefox</option><option value="Fish">Fish</option><option value="Fishing">Fishing</option><option value="Fitness">Fitness</option><option value="Flyfishing">Flyfishing</option><option value="Folk music">Folk music</option><option value="Food/Cooking">Food/Cooking</option><option value="For Kids">For Kids</option><option value="Foreign Films">Foreign Films</option><option value="Forensics">Forensics</option><option value="Forestry">Forestry</option><option value="Forums">Forums</option><option value="France">France</option><option value="Funk">Funk</option><option value="Futurism">Futurism</option><option value="Gadgets">Gadgets</option><option value="Gambling">Gambling</option><option value="Gardening">Gardening</option><option value="Gay Culture">Gay Culture</option><option value="Gay Sex">Gay Sex</option><option value="Genealogy">Genealogy</option><option value="Genetics">Genetics</option><option value="Geography">Geography</option><option value="Geoscience">Geoscience</option><option value="Germany">Germany</option><option value="Glaucoma">Glaucoma</option><option value="Golf">Golf</option><option value="Gospel music">Gospel music</option><option value="Goth Culture">Goth Culture</option><option value="Government">Government</option><option value="Graphic Design">Graphic Design</option><option value="Guitar">Guitar</option><option value="Guns">Guns</option><option value="Gymnastics">Gymnastics</option><option value="Hacking">Hacking</option><option value="Health">Health</option><option value="Heart Conditions">Heart Conditions</option><option value="Heavy metal">Heavy metal</option><option value="Hedonism">Hedonism</option><option value="Hentai Anime">Hentai Anime</option><option value="Hiking">Hiking</option><option value="Hinduism">Hinduism</option><option value="HipHop/Rap">HipHop/Rap</option><option value="History">History</option><option value="Hockey">Hockey</option><option value="Home Business">Home Business</option><option value="Home Improvement">Home Improvement</option><option value="Homebrewing">Homebrewing</option><option value="Homemaking">Homemaking</option><option value="Homeschooling">Homeschooling</option><option value="Horror Movies">Horror Movies</option><option value="Hotels">Hotels</option><option value="House music">House music</option><option value="Humanitarianism">Humanitarianism</option><option value="Humanities">Humanities</option><option value="Humor">Humor</option><option value="Hunting">Hunting</option><option value="IT">IT</option><option value="Independent Film">Independent Film</option><option value="India">India</option><option value="Indie Rock/Pop">Indie Rock/Pop</option><option value="Industrial Design">Industrial Design</option><option value="Industrial Music">Industrial Music</option><option value="Instant Messaging">Instant Messaging</option><option value="Insurance">Insurance</option><option value="Int\'l Development">Int\'l Development</option><option value="Interior Design">Interior Design</option><option value="Internet">Internet</option><option value="Internet Tools">Internet Tools</option><option value="Investing">Investing</option><option value="Ipod">Ipod</option><option value="Iraq">Iraq</option><option value="Ireland">Ireland</option><option value="Islam">Islam</option><option value="Israel">Israel</option><option value="Italy">Italy</option><option value="Japan">Japan</option><option value="Java">Java</option><option value="Jazz">Jazz</option><option value="Jewelry">Jewelry</option><option value="Journalism">Journalism</option><option value="Judaism">Judaism</option><option value="Karaoke">Karaoke</option><option value="Kids">Kids</option><option value="Kinesiology">Kinesiology</option><option value="Knitting">Knitting</option><option value="Korea">Korea</option><option value="Landscaping">Landscaping</option><option value="Latin Music">Latin Music</option><option value="Law">Law</option><option value="Learning Disorders">Learning Disorders</option><option value="Lefthanded">Lefthanded</option><option value="Lesbian Culture">Lesbian Culture</option><option value="Lesbian Sex">Lesbian Sex</option><option value="Liberal Politics">Liberal Politics</option><option value="Liberties/Rights">Liberties/Rights</option><option value="Library Resources">Library Resources</option><option value="Lingerie">Lingerie</option><option value="Linguistics">Linguistics</option><option value="Linux/Unix">Linux/Unix</option><option value="Literature">Literature</option><option value="Live Theatre">Live Theatre</option><option value="Logic">Logic</option><option value="Lounge Music">Lounge Music</option><option value="Luxury">Luxury</option><option value="MacOS">MacOS</option><option value="Machinery">Machinery</option><option value="Magic/Illusions">Magic/Illusions</option><option value="Management/HR">Management/HR</option><option value="Manufacturing">Manufacturing</option><option value="Marine Biology">Marine Biology</option><option value="Marketing">Marketing</option><option value="Married Life">Married Life</option><option value="Martial Arts">Martial Arts</option><option value="Matchmaking">Matchmaking</option><option value="Mathematics">Mathematics</option><option value="Mechanical Eng.">Mechanical Eng.</option><option value="Medical Science">Medical Science</option><option value="Medieval History">Medieval History</option><option value="Memorabilia">Memorabilia</option><option value="Men\'s Issues">Men\'s Issues</option><option value="Mental Health">Mental Health</option><option value="Meteorology">Meteorology</option><option value="Mexico">Mexico</option><option value="Microbiology">Microbiology</option><option value="Middle East">Middle East</option><option value="Military">Military</option><option value="Mining/Metallurgy">Mining/Metallurgy</option><option value="Mobile Computing">Mobile Computing</option><option value="Mormon">Mormon</option><option value="Motor Sports">Motor Sports</option><option value="Motorcycles">Motorcycles</option><option value="Movies">Movies</option><option value="Multimedia">Multimedia</option><option value="Music">Music</option><option value="Music Composition">Music Composition</option><option value="Music Instruments">Music Instruments</option><option value="Music Theory">Music Theory</option><option value="Musicals">Musicals</option><option value="Musician Resources">Musician Resources</option><option value="Mutual Funds">Mutual Funds</option><option value="Mystery Novels">Mystery Novels</option><option value="Mythology">Mythology</option><option value="Nanotech">Nanotech</option><option value="Native Americans">Native Americans</option><option value="Nature">Nature</option><option value="Netherlands">Netherlands</option><option value="Network Security">Network Security</option><option value="Neuroscience">Neuroscience</option><option value="New Age">New Age</option><option value="New York">New York</option><option value="News(General)">News(General)</option><option value="Nightlife">Nightlife</option><option value="Nonprofit/Charity">Nonprofit/Charity</option><option value="Nuclear Science">Nuclear Science</option><option value="Nude Art">Nude Art</option><option value="Nursing">Nursing</option><option value="Nutrition">Nutrition</option><option value="Oceania">Oceania</option><option value="Oldies Music">Oldies Music</option><option value="Online Games">Online Games</option><option value="Open Source">Open Source</option><option value="Opera">Opera</option><option value="Operating Systems">Operating Systems</option><option value="Options/Futures">Options/Futures</option><option value="Orthodox">Orthodox</option><option value="Outdoors">Outdoors</option><option value="P2P">P2P</option><option value="PHP">PHP</option><option value="Paganism">Paganism</option><option value="Painting">Painting</option><option value="Paleontology">Paleontology</option><option value="Paranormal">Paranormal</option><option value="Parenting">Parenting</option><option value="Percussion">Percussion</option><option value="Performing Arts">Performing Arts</option><option value="Peripheral Devices">Peripheral Devices</option><option value="Perl">Perl</option><option value="Personal Sites">Personal Sites</option><option value="Petroleum">Petroleum</option><option value="Pets">Pets</option><option value="Pharmacology">Pharmacology</option><option value="Philosophy">Philosophy</option><option value="Photo Gear">Photo Gear</option><option value="Photography">Photography</option><option value="Photoshop">Photoshop</option><option value="Physical Therapy">Physical Therapy</option><option value="Physics">Physics</option><option value="Physiology">Physiology</option><option value="Poetry">Poetry</option><option value="Poker">Poker</option><option value="Political Science">Political Science</option><option value="Politics">Politics</option><option value="Pop music">Pop music</option><option value="Pornography">Pornography</option><option value="Postmodernism">Postmodernism</option><option value="Pregnancy/Birth">Pregnancy/Birth</option><option value="Programming">Programming</option><option value="Protestant">Protestant</option><option value="Proxy">Proxy</option><option value="Psychiatry">Psychiatry</option><option value="Psychology">Psychology</option><option value="Punk Rock">Punk Rock</option><option value="Puzzles">Puzzles</option><option value="Quilting">Quilting</option><option value="Quizzes">Quizzes</option><option value="Quotes">Quotes</option><option value="Racquetball">Racquetball</option><option value="Radio Broadcasts">Radio Broadcasts</option><option value="Rave Culture">Rave Culture</option><option value="Real Estate">Real Estate</option><option value="Recording Gear">Recording Gear</option><option value="Reggae">Reggae</option><option value="Relationships">Relationships</option><option value="Religion">Religion</option><option value="Research">Research</option><option value="Restaurants">Restaurants</option><option value="Restoration">Restoration</option><option value="Robotics">Robotics</option><option value="Rock music">Rock music</option><option value="Rodeo">Rodeo</option><option value="Roleplaying Games">Roleplaying Games</option><option value="Romance Novels">Romance Novels</option><option value="Rugby">Rugby</option><option value="Running">Running</option><option value="Russia">Russia</option><option value="SEO">SEO</option><option value="Sailing">Sailing</option><option value="Satire">Satire</option><option value="Science">Science</option><option value="Science Fiction">Science Fiction</option><option value="Scientology">Scientology</option><option value="Scouting">Scouting</option><option value="Scrapbooking">Scrapbooking</option><option value="Scuba Diving">Scuba Diving</option><option value="Sculpting">Sculpting</option><option value="Search">Search</option><option value="Self Improvement">Self Improvement</option><option value="Semiconductors">Semiconductors</option><option value="Senior Citizens">Senior Citizens</option><option value="Sewing">Sewing</option><option value="Sex Industry">Sex Industry</option><option value="Sex Toys">Sex Toys</option><option value="Sexual Health">Sexual Health</option><option value="Sexuality">Sexuality</option><option value="Shakespeare">Shakespeare</option><option value="Shareware">Shareware</option><option value="Shopping">Shopping</option><option value="Skateboarding">Skateboarding</option><option value="Skiing">Skiing</option><option value="Skydiving">Skydiving</option><option value="Snowboarding">Snowboarding</option><option value="Soap Operas">Soap Operas</option><option value="Soccer">Soccer</option><option value="Socialism">Socialism</option><option value="Sociology">Sociology</option><option value="Software">Software</option><option value="Songwriting">Songwriting</option><option value="Soul/R&amp;B">Soul/R&amp;B</option><option value="Soundtracks">Soundtracks</option><option value="South America">South America</option><option value="Space Exploration">Space Exploration</option><option value="Spain">Spain</option><option value="Spas">Spas</option><option value="Spirituality">Spirituality</option><option value="Sports(General)">Sports(General)</option><option value="Squash">Squash</option><option value="Statistics">Statistics</option><option value="StumbleUpon">StumbleUpon</option><option value="Subculture">Subculture</option><option value="Substance Abuse">Substance Abuse</option><option value="Sufism">Sufism</option><option value="Sunni">Sunni</option><option value="Supercomputing">Supercomputing</option><option value="Surfing">Surfing</option><option value="Survivalist">Survivalist</option><option value="Swimming">Swimming</option><option value="Swingers">Swingers</option><option value="Tattoos/Piercing">Tattoos/Piercing</option><option value="Taxation">Taxation</option><option value="Tea">Tea</option><option value="Techno">Techno</option><option value="Technology">Technology</option><option value="Teen Life">Teen Life</option><option value="Teen Parenting">Teen Parenting</option><option value="Telecom">Telecom</option><option value="Television">Television</option><option value="Tennis">Tennis</option><option value="Terrorism">Terrorism</option><option value="Toys">Toys</option><option value="Track/Field">Track/Field</option><option value="Trains/Railroads">Trains/Railroads</option><option value="Trance">Trance</option><option value="Transexual Sex">Transexual Sex</option><option value="Transportation">Transportation</option><option value="Travel">Travel</option><option value="TripHop/Downtempo">TripHop/Downtempo</option><option value="UFOs">UFOs</option><option value="UK">UK</option><option value="USA">USA</option><option value="University/College">University/College</option><option value="Vegetarian">Vegetarian</option><option value="Video Equipment">Video Equipment</option><option value="Video Games">Video Games</option><option value="Vintage Cars">Vintage Cars</option><option value="Virtual Reality">Virtual Reality</option><option value="Vocal Music">Vocal Music</option><option value="Volleyball">Volleyball</option><option value="Water Sports">Water Sports</option><option value="Web Development">Web Development</option><option value="Webhosting">Webhosting</option><option value="Weblogs">Weblogs</option><option value="Weddings">Weddings</option><option value="Weight Loss">Weight Loss</option><option value="Wicca">Wicca</option><option value="Windows">Windows</option><option value="Windows Dev">Windows Dev</option><option value="Windsurfing">Windsurfing</option><option value="Wine">Wine</option><option value="Women\'s Issues">Women\'s Issues</option><option value="Woodworking">Woodworking</option><option value="Wrestling">Wrestling</option><option value="Writing">Writing</option><option value="Yoga">Yoga</option><option value="Zoology">Zoology</option>'; }
31
  //#### Show Unit Settings
32
  function showNTSettings($ii, $options, $isNew=false){ global $nxs_plurl; ?>
33
+ <div id="doSU<?php echo $ii; ?>Div" class="insOneDiv<?php if ($isNew) echo " clNewNTSets"; ?>" style="background-image: url(<?php echo $nxs_plurl; ?>img/su-bg.png); background-position:90% 10%;"> <input type="hidden" name="apDoSSU<?php echo $ii; ?>" value="0" id="apDoSSU<?php echo $ii; ?>" />
34
 
35
+ <div class="nsx_iconedTitle" style="float: right; background-image: url(<?php echo $nxs_plurl; ?>img/su16.png);"><a style="font-size: 12px;" target="_blank" href="http://www.nextscripts.com/setup-installation-stumbleupon-social-networks-auto-poster-wordpress/"><?php $nType="StumbleUpon"; printf( __( 'Detailed %s Installation/Configuration Instructions', 'nxs_snap' ), $nType); ?></a></div>
36
 
37
+ <div style="width:100%;"><strong><?php _e('Account Nickname', 'nxs_snap'); ?>:</strong> <i><?php _e('Just so you can easely identify it', 'nxs_snap'); ?></i> </div><input name="su[<?php echo $ii; ?>][nName]" id="sunName<?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")), 'nxs_snap') ?>" /><br/>
38
  <?php echo nxs_addQTranslSel('su', $ii, $options['qTLng']); ?><?php echo nxs_addPostingDelaySel('su', $ii, $options['nHrs'], $options['nMin']); ?>
39
 
40
  <?php if (!$isNew) { ?>
41
+ <div style="width:100%;"><strong><?php _e('Categories', 'nxs_snap'); ?>:</strong>
42
  <input value="0" id="catSelA<?php echo $ii; ?>" type="radio" name="su[<?php echo $ii; ?>][catSel]" <?php if ((int)$options['catSel'] != 1) echo "checked"; ?> /> All
43
  <input value="1" id="catSelSSU<?php echo $ii; ?>" type="radio" name="su[<?php echo $ii; ?>][catSel]" <?php if ((int)$options['catSel'] == 1) echo "checked"; ?> /> <a href="#" style="text-decoration: none;" class="showCats" id="nxs_SCA_SU<?php echo $ii; ?>" onclick="jQuery('#catSelSSU<?php echo $ii; ?>').attr('checked', true); jQuery('#tmpCatSelNT').val('SU<?php echo $ii; ?>'); nxs_markCats( jQuery('#nxs_SC_SU<?php echo $ii; ?>').val() ); jQuery('#showCatSel').bPopup({ modalClose: false, appendTo: '#nsStForm', opacity: 0.6, follow: [false, false], position: [75, 'auto']}); return false;">Selected<?php if ($options['catSelEd']!='') echo "[".(substr_count($options['catSelEd'], ",")+1)."]"; ?></a>
44
  <input type="hidden" name="su[<?php echo $ii; ?>][catSelEd]" id="nxs_SC_SU<?php echo $ii; ?>" value="<?php echo $options['catSelEd']; ?>" />
45
+ <br/><i><?php _e('Only selected categories will be autoposted to this account', 'nxs_snap'); ?></i></div>
46
  <br/>
47
  <?php } ?>
48
 
49
+ <div style="width:100%;"><strong>StumbleUpon Username:</strong> </div><input name="su[<?php echo $ii; ?>][apSUUName]" id="apSUUName" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['suUName'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" />
50
+ <div style="width:100%;"><strong>StumbleUpon Password:</strong> </div><input name="su[<?php echo $ii; ?>][apSUPass]" id="apSUPass" type="password" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities(substr($options['suPass'], 0, 5)=='n5g9a'?nsx_doDecode(substr($options['suPass'], 5)):$options['suPass'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" /> <br/>
51
 
52
  <?php if ($isNew) { ?> <input type="hidden" name="su[<?php echo $ii; ?>][apDoSU]" value="1" id="apDoNewSU<?php echo $ii; ?>" /> <?php } ?>
53
  <br/>
57
 
58
  <select name="su[<?php echo $ii; ?>][apSUCat]" id="apSUCat<?php echo $ii; ?>"><option value="error" selected="selected" disabled="">Select default StumbleUpon Category</option>
59
  <?php $suCats = $this->suCats();
60
+ if (isset($options['suCat']) && $options['suCat']!='') $suCats = str_replace('"'.$options['suCat'].'"', '"'.$options['suCat'].'" selected="selected"', $suCats); echo $suCats;
61
 
62
  ?>
63
  </select>
69
  </p>
70
 
71
  <div id="altFormat" style="">
72
+ <div style="width:100%;"><strong id="altFormatText"><?php _e('Post Text Format', 'nxs_snap'); ?></strong> (<a href="#" id="apSUMsgFrmt<?php echo $ii; ?>HintInfo" onclick="mxs_showHideFrmtInfo('apSUMsgFrmt<?php echo $ii; ?>'); return false;"><?php _e('Show format info', 'nxs_snap'); ?></a>)</div>
73
+ <input name="su[<?php echo $ii; ?>][apSUMsgFrmt]" id="apSUMsgFrmt" style="width: 50%;" value="<?php if ($isNew) echo "%TITLE% - %TEXT%"; else _e(apply_filters('format_to_edit', htmlentities($options['suMsgFormat'], ENT_COMPAT, "UTF-8")), 'nxs_snap'); ?>" onfocus="mxs_showFrmtInfo('apSUMsgFrmt<?php echo $ii; ?>');" /><?php nxs_doShowHint("apSUMsgFrmt".$ii); ?>
74
  </div><br/>
75
 
76
  <?php if ($options['suPass']!='') { ?>
77
  <?php wp_nonce_field( 'rePostToSU', 'rePostToSU_wpnonce' ); ?>
78
+ <b><?php _e('Test your settings', 'nxs_snap'); ?>:</b>&nbsp;&nbsp;&nbsp; <a href="#" class="NXSButton" onclick="testPost('SU', '<?php echo $ii; ?>'); return false;"><?php printf( __( 'Submit Test Post to %s' , 'nxs_snap'), $nType); ?></a>
79
 
80
  <?php }
81
 
82
+ ?><div class="submit"><input type="submit" class="button-primary" name="update_NS_SNAutoPoster_settings" value="<?php _e('Update Settings', 'nxs_snap') ?>" /></div></div><?php
83
  }
84
  //#### Set Unit Settings from POST
85
  function setNTSettings($post, $options){ global $nxs_snapThisPageUrl; $code = 'SU'; $lcode = 'su';
104
  }
105
  //#### Show Post->Edit Meta Box Settings
106
  function showEdPostNTSettings($ntOpts, $post){ global $nxs_plurl; $post_id = $post->ID;
107
+ foreach($ntOpts as $ii=>$ntOpt) { $pMeta = maybe_unserialize(get_post_meta($post_id, 'snapSU', true)); if (is_array($pMeta)) $ntOpt = $this->adjMetaOpt($ntOpt, $pMeta[$ii]);
108
+ $doSU = $ntOpt['doSU'] && (is_array($pMeta) || $ntOpt['catSel']!='1');
109
  $isAvailSU = $ntOpt['suUName']!='' && $ntOpt['suPass']!=''; $suMsgFormat = htmlentities($ntOpt['suMsgFormat'], ENT_COMPAT, "UTF-8"); $suMsgTFormat = htmlentities($ntOpt['suMsgTFormat'], ENT_COMPAT, "UTF-8");
110
  ?>
111
  <tr><th style="text-align:left;" colspan="2"><?php if ( $ntOpt['catSel']=='1' && trim($ntOpt['catSelEd'])!='' ) { ?> <input type="hidden" class="nxs_SC" id="nxs_SC_SU<?php echo $ii; ?>" value="<?php echo $ntOpt['catSelEd']; ?>" /> <?php } ?>
112
+ <?php if ($isAvailSU) { ?><input class="nxsGrpDoChb" value="1" id="doSU<?php echo $ii; ?>" <?php if ($post->post_status == "publish") echo 'disabled="disabled"';?> type="checkbox" name="su[<?php echo $ii; ?>][doSU]" <?php if (($post->post_status == "publish" && $ntOpt['isPosted'] == '1') || ($post->post_status != "publish" && ((int)$doSU == 1)) ) echo 'checked="checked" title="def"'; ?> /> <?php } ?>
113
 
114
+ <div class="nsx_iconedTitle" style="display: inline; font-size: 13px; background-image: url(<?php echo $nxs_plurl; ?>img/su16.png);">StumbleUpon - <?php _e('publish to', 'nxs_snap') ?> (<i style="color: #005800;"><?php echo $ntOpt['nName']; ?></i>)</div></th> <td><?php //## Only show RePost button if the post is "published"
115
+ if ($post->post_status == "publish" && $isAvailSU) { ?><input alt="<?php echo $ii; ?>" style="float: right;" onmouseout="hidePopShAtt('SV');" onmouseover="showPopShAtt('SV', event);" onclick="return false;" type="button" class="button" name="rePostToSU_repostButton" id="rePostToSU_button" value="<?php _e('Repost to StumbleUpon', 'nxs_snap') ?>" />
116
  <?php wp_nonce_field( 'rePostToSU', 'rePostToSU_wpnonce' ); } ?>
117
 
118
  <?php if (is_array($pMeta) && is_array($pMeta[$ii]) && isset($pMeta[$ii]['pgID']) ) {
119
 
120
  ?> <span id="pstdSU<?php echo $ii; ?>" style="float: right;padding-top: 4px; padding-right: 10px;">
121
+ <a style="font-size: 10px;" href="http://www.stumbleupon.com/content/<?php echo $pMeta[$ii]['pgID']; ?>" target="_blank"><?php $nType="Stumbleupon"; printf( __( 'Posted on', 'nxs_snap' ), $nType); ?> <?php echo (isset($pMeta[$ii]['pDate']) && $pMeta[$ii]['pDate']!='')?(" (".$pMeta[$ii]['pDate'].")"):""; ?></a>
122
  </span><?php } ?>
123
  </td></tr>
124
 
136
 
137
  </div> </td></tr>
138
 
139
+ <tr id="altFormat1" style=""><th scope="row" style="text-align:right; width:60px; padding-right:10px;"><?php _e('Text Format:', 'nxs_snap') ?></th>
140
  <td><input value="<?php echo $suMsgFormat ?>" type="text" name="su[<?php echo $ii; ?>][SNAPformat]" style="width:60%;max-width: 610px;" onfocus="jQuery('.nxs_FRMTHint').hide();mxs_showFrmtInfo('apSUMsgFrmt<?php echo $ii; ?>');"/><?php nxs_doShowHint("apSUMsgFrmt".$ii); ?></td></tr>
141
  <?php }
142
  }
146
  if (isset($pMeta['nsfw'])) $optMt['nsfw'] = $pMeta['nsfw'];
147
  if (isset($pMeta['SNAPformat'])) $optMt['suMsgFormat'] = $pMeta['SNAPformat'];
148
  if (isset($pMeta['apSUCat'])) $optMt['suCat'] = $pMeta['apSUCat'];
149
+ if (isset($pMeta['doSU'])) $optMt['doSU'] = $pMeta['doSU'] == 1?1:0; else { if (isset($pMeta['SNAPformat'])) $optMt['doSU'] = 0; }
150
+ if (isset($pMeta['SNAPincludeSU']) && $pMeta['SNAPincludeSU'] == '1' ) $optMt['doSU'] = 1;
151
+ return $optMt;
152
  }
153
  }}
154
  if (!function_exists("nxs_rePostToSU_ajax")) {
161
  }
162
  }
163
 
164
+ if (!function_exists("nxs_getSUHeaders")) { function nxs_getSUHeaders($ref, $post=false, $xhr=true){ $hdrsArr = array();
165
+ if ($xhr) $hdrsArr['X-Requested-With']='XMLHttpRequest';
166
+ $hdrsArr['Connection']='keep-alive'; $hdrsArr['Referer']=$ref;
167
+ $hdrsArr['User-Agent']='Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)';
168
  if($post) $hdrsArr['Content-Type']='application/x-www-form-urlencoded';
169
+ if ($xhr) $hdrsArr['Accept']='application/json, text/javascript, */*; q=0.01'; else $hdrsArr['Accept']='text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8';
170
+ $hdrsArr['Origin']='http://www.stumbleupon.com';
171
  $hdrsArr['Accept-Encoding']='gzip,deflate,sdch'; $hdrsArr['Accept-Language']='en-US,en;q=0.8'; $hdrsArr['Accept-Charset']='ISO-8859-1,utf-8;q=0.7,*;q=0.3'; return $hdrsArr;
172
  }}
173
  if (!function_exists("nxs_doCheckSU")) {function nxs_doCheckSU(){ global $nxs_suCkArray; $hdrsArr = nxs_getSUHeaders('https://www.stumbleupon.com/submit'); $ckArr = $nxs_suCkArray;
182
  return false;
183
  }}
184
  if (!function_exists("nxs_doConnectToSU")) { function nxs_doConnectToSU($u, $p){ global $nxs_suCkArray; $hdrsArr = nxs_getSUHeaders('https://www.stumbleupon.com/login', true); // echo "LOGGIN";
185
+ $response = wp_remote_get('https://www.stumbleupon.com/login'); if (is_wp_error($response)) { nxs_addToLog('SU', 'E', '-=ERROR=- '.print_r($response, true), ''); return "Connection ERROR. Please see log";}
186
+ $contents = $response['body']; //$response['body'] = htmlentities($response['body']); prr($response); die();
187
  $ckArr = $response['cookies'];
188
  $frmTxt = CutFromTo($contents, '<form id="login-form"','</form>'); $md = array(); $flds = array();// prr($frmTxt);
189
  while (stripos($frmTxt, '<input')!==false){ $inpField = trim(CutFromTo($frmTxt,'<input', '>')); $name = trim(CutFromTo($inpField,'name="', '"'));
197
  if ($resp['_success']=='1') { $ckArr = nxsMergeArraysOV($ckArr, $r2['cookies']); $nxs_suCkArray = $ckArr; return false; } elseif (isset($resp['_reason'])) { return $resp['_reason']; } else return "ERROR";
198
  }}
199
  if (!function_exists("nxs_doPostToSU")) { function nxs_doPostToSU($msg, $lnk, $cat, $tags, $nsfw=false){ global $nxs_suCkArray; $r2 = wp_remote_get($lnk);
200
+ $hdrsArr = nxs_getSUHeaders('https://www.stumbleupon.com/submit', false, false); $ckArr = $nxs_suCkArray;
201
+ $response = wp_remote_get('https://www.stumbleupon.com/submit', array( 'method' => 'GET', 'timeout' => 45, 'redirection' => 0, 'headers' => $hdrsArr, 'cookies' => $ckArr));
202
  $ckArr2 = nxsMergeArraysOV($ckArr, $response['cookies']); //$nxs_suCkArray = $ckArr;
203
 
204
  $contents = $response['body']; //$response['body'] = htmlentities($response['body']); prr($response);
205
  //$ckArr = nxsMergeArraysOV($ckArr, $response['cookies']);
206
+ $hdrsArr = nxs_getSUHeaders('https://www.stumbleupon.com/submit', true);
207
  $frmTxt = CutFromTo($contents, '<form method="post" id="submit-form"','</form>'); $md = array(); $flds = array(); // prr($contents);
208
  while (stripos($frmTxt, '<input')!==false){ $inpField = trim(CutFromTo($frmTxt,'<input', '>')); $name = trim(CutFromTo($inpField,'name="', '"'));
209
  if ( stripos($inpField, '"hidden"')!==false && $name!='' && !in_array($name, $md)) { $md[] = $name; $val = trim(CutFromTo($inpField,'value="', '"')); $flds[$name]= $val; $mids .= "&".$name."=".$val;}
210
  $frmTxt = substr($frmTxt, stripos($frmTxt, '<input')+8);
211
  } $flds['url'] = $lnk; $flds['review'] = $msg; $flds['tags'] = $cat; $flds['nsfw'] = $nsfw?'true':'false'; $flds['user-tags'] = $tags; $flds['_output'] = 'Json'; $flds['_method'] = 'create'; $flds['language'] = 'EN';
212
 
213
+ $r2 = wp_remote_post('https://www.stumbleupon.com/submit', array('method' => 'POST', 'timeout' => 45, 'redirection' => 0, 'headers' => $hdrsArr, 'body' => $flds, 'cookies' => $ckArr));
214
  $resp = json_decode($r2['body'], true); // prr($flds); prr($resp); //nxs_addToLog('SU', 'E', '-=DBG=- '.print_r($resp, true)." - #####", $extInfo);
215
 
216
  if (stripos($resp['_reason'][0]['message'], 'Failed to add URL')!==false) { sleep(5);
217
+ $r2 = wp_remote_post('https://www.stumbleupon.com/submit', array('method' => 'POST', 'timeout' => 45, 'redirection' => 0, 'headers' => $hdrsArr, 'body' => $flds, 'cookies' => $ckArr));
218
  $resp = json_decode($r2['body'], true); // prr($flds); prr($resp); //nxs_addToLog('SU', 'E', '-=DBG=- '.print_r($resp, true)." - #####", $extInfo);
219
  }
220
 
221
  if (stripos($resp['_error'], 'Invalid token')!==false) { // In case we got the Wrong Cookies
222
+ $r2 = wp_remote_post('https://www.stumbleupon.com/submit', array('method' => 'POST', 'timeout' => 45, 'redirection' => 0, 'headers' => $hdrsArr, 'body' => $flds, 'cookies' => $ckArr2));
223
  $resp = json_decode($r2['body'], true); // prr($flds); prr($resp); //nxs_addToLog('SU', 'E', '-=DBG=- '.print_r($resp, true)." - #####", $extInfo);
224
 
225
  if (stripos($resp['_reason'][0]['message'], 'Failed to add URL')!==false) { sleep(5);
226
+ $r2 = wp_remote_post('https://www.stumbleupon.com/submit', array('method' => 'POST', 'timeout' => 45, 'redirection' => 0, 'headers' => $hdrsArr, 'body' => $flds, 'cookies' => $ckArr2));
227
  $resp = json_decode($r2['body'], true); // prr($flds); prr($resp); //nxs_addToLog('SU', 'E', '-=DBG=- '.print_r($resp, true)." - #####", $extInfo);
228
  }
229
  }
inc-cl/tr.php CHANGED
@@ -4,8 +4,7 @@ $nxs_snapAvNts[] = array('code'=>'TR', 'lcode'=>'tr', 'name'=>'Tumblr');
4
 
5
  if (!class_exists("nxs_snapClassTR")) { class nxs_snapClassTR {
6
  //#### Show Common Settings
7
- function showGenNTSettings($ntOpts){ global $nxs_snapThisPageUrl, $nxs_plurl; $code = 'TR'; $lcode = 'tr'; wp_nonce_field( 'ns'.$code, 'ns'.$code.'_wpnonce' );
8
-
9
  if ( isset($_GET['auth']) && $_GET['auth']=='tr'){ require_once('apis/trOAuth.php'); $options = $ntOpts[$_GET['acc']];
10
  $consumer_key = $options['trConsKey']; $consumer_secret = $options['trConsSec'];
11
  $callback_url = $nxs_snapThisPageUrl."&auth=tra&acc=".$_GET['acc'];
@@ -19,7 +18,7 @@ if (!class_exists("nxs_snapClassTR")) { class nxs_snapClassTR {
19
  }
20
  die();
21
  }
22
- if ( isset($_GET['auth']) && $_GET['auth']=='tra'){ require_once('apis/trOAuth.php'); $options = $ntOpts[$_GET['acc']];
23
  $consumer_key = $options['trConsKey']; $consumer_secret = $options['trConsSec'];
24
  $tum_oauth = new TumblrOAuth($consumer_key, $consumer_secret, $options['trOAuthToken'], $options['trOAuthTokenSecret']);
25
  $options['trAccessTocken'] = $tum_oauth->getAccessToken($_REQUEST['oauth_verifier']); // prr($_GET); prr($_REQUEST); prr($options['trAccessTocken']);
@@ -33,45 +32,51 @@ if (!class_exists("nxs_snapClassTR")) { class nxs_snapClassTR {
33
  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>");
34
  }
35
  }
36
-
37
-
38
  ?>
39
- <hr/><div class="nsx_iconedTitle" style="background-image: url(<?php echo $nxs_plurl; ?>img/<?php echo $lcode; ?>16.png);">Tumblr Settings: <?php $cfbo = count($ntOpts); $mfbo = 1+max(array_keys($ntOpts)); ?> <?php wp_nonce_field( 'nsFB', 'nsFB_wpnonce' ); ?>
40
- <div class="nsBigText">You have <?php echo $cfbo=='0'?'No':$cfbo; ?> Tumblr account<?php if ($cfbo!=1){ ?>s<?php } ?> <!-- - <a href="#" class="NXSButton" onclick="doShowHideBlocks2('FB<?php echo $mfbo; ?>');return false;">Add new Facebook Account</a> --> </div></div>
41
-
42
- <?php // if (function_exists('nxs_doSMAS1')) nxs_doSMAS1($this, $mfbo); else nxs_doSMAS('Tumblr', 'TR'.$mfbo); ?>
43
- <?php foreach ($ntOpts as $indx=>$pbo){ if (trim($pbo['nName']=='')) $pbo['nName'] = str_ireplace('https://','', str_ireplace('http://','', $pbo['trURL'])); ?>
44
- <p style="margin: 0px;margin-left: 5px;"><input value="1" id="apDoTR" name="tr[<?php echo $indx; ?>][apDoTR]" type="checkbox" <?php if ((int)$pbo['doTR'] == 1) echo "checked"; ?> />
45
- <strong>Auto-publish your Posts to your Tumblr Blog <i style="color: #005800;"><?php if($pbo['nName']!='') echo "(".$pbo['nName'].")"; ?></i> </strong>
46
- &nbsp;&nbsp;<a id="doTR<?php echo $indx; ?>A" href="#" onclick="doShowHideBlocks2('TR<?php echo $indx; ?>');return false;">[Show Settings]</a>&nbsp;&nbsp;
47
- <a href="#" onclick="doDelAcct('tr', '<?php echo $indx; ?>', '<?php if (isset($pbo['trURL'])) echo $pbo['trURL']; ?>');return false;">[Remove Account]</a>
48
- </p><?php $this->showNTSettings($indx, $pbo);
49
- } //## END TR Settings
 
 
 
 
 
 
 
 
50
  }
51
  //#### Show NEW Settings Page
52
  function showNewNTSettings($bo){ $po = array('nName'=>'', 'doTR'=>'1', 'trURL'=>'', 'trPgID'=>'', 'trConsKey'=>'', 'trInclTags'=>'1', 'cImgURL'=>'R', 'trConsSec'=>'', 'trPostType'=>'T', 'trDefImg'=>'', 'trOAuthTokenSecret'=>'', 'trAccessTocken'=>'', 'trMsgFormat'=>'<p>New Post has been published on %URL%</p><blockquote><p><strong>%TITLE%</strong></p><p><img src=\'%IMG%\'/></p><p>%FULLTEXT%</p></blockquote>', 'trMsgTFormat'=>'New Post has been published on %SITENAME%' ); $this->showNTSettings($bo, $po, true);}
53
  //#### Show Unit Settings
54
  function showNTSettings($ii, $options, $isNew=false){ global $nxs_plurl,$nxs_snapThisPageUrl; ?>
55
- <div id="doTR<?php echo $ii; ?>Div"<?php if ($isNew){ ?>class="clNewNTSets"<?php } ?> style="max-width: 1000px; background-color: #EBF4FB; background-image: url(<?php echo $nxs_plurl; ?>img/tr-bg.png); background-position:90% 10%; background-repeat: no-repeat; margin: 10px; border: 1px solid #808080; padding: 10px; <?php if ((isset($options['trOAuthTokenSecret']) && $options['trOAuthTokenSecret']!='')||$isNew) { ?>display:none;<?php } ?>"> <input type="hidden" name="apDoSTR<?php echo $ii; ?>" value="0" id="apDoSTR<?php echo $ii; ?>" />
56
  <?php if ($isNew) { ?> <input type="hidden" name="tr[<?php echo $ii; ?>][apDoTR]" value="1" id="apDoNewTR<?php echo $ii; ?>" /> <?php } ?>
57
 
58
- <div class="nsx_iconedTitle" style="float: right; background-image: url(<?php echo $nxs_plurl; ?>img/tr16.png);"><a style="font-size: 12px;" target="_blank" href="http://www.nextscripts.com/setup-installation-tumblr-social-networks-auto-poster-wordpress/">Detailed Tumblr Installation/Configuration Instructions</a></div>
59
 
60
- <div style="width:100%;"><strong>Account Nickname:</strong> <i>Just so you can easely identify it</i> </div><input name="tr[<?php echo $ii; ?>][nName]" id="trnName<?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")), 'NS_SNAutoPoster') ?>" /><br/>
61
  <?php echo nxs_addQTranslSel('tr', $ii, $options['qTLng']); ?><?php echo nxs_addPostingDelaySel('tr', $ii, $options['nHrs'], $options['nMin']); ?>
62
 
63
  <?php if (!$isNew) { ?>
64
- <div style="width:100%;"><strong>Auto-Post Categories:</strong>
65
  <input value="0" id="catSelA<?php echo $ii; ?>" type="radio" name="tr[<?php echo $ii; ?>][catSel]" <?php if ((int)$options['catSel'] != 1) echo "checked"; ?> /> All
66
  <input value="1" id="catSelSTR<?php echo $ii; ?>" type="radio" name="tr[<?php echo $ii; ?>][catSel]" <?php if ((int)$options['catSel'] == 1) echo "checked"; ?> /> <a href="#" style="text-decoration: none;" class="showCats" id="nxs_SCA_TR<?php echo $ii; ?>" onclick="jQuery('#catSelSTR<?php echo $ii; ?>').attr('checked', true); jQuery('#tmpCatSelNT').val('TR<?php echo $ii; ?>'); nxs_markCats( jQuery('#nxs_SC_TR<?php echo $ii; ?>').val() ); jQuery('#showCatSel').bPopup({ modalClose: false, appendTo: '#nsStForm', opacity: 0.6, follow: [false, false], position: [75, 'auto']}); return false;">Selected<?php if ($options['catSelEd']!='') echo "[".(substr_count($options['catSelEd'], ",")+1)."]"; ?></a>
67
  <input type="hidden" name="tr[<?php echo $ii; ?>][catSelEd]" id="nxs_SC_TR<?php echo $ii; ?>" value="<?php echo $options['catSelEd']; ?>" />
68
- </div>
69
  <br/>
70
  <?php } ?>
71
 
72
- <div style="width:100%;"><strong>Your Tumblr URL:</strong> </div><input onchange="nxsTRURLVal(<?php echo $ii; ?>);" name="tr[<?php echo $ii; ?>][apTRURL]" id="apTRURL<?php echo $ii; ?>" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['trURL'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" /><span style="color: #F00000;" id="apTRURLerr<?php echo $ii; ?>"></span>
73
- <div style="width:100%;"><strong>Your Tumblr OAuth Consumer Key:</strong> </div><input name="tr[<?php echo $ii; ?>][apTRConsKey]" id="apTRConsKey" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['trConsKey'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" />
74
- <div style="width:100%;"><strong>Your Tumblr Secret Key:</strong> </div><input name="tr[<?php echo $ii; ?>][apTRConsSec]" id="apTRConsSec" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['trConsSec'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" />
75
  <br/>
76
 
77
  <div style="width:100%;"><strong id="altFormatText">Default Post Type:</strong></div>
@@ -79,8 +84,8 @@ if (!class_exists("nxs_snapClassTR")) { class nxs_snapClassTR {
79
 
80
  <input type="radio" name="tr[<?php echo $ii; ?>][apTRPostType]" value="T" <?php if ($options['trPostType'] != 'I') echo 'checked="checked"'; ?> onchange="nxs_TRSetEnable('T','<?php echo $ii; ?>');" /> Text Post<br/>
81
 
82
- <div style="width:100%; margin-left: 15px;"><strong id="altFormatText">Text Post Title Format:</strong> (<a href="#" id="apTRTMsgFrmt<?php echo $ii; ?>HintInfo" onclick="mxs_showHideFrmtInfo('apTRTMsgFrmt<?php echo $ii; ?>'); return false;">Show format info</a>) </div><div onblur="jQuery('#apTRMsgFrmt<?php echo $ii; ?>Hint').hide();">
83
- <input name="tr[<?php echo $ii; ?>][apTRMsgTFrmt]" id="apTRMsgTFrmt<?php echo $ii; ?>" style="margin-left: 15px; width: 50%;" value="<?php if ($options['trMsgTFormat']!='') _e(apply_filters('format_to_edit', htmlentities($options['trMsgTFormat'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster'); else echo "New Post has been published on %SITENAME%"; ?>" onfocus="jQuery('#apTRTMsgFrmt<?php echo $ii; ?>Hint').show();" <?php if ($options['trPostType'] == 'I') echo 'disabled="disabled"'; ?> /><br/>
84
  <?php nxs_doShowHint("apTRTMsgFrmt".$ii); ?>
85
  </div>
86
 
@@ -98,7 +103,7 @@ if (!class_exists("nxs_snapClassTR")) { class nxs_snapClassTR {
98
 
99
  <strong>Defailt Image to Post:</strong>
100
  <p style="font-size: 11px; margin: 0px;">If your post is missing "Featured Image" and doesn't have any images in the text body this will be used instead.</p>
101
- </div><input name="tr[<?php echo $ii; ?>][apTRDefImg]" id="apTRDefImg<?php echo $ii; ?>" style=" margin-left: 15px; width: 30%;" <?php if ($options['trPostType'] != 'I') echo 'disabled="disabled"'; ?> value="<?php _e(apply_filters('format_to_edit', htmlentities($options['trDefImg'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" />
102
  <br/>
103
  <input type="radio" name="tr[<?php echo $ii; ?>][apTRPostType]" value="U" <?php if ($options['trPostType'] == 'U') echo 'checked="checked"'; ?> /> Audio Post<br/>
104
  <input type="radio" name="tr[<?php echo $ii; ?>][apTRPostType]" value="V" <?php if ($options['trPostType'] == 'V') echo 'checked="checked"'; ?> /> Video Post<br/>
@@ -107,9 +112,9 @@ if (!class_exists("nxs_snapClassTR")) { class nxs_snapClassTR {
107
 
108
  </div>
109
 
110
- <div style="width:100%;"><strong id="altFormatText">Post Text Format:</strong> (<a href="#" id="apTRMsgFrmt<?php echo $ii; ?>HintInfo" onclick="mxs_showHideFrmtInfo('apTRMsgFrmt<?php echo $ii; ?>'); return false;">Show format info</a>) </div>
111
 
112
- <input name="tr[<?php echo $ii; ?>][apTRMsgFrmt]" id="apTRMsgFrmt" style="width: 50%;" value="<?php if ($options['trMsgFormat']!='') _e(apply_filters('format_to_edit', htmlentities($options['trMsgFormat'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster'); else echo htmlentities("<p>New Post has been published on %URL%</p><blockquote><p><strong>%TITLE%</strong></p><p><img src=\"%IMG%\"/></p><p>%FULLTEXT%</p></blockquote>"); ?>" onfocus="jQuery('#apTRMsgFrmt<?php echo $ii; ?>Hint').show();" /><br/>
113
  <?php nxs_doShowHint("apTRMsgFrmt".$ii); ?>
114
 
115
 
@@ -121,7 +126,7 @@ if (!class_exists("nxs_snapClassTR")) { class nxs_snapClassTR {
121
  if($options['trConsSec']=='') { ?>
122
  <b>Authorize Your Tumblr Account</b>. Please save your settings and come back here to Authorize your account.
123
  <?php } else { if(isset($options['trAccessTocken']) && isset($options['trAccessTocken']['oauth_token_secret']) && $options['trAccessTocken']['oauth_token_secret']!=='') { ?>
124
- Your Tumblr Account has been authorized. Blog ID: <?php _e(apply_filters('format_to_edit', htmlentities($options['trPgID'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>.
125
  You can Re- <?php } ?>
126
  <a href="<?php echo $nxs_snapThisPageUrl;?>&auth=tr&acc=<?php echo $ii; ?>">Authorize Your Tumblr Account</a>
127
  <?php if (!isset($options['trOAuthTokenSecret']) || $options['trOAuthTokenSecret']=='') { ?> <div class="blnkg">&lt;=== Authorize your account ===</div> <?php } ?>
@@ -130,9 +135,9 @@ if (!class_exists("nxs_snapClassTR")) { class nxs_snapClassTR {
130
 
131
  <?php if( isset($options['trOAuthTokenSecret']) && $options['trOAuthTokenSecret']!='') { ?>
132
  <?php wp_nonce_field( 'rePostToTR', 'rePostToTR_wpnonce' ); ?>
133
- <br/><br/><b>Test your settings:</b>&nbsp;&nbsp;&nbsp; <a href="#" class="NXSButton" onclick="testPost('TR', '<?php echo $ii; ?>'); return false;">Submit Test Post to Tumblr</a> <br/><br/>
134
  <?php }?>
135
- <div class="submit"><input type="submit" class="button-primary" name="update_NS_SNAutoPoster_settings" value="<?php _e('Update Settings', 'NS_SNAutoPoster') ?>" /></div>
136
 
137
  </div>
138
  <?php
@@ -169,20 +174,21 @@ if (!class_exists("nxs_snapClassTR")) { class nxs_snapClassTR {
169
  }
170
  //#### Show Post->Edit Meta Box Settings
171
  function showEdPostNTSettings($ntOpts, $post){ global $nxs_plurl; $post_id = $post->ID;
172
- foreach($ntOpts as $ii=>$options) {$pMeta = maybe_unserialize(get_post_meta($post_id, 'snapTR', true)); if (is_array($pMeta)) $options = $this->adjMetaOpt($options, $pMeta[$ii]); $doTR = $options['doTR'] && $options['catSel']!='1';
 
173
  $isAvailTR = isset($options['trAccessTocken']) && isset($options['trAccessTocken']['oauth_token_secret']) && $options['trAccessTocken']['oauth_token_secret']!=='';
174
  $trMsgFormat = htmlentities($options['trMsgFormat'], ENT_COMPAT, "UTF-8"); $trMsgTFormat = htmlentities($options['trMsgTFormat'], ENT_COMPAT, "UTF-8");
175
  ?>
176
 
177
  <tr><th style="text-align:left;" colspan="2"><?php if ( $options['catSel']=='1' && trim($options['catSelEd'])!='' ) { ?> <input type="hidden" class="nxs_SC" id="nxs_SC_TR<?php echo $ii; ?>" value="<?php echo $options['catSelEd']; ?>" /> <?php } ?>
178
- <?php if ($isAvailTR) { ?><input class="nxsGrpDoChb" value="1" id="doTR<?php echo $ii; ?>" <?php if ($post->post_status == "publish") echo 'disabled="disabled"';?> type="checkbox" name="tr[<?php echo $ii; ?>][SNAPincludeTR]" <?php if (($post->post_status == "publish" && $options['isPosted'] == '1') || ($post->post_status != "publish" && ((int)$doTR == 1)) ) echo 'checked="checked" title="def"'; ?> /> <?php } ?>
179
- <div class="nsx_iconedTitle" style="display: inline; font-size: 13px; background-image: url(<?php echo $nxs_plurl; ?>img/tr16.png);">Tumblr - publish to (<i style="color: #005800;"><?php echo $options['nName']; ?></i>) </div></th><td><?php //## Only show RePost button if the post is "published"
180
- if ($post->post_status == "publish" && $isAvailTR) { ?><input alt="<?php echo $ii; ?>" style="float: right;" onmouseout="hidePopShAtt('SV');" onmouseover="showPopShAtt('SV', event);" onclick="return false;"Z type="button" class="button" name="rePostToTR_repostButton" id="rePostToTR_button" value="<?php _e('Repost to Tumblr', 're-post') ?>" />
181
  <?php wp_nonce_field( 'rePostToTR', 'rePostToTR_wpnonce' ); } ?>
182
 
183
  <?php if (is_array($pMeta) && is_array($pMeta[$ii]) && isset($pMeta[$ii]['pgID']) ) {
184
  ?> <span id="pstdTR<?php echo $ii; ?>" style="float: right;padding-top: 4px; padding-right: 10px;">
185
- <a style="font-size: 10px;" href="<?php echo $options['trURL']; ?>post/<?php echo $pMeta[$ii]['pgID']; ?>" target="_blank">Posted on Tumblr <?php echo (isset($pMeta[$ii]['pDate']) && $pMeta[$ii]['pDate']!='')?(" (".$pMeta[$ii]['pDate'].")"):""; ?></a>
186
  </span><?php } ?>
187
 
188
  </td></tr>
@@ -192,7 +198,7 @@ if (!class_exists("nxs_snapClassTR")) { class nxs_snapClassTR {
192
  <tr id="altFormat1" style=""><th scope="row" style="text-align:right; width:60px; padding-right:10px;">
193
  <input type="radio" name="tr[<?php echo $ii; ?>][apTRPostType]" value="T" <?php if ($options['trPostType'] != 'I') echo 'checked="checked"'; ?> /> <br/>
194
  </th>
195
- <td><b><?php _e('Text Post. Title Format:', 'NS_SPAP') ?></b>&nbsp;<input value="<?php echo $trMsgTFormat ?>" type="text" name="tr[<?php echo $ii; ?>][SNAPTformat]" style="width:270px;" onfocus="jQuery('.nxs_FRMTHint').hide();mxs_showFrmtInfo('apTRTMsgFrmt<?php echo $ii; ?>');"/>
196
  <?php nxs_doShowHint("apTRTMsgFrmt".$ii); ?> </td></tr>
197
 
198
  <tr id="altFormat1" style=""><th scope="row" style="text-align:right; width:60px; padding-right:10px;">
@@ -203,7 +209,7 @@ if (!class_exists("nxs_snapClassTR")) { class nxs_snapClassTR {
203
  <input type="radio" name="tr[<?php echo $ii; ?>][apTRPostType]" value="U" <?php if ($options['trPostType'] == 'U') echo 'checked="checked"'; ?> /> <b>Audio Post</b> <?php nxs_doShowHint("apTRTMsgFrmt".$ii); ?>
204
  </td></tr>
205
 
206
- <tr id="altFormat1" style=""><th scope="row" style="text-align:right; width:60px; padding-right:10px;"><?php _e('Text Format:', 'NS_SPAP') ?></th>
207
  <td><input value="<?php echo $trMsgFormat ?>" type="text" name="tr[<?php echo $ii; ?>][SNAPformat]" style="width:60%;max-width: 610px;" onfocus="jQuery('.nxs_FRMTHint').hide();mxs_showFrmtInfo('apTRMsgFrmt<?php echo $ii; ?>');"/><?php nxs_doShowHint("apTRMsgFrmt".$ii); ?></td></tr>
208
 
209
  <?php }
@@ -216,7 +222,9 @@ if (!class_exists("nxs_snapClassTR")) { class nxs_snapClassTR {
216
  if (isset($pMeta['SNAPTformat'])) $optMt['trMsgTFormat'] = $pMeta['SNAPTformat'];
217
  if (isset($pMeta['apTRPostType'])) $optMt['trPostType'] = $pMeta['apTRPostType'];
218
  if (isset($pMeta['AttachPost'])) $optMt['trAttch'] = $pMeta['AttachPost'] == 1?1:0; else { if (isset($pMeta['SNAPformat'])) $optMt['trAttch'] = 0; }
219
- if (isset($pMeta['SNAPincludeTR'])) $optMt['doTR'] = $pMeta['SNAPincludeTR'] == 1?1:0; else { if (isset($pMeta['SNAPformat'])) $optMt['doTR'] = 0; }return $optMt;
 
 
220
  }
221
  }}
222
 
4
 
5
  if (!class_exists("nxs_snapClassTR")) { class nxs_snapClassTR {
6
  //#### Show Common Settings
7
+ function showGenNTSettings($ntOpts){ global $nxs_snapThisPageUrl, $nxs_plurl; $ntInfo = array('code'=>'TR', 'lcode'=>'tr', 'name'=>'Tumblr', 'defNName'=>'', 'tstReq' => true);
 
8
  if ( isset($_GET['auth']) && $_GET['auth']=='tr'){ require_once('apis/trOAuth.php'); $options = $ntOpts[$_GET['acc']];
9
  $consumer_key = $options['trConsKey']; $consumer_secret = $options['trConsSec'];
10
  $callback_url = $nxs_snapThisPageUrl."&auth=tra&acc=".$_GET['acc'];
18
  }
19
  die();
20
  }
21
+ if ( isset($_GET['auth']) && $_GET['auth']=='tra'){ require_once('apis/trOAuth.php'); $options = $ntOpts[$_GET['acc']];
22
  $consumer_key = $options['trConsKey']; $consumer_secret = $options['trConsSec'];
23
  $tum_oauth = new TumblrOAuth($consumer_key, $consumer_secret, $options['trOAuthToken'], $options['trOAuthTokenSecret']);
24
  $options['trAccessTocken'] = $tum_oauth->getAccessToken($_REQUEST['oauth_verifier']); // prr($_GET); prr($_REQUEST); prr($options['trAccessTocken']);
32
  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>");
33
  }
34
  }
 
 
35
  ?>
36
+ <div class="nxs_box">
37
+ <div class="nxs_box_header">
38
+ <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']; ?>
39
+ <?php $cbo = count($ntOpts); ?> <?php wp_nonce_field( 'ns'.$ntInfo['code'], 'ns'.$ntInfo['code'].'_wpnonce' ); ?>
40
+ <?php if ($cbo>1){ ?><div class="nsBigText"><?php echo "(".($cbo=='0'?'No':$cbo)." "; _e('accounts', 'nxs_snap'); echo ")"; ?></div><?php } ?>
41
+ </div>
42
+ </div>
43
+ <div class="nxs_box_inside">
44
+ <?php foreach ($ntOpts as $indx=>$pbo){ if (trim($pbo['nName']=='')) $pbo['nName'] = str_ireplace('https://','', str_ireplace('http://','', $pbo['trURL']));
45
+ if (!isset($pbo[$ntInfo['lcode'].'OK']) || $pbo[$ntInfo['lcode'].'OK']=='') $pbo[$ntInfo['lcode'].'OK'] = (isset($pbo['trOAuthTokenSecret']) && $pbo['trOAuthTokenSecret']!='')?'1':''; ?>
46
+ <p style="margin:0px;margin-left:5px;">
47
+ <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"; ?> />
48
+ <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>
49
+ &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;
50
+ <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>
51
+ </p><?php $this->showNTSettings($indx, $pbo);
52
+ }?>
53
+ </div>
54
+ </div> <?php
55
  }
56
  //#### Show NEW Settings Page
57
  function showNewNTSettings($bo){ $po = array('nName'=>'', 'doTR'=>'1', 'trURL'=>'', 'trPgID'=>'', 'trConsKey'=>'', 'trInclTags'=>'1', 'cImgURL'=>'R', 'trConsSec'=>'', 'trPostType'=>'T', 'trDefImg'=>'', 'trOAuthTokenSecret'=>'', 'trAccessTocken'=>'', 'trMsgFormat'=>'<p>New Post has been published on %URL%</p><blockquote><p><strong>%TITLE%</strong></p><p><img src=\'%IMG%\'/></p><p>%FULLTEXT%</p></blockquote>', 'trMsgTFormat'=>'New Post has been published on %SITENAME%' ); $this->showNTSettings($bo, $po, true);}
58
  //#### Show Unit Settings
59
  function showNTSettings($ii, $options, $isNew=false){ global $nxs_plurl,$nxs_snapThisPageUrl; ?>
60
+ <div id="doTR<?php echo $ii; ?>Div" class="insOneDiv<?php if ($isNew) echo " clNewNTSets"; ?>" style="background-image: url(<?php echo $nxs_plurl; ?>img/tr-bg.png); background-position:90% 10%;"> <input type="hidden" name="apDoSTR<?php echo $ii; ?>" value="0" id="apDoSTR<?php echo $ii; ?>" />
61
  <?php if ($isNew) { ?> <input type="hidden" name="tr[<?php echo $ii; ?>][apDoTR]" value="1" id="apDoNewTR<?php echo $ii; ?>" /> <?php } ?>
62
 
63
+ <div class="nsx_iconedTitle" style="float: right; background-image: url(<?php echo $nxs_plurl; ?>img/tr16.png);"><a style="font-size: 12px;" target="_blank" href="http://www.nextscripts.com/setup-installation-tumblr-social-networks-auto-poster-wordpress/"><?php $nType="Tumblr"; printf( __( 'Detailed %s Installation/Configuration Instructions' , 'nxs_snap'), $nType); ?></a></div>
64
 
65
+ <div style="width:100%;"><strong><?php _e('Account Nickname', 'nxs_snap'); ?>:</strong> <i><?php _e('Just so you can easely identify it', 'nxs_snap'); ?></i> </div><input name="tr[<?php echo $ii; ?>][nName]" id="trnName<?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")), 'nxs_snap') ?>" /><br/>
66
  <?php echo nxs_addQTranslSel('tr', $ii, $options['qTLng']); ?><?php echo nxs_addPostingDelaySel('tr', $ii, $options['nHrs'], $options['nMin']); ?>
67
 
68
  <?php if (!$isNew) { ?>
69
+ <div style="width:100%;"><strong><?php _e('Categories', 'nxs_snap'); ?>:</strong>
70
  <input value="0" id="catSelA<?php echo $ii; ?>" type="radio" name="tr[<?php echo $ii; ?>][catSel]" <?php if ((int)$options['catSel'] != 1) echo "checked"; ?> /> All
71
  <input value="1" id="catSelSTR<?php echo $ii; ?>" type="radio" name="tr[<?php echo $ii; ?>][catSel]" <?php if ((int)$options['catSel'] == 1) echo "checked"; ?> /> <a href="#" style="text-decoration: none;" class="showCats" id="nxs_SCA_TR<?php echo $ii; ?>" onclick="jQuery('#catSelSTR<?php echo $ii; ?>').attr('checked', true); jQuery('#tmpCatSelNT').val('TR<?php echo $ii; ?>'); nxs_markCats( jQuery('#nxs_SC_TR<?php echo $ii; ?>').val() ); jQuery('#showCatSel').bPopup({ modalClose: false, appendTo: '#nsStForm', opacity: 0.6, follow: [false, false], position: [75, 'auto']}); return false;">Selected<?php if ($options['catSelEd']!='') echo "[".(substr_count($options['catSelEd'], ",")+1)."]"; ?></a>
72
  <input type="hidden" name="tr[<?php echo $ii; ?>][catSelEd]" id="nxs_SC_TR<?php echo $ii; ?>" value="<?php echo $options['catSelEd']; ?>" />
73
+ <br/><i><?php _e('Only selected categories will be autoposted to this account', 'nxs_snap'); ?></i></div>
74
  <br/>
75
  <?php } ?>
76
 
77
+ <div style="width:100%;"><strong>Your Tumblr URL:</strong> </div><input onchange="nxsTRURLVal(<?php echo $ii; ?>);" name="tr[<?php echo $ii; ?>][apTRURL]" id="apTRURL<?php echo $ii; ?>" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['trURL'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" /><span style="color: #F00000;" id="apTRURLerr<?php echo $ii; ?>"></span>
78
+ <div style="width:100%;"><strong>Your Tumblr OAuth Consumer Key:</strong> </div><input name="tr[<?php echo $ii; ?>][apTRConsKey]" id="apTRConsKey" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['trConsKey'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" />
79
+ <div style="width:100%;"><strong>Your Tumblr Secret Key:</strong> </div><input name="tr[<?php echo $ii; ?>][apTRConsSec]" id="apTRConsSec" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['trConsSec'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" />
80
  <br/>
81
 
82
  <div style="width:100%;"><strong id="altFormatText">Default Post Type:</strong></div>
84
 
85
  <input type="radio" name="tr[<?php echo $ii; ?>][apTRPostType]" value="T" <?php if ($options['trPostType'] != 'I') echo 'checked="checked"'; ?> onchange="nxs_TRSetEnable('T','<?php echo $ii; ?>');" /> Text Post<br/>
86
 
87
+ <div style="width:100%; margin-left: 15px;"><strong id="altFormatText">Text <?php _e('Post Title Format', 'nxs_snap'); ?>:</strong> (<a href="#" id="apTRTMsgFrmt<?php echo $ii; ?>HintInfo" onclick="mxs_showHideFrmtInfo('apTRTMsgFrmt<?php echo $ii; ?>'); return false;"><?php _e('Show format info', 'nxs_snap'); ?></a>) </div><div onblur="jQuery('#apTRMsgFrmt<?php echo $ii; ?>Hint').hide();">
88
+ <input name="tr[<?php echo $ii; ?>][apTRMsgTFrmt]" id="apTRMsgTFrmt<?php echo $ii; ?>" style="margin-left: 15px; width: 50%;" value="<?php if ($options['trMsgTFormat']!='') _e(apply_filters('format_to_edit', htmlentities($options['trMsgTFormat'], ENT_COMPAT, "UTF-8")), 'nxs_snap'); else echo "New Post has been published on %SITENAME%"; ?>" onfocus="jQuery('#apTRTMsgFrmt<?php echo $ii; ?>Hint').show();" <?php if ($options['trPostType'] == 'I') echo 'disabled="disabled"'; ?> /><br/>
89
  <?php nxs_doShowHint("apTRTMsgFrmt".$ii); ?>
90
  </div>
91
 
103
 
104
  <strong>Defailt Image to Post:</strong>
105
  <p style="font-size: 11px; margin: 0px;">If your post is missing "Featured Image" and doesn't have any images in the text body this will be used instead.</p>
106
+ </div><input name="tr[<?php echo $ii; ?>][apTRDefImg]" id="apTRDefImg<?php echo $ii; ?>" style=" margin-left: 15px; width: 30%;" <?php if ($options['trPostType'] != 'I') echo 'disabled="disabled"'; ?> value="<?php _e(apply_filters('format_to_edit', htmlentities($options['trDefImg'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" />
107
  <br/>
108
  <input type="radio" name="tr[<?php echo $ii; ?>][apTRPostType]" value="U" <?php if ($options['trPostType'] == 'U') echo 'checked="checked"'; ?> /> Audio Post<br/>
109
  <input type="radio" name="tr[<?php echo $ii; ?>][apTRPostType]" value="V" <?php if ($options['trPostType'] == 'V') echo 'checked="checked"'; ?> /> Video Post<br/>
112
 
113
  </div>
114
 
115
+ <div style="width:100%;"><strong id="altFormatText"><?php _e('Post Text Format', 'nxs_snap'); ?>:</strong> (<a href="#" id="apTRMsgFrmt<?php echo $ii; ?>HintInfo" onclick="mxs_showHideFrmtInfo('apTRMsgFrmt<?php echo $ii; ?>'); return false;"><?php _e('Show format info', 'nxs_snap'); ?></a>) </div>
116
 
117
+ <input name="tr[<?php echo $ii; ?>][apTRMsgFrmt]" id="apTRMsgFrmt" style="width: 50%;" value="<?php if ($options['trMsgFormat']!='') _e(apply_filters('format_to_edit', htmlentities($options['trMsgFormat'], ENT_COMPAT, "UTF-8")), 'nxs_snap'); else echo htmlentities("<p>New Post has been published on %URL%</p><blockquote><p><strong>%TITLE%</strong></p><p><img src=\"%IMG%\"/></p><p>%FULLTEXT%</p></blockquote>"); ?>" onfocus="jQuery('#apTRMsgFrmt<?php echo $ii; ?>Hint').show();" /><br/>
118
  <?php nxs_doShowHint("apTRMsgFrmt".$ii); ?>
119
 
120
 
126
  if($options['trConsSec']=='') { ?>
127
  <b>Authorize Your Tumblr Account</b>. Please save your settings and come back here to Authorize your account.
128
  <?php } else { if(isset($options['trAccessTocken']) && isset($options['trAccessTocken']['oauth_token_secret']) && $options['trAccessTocken']['oauth_token_secret']!=='') { ?>
129
+ Your Tumblr Account has been authorized. Blog ID: <?php _e(apply_filters('format_to_edit', htmlentities($options['trPgID'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>.
130
  You can Re- <?php } ?>
131
  <a href="<?php echo $nxs_snapThisPageUrl;?>&auth=tr&acc=<?php echo $ii; ?>">Authorize Your Tumblr Account</a>
132
  <?php if (!isset($options['trOAuthTokenSecret']) || $options['trOAuthTokenSecret']=='') { ?> <div class="blnkg">&lt;=== Authorize your account ===</div> <?php } ?>
135
 
136
  <?php if( isset($options['trOAuthTokenSecret']) && $options['trOAuthTokenSecret']!='') { ?>
137
  <?php wp_nonce_field( 'rePostToTR', 'rePostToTR_wpnonce' ); ?>
138
+ <br/><br/><b><?php _e('Test your settings', 'nxs_snap'); ?>:</b>&nbsp;&nbsp;&nbsp; <a href="#" class="NXSButton" onclick="testPost('TR', '<?php echo $ii; ?>'); return false;"><?php printf( __( 'Submit Test Post to %s' , 'nxs_snap'), $nType); ?></a> <br/><br/>
139
  <?php }?>
140
+ <div class="submit"><input type="submit" class="button-primary" name="update_NS_SNAutoPoster_settings" value="<?php _e('Update Settings', 'nxs_snap') ?>" /></div>
141
 
142
  </div>
143
  <?php
174
  }
175
  //#### Show Post->Edit Meta Box Settings
176
  function showEdPostNTSettings($ntOpts, $post){ global $nxs_plurl; $post_id = $post->ID;
177
+ foreach($ntOpts as $ii=>$options) {$pMeta = maybe_unserialize(get_post_meta($post_id, 'snapTR', true)); if (is_array($pMeta)) $options = $this->adjMetaOpt($options, $pMeta[$ii]);
178
+ $doTR = $options['doTR'] && (is_array($pMeta) || (is_array($pMeta) || $options['catSel']!='1'));
179
  $isAvailTR = isset($options['trAccessTocken']) && isset($options['trAccessTocken']['oauth_token_secret']) && $options['trAccessTocken']['oauth_token_secret']!=='';
180
  $trMsgFormat = htmlentities($options['trMsgFormat'], ENT_COMPAT, "UTF-8"); $trMsgTFormat = htmlentities($options['trMsgTFormat'], ENT_COMPAT, "UTF-8");
181
  ?>
182
 
183
  <tr><th style="text-align:left;" colspan="2"><?php if ( $options['catSel']=='1' && trim($options['catSelEd'])!='' ) { ?> <input type="hidden" class="nxs_SC" id="nxs_SC_TR<?php echo $ii; ?>" value="<?php echo $options['catSelEd']; ?>" /> <?php } ?>
184
+ <?php if ($isAvailTR) { ?><input class="nxsGrpDoChb" value="1" id="doTR<?php echo $ii; ?>" <?php if ($post->post_status == "publish") echo 'disabled="disabled"';?> type="checkbox" name="tr[<?php echo $ii; ?>][doTR]" <?php if (($post->post_status == "publish" && $options['isPosted'] == '1') || ($post->post_status != "publish" && ((int)$doTR == 1)) ) echo 'checked="checked" title="def"'; ?> /> <?php } ?>
185
+ <div class="nsx_iconedTitle" style="display: inline; font-size: 13px; background-image: url(<?php echo $nxs_plurl; ?>img/tr16.png);">Tumblr - <?php _e('publish to', 'nxs_snap') ?> (<i style="color: #005800;"><?php echo $options['nName']; ?></i>) </div></th><td><?php //## Only show RePost button if the post is "published"
186
+ if ($post->post_status == "publish" && $isAvailTR) { ?><input alt="<?php echo $ii; ?>" style="float: right;" onmouseout="hidePopShAtt('SV');" onmouseover="showPopShAtt('SV', event);" onclick="return false;"Z type="button" class="button" name="rePostToTR_repostButton" id="rePostToTR_button" value="<?php _e('Repost to Tumblr', 'nxs_snap') ?>" />
187
  <?php wp_nonce_field( 'rePostToTR', 'rePostToTR_wpnonce' ); } ?>
188
 
189
  <?php if (is_array($pMeta) && is_array($pMeta[$ii]) && isset($pMeta[$ii]['pgID']) ) {
190
  ?> <span id="pstdTR<?php echo $ii; ?>" style="float: right;padding-top: 4px; padding-right: 10px;">
191
+ <a style="font-size: 10px;" href="<?php echo $options['trURL']; ?>post/<?php echo $pMeta[$ii]['pgID']; ?>" target="_blank"><?php $nType="Tumblr"; printf( __( 'Posted on', 'nxs_snap' ), $nType); ?> <?php echo (isset($pMeta[$ii]['pDate']) && $pMeta[$ii]['pDate']!='')?(" (".$pMeta[$ii]['pDate'].")"):""; ?></a>
192
  </span><?php } ?>
193
 
194
  </td></tr>
198
  <tr id="altFormat1" style=""><th scope="row" style="text-align:right; width:60px; padding-right:10px;">
199
  <input type="radio" name="tr[<?php echo $ii; ?>][apTRPostType]" value="T" <?php if ($options['trPostType'] != 'I') echo 'checked="checked"'; ?> /> <br/>
200
  </th>
201
+ <td><b><?php _e('Text Post. Title Format:', 'nxs_snap') ?></b>&nbsp;<input value="<?php echo $trMsgTFormat ?>" type="text" name="tr[<?php echo $ii; ?>][SNAPTformat]" style="width:270px;" onfocus="jQuery('.nxs_FRMTHint').hide();mxs_showFrmtInfo('apTRTMsgFrmt<?php echo $ii; ?>');"/>
202
  <?php nxs_doShowHint("apTRTMsgFrmt".$ii); ?> </td></tr>
203
 
204
  <tr id="altFormat1" style=""><th scope="row" style="text-align:right; width:60px; padding-right:10px;">
209
  <input type="radio" name="tr[<?php echo $ii; ?>][apTRPostType]" value="U" <?php if ($options['trPostType'] == 'U') echo 'checked="checked"'; ?> /> <b>Audio Post</b> <?php nxs_doShowHint("apTRTMsgFrmt".$ii); ?>
210
  </td></tr>
211
 
212
+ <tr id="altFormat1" style=""><th scope="row" style="text-align:right; width:60px; padding-right:10px;"><?php _e('Text Format:', 'nxs_snap') ?></th>
213
  <td><input value="<?php echo $trMsgFormat ?>" type="text" name="tr[<?php echo $ii; ?>][SNAPformat]" style="width:60%;max-width: 610px;" onfocus="jQuery('.nxs_FRMTHint').hide();mxs_showFrmtInfo('apTRMsgFrmt<?php echo $ii; ?>');"/><?php nxs_doShowHint("apTRMsgFrmt".$ii); ?></td></tr>
214
 
215
  <?php }
222
  if (isset($pMeta['SNAPTformat'])) $optMt['trMsgTFormat'] = $pMeta['SNAPTformat'];
223
  if (isset($pMeta['apTRPostType'])) $optMt['trPostType'] = $pMeta['apTRPostType'];
224
  if (isset($pMeta['AttachPost'])) $optMt['trAttch'] = $pMeta['AttachPost'] == 1?1:0; else { if (isset($pMeta['SNAPformat'])) $optMt['trAttch'] = 0; }
225
+ if (isset($pMeta['doTR'])) $optMt['doTR'] = $pMeta['doTR'] == 1?1:0; else { if (isset($pMeta['SNAPformat'])) $optMt['doTR'] = 0; }
226
+ if (isset($pMeta['SNAPincludeTR']) && $pMeta['SNAPincludeTR'] == '1' ) $optMt['doTR'] = 1;
227
+ return $optMt;
228
  }
229
  }}
230
 
inc-cl/tw.php CHANGED
@@ -4,57 +4,65 @@ $nxs_snapAvNts[] = array('code'=>'TW', 'lcode'=>'tw', 'name'=>'Twitter');
4
 
5
  if (!class_exists("nxs_snapClassTW")) { class nxs_snapClassTW {
6
  //#### Show Common Settings
7
- function showGenNTSettings($ntOpts){ global $nxs_snapThisPageUrl, $nxs_plurl; $code = 'TW'; $lcode = 'tw'; wp_nonce_field( 'ns'.$code, 'ns'.$code.'_wpnonce' ); ?>
8
- <hr/><div class="nsx_iconedTitle" style="background-image: url(<?php echo $nxs_plurl; ?>img/<?php echo $lcode; ?>16.png);">Twitter Settings: <?php $ctwo = count($ntOpts); $mtwo = 1+max(array_keys($ntOpts)); ?>
9
- <div class="nsBigText">You have <?php echo $ctwo=='0'?'No':$ctwo; ?> Twitter account<?php if ($ctwo!=1){ ?>s<?php } ?> <!-- set - <a href="#" class="NXSButton" onclick="doShowHideBlocks2('TW<?php echo $mtwo; ?>');return false;">Add new Twitter Account</a> --></div><br/></div>
10
- <?php // if (function_exists('nxs_doSMAS1')) nxs_doSMAS1($this, $mtwo); else nxs_doSMAS('Twitter', 'TW'.$mtwo); ?>
11
- <?php foreach ($ntOpts as $indx=>$two){ if (trim($two['nName']=='')) $two['nName'] = str_ireplace('https://','', str_ireplace('http://','', $two['twURL'])); ?>
12
- <p style="margin: 0px;margin-left: 5px;"><input value="1" id="apDoTW" name="tw[<?php echo $indx; ?>][apDoTW]" type="checkbox" <?php if ((int)$two['doTW'] == 1) echo "checked"; ?> />
13
- <strong>Auto-publish your Posts to your Twitter <i style="color: #005800;"><?php if($two['nName']!='') echo "(".$two['nName'].")"; ?></i></strong>
14
- &nbsp;&nbsp;<a id="doTW<?php echo $indx; ?>A" href="#" onclick="doShowHideBlocks2('TW<?php echo $indx; ?>');return false;">[Show Settings]</a>&nbsp;&nbsp;
15
- <a href="#" onclick="doDelAcct('tw','<?php echo $indx; ?>', '<?php echo $two['twURL']; ?>');return false;">[Remove Account]</a>
16
- </p><?php $this->showNTSettings($indx, $two);
17
- } //## END TW Settings
 
 
 
 
 
 
 
 
18
  }
19
  //#### Show NEW Settings Page
20
  function showNewNTSettings($mtwo){ $two = array('nName'=>'', 'doTW'=>'1', 'twURL'=>'', 'twConsKey'=>'', 'twConsSec'=>'', 'twAccToken'=>'', 'twAccTokenSec'=>'', 'attchImg'=>0, 'twAttch'=>'', 'twAccTokenSec'=>''); $this->showNTSettings($mtwo, $two, true);}
21
  //#### Show Unit Settings
22
  function showNTSettings($ii, $two, $isNew=false){ global $nxs_plurl; ?>
23
- <div id="doTW<?php echo $ii; ?>Div" <?php if ($isNew){ ?>class="clNewNTSets"<?php } ?> style="max-width: 1000px; background-color: #EBF4FB; background-image: url(<?php echo $nxs_plurl; ?>img/tw-bg.png); background-position:90% 10%; background-repeat: no-repeat; margin: 10px; border: 1px solid #808080; padding: 10px; <?php if ((isset($two['twOK']) && $two['twOK']=='1')||$isNew) { ?>display:none;<?php } ?>"> <input type="hidden" name="apDoSTW<?php echo $ii; ?>" value="0" id="apDoSTW<?php echo $ii; ?>" />
24
 
25
- <div class="nsx_iconedTitle" style="float: right; background-image: url(<?php echo $nxs_plurl; ?>img/tw16.png);"><a style="font-size: 12px;" target="_blank" href="http://www.nextscripts.com/setup-installation-twitter-social-networks-auto-poster-wordpress/">Detailed Twitter Installation/Configuration Instructions</a></div>
26
 
27
- <div style="width:100%;"><strong>Account Nickname:</strong> <i>Just so you can easely identify it</i> </div><input name="tw[<?php echo $ii; ?>][nName]" id="twnName<?php echo $ii; ?>" style="font-weight: bold; color: #005800; border: 1px solid #ACACAC; width: 40%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($two['nName'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" /><br/>
28
  <?php echo nxs_addQTranslSel('tw', $ii, $two['qTLng']); ?><?php echo nxs_addPostingDelaySel('tw', $ii, $two['nHrs'], $two['nMin']); ?>
29
 
30
  <?php if (!$isNew) { ?>
31
- <div style="width:100%;"><strong>Auto-Post Categories:</strong>
32
  <input value="0" id="catSelA<?php echo $ii; ?>" type="radio" name="tw[<?php echo $ii; ?>][catSel]" <?php if ((int)$two['catSel'] != 1) echo "checked"; ?> /> All
33
  <input value="1" id="catSelSTW<?php echo $ii; ?>" type="radio" name="tw[<?php echo $ii; ?>][catSel]" <?php if ((int)$two['catSel'] == 1) echo "checked"; ?> /> <a href="#" style="text-decoration: none;" class="showCats" id="nxs_SCA_TW<?php echo $ii; ?>" onclick="jQuery('#catSelSTW<?php echo $ii; ?>').attr('checked', true); jQuery('#tmpCatSelNT').val('TW<?php echo $ii; ?>'); nxs_markCats( jQuery('#nxs_SC_TW<?php echo $ii; ?>').val() ); jQuery('#showCatSel').bPopup({ modalClose: false, appendTo: '#nsStForm', opacity: 0.6, follow: [false, false], position: [75, 'auto']}); return false;">Selected<?php if ($two['catSelEd']!='') echo "[".(substr_count($two['catSelEd'], ",")+1)."]"; ?></a>
34
  <input type="hidden" name="tw[<?php echo $ii; ?>][catSelEd]" id="nxs_SC_TW<?php echo $ii; ?>" value="<?php echo $two['catSelEd']; ?>" />
35
- </div>
36
  <br/>
37
  <?php } ?>
38
 
39
- <div style="width:100%;"><strong>Your Twitter URL:</strong> </div><input name="tw[<?php echo $ii; ?>][apTWURL]" id="apTWURL" style="width: 40%;border: 1px solid #ACACAC;" value="<?php _e(apply_filters('format_to_edit', htmlentities($two['twURL'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" />
40
- <div style="width:100%;"><strong>Your Twitter Consumer Key:</strong> </div><input name="tw[<?php echo $ii; ?>][apTWConsKey]" id="apTWConsKey" style="width: 40%; border: 1px solid #ACACAC;" value="<?php _e(apply_filters('format_to_edit', htmlentities($two['twConsKey'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" />
41
- <div style="width:100%;"><strong>Your Twitter Consumer Secret:</strong> </div><input name="tw[<?php echo $ii; ?>][apTWConsSec]" id="apTWConsSec" style="width: 40%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($two['twConsSec'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" />
42
- <div style="width:100%;"><strong>Your Access Token:</strong> </div><input name="tw[<?php echo $ii; ?>][apTWAccToken]" id="apTWAccToken" style="width: 40%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($two['twAccToken'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" />
43
- <div style="width:100%;"><strong>Your Access Token Secret:</strong> </div><input name="tw[<?php echo $ii; ?>][apTWAccTokenSec]" id="apTWAccTokenSec" style="width: 40%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($two['twAccTokenSec'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" />
44
  <?php if ($isNew) { ?> <input type="hidden" name="tw[<?php echo $ii; ?>][apDoTW]" value="1" id="apDoNewTW<?php echo $ii; ?>" /> <?php } ?>
45
  <br/><br/>
46
  <p style="margin: 0px;"><input value="1" id="apLIAttch" type="checkbox" name="tw[<?php echo $ii; ?>][attchImg]" <?php if ((int)$two['attchImg'] == 1) echo "checked"; ?> /> <strong>Attach Image to Twitter Post</strong></p>
47
  <br/>
48
- <strong id="altFormatText">Message Text Format:</strong>
49
  <div style="width:100%;">
50
  <p style="font-size: 11px; margin: 0px;">%SITENAME% - Inserts the Your Blog/Site Name. &nbsp; %TITLE% - Inserts the Title of your post. &nbsp; %URL% - Inserts the URL of your post. &nbsp; %SURL% - Inserts the <b>Shortened URL</b> of your post. &nbsp; %TEXT% - Inserts the excerpt of your post. &nbsp; %TAGS% - Inserts the post tags as hashtags. &nbsp; %CATS% - Inserts the post categories as hashtags. &nbsp; %FULLTEXT% - Inserts the body(text) of your post, %AUTHORNAME% - Inserts the author's name. <i>Please remember that Twitter takes only 140 characters.</i></p>
51
  </div>
52
- <input name="tw[<?php echo $ii; ?>][apTWMsgFrmt]" id="apTWMsgFrmt" style="width: 50%;" value="<?php if (!$isNew) _e(apply_filters('format_to_edit', htmlentities($two['twMsgFormat'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster'); else echo "%TITLE% - %URL%"; ?>" />
53
 
54
  <?php if($two['twAccTokenSec']!='') { ?> <?php wp_nonce_field( 'rePostToTW', 'rePostToTW_wpnonce' ); ?>
55
- <br/><br/><b>Test your settings:</b>&nbsp;&nbsp;&nbsp; <?php if (!isset($two['twOK']) || $two['twOK']!='1') { ?> <div class="blnkg">=== Submit Test Post to Complete ===&gt;</div> <?php } ?> <a href="#" class="NXSButton" onclick="testPost('TW', '<?php echo $ii; ?>'); return false;">Submit Test Post to Twitter</a> <br/>
56
  <?php }?>
57
- <div class="submit"><input type="submit" class="button-primary" name="update_NS_SNAutoPoster_settings" value="<?php _e('Update Settings', 'NS_SNAutoPoster') ?>" /></div>
58
  </div>
59
  <?php
60
  }
@@ -82,23 +90,24 @@ if (!class_exists("nxs_snapClassTW")) { class nxs_snapClassTW {
82
  }
83
  //#### Show Post->Edit Meta Box Settings
84
  function showEdPostNTSettings($ntOpts, $post){ global $nxs_plurl; $post_id = $post->ID;
85
- foreach($ntOpts as $ii=>$ntOpt) { $pMeta = maybe_unserialize(get_post_meta($post_id, 'snapTW', true)); if (is_array($pMeta)) $ntOpt = $this->adjMetaOpt($ntOpt, $pMeta[$ii]); $doTW = $ntOpt['doTW'] && $ntOpt['catSel']!='1';
 
86
  $isAvailTW = $ntOpt['twURL']!='' && $ntOpt['twConsKey']!='' && $ntOpt['twConsSec']!='' && $ntOpt['twAccToken']!=''; $twMsgFormat = htmlentities($ntOpt['twMsgFormat'], ENT_COMPAT, "UTF-8"); $isAttchImg = $ntOpt['attchImg'];
87
  ?>
88
  <tr><th style="text-align:left;" colspan="2"><?php if ( $ntOpt['catSel']=='1' && trim($ntOpt['catSelEd'])!='' ) { ?> <input type="hidden" class="nxs_SC" id="nxs_SC_TW<?php echo $ii; ?>" value="<?php echo $ntOpt['catSelEd']; ?>" /> <?php } ?>
89
- <?php if ($isAvailTW) { ?><input class="nxsGrpDoChb" value="1" id="doTW<?php echo $ii; ?>" <?php if ($post->post_status == "publish") echo 'disabled="disabled"';?> type="checkbox" name="tw[<?php echo $ii; ?>][SNAPincludeTW]" <?php if (($post->post_status == "publish" && $ntOpt['isPosted'] == '1') || ($post->post_status != "publish" && ((int)$doTW == 1)) ) echo 'checked="checked" title="def"'; ?> /> <?php } ?>
90
- <div class="nsx_iconedTitle" style="display: inline; font-size: 13px; background-image: url(<?php echo $nxs_plurl; ?>img/tw16.png);">Twitter - publish to (<i style="color: #005800;"><?php echo $ntOpt['nName']; ?></i>)</div></th><td><?php //## Only show RePost button if the post is "published"
91
  if ($post->post_status == "publish" && $isAvailTW) { ?>
92
- <input alt="<?php echo $ii; ?>" style="float: right;" onmouseout="hidePopShAtt('SV');" onmouseover="showPopShAtt('SV', event);" onclick="return false;" type="button" class="button" name="rePostToTW_repostButton" id="rePostToTW_button" value="<?php _e('Repost to Twitter', 're-post') ?>" />
93
  <?php wp_nonce_field( 'rePostToTW', 'rePostToTW_wpnonce' ); } ?>
94
  <?php if (is_array($pMeta) && is_array($pMeta[$ii]) && isset($pMeta[$ii]['pgID'])) { ?> <span style="float: right;padding-top: 4px; padding-right: 10px;">
95
- <a id="pstdTW<?php echo $ii; ?>" style="font-size: 10px;" href="<?php echo $ntOpt['twURL'].'/status/'.$pMeta[$ii]['pgID']; ?>" target="_blank">Posted on Twitter <?php echo (isset($pMeta[$ii]['pDate']) && $pMeta[$ii]['pDate']!='')?(" (".$pMeta[$ii]['pDate'].")"):""; ?></a>
96
  </span><?php } ?>
97
  </td></tr>
98
  <?php if (!$isAvailTW) { ?><tr><th scope="row" style="text-align:right; width:150px; padding-top: 5px; padding-right:10px;"></th> <td><b>Setup your Twitter Account to AutoPost to Twitter</b>
99
  <?php }elseif ($post->post_status != "puZblish") { ?>
100
 
101
- <tr id="altFormat1" style=""><th scope="row" style="text-align:right; width:60px; padding-right:10px;"><?php _e('Message Format:', 'NS_SPAP') ?></th>
102
  <td><input value="<?php echo $twMsgFormat ?>" type="text" name="tw[<?php echo $ii; ?>][SNAPformat]" style="width:60%;max-width: 610px;" onfocus="jQuery('.nxs_FRMTHint').hide();mxs_showFrmtInfo('apTWMsgFrmt<?php echo $ii; ?>');"/><?php nxs_doShowHint("apTWMsgFrmt".$ii); ?></td></tr>
103
 
104
  <tr><th scope="row" style="text-align:right; width:150px; vertical-align:top; padding-top: 5px; padding-right:10px;">
@@ -111,7 +120,9 @@ if (!class_exists("nxs_snapClassTW")) { class nxs_snapClassTW {
111
  function adjMetaOpt($optMt, $pMeta){ if (isset($pMeta['isPosted'])) $optMt['isPosted'] = $pMeta['isPosted']; else $optMt['isPosted'] = '';
112
  if (isset($pMeta['SNAPformat'])) $optMt['twMsgFormat'] = $pMeta['SNAPformat'];
113
  if (isset($pMeta['attchImg'])) $optMt['attchImg'] = $pMeta['attchImg'] == 1?1:0; else { if (isset($pMeta['attchImg'])) $optMt['attchImg'] = 0; }
114
- if (isset($pMeta['SNAPincludeTW'])) $optMt['doTW'] = $pMeta['SNAPincludeTW'] == 1?1:0; else { if (isset($pMeta['SNAPformat'])) $optMt['doTW'] = 0; } return $optMt;
 
 
115
  }
116
  }}
117
 
@@ -140,7 +151,7 @@ if (!function_exists("nxs_doPublishToTW")) { //## Second Function to Post to TW
140
  }}
141
  if ($options['attchImg']=='1' && $img!='') $twLim = 119; else $twLim = 140;
142
 
143
- if ($postID=='0') { echo "Testing ... <br/><br/>"; $msg = 'Test Post from '.$blogTitle." - ".rand(1, 155); $uln = strlen($msg);}
144
  else{ $post = get_post($postID); if(!$post) return; $twMsgFormat = $options['twMsgFormat']; nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPrePosted'=>'1'));
145
  if (stripos($twMsgFormat, '%URL%')!==false || stripos($twMsgFormat, '%SURL%')!==false) $twLim = $twLim - 20;
146
  if (stripos($twMsgFormat, '%AUTHORNAME%')!==false) { $aun = $post->post_author; $aun = get_the_author_meta('display_name', $aun ); $twLim = $twLim - strlen($aun); }
@@ -155,20 +166,20 @@ if (!function_exists("nxs_doPublishToTW")) { //## Second Function to Post to TW
155
  $pRawText = $post->post_content;
156
 
157
  if (stripos($twMsgFormat, '%TAGS%')!==false || stripos($twMsgFormat, '%HTAGS%')!==false) {
158
- $t = wp_get_post_tags($postID); $tggs = array(); foreach ($t as $tagA) { $frmTag = trim(str_replace(' ','_', str_replace(' ', ' ', trim($tagA->name))));
159
- if (stripos($pTitle, $tagA->name)!==false) $pTitle = str_ireplace($tagA->name, '#'.$frmTag, $pTitle); elseif (stripos($pTitle, $frmTag)!==false) $pTitle = str_ireplace($frmTag, '#'.$frmTag, $pTitle);
160
- if (stripos($pText, $tagA->name)!==false) $pText = str_ireplace($tagA->name, '#'.$frmTag, $pText); elseif (stripos($pText, $frmTag)!==false) $pText = str_ireplace($frmTag, '#'.$frmTag, $pText);
161
- if (stripos($pFullText, $tagA->name)!==false) $pFullText = str_ireplace($tagA->name, '#'.$frmTag, $pFullText); elseif (stripos($pFullText, $frmTag)!==false) $pFullText = str_ireplace($frmTag, '#'.$frmTag, $pFullText);
162
- if (stripos($pRawText, $tagA->name)!==false) $pRawText = str_ireplace($tagA->name, '#'.$frmTag, $pRawText); elseif (stripos($pRawText, $frmTag)!==false) $pRawText = str_ireplace($frmTag, '#'.$frmTag, $pRawText);
163
- if ( ((stripos($twMsgFormat, '%TITLE%')!==false) && (stripos($pTitle, $tagA->name)!==false || stripos($pTitle, $frmTag)!==false)) ||
164
- ((stripos($twMsgFormat, '%TEXT%')!==false) && (stripos($pText, $tagA->name)!==false || stripos($pText, $frmTag)!==false)) ||
165
- ((stripos($twMsgFormat, '%FULLTEXT%')!==false) && (stripos($pFullText, $tagA->name)!==false || stripos($pFullText, $frmTag)!==false)) ||
166
- ((stripos($twMsgFormat, '%RAWTEXT%')!==false) && (stripos($pRawText, $tagA->name)!==false || stripos($pRawText, $frmTag)!==false)) ) {} else $tggs[] = '#'.$frmTag;
167
  } $tags = implode(' ',$tggs); while(strlen($tags)>($twLim-10)) {array_pop($tggs); $tags = implode(' ',$tggs);} $twMsgFormat = str_ireplace("%TAGS%", $tags, $twMsgFormat); $twMsgFormat = str_ireplace("%HTAGS%", $tags, $twMsgFormat);
168
  $twLim = $twLim - strlen($tags);
169
  }
170
  if (stripos($twMsgFormat, '%CATS%')!==false || stripos($twMsgFormat, '%HCATS%')!==false) {
171
- $t = wp_get_post_categories($postID); $cats = array(); foreach($t as $c){ $cat = get_category($c); $frmTag = trim(str_replace(' ','_', str_replace(' ',' ',str_ireplace('&','&amp;',trim($cat->name)))));
172
  if (stripos($pTitle, $cat->name)!==false) $pTitle = str_ireplace($cat->name, '#'.$frmTag, $pTitle); elseif (stripos($pTitle, $frmTag)!==false) $pTitle = str_ireplace($frmTag, '#'.$frmTag, $pTitle);
173
  if (stripos($pText, $cat->name)!==false) $pText = str_ireplace($cat->name, '#'.$frmTag, $pText); elseif (stripos($pText, $frmTag)!==false) $pText = str_ireplace($frmTag, '#'.$frmTag, $pText);
174
  if (stripos($pFullText, $cat->name)!==false) $pFullText = str_ireplace($cat->name, '#'.$frmTag, $pFullText); elseif (stripos($pFullText, $frmTag)!==false) $pFullText = str_ireplace($frmTag, '#'.$frmTag, $pFullText);
@@ -203,8 +214,7 @@ if (!function_exists("nxs_doPublishToTW")) { //## Second Function to Post to TW
203
 
204
  $extInfo = ' | PostID: '.$postID." - ".$post->post_title; $logNT = '<span style="color:#00FFFF">Twitter</span> - '.$options['nName'];
205
  require_once ('apis/tmhOAuth.php'); require_once ('apis/tmhUtilities.php'); if ($uln>0) $msg = nsTrnc($msg, 140+$uln); else { $url = get_permalink($postID); $msg = nsTrnc($msg, 120+strlen($url)); }
206
- $tmhOAuth = new NXS_tmhOAuth(array( 'consumer_key' => $options['twConsKey'], 'consumer_secret' => $options['twConsSec'], 'user_token' => $options['twAccToken'], 'user_secret' => $options['twAccTokenSec']));
207
-
208
  if ($options['attchImg']=='1' && $img!='') $code = $tmhOAuth -> request('POST', 'http://upload.twitter.com/1/statuses/update_with_media.json', array( 'media[]' => $img, 'status' => $msg), true, true);
209
  else $code = $tmhOAuth->request('POST', $tmhOAuth->url('1.1/statuses/update'), array('status' =>$msg)); //prr($code); echo "YYY";
210
  if ($code == 200){if ($postID=='0'){ nxs_addToLog($logNT, 'M', 'OK - TEST Message Posted '); echo 'OK - Message Posted, please see your Twitter Page'; /*NXS_tmhUtilities::pr(json_decode($tmhOAuth->response['response'])); */ return 201;}
4
 
5
  if (!class_exists("nxs_snapClassTW")) { class nxs_snapClassTW {
6
  //#### Show Common Settings
7
+ function showGenNTSettings($ntOpts){ global $nxs_plurl; $ntInfo = array('code'=>'TW', 'lcode'=>'tw', 'name'=>'Twitter', 'defNName'=>'dlUName', 'tstReq' => true); ?>
8
+ <div class="nxs_box">
9
+ <div class="nxs_box_header">
10
+ <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']; ?>
11
+ <?php $cbo = count($ntOpts); ?> <?php wp_nonce_field( 'ns'.$ntInfo['code'], 'ns'.$ntInfo['code'].'_wpnonce' ); ?>
12
+ <?php if ($cbo>1){ ?><div class="nsBigText"><?php echo "(".($cbo=='0'?'No':$cbo)." "; _e('accounts', 'nxs_snap'); echo ")"; ?></div><?php } ?>
13
+ </div>
14
+ </div>
15
+ <div class="nxs_box_inside">
16
+ <?php foreach ($ntOpts as $indx=>$pbo){ if (trim($pbo['nName']=='')) $pbo['nName'] = str_ireplace('https://','', str_ireplace('http://','', $pbo['twURL'])); ?>
17
+ <p style="margin:0px;margin-left:5px;">
18
+ <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"; ?> />
19
+ <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>
20
+ &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;
21
+ <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>
22
+ </p><?php $this->showNTSettings($indx, $pbo);
23
+ }?>
24
+ </div>
25
+ </div> <?php
26
  }
27
  //#### Show NEW Settings Page
28
  function showNewNTSettings($mtwo){ $two = array('nName'=>'', 'doTW'=>'1', 'twURL'=>'', 'twConsKey'=>'', 'twConsSec'=>'', 'twAccToken'=>'', 'twAccTokenSec'=>'', 'attchImg'=>0, 'twAttch'=>'', 'twAccTokenSec'=>''); $this->showNTSettings($mtwo, $two, true);}
29
  //#### Show Unit Settings
30
  function showNTSettings($ii, $two, $isNew=false){ global $nxs_plurl; ?>
31
+ <div id="doTW<?php echo $ii; ?>Div" class="insOneDiv<?php if ($isNew) echo " clNewNTSets"; ?>" style="background-image: url(<?php echo $nxs_plurl; ?>img/tw-bg.png); background-position:90% 10%;"> <input type="hidden" name="apDoSTW<?php echo $ii; ?>" value="0" id="apDoSTW<?php echo $ii; ?>" />
32
 
33
+ <div class="nsx_iconedTitle" style="float: right; background-image: url(<?php echo $nxs_plurl; ?>img/tw16.png);"><a style="font-size: 12px;" target="_blank" href="http://www.nextscripts.com/setup-installation-twitter-social-networks-auto-poster-wordpress/"><?php $nType="Twitter"; printf( __( 'Detailed %s Installation/Configuration Instructions', 'nxs_snap' ), $nType); ?></a></div>
34
 
35
+ <div style="width:100%;"><strong><?php _e('Account Nickname', 'nxs_snap'); ?>:</strong> <i><?php _e('Just so you can easely identify it', 'nxs_snap'); ?></i> </div><input name="tw[<?php echo $ii; ?>][nName]" id="twnName<?php echo $ii; ?>" style="font-weight: bold; color: #005800; border: 1px solid #ACACAC; width: 40%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($two['nName'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" /><br/>
36
  <?php echo nxs_addQTranslSel('tw', $ii, $two['qTLng']); ?><?php echo nxs_addPostingDelaySel('tw', $ii, $two['nHrs'], $two['nMin']); ?>
37
 
38
  <?php if (!$isNew) { ?>
39
+ <div style="width:100%;"><strong><?php _e('Categories', 'nxs_snap'); ?>:</strong>
40
  <input value="0" id="catSelA<?php echo $ii; ?>" type="radio" name="tw[<?php echo $ii; ?>][catSel]" <?php if ((int)$two['catSel'] != 1) echo "checked"; ?> /> All
41
  <input value="1" id="catSelSTW<?php echo $ii; ?>" type="radio" name="tw[<?php echo $ii; ?>][catSel]" <?php if ((int)$two['catSel'] == 1) echo "checked"; ?> /> <a href="#" style="text-decoration: none;" class="showCats" id="nxs_SCA_TW<?php echo $ii; ?>" onclick="jQuery('#catSelSTW<?php echo $ii; ?>').attr('checked', true); jQuery('#tmpCatSelNT').val('TW<?php echo $ii; ?>'); nxs_markCats( jQuery('#nxs_SC_TW<?php echo $ii; ?>').val() ); jQuery('#showCatSel').bPopup({ modalClose: false, appendTo: '#nsStForm', opacity: 0.6, follow: [false, false], position: [75, 'auto']}); return false;">Selected<?php if ($two['catSelEd']!='') echo "[".(substr_count($two['catSelEd'], ",")+1)."]"; ?></a>
42
  <input type="hidden" name="tw[<?php echo $ii; ?>][catSelEd]" id="nxs_SC_TW<?php echo $ii; ?>" value="<?php echo $two['catSelEd']; ?>" />
43
+ <br/><i><?php _e('Only selected categories will be autoposted to this account', 'nxs_snap'); ?></i></div>
44
  <br/>
45
  <?php } ?>
46
 
47
+ <div style="width:100%;"><strong>Your Twitter URL:</strong> </div><input name="tw[<?php echo $ii; ?>][apTWURL]" id="apTWURL" style="width: 40%;border: 1px solid #ACACAC;" value="<?php _e(apply_filters('format_to_edit', htmlentities($two['twURL'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" />
48
+ <div style="width:100%;"><strong>Your Twitter Consumer Key:</strong> </div><input name="tw[<?php echo $ii; ?>][apTWConsKey]" id="apTWConsKey" style="width: 40%; border: 1px solid #ACACAC;" value="<?php _e(apply_filters('format_to_edit', htmlentities($two['twConsKey'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" />
49
+ <div style="width:100%;"><strong>Your Twitter Consumer Secret:</strong> </div><input name="tw[<?php echo $ii; ?>][apTWConsSec]" id="apTWConsSec" style="width: 40%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($two['twConsSec'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" />
50
+ <div style="width:100%;"><strong>Your Access Token:</strong> </div><input name="tw[<?php echo $ii; ?>][apTWAccToken]" id="apTWAccToken" style="width: 40%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($two['twAccToken'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" />
51
+ <div style="width:100%;"><strong>Your Access Token Secret:</strong> </div><input name="tw[<?php echo $ii; ?>][apTWAccTokenSec]" id="apTWAccTokenSec" style="width: 40%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($two['twAccTokenSec'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" />
52
  <?php if ($isNew) { ?> <input type="hidden" name="tw[<?php echo $ii; ?>][apDoTW]" value="1" id="apDoNewTW<?php echo $ii; ?>" /> <?php } ?>
53
  <br/><br/>
54
  <p style="margin: 0px;"><input value="1" id="apLIAttch" type="checkbox" name="tw[<?php echo $ii; ?>][attchImg]" <?php if ((int)$two['attchImg'] == 1) echo "checked"; ?> /> <strong>Attach Image to Twitter Post</strong></p>
55
  <br/>
56
+ <strong id="altFormatText"><?php _e('Message text Format', 'nxs_snap'); ?>:</strong>
57
  <div style="width:100%;">
58
  <p style="font-size: 11px; margin: 0px;">%SITENAME% - Inserts the Your Blog/Site Name. &nbsp; %TITLE% - Inserts the Title of your post. &nbsp; %URL% - Inserts the URL of your post. &nbsp; %SURL% - Inserts the <b>Shortened URL</b> of your post. &nbsp; %TEXT% - Inserts the excerpt of your post. &nbsp; %TAGS% - Inserts the post tags as hashtags. &nbsp; %CATS% - Inserts the post categories as hashtags. &nbsp; %FULLTEXT% - Inserts the body(text) of your post, %AUTHORNAME% - Inserts the author's name. <i>Please remember that Twitter takes only 140 characters.</i></p>
59
  </div>
60
+ <input name="tw[<?php echo $ii; ?>][apTWMsgFrmt]" id="apTWMsgFrmt" style="width: 50%;" value="<?php if (!$isNew) _e(apply_filters('format_to_edit', htmlentities($two['twMsgFormat'], ENT_COMPAT, "UTF-8")), 'nxs_snap'); else echo "%TITLE% - %URL%"; ?>" />
61
 
62
  <?php if($two['twAccTokenSec']!='') { ?> <?php wp_nonce_field( 'rePostToTW', 'rePostToTW_wpnonce' ); ?>
63
+ <br/><br/><b><?php _e('Test your settings', 'nxs_snap'); ?>:</b>&nbsp;&nbsp;&nbsp; <?php if (!isset($two['twOK']) || $two['twOK']!='1') { ?> <div class="blnkg">=== Submit Test Post to Complete ===&gt;</div> <?php } ?> <a href="#" class="NXSButton" onclick="testPost('TW', '<?php echo $ii; ?>'); return false;"><?php printf( __( 'Submit Test Post to %s' , 'nxs_snap'), $nType); ?></a> <br/>
64
  <?php }?>
65
+ <div class="submit"><input type="submit" class="button-primary" name="update_NS_SNAutoPoster_settings" value="<?php _e('Update Settings', 'nxs_snap') ?>" /></div>
66
  </div>
67
  <?php
68
  }
90
  }
91
  //#### Show Post->Edit Meta Box Settings
92
  function showEdPostNTSettings($ntOpts, $post){ global $nxs_plurl; $post_id = $post->ID;
93
+ foreach($ntOpts as $ii=>$ntOpt) { $pMeta = maybe_unserialize(get_post_meta($post_id, 'snapTW', true)); if (is_array($pMeta)) $ntOpt = $this->adjMetaOpt($ntOpt, $pMeta[$ii]);
94
+ $doTW = $ntOpt['doTW'] && (is_array($pMeta) || $ntOpt['catSel']!='1');
95
  $isAvailTW = $ntOpt['twURL']!='' && $ntOpt['twConsKey']!='' && $ntOpt['twConsSec']!='' && $ntOpt['twAccToken']!=''; $twMsgFormat = htmlentities($ntOpt['twMsgFormat'], ENT_COMPAT, "UTF-8"); $isAttchImg = $ntOpt['attchImg'];
96
  ?>
97
  <tr><th style="text-align:left;" colspan="2"><?php if ( $ntOpt['catSel']=='1' && trim($ntOpt['catSelEd'])!='' ) { ?> <input type="hidden" class="nxs_SC" id="nxs_SC_TW<?php echo $ii; ?>" value="<?php echo $ntOpt['catSelEd']; ?>" /> <?php } ?>
98
+ <?php if ($isAvailTW) { ?><input class="nxsGrpDoChb" value="1" id="doTW<?php echo $ii; ?>" <?php if ($post->post_status == "publish") echo 'disabled="disabled"';?> type="checkbox" name="tw[<?php echo $ii; ?>][doTW]" <?php if (($post->post_status == "publish" && $ntOpt['isPosted'] == '1') || ($post->post_status != "publish" && ((int)$doTW == 1)) ) echo 'checked="checked" title="def"'; ?> /> <?php } ?>
99
+ <div class="nsx_iconedTitle" style="display: inline; font-size: 13px; background-image: url(<?php echo $nxs_plurl; ?>img/tw16.png);">Twitter - <?php _e('publish to', 'nxs_snap') ?> (<i style="color: #005800;"><?php echo $ntOpt['nName']; ?></i>)</div></th><td><?php //## Only show RePost button if the post is "published"
100
  if ($post->post_status == "publish" && $isAvailTW) { ?>
101
+ <input alt="<?php echo $ii; ?>" style="float: right;" onmouseout="hidePopShAtt('SV');" onmouseover="showPopShAtt('SV', event);" onclick="return false;" type="button" class="button" name="rePostToTW_repostButton" id="rePostToTW_button" value="<?php _e('Repost to Twitter', 'nxs_snap') ?>" />
102
  <?php wp_nonce_field( 'rePostToTW', 'rePostToTW_wpnonce' ); } ?>
103
  <?php if (is_array($pMeta) && is_array($pMeta[$ii]) && isset($pMeta[$ii]['pgID'])) { ?> <span style="float: right;padding-top: 4px; padding-right: 10px;">
104
+ <a id="pstdTW<?php echo $ii; ?>" style="font-size: 10px;" href="<?php echo $ntOpt['twURL'].'/status/'.$pMeta[$ii]['pgID']; ?>" target="_blank"><?php $nType="Twitter"; printf( __( 'Posted on', 'nxs_snap' ), $nType); ?> <?php echo (isset($pMeta[$ii]['pDate']) && $pMeta[$ii]['pDate']!='')?(" (".$pMeta[$ii]['pDate'].")"):""; ?></a>
105
  </span><?php } ?>
106
  </td></tr>
107
  <?php if (!$isAvailTW) { ?><tr><th scope="row" style="text-align:right; width:150px; padding-top: 5px; padding-right:10px;"></th> <td><b>Setup your Twitter Account to AutoPost to Twitter</b>
108
  <?php }elseif ($post->post_status != "puZblish") { ?>
109
 
110
+ <tr id="altFormat1" style=""><th scope="row" style="text-align:right; width:60px; padding-right:10px;"><?php _e('Message Format:', 'nxs_snap') ?></th>
111
  <td><input value="<?php echo $twMsgFormat ?>" type="text" name="tw[<?php echo $ii; ?>][SNAPformat]" style="width:60%;max-width: 610px;" onfocus="jQuery('.nxs_FRMTHint').hide();mxs_showFrmtInfo('apTWMsgFrmt<?php echo $ii; ?>');"/><?php nxs_doShowHint("apTWMsgFrmt".$ii); ?></td></tr>
112
 
113
  <tr><th scope="row" style="text-align:right; width:150px; vertical-align:top; padding-top: 5px; padding-right:10px;">
120
  function adjMetaOpt($optMt, $pMeta){ if (isset($pMeta['isPosted'])) $optMt['isPosted'] = $pMeta['isPosted']; else $optMt['isPosted'] = '';
121
  if (isset($pMeta['SNAPformat'])) $optMt['twMsgFormat'] = $pMeta['SNAPformat'];
122
  if (isset($pMeta['attchImg'])) $optMt['attchImg'] = $pMeta['attchImg'] == 1?1:0; else { if (isset($pMeta['attchImg'])) $optMt['attchImg'] = 0; }
123
+ if (isset($pMeta['doTW'])) $optMt['doTW'] = $pMeta['doTW'] == 1?1:0; else { if (isset($pMeta['SNAPformat'])) $optMt['doTW'] = 0; }
124
+ if (isset($pMeta['SNAPincludeTW']) && $pMeta['SNAPincludeTW'] == '1' ) $optMt['doTW'] = 1; // <2.6 Compatibility fix
125
+ return $optMt;
126
  }
127
  }}
128
 
151
  }}
152
  if ($options['attchImg']=='1' && $img!='') $twLim = 119; else $twLim = 140;
153
 
154
+ if ($postID=='0') { echo "Testing ... <br/><br/>"; $msg = 'Test Post from '.nsTrnc($blogTitle, $twLim - 24)." - ".rand(1, 155); $uln = strlen($msg);}
155
  else{ $post = get_post($postID); if(!$post) return; $twMsgFormat = $options['twMsgFormat']; nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPrePosted'=>'1'));
156
  if (stripos($twMsgFormat, '%URL%')!==false || stripos($twMsgFormat, '%SURL%')!==false) $twLim = $twLim - 20;
157
  if (stripos($twMsgFormat, '%AUTHORNAME%')!==false) { $aun = $post->post_author; $aun = get_the_author_meta('display_name', $aun ); $twLim = $twLim - strlen($aun); }
166
  $pRawText = $post->post_content;
167
 
168
  if (stripos($twMsgFormat, '%TAGS%')!==false || stripos($twMsgFormat, '%HTAGS%')!==false) {
169
+ $t = wp_get_post_tags($postID); $tggs = array(); foreach ($t as $tagA) { $frmTag = trim(str_replace(' ','', str_replace(' ', ' ', trim(ucwords($tagA->name)))));
170
+ if (preg_match('/\b'.$frmTag.'\b/iu', $pTitle)) $pTitle = trim(preg_replace('/\b'.$frmTag.'\b/iu', '#'.$frmTag, $pTitle));
171
+ if (preg_match('/\b'.$frmTag.'\b/iu', $pFullText)) $pFullText = trim(preg_replace('/\b'.$frmTag.'\b/iu', '#'.$frmTag, $pFullText));
172
+ if (preg_match('/\b'.$frmTag.'\b/iu', $pText)) $pText = trim(preg_replace('/\b'.$frmTag.'\b/iu', '#'.$frmTag, $pText));
173
+ if (preg_match('/\b'.$frmTag.'\b/iu', $pRawText)) $pRawText = trim(preg_replace('/\b'.$frmTag.'\b/iu', '#'.$frmTag, $pRawText));
174
+ if ( ((stripos($twMsgFormat, '%TITLE%')!==false) && preg_match('/\b'.$frmTag.'\b/i', $pTitle)) ||
175
+ ((stripos($twMsgFormat, '%TEXT%')!==false) && preg_match('/\b'.$frmTag.'\b/i', $pText)) ||
176
+ ((stripos($twMsgFormat, '%FULLTEXT%')!==false) && preg_match('/\b'.$frmTag.'\b/i', $pFullText)) ||
177
+ ((stripos($twMsgFormat, '%RAWTEXT%')!==false) && preg_match('/\b'.$frmTag.'\b/i', $pRawText)) ) {} else $tggs[] = '#'.$frmTag;
178
  } $tags = implode(' ',$tggs); while(strlen($tags)>($twLim-10)) {array_pop($tggs); $tags = implode(' ',$tggs);} $twMsgFormat = str_ireplace("%TAGS%", $tags, $twMsgFormat); $twMsgFormat = str_ireplace("%HTAGS%", $tags, $twMsgFormat);
179
  $twLim = $twLim - strlen($tags);
180
  }
181
  if (stripos($twMsgFormat, '%CATS%')!==false || stripos($twMsgFormat, '%HCATS%')!==false) {
182
+ $t = wp_get_post_categories($postID); $cats = array(); foreach($t as $c){ $cat = get_category($c); $frmTag = trim(str_replace(' ','', str_replace(' ',' ',str_ireplace('&','&amp;',trim(ucwords($cat->name))))));
183
  if (stripos($pTitle, $cat->name)!==false) $pTitle = str_ireplace($cat->name, '#'.$frmTag, $pTitle); elseif (stripos($pTitle, $frmTag)!==false) $pTitle = str_ireplace($frmTag, '#'.$frmTag, $pTitle);
184
  if (stripos($pText, $cat->name)!==false) $pText = str_ireplace($cat->name, '#'.$frmTag, $pText); elseif (stripos($pText, $frmTag)!==false) $pText = str_ireplace($frmTag, '#'.$frmTag, $pText);
185
  if (stripos($pFullText, $cat->name)!==false) $pFullText = str_ireplace($cat->name, '#'.$frmTag, $pFullText); elseif (stripos($pFullText, $frmTag)!==false) $pFullText = str_ireplace($frmTag, '#'.$frmTag, $pFullText);
214
 
215
  $extInfo = ' | PostID: '.$postID." - ".$post->post_title; $logNT = '<span style="color:#00FFFF">Twitter</span> - '.$options['nName'];
216
  require_once ('apis/tmhOAuth.php'); require_once ('apis/tmhUtilities.php'); if ($uln>0) $msg = nsTrnc($msg, 140+$uln); else { $url = get_permalink($postID); $msg = nsTrnc($msg, 120+strlen($url)); }
217
+ $tmhOAuth = new NXS_tmhOAuth(array( 'consumer_key' => $options['twConsKey'], 'consumer_secret' => $options['twConsSec'], 'user_token' => $options['twAccToken'], 'user_secret' => $options['twAccTokenSec']));
 
218
  if ($options['attchImg']=='1' && $img!='') $code = $tmhOAuth -> request('POST', 'http://upload.twitter.com/1/statuses/update_with_media.json', array( 'media[]' => $img, 'status' => $msg), true, true);
219
  else $code = $tmhOAuth->request('POST', $tmhOAuth->url('1.1/statuses/update'), array('status' =>$msg)); //prr($code); echo "YYY";
220
  if ($code == 200){if ($postID=='0'){ nxs_addToLog($logNT, 'M', 'OK - TEST Message Posted '); echo 'OK - Message Posted, please see your Twitter Page'; /*NXS_tmhUtilities::pr(json_decode($tmhOAuth->response['response'])); */ return 201;}
inc-cl/vb.php CHANGED
@@ -1,24 +1,28 @@
1
  <?php
2
  //## NextScripts Facebook Connection Class
3
- $nxs_snapAvNts[] = array('code'=>'VB', 'lcode'=>'vb', 'name'=>'vBulletin (Beta)');
4
 
5
  if (!class_exists("nxs_snapClassVB")) { class nxs_snapClassVB {
6
  //#### Show Common Settings
7
- function showGenNTSettings($ntOpts){ global $nxs_snapThisPageUrl, $nxs_plurl, $nxsOne; $code = 'VB'; $lcode = 'vb'; wp_nonce_field( 'ns'.$code, 'ns'.$code.'_wpnonce' ); ?>
8
- <hr/><div class="nsx_iconedTitle" style="background-image: url(<?php echo $nxs_plurl; ?>img/<?php echo $lcode; ?>16.png);">vBulletin Settings:
9
- <?php $cgpo = count($ntOpts); $mgpo = 1+max(array_keys($ntOpts)); $nxsOne .= "&g=1"; ?>
10
- <div class="nsBigText">You have <?php echo $cgpo=='0'?'No':$cgpo; ?> vBulletin account<?php if ($cgpo!=1){ ?>s<?php } ?> </div></div>
11
- <?php //if (function_exists('nxs_doSMAS1')) nxs_doSMAS1($this, $mgpo); else nxs_doSMAS('Google+', 'GP'.$mgpo); ?>
12
- <?php foreach ($ntOpts as $indx=>$options){ if (trim($options['nName']=='')) $options['nName'] =$options['vbUName']; ?>
13
- <p style="margin: 0px;margin-left: 5px;">
14
- <input value="1" id="apDoVB" name="vb[<?php echo $indx; ?>][apDoVB]" onchange="doShowHideBlocks('VB');" type="checkbox" <?php if ((int)$options['doVB'] == 1) echo "checked"; ?> />
15
- <strong>Auto-publish your Posts to your vBulletin Account <i style="color: #005800;"><?php if($options['nName']!='') echo "(".$options['nName'].")"; ?></i> </strong>
16
- &nbsp;&nbsp;<a id="doVB<?php echo $indx; ?>A" href="#" onclick="doShowHideBlocks2('VB<?php echo $indx; ?>');return false;">[Show Settings]</a> &nbsp;&nbsp;
17
- <a href="#" onclick="doDelAcct('vb','<?php echo $indx; ?>', '<?php echo $options['vbUName']; ?>');return false;">[Remove Account]</a>
18
- </p>
19
- <?php $this->showNTSettings($indx, $options);
20
- } ?>
21
- <?php
 
 
 
 
22
  }
23
  //#### Show NEW Settings Page
24
  function showNewNTSettings($mgpo){ $options = array('nName'=>'', 'doVB'=>'1', 'vbUName'=>'', 'vbInclTags'=>'1', 'vbAttch'=>'', 'vbURL'=>'', 'vbPass'=>''); $this->showNTSettings($mgpo, $options, true);}
@@ -26,30 +30,30 @@ if (!class_exists("nxs_snapClassVB")) { class nxs_snapClassVB {
26
 
27
  //#### Show Unit Settings
28
  function showNTSettings($ii, $options, $isNew=false){ global $nxs_plurl; ?>
29
- <div id="doVB<?php echo $ii; ?>Div" <?php if ($isNew){ ?>class="clNewNTSets"<?php } ?> style="max-width: 1000px; background-color: #EBF4FB; background-image: url(<?php echo $nxs_plurl; ?>img/vb-bg.png); background-position:90% 10%; background-repeat: no-repeat; margin: 10px; border: 1px solid #808080; padding: 10px; display:none;"> <input type="hidden" name="apDoSVB<?php echo $ii; ?>" value="0" id="apDoSVB<?php echo $ii; ?>" />
30
 
31
- <div class="nsx_iconedTitle" style="float: right; background-image: url(<?php echo $nxs_plurl; ?>img/vb16.png);"><a style="font-size: 12px;" target="_blank" href="http://www.nextscripts.com/setup-installation-vbulletin-social-networks-auto-poster-wordpress/">Detailed vBulletin Installation/Configuration Instructions</a></div>
32
 
33
- <div style="width:100%;"><strong>Account Nickname:</strong> <i>Just so you can easely identify it</i> </div><input name="vb[<?php echo $ii; ?>][nName]" id="vbnName<?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")), 'NS_SNAutoPoster') ?>" /><br/>
34
  <?php echo nxs_addQTranslSel('vb', $ii, $options['qTLng']); ?><?php echo nxs_addPostingDelaySel('vb', $ii, $options['nHrs'], $options['nMin']); ?>
35
 
36
  <?php if (!$isNew) { ?>
37
- <div style="width:100%;"><strong>Auto-Post Categories:</strong>
38
  <input value="0" id="catSelA<?php echo $ii; ?>" type="radio" name="vb[<?php echo $ii; ?>][catSel]" <?php if ((int)$options['catSel'] != 1) echo "checked"; ?> /> All
39
  <input value="1" id="catSelSVB<?php echo $ii; ?>" type="radio" name="vb[<?php echo $ii; ?>][catSel]" <?php if ((int)$options['catSel'] == 1) echo "checked"; ?> /> <a href="#" style="text-decoration: none;" class="showCats" id="nxs_SCA_VB<?php echo $ii; ?>" onclick="jQuery('#catSelSVB<?php echo $ii; ?>').attr('checked', true); jQuery('#tmpCatSelNT').val('VB<?php echo $ii; ?>'); nxs_markCats( jQuery('#nxs_SC_VB<?php echo $ii; ?>').val() ); jQuery('#showCatSel').bPopup({ modalClose: false, appendTo: '#nsStForm', opacity: 0.6, follow: [false, false], position: [75, 'auto']}); return false;">Selected<?php if ($options['catSelEd']!='') echo "[".(substr_count($options['catSelEd'], ",")+1)."]"; ?></a>
40
  <input type="hidden" name="vb[<?php echo $ii; ?>][catSelEd]" id="nxs_SC_VB<?php echo $ii; ?>" value="<?php echo $options['catSelEd']; ?>" />
41
- </div>
42
  <br/>
43
  <?php } ?>
44
 
45
  <div id="altFormat" style="">
46
  <div style="width:100%;"><strong id="altFormatText">vBulletin URL:</strong> <span style="font-size: 11px; margin: 0px;">Could be Forum URL or Thread URL. Either new thread of new post will be created.</span></div>
47
- <input name="vb[<?php echo $ii; ?>][apVBURL]" id="apVBURL" style="width: 60%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['vbURL'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" /> <br/>
48
 
49
  </div>
50
 
51
- <div style="width:100%;"><strong>vBulletin Username:</strong> </div><input name="vb[<?php echo $ii; ?>][apVBUName]" id="apVBUName" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['vbUName'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" />
52
- <div style="width:100%;"><strong>vBulletin Password:</strong> </div><input name="vb[<?php echo $ii; ?>][apVBPass]" id="apVBPass" type="password" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities(substr($options['vbPass'], 0, 5)=='n5g9a'?nsx_doDecode(substr($options['vbPass'], 5)):$options['vbPass'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" /> <br/>
53
 
54
  <?php if ($isNew) { ?> <input type="hidden" name="vb[<?php echo $ii; ?>][apDoVB]" value="1" id="apDoNewVB<?php echo $ii; ?>" /> <?php } ?>
55
  <br/>
@@ -61,22 +65,22 @@ if (!class_exists("nxs_snapClassVB")) { class nxs_snapClassVB {
61
  </p>
62
 
63
  <div id="altFormat" style="">
64
- <div style="width:100%;"><strong id="altFormatText">Post Title Format</strong> (<a href="#" id="apVBMsgTFrmt<?php echo $ii; ?>HintInfo" onclick="mxs_showHideFrmtInfo('apVBMsgTFrmt<?php echo $ii; ?>'); return false;">Show format info</a>)</div>
65
- <input name="vb[<?php echo $ii; ?>][apVBMsgTFrmt]" id="apVBMsgTFrmt" style="width: 50%;" value="<?php if ($isNew) echo "%TITLE%"; else _e(apply_filters('format_to_edit', htmlentities($options['vbMsgTFormat'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster'); ?>" onfocus="mxs_showFrmtInfo('apVBMsgTFrmt<?php echo $ii; ?>');" /><?php nxs_doShowHint("apVBMsgTFrmt".$ii); ?>
66
  </div><br/>
67
 
68
  <div id="altFormat" style="">
69
- <div style="width:100%;"><strong id="altFormatText">Post Text Format</strong> (<a href="#" id="apVBMsgFrmt<?php echo $ii; ?>HintInfo" onclick="mxs_showHideFrmtInfo('apVBMsgFrmt<?php echo $ii; ?>'); return false;">Show format info</a>)</div>
70
- <input name="vb[<?php echo $ii; ?>][apVBMsgFrmt]" id="apVBMsgFrmt" style="width: 50%;" value="<?php if ($isNew) echo "%TEXT%"; else _e(apply_filters('format_to_edit', htmlentities($options['vbMsgFormat'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster'); ?>" onfocus="mxs_showFrmtInfo('apVBMsgFrmt<?php echo $ii; ?>');" /><?php nxs_doShowHint("apVBMsgFrmt".$ii); ?>
71
  </div><br/>
72
 
73
  <?php if ($options['vbPass']!='') { ?>
74
  <?php wp_nonce_field( 'rePostToVB', 'rePostToVB_wpnonce' ); ?>
75
- <b>Test your settings:</b>&nbsp;&nbsp;&nbsp; <a href="#" class="NXSButton" onclick="testPost('VB', '<?php echo $ii; ?>'); return false;">Submit Test Post to vBulletin</a>
76
 
77
  <?php }
78
 
79
- ?><div class="submit"><input type="submit" class="button-primary" name="update_NS_SNAutoPoster_settings" value="<?php _e('Update Settings', 'NS_SNAutoPoster') ?>" /></div></div><?php
80
  }
81
  //#### Set Unit Settings from POST
82
  function setNTSettings($post, $options){ global $nxs_snapThisPageUrl; $code = 'VB'; $lcode = 'vb';
@@ -102,20 +106,21 @@ if (!class_exists("nxs_snapClassVB")) { class nxs_snapClassVB {
102
  }
103
  //#### Show Post->Edit Meta Box Settings
104
  function showEdPostNTSettings($ntOpts, $post){ global $nxs_plurl; $post_id = $post->ID;
105
- foreach($ntOpts as $ii=>$ntOpt) { $pMeta = maybe_unserialize(get_post_meta($post_id, 'snapVB', true)); if (is_array($pMeta)) $ntOpt = $this->adjMetaOpt($ntOpt, $pMeta[$ii]); $doVB = $ntOpt['doVB'] && $ntOpt['catSel']!='1';
 
106
  $isAvailVB = $ntOpt['vbUName']!='' && $ntOpt['vbPass']!=''; $vbMsgFormat = htmlentities($ntOpt['vbMsgFormat'], ENT_COMPAT, "UTF-8"); $vbMsgTFormat = htmlentities($ntOpt['vbMsgTFormat'], ENT_COMPAT, "UTF-8");
107
  ?>
108
  <tr><th style="text-align:left;" colspan="2"><?php if ( $ntOpt['catSel']=='1' && trim($ntOpt['catSelEd'])!='' ) { ?> <input type="hidden" class="nxs_SC" id="nxs_SC_VB<?php echo $ii; ?>" value="<?php echo $ntOpt['catSelEd']; ?>" /> <?php } ?>
109
- <?php if ($isAvailVB) { ?><input class="nxsGrpDoChb" value="1" id="doVB<?php echo $ii; ?>" <?php if ($post->post_status == "publish") echo 'disabled="disabled"';?> type="checkbox" name="vb[<?php echo $ii; ?>][SNAPincludeVB]" <?php if (($post->post_status == "publish" && $ntOpt['isPosted'] == '1') || ($post->post_status != "publish" && ((int)$doVB == 1)) ) echo 'checked="checked" title="def"'; ?> /> <?php } ?>
110
 
111
- <div class="nsx_iconedTitle" style="display: inline; font-size: 13px; background-image: url(<?php echo $nxs_plurl; ?>img/vb16.png);">vBulletin - publish to (<i style="color: #005800;"><?php echo $ntOpt['nName']; ?></i>)</div></th> <td><?php //## Only show RePost button if the post is "published"
112
- if ($post->post_status == "publish" && $isAvailVB) { ?><input alt="<?php echo $ii; ?>" style="float: right;" onmouseout="hidePopShAtt('SV');" onmouseover="showPopShAtt('SV', event);" onclick="return false;" type="button" class="button" name="rePostToVB_repostButton" id="rePostToVB_button" value="<?php _e('Repost to vBulletin', 're-post') ?>" />
113
  <?php wp_nonce_field( 'rePostToVB', 'rePostToVB_wpnonce' ); } ?>
114
 
115
  <?php if (is_array($pMeta) && is_array($pMeta[$ii]) && isset($pMeta[$ii]['pgID']) ) { $wpURL = str_ireplace('/xmlrpc.php', '', $ntOpt['vbURL']);
116
  if (substr($wpURL, -1)=='/') $wpURL = substr($wpURL, 0, -1); $wpURL = $wpURL."/";
117
  ?> <span id="pstdVB<?php echo $ii; ?>" style="float: right;padding-top: 4px; padding-right: 10px;">
118
- <a style="font-size: 10px;" href="<?php echo $pMeta[$ii]['pgID']; ?>" target="_blank">Posted on vBulletin <?php echo (isset($pMeta[$ii]['pDate']) && $pMeta[$ii]['pDate']!='')?(" (".$pMeta[$ii]['pDate'].")"):""; ?></a>
119
  </span><?php } ?>
120
 
121
  </td></tr>
@@ -123,10 +128,10 @@ if (!class_exists("nxs_snapClassVB")) { class nxs_snapClassVB {
123
  <?php if (!$isAvailVB) { ?><tr><th scope="row" style="text-align:right; width:150px; padding-top: 5px; padding-right:10px;"></th> <td><b>Setup your vBulletin Account to AutoPost to vBulletin</b>
124
  <?php } elseif ($post->post_status != "puZblish") { ?>
125
 
126
- <tr id="altFormat1" style=""><th scope="row" style="text-align:right; width:60px; padding-right:10px;"><?php _e('Text Format:', 'NS_SPAP') ?></th>
127
  <td><input value="<?php echo $vbMsgTFormat ?>" type="text" name="vb[<?php echo $ii; ?>][SNAPformatT]" style="width:60%;max-width: 610px;" onfocus="jQuery('.nxs_FRMTHint').hide();mxs_showFrmtInfo('apVBMsgTFrmt<?php echo $ii; ?>');"/><?php nxs_doShowHint("apVBMsgTFrmt".$ii); ?></td></tr>
128
 
129
- <tr id="altFormat1" style=""><th scope="row" style="text-align:right; width:60px; padding-right:10px;"><?php _e('Text Format:', 'NS_SPAP') ?></th>
130
  <td><input value="<?php echo $vbMsgFormat ?>" type="text" name="vb[<?php echo $ii; ?>][SNAPformat]" style="width:60%;max-width: 610px;" onfocus="jQuery('.nxs_FRMTHint').hide();mxs_showFrmtInfo('apVBMsgFrmt<?php echo $ii; ?>');"/><?php nxs_doShowHint("apVBMsgFrmt".$ii); ?></td></tr>
131
  <?php }
132
  }
@@ -135,7 +140,9 @@ if (!class_exists("nxs_snapClassVB")) { class nxs_snapClassVB {
135
  function adjMetaOpt($optMt, $pMeta){ if (isset($pMeta['isPosted'])) $optMt['isPosted'] = $pMeta['isPosted']; else $optMt['isPosted'] = '';
136
  if (isset($pMeta['SNAPformat'])) $optMt['vbMsgFormat'] = $pMeta['SNAPformat'];
137
  if (isset($pMeta['SNAPformatT'])) $optMt['vbMsgTFormat'] = $pMeta['SNAPformatT'];
138
- if (isset($pMeta['SNAPincludeVB'])) $optMt['doVB'] = $pMeta['SNAPincludeVB'] == 1?1:0; else { if (isset($pMeta['SNAPformat'])) $optMt['doVB'] = 0; } return $optMt;
 
 
139
  }
140
  }}
141
  if (!function_exists("nxs_rePostToVB_ajax")) {
@@ -162,7 +169,7 @@ if (!function_exists("nxs_doCheckVB")) {function nxs_doCheckVB($url){ global $nx
162
  } else return 'No Saved Login';
163
  return false;
164
  }}
165
- if (!function_exists("nxs_doConnectToVB")) { function nxs_doConnectToVB($u, $p, $url){ global $nxs_vbCkArray; $hdrsArr = nxs_getVBHeaders($url, true); echo "LOGGIN";
166
  $response = wp_remote_get($url); if(is_wp_error($response)) { nxs_addToLog('VB', 'E', '-=ERROR=- '.print_r($response, true), ''); return "Invalid Connection. Please see log."; }
167
  $contents = $response['body']; //$response['body'] = htmlentities($response['body']); prr($response); die();
168
  $ckArr = $response['cookies']; $mdhashLoc = stripos($contents, 'md5hash(vb_login_password');
1
  <?php
2
  //## NextScripts Facebook Connection Class
3
+ $nxs_snapAvNts[] = array('code'=>'VB', 'lcode'=>'vb', 'name'=>'vBulletin');
4
 
5
  if (!class_exists("nxs_snapClassVB")) { class nxs_snapClassVB {
6
  //#### Show Common Settings
7
+ function showGenNTSettings($ntOpts){ global $nxs_plurl; $ntInfo = array('code'=>'VB', 'lcode'=>'vb', 'name'=>'vBulletin', 'defNName'=>'vbUName', 'tstReq' => false); ?>
8
+ <div class="nxs_box">
9
+ <div class="nxs_box_header">
10
+ <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']; ?>
11
+ <?php $cbo = count($ntOpts); ?> <?php wp_nonce_field( 'ns'.$ntInfo['code'], 'ns'.$ntInfo['code'].'_wpnonce' ); ?>
12
+ <?php if ($cbo>1){ ?><div class="nsBigText"><?php echo "(".($cbo=='0'?'No':$cbo)." "; _e('accounts', 'nxs_snap'); echo ")"; ?></div><?php } ?>
13
+ </div>
14
+ </div>
15
+ <div class="nxs_box_inside">
16
+ <?php foreach ($ntOpts as $indx=>$pbo){ if (trim($pbo['nName']=='')) $pbo['nName'] = $pbo[$ntInfo['defNName']]; ?>
17
+ <p style="margin:0px;margin-left:5px;">
18
+ <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"; ?> />
19
+ <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>
20
+ &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;
21
+ <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>
22
+ </p><?php $this->showNTSettings($indx, $pbo);
23
+ }?>
24
+ </div>
25
+ </div> <?php
26
  }
27
  //#### Show NEW Settings Page
28
  function showNewNTSettings($mgpo){ $options = array('nName'=>'', 'doVB'=>'1', 'vbUName'=>'', 'vbInclTags'=>'1', 'vbAttch'=>'', 'vbURL'=>'', 'vbPass'=>''); $this->showNTSettings($mgpo, $options, true);}
30
 
31
  //#### Show Unit Settings
32
  function showNTSettings($ii, $options, $isNew=false){ global $nxs_plurl; ?>
33
+ <div id="doVB<?php echo $ii; ?>Div" class="insOneDiv<?php if ($isNew) echo " clNewNTSets"; ?>" style="background-image: url(<?php echo $nxs_plurl; ?>img/vb-bg.png); background-position:90% 10%;"> <input type="hidden" name="apDoSVB<?php echo $ii; ?>" value="0" id="apDoSVB<?php echo $ii; ?>" />
34
 
35
+ <div class="nsx_iconedTitle" style="float: right; background-image: url(<?php echo $nxs_plurl; ?>img/vb16.png);"><a style="font-size: 12px;" target="_blank" href="http://www.nextscripts.com/setup-installation-vbulletin-social-networks-auto-poster-wordpress/"><?php $nType="vBulletin"; printf( __( 'Detailed %s Installation/Configuration Instructions', 'nxs_snap' ), $nType); ?></a></div>
36
 
37
+ <div style="width:100%;"><strong><?php _e('Account Nickname', 'nxs_snap'); ?>:</strong> <i><?php _e('Just so you can easely identify it', 'nxs_snap'); ?></i> </div><input name="vb[<?php echo $ii; ?>][nName]" id="vbnName<?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")), 'nxs_snap') ?>" /><br/>
38
  <?php echo nxs_addQTranslSel('vb', $ii, $options['qTLng']); ?><?php echo nxs_addPostingDelaySel('vb', $ii, $options['nHrs'], $options['nMin']); ?>
39
 
40
  <?php if (!$isNew) { ?>
41
+ <div style="width:100%;"><strong><?php _e('Categories', 'nxs_snap'); ?>:</strong>
42
  <input value="0" id="catSelA<?php echo $ii; ?>" type="radio" name="vb[<?php echo $ii; ?>][catSel]" <?php if ((int)$options['catSel'] != 1) echo "checked"; ?> /> All
43
  <input value="1" id="catSelSVB<?php echo $ii; ?>" type="radio" name="vb[<?php echo $ii; ?>][catSel]" <?php if ((int)$options['catSel'] == 1) echo "checked"; ?> /> <a href="#" style="text-decoration: none;" class="showCats" id="nxs_SCA_VB<?php echo $ii; ?>" onclick="jQuery('#catSelSVB<?php echo $ii; ?>').attr('checked', true); jQuery('#tmpCatSelNT').val('VB<?php echo $ii; ?>'); nxs_markCats( jQuery('#nxs_SC_VB<?php echo $ii; ?>').val() ); jQuery('#showCatSel').bPopup({ modalClose: false, appendTo: '#nsStForm', opacity: 0.6, follow: [false, false], position: [75, 'auto']}); return false;">Selected<?php if ($options['catSelEd']!='') echo "[".(substr_count($options['catSelEd'], ",")+1)."]"; ?></a>
44
  <input type="hidden" name="vb[<?php echo $ii; ?>][catSelEd]" id="nxs_SC_VB<?php echo $ii; ?>" value="<?php echo $options['catSelEd']; ?>" />
45
+ <br/><i><?php _e('Only selected categories will be autoposted to this account', 'nxs_snap'); ?></i></div>
46
  <br/>
47
  <?php } ?>
48
 
49
  <div id="altFormat" style="">
50
  <div style="width:100%;"><strong id="altFormatText">vBulletin URL:</strong> <span style="font-size: 11px; margin: 0px;">Could be Forum URL or Thread URL. Either new thread of new post will be created.</span></div>
51
+ <input name="vb[<?php echo $ii; ?>][apVBURL]" id="apVBURL" style="width: 60%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['vbURL'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" /> <br/>
52
 
53
  </div>
54
 
55
+ <div style="width:100%;"><strong>vBulletin Username:</strong> </div><input name="vb[<?php echo $ii; ?>][apVBUName]" id="apVBUName" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['vbUName'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" />
56
+ <div style="width:100%;"><strong>vBulletin Password:</strong> </div><input name="vb[<?php echo $ii; ?>][apVBPass]" id="apVBPass" type="password" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities(substr($options['vbPass'], 0, 5)=='n5g9a'?nsx_doDecode(substr($options['vbPass'], 5)):$options['vbPass'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" /> <br/>
57
 
58
  <?php if ($isNew) { ?> <input type="hidden" name="vb[<?php echo $ii; ?>][apDoVB]" value="1" id="apDoNewVB<?php echo $ii; ?>" /> <?php } ?>
59
  <br/>
65
  </p>
66
 
67
  <div id="altFormat" style="">
68
+ <div style="width:100%;"><strong id="altFormatText"><?php _e('Post Title Format', 'nxs_snap'); ?></strong> (<a href="#" id="apVBMsgTFrmt<?php echo $ii; ?>HintInfo" onclick="mxs_showHideFrmtInfo('apVBMsgTFrmt<?php echo $ii; ?>'); return false;"><?php _e('Show format info', 'nxs_snap'); ?></a>)</div>
69
+ <input name="vb[<?php echo $ii; ?>][apVBMsgTFrmt]" id="apVBMsgTFrmt" style="width: 50%;" value="<?php if ($isNew) echo "%TITLE%"; else _e(apply_filters('format_to_edit', htmlentities($options['vbMsgTFormat'], ENT_COMPAT, "UTF-8")), 'nxs_snap'); ?>" onfocus="mxs_showFrmtInfo('apVBMsgTFrmt<?php echo $ii; ?>');" /><?php nxs_doShowHint("apVBMsgTFrmt".$ii); ?>
70
  </div><br/>
71
 
72
  <div id="altFormat" style="">
73
+ <div style="width:100%;"><strong id="altFormatText"><?php _e('Post Text Format', 'nxs_snap'); ?></strong> (<a href="#" id="apVBMsgFrmt<?php echo $ii; ?>HintInfo" onclick="mxs_showHideFrmtInfo('apVBMsgFrmt<?php echo $ii; ?>'); return false;"><?php _e('Show format info', 'nxs_snap'); ?></a>)</div>
74
+ <input name="vb[<?php echo $ii; ?>][apVBMsgFrmt]" id="apVBMsgFrmt" style="width: 50%;" value="<?php if ($isNew) echo "%TEXT%"; else _e(apply_filters('format_to_edit', htmlentities($options['vbMsgFormat'], ENT_COMPAT, "UTF-8")), 'nxs_snap'); ?>" onfocus="mxs_showFrmtInfo('apVBMsgFrmt<?php echo $ii; ?>');" /><?php nxs_doShowHint("apVBMsgFrmt".$ii); ?>
75
  </div><br/>
76
 
77
  <?php if ($options['vbPass']!='') { ?>
78
  <?php wp_nonce_field( 'rePostToVB', 'rePostToVB_wpnonce' ); ?>
79
+ <b><?php _e('Test your settings', 'nxs_snap'); ?>:</b>&nbsp;&nbsp;&nbsp; <a href="#" class="NXSButton" onclick="testPost('VB', '<?php echo $ii; ?>'); return false;"><?php printf( __( 'Submit Test Post to %s', 'nxs_snap' ), $nType); ?></a>
80
 
81
  <?php }
82
 
83
+ ?><div class="submit"><input type="submit" class="button-primary" name="update_NS_SNAutoPoster_settings" value="<?php _e('Update Settings', 'nxs_snap') ?>" /></div></div><?php
84
  }
85
  //#### Set Unit Settings from POST
86
  function setNTSettings($post, $options){ global $nxs_snapThisPageUrl; $code = 'VB'; $lcode = 'vb';
106
  }
107
  //#### Show Post->Edit Meta Box Settings
108
  function showEdPostNTSettings($ntOpts, $post){ global $nxs_plurl; $post_id = $post->ID;
109
+ foreach($ntOpts as $ii=>$ntOpt) { $pMeta = maybe_unserialize(get_post_meta($post_id, 'snapVB', true)); if (is_array($pMeta)) $ntOpt = $this->adjMetaOpt($ntOpt, $pMeta[$ii]);
110
+ $doVB = $ntOpt['doVB'] && (is_array($pMeta) || $ntOpt['catSel']!='1');
111
  $isAvailVB = $ntOpt['vbUName']!='' && $ntOpt['vbPass']!=''; $vbMsgFormat = htmlentities($ntOpt['vbMsgFormat'], ENT_COMPAT, "UTF-8"); $vbMsgTFormat = htmlentities($ntOpt['vbMsgTFormat'], ENT_COMPAT, "UTF-8");
112
  ?>
113
  <tr><th style="text-align:left;" colspan="2"><?php if ( $ntOpt['catSel']=='1' && trim($ntOpt['catSelEd'])!='' ) { ?> <input type="hidden" class="nxs_SC" id="nxs_SC_VB<?php echo $ii; ?>" value="<?php echo $ntOpt['catSelEd']; ?>" /> <?php } ?>
114
+ <?php if ($isAvailVB) { ?><input class="nxsGrpDoChb" value="1" id="doVB<?php echo $ii; ?>" <?php if ($post->post_status == "publish") echo 'disabled="disabled"';?> type="checkbox" name="vb[<?php echo $ii; ?>][doVB]" <?php if (($post->post_status == "publish" && $ntOpt['isPosted'] == '1') || ($post->post_status != "publish" && ((int)$doVB == 1)) ) echo 'checked="checked" title="def"'; ?> /> <?php } ?>
115
 
116
+ <div class="nsx_iconedTitle" style="display: inline; font-size: 13px; background-image: url(<?php echo $nxs_plurl; ?>img/vb16.png);">vBulletin - <?php _e('publish to', 'nxs_snap') ?> (<i style="color: #005800;"><?php echo $ntOpt['nName']; ?></i>)</div></th> <td><?php //## Only show RePost button if the post is "published"
117
+ if ($post->post_status == "publish" && $isAvailVB) { ?><input alt="<?php echo $ii; ?>" style="float: right;" onmouseout="hidePopShAtt('SV');" onmouseover="showPopShAtt('SV', event);" onclick="return false;" type="button" class="button" name="rePostToVB_repostButton" id="rePostToVB_button" value="<?php _e('Repost to vBulletin', 'nxs_snap') ?>" />
118
  <?php wp_nonce_field( 'rePostToVB', 'rePostToVB_wpnonce' ); } ?>
119
 
120
  <?php if (is_array($pMeta) && is_array($pMeta[$ii]) && isset($pMeta[$ii]['pgID']) ) { $wpURL = str_ireplace('/xmlrpc.php', '', $ntOpt['vbURL']);
121
  if (substr($wpURL, -1)=='/') $wpURL = substr($wpURL, 0, -1); $wpURL = $wpURL."/";
122
  ?> <span id="pstdVB<?php echo $ii; ?>" style="float: right;padding-top: 4px; padding-right: 10px;">
123
+ <a style="font-size: 10px;" href="<?php echo $pMeta[$ii]['pgID']; ?>" target="_blank"><?php $nType="vBulletin"; printf( __( 'Posted on', 'nxs_snap' ), $nType); ?> <?php echo (isset($pMeta[$ii]['pDate']) && $pMeta[$ii]['pDate']!='')?(" (".$pMeta[$ii]['pDate'].")"):""; ?></a>
124
  </span><?php } ?>
125
 
126
  </td></tr>
128
  <?php if (!$isAvailVB) { ?><tr><th scope="row" style="text-align:right; width:150px; padding-top: 5px; padding-right:10px;"></th> <td><b>Setup your vBulletin Account to AutoPost to vBulletin</b>
129
  <?php } elseif ($post->post_status != "puZblish") { ?>
130
 
131
+ <tr id="altFormat1" style=""><th scope="row" style="text-align:right; width:60px; padding-right:10px;"><?php _e('Text Format:', 'nxs_snap') ?></th>
132
  <td><input value="<?php echo $vbMsgTFormat ?>" type="text" name="vb[<?php echo $ii; ?>][SNAPformatT]" style="width:60%;max-width: 610px;" onfocus="jQuery('.nxs_FRMTHint').hide();mxs_showFrmtInfo('apVBMsgTFrmt<?php echo $ii; ?>');"/><?php nxs_doShowHint("apVBMsgTFrmt".$ii); ?></td></tr>
133
 
134
+ <tr id="altFormat1" style=""><th scope="row" style="text-align:right; width:60px; padding-right:10px;"><?php _e('Text Format:', 'nxs_snap') ?></th>
135
  <td><input value="<?php echo $vbMsgFormat ?>" type="text" name="vb[<?php echo $ii; ?>][SNAPformat]" style="width:60%;max-width: 610px;" onfocus="jQuery('.nxs_FRMTHint').hide();mxs_showFrmtInfo('apVBMsgFrmt<?php echo $ii; ?>');"/><?php nxs_doShowHint("apVBMsgFrmt".$ii); ?></td></tr>
136
  <?php }
137
  }
140
  function adjMetaOpt($optMt, $pMeta){ if (isset($pMeta['isPosted'])) $optMt['isPosted'] = $pMeta['isPosted']; else $optMt['isPosted'] = '';
141
  if (isset($pMeta['SNAPformat'])) $optMt['vbMsgFormat'] = $pMeta['SNAPformat'];
142
  if (isset($pMeta['SNAPformatT'])) $optMt['vbMsgTFormat'] = $pMeta['SNAPformatT'];
143
+ if (isset($pMeta['doVB'])) $optMt['doVB'] = $pMeta['doVB'] == 1?1:0; else { if (isset($pMeta['SNAPformat'])) $optMt['doVB'] = 0; }
144
+ if (isset($pMeta['SNAPincludeVB']) && $pMeta['SNAPincludeVB'] == '1' ) $optMt['doVB'] = 1;
145
+ return $optMt;
146
  }
147
  }}
148
  if (!function_exists("nxs_rePostToVB_ajax")) {
169
  } else return 'No Saved Login';
170
  return false;
171
  }}
172
+ if (!function_exists("nxs_doConnectToVB")) { function nxs_doConnectToVB($u, $p, $url){ global $nxs_vbCkArray; $hdrsArr = nxs_getVBHeaders($url, true); // echo "LOGGIN";
173
  $response = wp_remote_get($url); if(is_wp_error($response)) { nxs_addToLog('VB', 'E', '-=ERROR=- '.print_r($response, true), ''); return "Invalid Connection. Please see log."; }
174
  $contents = $response['body']; //$response['body'] = htmlentities($response['body']); prr($response); die();
175
  $ckArr = $response['cookies']; $mdhashLoc = stripos($contents, 'md5hash(vb_login_password');
inc-cl/vk.php CHANGED
@@ -4,121 +4,125 @@ $nxs_snapAvNts[] = array('code'=>'VK', 'lcode'=>'vk', 'name'=>'vKontakte(VK)');
4
 
5
  if (!class_exists("nxs_snapClassVK")) { class nxs_snapClassVK {
6
  //#### Show Common Settings
7
- function showGenNTSettings($ntOpts){ global $nxs_snapThisPageUrl, $nxs_plurl; $code = 'VK'; $lcode = 'vk'; wp_nonce_field( 'ns'.$code, 'ns'.$code.'_wpnonce' ); ?>
8
- <hr/><div class="nsx_iconedTitle" style="background-image: url(<?php echo $nxs_plurl; ?>img/<?php echo $lcode; ?>16.png);">vKontakte(VK) Settings: <?php $cNTo = count($ntOpts); ?> <?php wp_nonce_field( 'nsVK', 'nsVK_wpnonce' ); ?>
9
- <div class="nsBigText">You have <?php echo $cNTo=='0'?'No':$cNTo; ?> vKontakte(VK) account<?php if ($cNTo!=1){ ?>s<?php } ?> </div></div>
10
-
11
- <?php foreach ($ntOpts as $indx=>$nto){ $nto['ii'] = $indx; if (trim($nto['nName']=='')) $nto['nName'] = str_ireplace('https://vk.com','', str_ireplace('http://vk.com','', $nto['url'])); ?>
12
- <p style="margin: 0px;margin-left: 5px;"><input value="1" id="apDoVK" name="vk[<?php echo $indx; ?>][apDoVK]" type="checkbox" <?php if ((int)$nto['doVK'] == 1) echo "checked"; ?> />
13
- <strong>Auto-publish your Posts to your vKontakte(VK) Page or Profile <i style="color: #005800;"><?php if($nto['nName']!='') echo "(".$nto['nName'].")"; ?></i> </strong>
14
- &nbsp;&nbsp;<a id="doVK<?php echo $indx; ?>A" href="#" onclick="doShowHideBlocks2('VK<?php echo $indx; ?>');return false;">[Show Settings]</a>&nbsp;&nbsp;
15
- <a href="#" onclick="doDelAcct('vk', '<?php echo $indx; ?>', '<?php echo $nto['url']; ?>');return false;">[Remove Account]</a>
16
- </p><?php $this->showNTSettings($indx, $nto);
17
- } //## END VK Settings
 
 
 
 
 
 
 
 
18
  }
19
  //#### Show NEW Settings Page
20
- function showNewNTSettings($mNTo){ $nto = array('nName'=>'', 'doVK'=>'1', 'url'=>'', 'vkAppID'=>'', 'imgUpl'=>'1', 'addBackLink'=>'1', 'vkPostType'=>'A', 'msgAFormat'=>'', 'attch'=>'1', 'vkPgID'=>'', 'vkAppAuthUser'=>'', 'msgFrmt'=>'New post has been published on %SITENAME%' ); $this->showNTSettings($mNTo, $nto, true);}
21
  //#### Show Unit Settings
22
  function showNTSettings($ii, $options, $isNew=false){ global $nxs_plurl, $nxs_snapThisPageUrl; if ((int)$options['attch']==0 && (!isset($options['trPostType']) || $options['trPostType']=='')) $options['trPostType'] = 'T';
23
  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'] = ''; ?>
24
- <div id="doVK<?php echo $ii; ?>Div" <?php if ($isNew){ ?>class="clNewNTSets"<?php } ?> style="max-width: 1000px; background-color: #EBF4FB; background-image: url(<?php echo $nxs_plurl; ?>img/vk-bg.png); background-position:90% 10%; background-repeat: no-repeat; margin: 10px; border: 1px solid #808080; padding: 10px; <?php if ((isset($options['vkAppAuthUser']) && $options['vkAppAuthUser']>1)||$isNew) { ?>display:none;<?php } ?>"> <input type="hidden" name="apDoSVK<?php echo $ii; ?>" value="0" id="apDoSVK<?php echo $ii; ?>" />
25
  <?php if ($isNew) { ?> <input type="hidden" name="vk[<?php echo $ii; ?>][apDoVK]" value="1" id="apDoNewVK<?php echo $ii; ?>" /> <?php } ?>
26
 
27
- <div class="nsx_iconedTitle" style="float: right; max-width: 320px; text-align: right; background-image: url(<?php echo $nxs_plurl; ?>img/vk16.png);"><a style="font-size: 12px;" target="_blank" href="http://www.nextscripts.com/setup-installation-vkontakte-social-networks-auto-poster-wordpress/">Detailed vKontakte Installation/Configuration Instructions</a><br/>
28
  <span style="font-size: 10px;">Please use URL <em style="font-size: 10px; color:#CB4B16;">http://<?php echo $_SERVER["SERVER_NAME"] ?></em> and domain <em style="font-size: 10px; color:#CB4B16;"><?php echo $_SERVER["SERVER_NAME"] ?></em> in your vKontakte(VK) App</span>
29
 
30
  </div>
31
 
32
- <div style="width:100%;"><strong>Account Nickname:</strong> <i>Just so you can easely identify it</i> </div><input name="vk[<?php echo $ii; ?>][nName]" id="vknName<?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")), 'NS_SNAutoPoster') ?>" /><br/>
33
  <?php echo nxs_addQTranslSel('vk', $ii, $options['qTLng']); ?>
34
  <?php echo nxs_addPostingDelaySel('vk', $ii, $options['nHrs'], $options['nMin']); ?>
35
 
36
  <?php if (!$isNew) { ?>
37
- <div style="width:100%;"><strong>Auto-Post Categories:</strong>
38
  <input value="0" id="catSelA<?php echo $ii; ?>" type="radio" name="vk[<?php echo $ii; ?>][catSel]" <?php if ((int)$options['catSel'] != 1) echo "checked"; ?> /> All
39
  <input value="1" id="catSelSVK<?php echo $ii; ?>" type="radio" name="vk[<?php echo $ii; ?>][catSel]" <?php if ((int)$options['catSel'] == 1) echo "checked"; ?> /> <a href="#" style="text-decoration: none;" class="showCats" id="nxs_SCA_VK<?php echo $ii; ?>" onclick="jQuery('#catSelSVK<?php echo $ii; ?>').attr('checked', true); jQuery('#tmpCatSelNT').val('VK<?php echo $ii; ?>'); nxs_markCats( jQuery('#nxs_SC_VK<?php echo $ii; ?>').val() ); jQuery('#showCatSel').bPopup({ modalClose: false, appendTo: '#nsStForm', opacity: 0.6, follow: [false, false], position: [75, 'auto']}); return false;">Selected<?php if ($options['catSelEd']!='') echo "[".(substr_count($options['catSelEd'], ",")+1)."]"; ?></a>
40
  <input type="hidden" name="vk[<?php echo $ii; ?>][catSelEd]" id="nxs_SC_VK<?php echo $ii; ?>" value="<?php echo $options['catSelEd']; ?>" />
41
- </div>
42
  <br/>
43
  <?php } ?>
44
 
45
- <div style="width:100%;"><strong>Your vKontakte(VK) URL:</strong> </div>
46
- <p style="font-size: 11px; margin: 0px;">Could be your vKontakte(VK) Profile or vKontakte(VK) Group Page</p>
47
- <input name="vk[<?php echo $ii; ?>][url]" id="apurl" style="width: 50%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['url'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" />
48
 
49
- <div style="width:100%; margin-top: 15px; margin-bottom: 5px;"><b style="font-size: 14px;" >VK API</b> (It could be used for "Text" and "Image" posts)</div>
50
 
51
  <div style="width:100%; margin-left: 15px;">
52
 
53
- <div style="width:100%;"><strong>vKontakte(VK) Application ID:</strong> <a href="http://vk.com/editapp?act=create" target="_blank">[Create VK App]</a> <a href="http://vk.com/apps?act=settings" target="_blank">[Manage VK Apps]</a> </div>
54
- <input name="vk[<?php echo $ii; ?>][apVKAppID]" id="apVKAppID" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['vkAppID'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" />
55
  <br/>
56
  <?php if($options['vkAppID']=='') { ?>
57
- <b>Authorize Your vKontakte(VK) Account</b>. Please click "Update Settings" to be able to Authorize your account.
58
  <?php } else { if(isset($options['vkAppAuthUser']) && $options['vkAppAuthUser']>0) { ?>
59
- Your vKontakte(VK) Account has been authorized. User ID: <?php _e(apply_filters('format_to_edit', htmlentities($options['vkAppAuthUser'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>.
60
- You can Re- <?php } ?>
61
- <a target="_blank" href="http://api.vkontakte.ru/oauth/authorize?client_id=<?php echo $options['vkAppID'];?>&scope=offline,wall,photos,pages&redirect_uri=http://api.vkontakte.ru/blank.html&display=page&response_type=token<?php '&auth=vk&acc='.$options['ii'];?>">Authorize Your vKontakte(VK) Account</a>
62
  <!-- <a href="http://api.vkontakte.ru/oauth/authorize?client_id=<?php echo $options['vkAppID'];?>&scope=offline,wall,photos,pages&redirect_uri=<?php echo urlencode($nxs_snapThisPageUrl.'&auth=vk&acc='.$options['ii']);?>">Authorize Your vKontakte(VK) Account</a> -->
63
- <?php if (!isset($options['vkAppAuthUser']) || $options['vkAppAuthUser']<1) { ?> <div class="blnkg">&lt;=== Authorize your account ===</div> <?php } ?>
64
 
65
- <div style="width:100%;"><strong>vKontakte(VK) Auth Responce:</strong> </div><input name="vk[<?php echo $ii; ?>][apVKAuthResp]" style="width: 50%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['apVKAuthResp'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" /><br/><br/>
66
 
67
  <?php } ?>
68
 
69
  </div>
70
 
71
- <div style="width:100%; margin-bottom: 5px;"><b style="font-size: 14px;" >NextScripts VK API</b> (It could be used for "Text with attached link" posts)</div>
72
 
73
  <div style="width:100%; margin-left: 15px;">
74
  <?php if( function_exists("nxs_doPostToVK")) { ?>
75
- <div style="width:100%;"><strong>vKontakte(VK) Username:</strong> </div><input name="vk[<?php echo $ii; ?>][uName]" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['uName'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" />
76
- <div style="width:100%;"><strong>vKontakte(VK) Password:</strong> </div><input name="vk[<?php echo $ii; ?>][uPass]" type="password" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities(substr($options['uPass'], 0, 5)=='n5g9a'?nsx_doDecode(substr($options['uPass'], 5)):$options['uPass'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" />
77
- <?php } else { ?> **** Please upgrade the plugin to "PRO" get NextScripts VK API <?php } ?>
78
  </div>
79
  <br/>
80
  <div id="altFormat">
81
- <div style="width:100%;"><strong id="altFormatText">Message text Format:</strong> (<a href="#" id="msgFrmt<?php echo $ii; ?>HintInfo" onclick="mxs_showHideFrmtInfo('msgFrmt<?php echo $ii; ?>'); return false;">Show format info</a>)</div>
82
- <input name="vk[<?php echo $ii; ?>][msgFrmt]" id="vkmsgFrmt<?php echo $ii; ?>" style="width: 50%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['msgFrmt'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" onfocus="mxs_showFrmtInfo('msgFrmt<?php echo $ii; ?>');"/><?php nxs_doShowHint("msgFrmt".$ii); ?><br/>
83
  </div>
84
  <div >
85
- <input value="1" type="checkbox" name="vk[<?php echo $ii; ?>][addBackLink]" <?php if (isset($options['addBackLink']) && (int)$options['addBackLink'] == 1) echo "checked"; ?> /> Add backlink to the post
86
  </div>
87
  <br/>
88
- <div style="width:100%;"><strong id="altFormatText">Post Type:</strong> </div>
89
  <div style="margin-left: 10px;">
90
 
91
- <input type="radio" name="vk[<?php echo $ii; ?>][postType]" value="T" <?php if ($options['postType'] == 'T') echo 'checked="checked"'; ?> /> Text Post - <i>just text message</i><br/>
92
- <input type="radio" name="vk[<?php echo $ii; ?>][postType]" value="I" <?php if ($options['postType'] == 'I') echo 'checked="checked"'; ?> /> Image Post - <i>big image with text message</i><br/>
93
- <input type="radio" <?php if( !function_exists("nxs_doPostToVK")) { ?> disabled="disabled" <?php } ?> name="vk[<?php echo $ii; ?>][postType]" value="A" <?php if ( !isset($options['postType']) || $options['postType'] == '' || $options['postType'] == 'A') echo 'checked="checked"'; ?> /> <span <?php if( !function_exists("nxs_doPostToVK")) { ?>style="color:#C0C0C0;"<?php } ?> >Text Post with "attached" link</span><br/>
94
  <?php if( function_exists("nxs_doPostToVK")) { ?>
95
- <div style="width:100%; margin-left: 15px;"><strong>Link attachment type:&nbsp;</strong>
96
  <div style="margin-bottom: 5px; margin-left: 10px; "><input value="1" id="apattchAsVid" type="checkbox" name="vk[<?php echo $ii; ?>][attchAsVid]" <?php if (isset($options['attchAsVid']) && (int)$options['attchAsVid'] == 1) echo "checked"; ?> />
97
- <strong>If post has video use it as an attachment thumbnail.</strong> <i>Video will be used for an attachment thumbnail instead of featured image. Only Youtube is supported at this time.</i><br/>
98
 
99
  </div>
100
- <strong>Attachment Text Format:</strong><br/>
101
- <input value="1" id="apVKMsgAFrmtA<?php echo $ii; ?>" <?php if (trim($options['msgAFormat'])=='') echo "checked"; ?> onchange="if (jQuery(this).is(':checked')) { jQuery('#apVKMsgAFrmtDiv<?php echo $ii; ?>').hide(); jQuery('#apVKMsgAFrmt<?php echo $ii; ?>').val(''); }else jQuery('#apVKMsgAFrmtDiv<?php echo $ii; ?>').show();" type="checkbox" name="vk[<?php echo $ii; ?>][msgAFormat]"/> <strong>Auto</strong>
102
- <i> - Recommended. Info from SEO Plugins will be used, then post excerpt, then post text </i><br/>
103
- <div id="apVKMsgAFrmtDiv<?php echo $ii; ?>" style="<?php if ($options['msgAFormat']=='') echo "display:none;"; ?>" >&nbsp;&nbsp;&nbsp; Set your own format:<input name="vk[<?php echo $ii; ?>][msgAFormat]" id="apVKMsgAFrmt<?php echo $ii; ?>" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['msgAFormat'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" /><br/></div>
104
  </div><br/>
105
 
106
  <?php } ?>
107
-
108
- </div><br/>
109
-
110
- <div class="popShAtt" style="z-index: 9999" id="popShAtt<?php echo $ii; ?>X"><h3>vKontakte(VK) Post Types</h3><img src="<?php echo $nxs_plurl; ?>img/fbPostTypesDiff6.png" width="600" height="398" alt="vKontakte(VK) Post Types"/></div>
111
 
112
 
113
- <?php if ($options['vkPgID']!='') {?><div style="width:100%;"><strong>Your vKontakte(VK) Page ID:</strong> <?php _e(apply_filters('format_to_edit', htmlentities($options['vkPgID'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?> </div><?php } ?>
114
-
115
-
116
 
117
  <?php if(isset($options['vkAppAuthUser']) && $options['vkAppAuthUser']>0) { ?>
118
  <?php wp_nonce_field( 'rePostToVK', 'rePostToVK_wpnonce' ); ?>
119
- <br/><br/><b>Test your settings:</b>&nbsp;&nbsp;&nbsp; <a href="#" class="NXSButton" onclick="testPost('VK','<?php echo $ii; ?>'); return false;">Submit Test Post to vKontakte(VK)</a>
120
  <?php }?>
121
- <div class="submit"><input type="submit" class="button-primary" name="update_NS_SNAutoPoster_settings" value="<?php _e('Update Settings', 'NS_SNAutoPoster') ?>" /></div>
122
 
123
  </div>
124
  <?php
@@ -130,7 +134,10 @@ if (!class_exists("nxs_snapClassVK")) { class nxs_snapClassVK {
130
  if (isset($pval['apVKAppID']) && $pval['apVKAppID']!='') { if (!isset($options[$ii])) $options[$ii] = array();
131
  if (isset($pval['apDoVK'])) $options[$ii]['doVK'] = $pval['apDoVK']; else $options[$ii]['doVK'] = 0;
132
  if (isset($pval['nName'])) $options[$ii]['nName'] = trim($pval['nName']);
133
- if (isset($pval['apVKAppID'])) $options[$ii]['vkAppID'] = trim($pval['apVKAppID']);
 
 
 
134
 
135
 
136
  if (isset($pval['apVKAuthResp'])) { $options[$ii]['apVKAuthResp'] = trim($pval['apVKAuthResp']);
@@ -138,6 +145,7 @@ if (!class_exists("nxs_snapClassVK")) { class nxs_snapClassVK {
138
  $options[$ii]['vkAppAuthUser'] = trim( CutFromTo($pval['apVKAuthResp']."&", 'user_id=','&'));
139
  $hdrsArr = nxs_getVKHeaders($pval['url']);
140
  $response = wp_remote_get($pval['url'], array( 'method' => 'GET', 'timeout' => 45, 'redirection' => 0, 'headers' => $hdrsArr)); $contents = $response['body'];
 
141
  if (stripos($contents, '"public_id":')!==false) { $options[$ii]['pgIntID'] = '-'.CutFromTo($contents, '"public_id":', ','); $type='all'; }
142
  if (stripos($contents, '"user_id":')!==false) { $options[$ii]['pgIntID'] = CutFromTo($contents, '"user_id":', ','); $type='own'; }
143
  }
@@ -170,36 +178,37 @@ if (!class_exists("nxs_snapClassVK")) { class nxs_snapClassVK {
170
  }
171
  //#### Show Post->Edit Meta Box Settings
172
  function showEdPostNTSettings($ntOpts, $post){ global $nxs_plurl; $post_id = $post->ID;
173
- foreach($ntOpts as $ii=>$ntOpt) { $pMeta = maybe_unserialize(get_post_meta($post_id, 'snapVK', true)); if (is_array($pMeta)) $ntOpt = $this->adjMetaOpt($ntOpt, $pMeta[$ii]); $doVK = $ntOpt['doVK'] && $ntOpt['catSel']!='1';
 
174
  $isAvailVK = $ntOpt['url']!='' && $ntOpt['vkAppID']!='' || $ntOpt['uPass']!=''; $isAttachVK = $ntOpt['attch']; $msgFrmt = htmlentities($ntOpt['msgFrmt'], ENT_COMPAT, "UTF-8"); $postType = $ntOpt['postType'];
175
  ?>
176
  <tr><th style="text-align:left;" colspan="2"> <?php if ( $ntOpt['catSel']=='1' && trim($ntOpt['catSelEd'])!='' ) { ?> <input type="hidden" class="nxs_SC" id="nxs_SC_VK<?php echo $ii; ?>" value="<?php echo $ntOpt['catSelEd']; ?>" /> <?php } ?>
177
- <?php if ($isAvailVK) { ?><input class="nxsGrpDoChb" value="1" id="doVK<?php echo $ii; ?>" <?php if ($post->post_status == "publish") echo 'disabled="disabled"';?> type="checkbox" name="vk[<?php echo $ii; ?>][SNAPincludeVK]" <?php if (($post->post_status == "publish" && $ntOpt['isPosted'] == '1') || ($post->post_status != "publish" && ((int)$doVK == 1)) ) echo 'checked="checked" title="def"'; ?> /> <?php } ?>
178
- <div class="nsx_iconedTitle" style="display: inline; font-size: 13px; background-image: url(<?php echo $nxs_plurl; ?>img/vk16.png);">vKontakte(VK) - <?php _e('publish to ', 'NS_SPAP'); ?> (<i style="color: #005800;"><?php echo $ntOpt['nName']; ?></i>)</div></th>
179
  <td><?php //## Only show RePost button if the post is "published"
180
  if ($post->post_status == "publish" && $isAvailVK) { ?>
181
- <input alt="<?php echo $ii; ?>" style="float: right;" onmouseout="hidePopShAtt('SV');" onmouseover="showPopShAtt('SV', event);" onclick="return false;" type="button" class="button" name="rePostToVK_repostButton" id="rePostToVK_button" value="<?php _e('Repost to vKontakte(VK)', 're-post') ?>" />
182
  <?php wp_nonce_field( 'rePostToVK', 'rePostToVK_wpnonce' ); } ?>
183
  <?php if (is_array($pMeta) && is_array($pMeta[$ii]) && isset($pMeta[$ii]['pgID'])) { ?> <span id="pstdVK<?php echo $ii; ?>" style="float: right;padding-top: 4px; padding-right: 10px;">
184
- <a style="font-size: 10px;" href="http://vk.com/wall<?php echo $pMeta[$ii]['pgID']; ?>" target="_blank">Posted on vKontakte(VK) <?php echo (isset($pMeta[$ii]['pDate']) && $pMeta[$ii]['pDate']!='')?(" (".$pMeta[$ii]['pDate'].")"):""; ?></a>
185
  </span>
186
  <?php } ?>
187
  </td></tr>
188
  <?php if (!$isAvailVK) { ?><tr><th scope="row" style="text-align:right; width:150px; padding-top: 5px; padding-right:10px;"></th> <td><b>Setup and Authorize your vKontakte(VK) Account to AutoPost to vKontakte(VK)</b>
189
  <?php } elseif ($post->post_status != "puZblish") {?>
190
- <tr id="altFormat1" style=""><th scope="row" valign="top" style="text-align:right; width:60px; padding-right:10px;"><?php _e('Message Format:', 'NS_SPAP') ?></th>
191
  <td><input value="<?php echo $msgFrmt ?>" type="text" name="vk[<?php echo $ii; ?>][SNAPformat]" style="width:60%;max-width: 610px;" onfocus="jQuery('.nxs_FRMTHint').hide();mxs_showFrmtInfo('apVKTMsgFrmt<?php echo $ii; ?>');"/><?php nxs_doShowHint("apVKTMsgFrmt".$ii); ?>
192
  <br/><div ><input value="0" type="hidden" name="vk[<?php echo $ii; ?>][addBackLink]" />
193
- <input value="1" type="checkbox" name="vk[<?php echo $ii; ?>][addBackLink]" <?php if (isset($ntOpt['addBackLink']) && (int)$ntOpt['addBackLink'] == 1) echo "checked"; ?> /> Add backlink to the post
194
  </div>
195
  </td></tr>
196
- <tr><th scope="row" style="text-align:right; width:150px; vertical-align:top; padding-top: 0px; padding-right:10px;"> Post Type: <br/>
197
- (<a id="showShAtt" style="font-weight: normal" onmouseout="hidePopShAtt('<?php echo $ii; ?>X');" onmouseover="showPopShAtt('<?php echo $ii; ?>X', event);" onclick="return false;" class="underdash" href="http://www.nextscripts.com/blog/">What's the difference?</a>)</th><td>
198
- <input type="radio" name="vk[<?php echo $ii; ?>][PostType]" value="T" <?php if ($postType == 'T') echo 'checked="checked"'; ?> /> Text Post - <i>just text message</i><br/>
199
- <input type="radio" name="vk[<?php echo $ii; ?>][PostType]" value="I" <?php if ($postType == 'I') echo 'checked="checked"'; ?> /> Image Post - <i>big image with text message</i>
200
  <?php if( function_exists("nxs_doPostToVK")) { ?> <br/>
201
- <input type="radio" name="vk[<?php echo $ii; ?>][PostType]" value="A" <?php if ( !isset($postType) || $postType == '' || $postType == 'A') echo 'checked="checked"'; ?> /> Text Post with "attached" blogpost
202
- <?php } ?><br/><div class="popShAtt" id="popShAtt<?php echo $ii; ?>X"><h3>vKontakte(VK) Post Types</h3><img src="<?php echo $nxs_plurl; ?>img/fbPostTypesDiff6.png" width="600" height="398" alt="vKontakte(VK) Post Types"/></div>
203
  </td></tr><?php }
204
  }
205
 
@@ -210,7 +219,8 @@ if (!class_exists("nxs_snapClassVK")) { class nxs_snapClassVK {
210
  if (isset($pMeta['AttachPost'])) $optMt['attch'] = ($pMeta['AttachPost'] != '')?$pMeta['AttachPost']:0; else { if (isset($pMeta['SNAPformat'])) $optMt['attch'] = 0; }
211
  if (isset($pMeta['addBackLink'])) $optMt['addBackLink'] = ($pMeta['addBackLink'] != '')?$pMeta['addBackLink']:0; else { if (isset($pMeta['SNAPformat'])) $optMt['addBackLink'] = 0; }
212
  if (isset($pMeta['PostType'])) $optMt['postType'] = ($pMeta['PostType'] != '')?$pMeta['PostType']:0; else { if (isset($pMeta['SNAPformat'])) $optMt['postType'] = 'T'; }
213
- if (isset($pMeta['SNAPincludeVK'])) $optMt['doVK'] = $pMeta['SNAPincludeVK'] == 1?1:0; else { if (isset($pMeta['SNAPformat'])) $optMt['doVK'] = 0; }
 
214
  return $optMt;
215
  }
216
  }}
@@ -268,7 +278,7 @@ if (!function_exists("nxs_doPublishToVK")) { //## Second Function to Post to VK
268
  $msgFormat = $options['msgFrmt']; $msg = nsFormatMessage($msgFormat, $postID); $link = get_permalink($postID); nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPrePosted'=>'1'));
269
  }
270
  $dusername = $options['uName']; $postType = $options['postType']; //$link = urlencode($link); $desc = urlencode(substr($msg, 0, 500));
271
- $extInfo = ' | PostID: '.$postID." - ".$post->post_title; $logNT = '<span style="color:#000080">StumbleUpon</span> - '.$options['nName'];
272
 
273
  $msgOpts = array(); $msgOpts['type'] = $postType; $msgOpts['uid'] = $options['vkPgID']; $imgURL = nxs_getPostImage($postID);// if ($link!='') $msgOpts['link'] = $link;
274
  if ($postType=='I' && trim($imgURL)=='') $postType='T';
@@ -299,8 +309,9 @@ if (!function_exists("nxs_doPublishToVK")) { //## Second Function to Post to VK
299
  if (is_array($atts)) $atts = implode(',', $atts);
300
  $postUrl = 'https://api.vkontakte.ru/method/wall.post?owner_id='.$options['pgIntID'].'&access_token='.$options['vkAppAuthToken'].'&from_group=1&message='.urlencode($msg).'&attachment='.urlencode($atts);
301
  $response = wp_remote_get($postUrl);
302
- if ( is_wp_error($response) || (is_object($response) && (isset($response->errors))) || (is_array($response) && stripos($response['body'],'"error":')!==false )) {nxs_addToLog($logNT, 'E', '-=ERROR=- '.print_r($response, true), $extInfo); }
303
- else { $respJ = json_decode($response['body'], true); $ret = array("code"=>"OK", "post_id"=>$options['pgIntID'].'_'.$respJ['response']['post_id']); }
 
304
 
305
  }
306
  if (is_array($ret) && $ret['code']=='OK') { if ($postID=='0') { nxs_addToLog($logNT, 'M', 'OK - TEST Message Posted '); echo ' OK - Message Posted, please see your VK Page '; } else
4
 
5
  if (!class_exists("nxs_snapClassVK")) { class nxs_snapClassVK {
6
  //#### Show Common Settings
7
+ function showGenNTSettings($ntOpts){ global $nxs_plurl; $ntInfo = array('code'=>'VK', 'lcode'=>'vk', 'name'=>'vKontakte(VK)', 'defNName'=>'', 'tstReq' => false); ?>
8
+ <div class="nxs_box">
9
+ <div class="nxs_box_header">
10
+ <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']; ?>
11
+ <?php $cbo = count($ntOpts); ?> <?php wp_nonce_field( 'ns'.$ntInfo['code'], 'ns'.$ntInfo['code'].'_wpnonce' ); ?>
12
+ <?php if ($cbo>1){ ?><div class="nsBigText"><?php echo "(".($cbo=='0'?'No':$cbo)." "; _e('accounts', 'nxs_snap'); echo ")"; ?></div><?php } ?>
13
+ </div>
14
+ </div>
15
+ <div class="nxs_box_inside">
16
+ <?php foreach ($ntOpts as $indx=>$pbo){ if (trim($pbo['nName']=='')) $pbo['nName'] = str_ireplace('https://vk.com','', str_ireplace('http://vk.com','', $pbo['url'])); ?>
17
+ <p style="margin:0px;margin-left:5px;">
18
+ <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"; ?> />
19
+ <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>
20
+ &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;
21
+ <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>
22
+ </p><?php $this->showNTSettings($indx, $pbo);
23
+ }?>
24
+ </div>
25
+ </div> <?php
26
  }
27
  //#### Show NEW Settings Page
28
+ function showNewNTSettings($mNTo){ $nto = array('nName'=>'', 'doVK'=>'1', 'url'=>'', 'vkAppID'=>'', 'imgUpl'=>'1', 'addBackLink'=>'1', 'vkPostType'=>'T', 'msgAFormat'=>'', 'attch'=>'1', 'vkPgID'=>'', 'vkAppAuthUser'=>'', 'msgFrmt'=>'New post has been published on %SITENAME%' ); $this->showNTSettings($mNTo, $nto, true);}
29
  //#### Show Unit Settings
30
  function showNTSettings($ii, $options, $isNew=false){ global $nxs_plurl, $nxs_snapThisPageUrl; if ((int)$options['attch']==0 && (!isset($options['trPostType']) || $options['trPostType']=='')) $options['trPostType'] = 'T';
31
  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'] = ''; ?>
32
+ <div id="doVK<?php echo $ii; ?>Div" class="insOneDiv<?php if ($isNew) echo " clNewNTSets"; ?>" style="background-image: url(<?php echo $nxs_plurl; ?>img/vk-bg.png); background-position:90% 10%;"> <input type="hidden" name="apDoSVK<?php echo $ii; ?>" value="0" id="apDoSVK<?php echo $ii; ?>" />
33
  <?php if ($isNew) { ?> <input type="hidden" name="vk[<?php echo $ii; ?>][apDoVK]" value="1" id="apDoNewVK<?php echo $ii; ?>" /> <?php } ?>
34
 
35
+ <div class="nsx_iconedTitle" style="float: right; max-width: 322px; text-align: right; background-image: url(<?php echo $nxs_plurl; ?>img/vk16.png);"><a style="font-size: 12px;" target="_blank" href="http://www.nextscripts.com/setup-installation-vkontakte-social-networks-auto-poster-wordpress/"><?php $nType="vKontakte"; printf( __( 'Detailed %s Installation/Configuration Instructions', 'nxs_snap' ), $nType); ?></a><br/>
36
  <span style="font-size: 10px;">Please use URL <em style="font-size: 10px; color:#CB4B16;">http://<?php echo $_SERVER["SERVER_NAME"] ?></em> and domain <em style="font-size: 10px; color:#CB4B16;"><?php echo $_SERVER["SERVER_NAME"] ?></em> in your vKontakte(VK) App</span>
37
 
38
  </div>
39
 
40
+ <div style="width:100%;"><strong><?php _e('Account Nickname', 'nxs_snap'); ?>:</strong> <i><?php _e('Just so you can easely identify it', 'nxs_snap'); ?></i> </div><input name="vk[<?php echo $ii; ?>][nName]" id="vknName<?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")), 'nxs_snap') ?>" /><br/>
41
  <?php echo nxs_addQTranslSel('vk', $ii, $options['qTLng']); ?>
42
  <?php echo nxs_addPostingDelaySel('vk', $ii, $options['nHrs'], $options['nMin']); ?>
43
 
44
  <?php if (!$isNew) { ?>
45
+ <div style="width:100%;"><strong><?php _e('Categories', 'nxs_snap'); ?>:</strong>
46
  <input value="0" id="catSelA<?php echo $ii; ?>" type="radio" name="vk[<?php echo $ii; ?>][catSel]" <?php if ((int)$options['catSel'] != 1) echo "checked"; ?> /> All
47
  <input value="1" id="catSelSVK<?php echo $ii; ?>" type="radio" name="vk[<?php echo $ii; ?>][catSel]" <?php if ((int)$options['catSel'] == 1) echo "checked"; ?> /> <a href="#" style="text-decoration: none;" class="showCats" id="nxs_SCA_VK<?php echo $ii; ?>" onclick="jQuery('#catSelSVK<?php echo $ii; ?>').attr('checked', true); jQuery('#tmpCatSelNT').val('VK<?php echo $ii; ?>'); nxs_markCats( jQuery('#nxs_SC_VK<?php echo $ii; ?>').val() ); jQuery('#showCatSel').bPopup({ modalClose: false, appendTo: '#nsStForm', opacity: 0.6, follow: [false, false], position: [75, 'auto']}); return false;">Selected<?php if ($options['catSelEd']!='') echo "[".(substr_count($options['catSelEd'], ",")+1)."]"; ?></a>
48
  <input type="hidden" name="vk[<?php echo $ii; ?>][catSelEd]" id="nxs_SC_VK<?php echo $ii; ?>" value="<?php echo $options['catSelEd']; ?>" />
49
+ <br/><i><?php _e('Only selected categories will be autoposted to this account', 'nxs_snap'); ?></i></div>
50
  <br/>
51
  <?php } ?>
52
 
53
+ <div style="width:100%;"><strong>vKontakte(VK) URL:</strong> </div>
54
+ <p style="font-size: 11px; margin: 0px;"><?php _e('Could be your vKontakte(VK) Profile or vKontakte(VK) Group Page', 'nxs_snap'); ?></p>
55
+ <input name="vk[<?php echo $ii; ?>][url]" id="apurl" style="width: 50%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['url'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" />
56
 
57
+ <div style="width:100%; margin-top: 15px; margin-bottom: 5px;"><b style="font-size: 14px;" >VK API</b> <?php _e('(It could be used for "Text" and "Image" posts)', 'nxs_snap'); ?></div>
58
 
59
  <div style="width:100%; margin-left: 15px;">
60
 
61
+ <div style="width:100%;"><strong>vKontakte(VK) Application ID:</strong> <a href="http://vk.com/editapp?act=create" target="_blank"><?php _e('[Create VK App]', 'nxs_snap'); ?></a> <a href="http://vk.com/apps?act=settings" target="_blank"><?php _e('[Manage VK Apps]', 'nxs_snap'); ?></a> </div>
62
+ <input name="vk[<?php echo $ii; ?>][apVKAppID]" id="apVKAppID" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['vkAppID'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" />
63
  <br/>
64
  <?php if($options['vkAppID']=='') { ?>
65
+ <?php _e('<b>Authorize Your vKontakte(VK) Account</b>. Please click "Update Settings" to be able to Authorize your account.', 'nxs_snap'); ?>
66
  <?php } else { if(isset($options['vkAppAuthUser']) && $options['vkAppAuthUser']>0) { ?>
67
+ <?php _e('Your vKontakte(VK) Account has been authorized.'); ?> User ID: <?php _e(apply_filters('format_to_edit', htmlentities($options['vkAppAuthUser'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>.
68
+ <?php _e('You can', 'nxs_snap'); ?> Re- <?php } ?>
69
+ <a target="_blank" href="http://api.vkontakte.ru/oauth/authorize?client_id=<?php echo $options['vkAppID'];?>&scope=offline,wall,photos,pages&redirect_uri=http://api.vkontakte.ru/blank.html&display=page&response_type=token<?php '&auth=vk&acc='.$ii;?>">Authorize Your vKontakte(VK) Account</a>
70
  <!-- <a href="http://api.vkontakte.ru/oauth/authorize?client_id=<?php echo $options['vkAppID'];?>&scope=offline,wall,photos,pages&redirect_uri=<?php echo urlencode($nxs_snapThisPageUrl.'&auth=vk&acc='.$options['ii']);?>">Authorize Your vKontakte(VK) Account</a> -->
71
+ <?php if (!isset($options['vkAppAuthUser']) || $options['vkAppAuthUser']<1) { ?> <div class="blnkg">&lt;=== <?php _e('Authorize your account', 'nxs_snap'); ?> ===</div> <?php } ?>
72
 
73
+ <div style="width:100%;"><strong>vKontakte(VK) Auth Response:</strong> </div><input name="vk[<?php echo $ii; ?>][apVKAuthResp]" style="width: 50%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['apVKAuthResp'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" /><br/><br/>
74
 
75
  <?php } ?>
76
 
77
  </div>
78
 
79
+ <div style="width:100%; margin-bottom: 5px;"><b style="font-size: 14px;" >NextScripts VK API</b> <?php _e('(It could be used for "Text with attached link" posts)', 'nxs_snap'); ?></div>
80
 
81
  <div style="width:100%; margin-left: 15px;">
82
  <?php if( function_exists("nxs_doPostToVK")) { ?>
83
+ <div style="width:100%;"><strong>vKontakte(VK) Email:</strong> </div><input name="vk[<?php echo $ii; ?>][uName]" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['uName'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" />
84
+ <div style="width:100%;"><strong>vKontakte(VK) Password:</strong> </div><input name="vk[<?php echo $ii; ?>][uPass]" type="password" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities(substr($options['uPass'], 0, 5)=='n5g9a'?nsx_doDecode(substr($options['uPass'], 5)):$options['uPass'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" />
85
+ <?php } else { ?> **** <?php _e('Please upgrade the plugin to "PRO" get NextScripts VK API', 'nxs_snap'); ?> <?php } ?>
86
  </div>
87
  <br/>
88
  <div id="altFormat">
89
+ <div style="width:100%;"><strong id="altFormatText"><?php _e('Message text Format', 'nxs_snap'); ?>:</strong> (<a href="#" id="msgFrmt<?php echo $ii; ?>HintInfo" onclick="mxs_showHideFrmtInfo('msgFrmt<?php echo $ii; ?>'); return false;"><?php _e('Show format info', 'nxs_snap'); ?></a>)</div>
90
+ <input name="vk[<?php echo $ii; ?>][msgFrmt]" id="vkmsgFrmt<?php echo $ii; ?>" style="width: 50%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['msgFrmt'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" onfocus="mxs_showFrmtInfo('msgFrmt<?php echo $ii; ?>');"/><?php nxs_doShowHint("msgFrmt".$ii); ?><br/>
91
  </div>
92
  <div >
93
+ <input value="1" type="checkbox" name="vk[<?php echo $ii; ?>][addBackLink]" <?php if (isset($options['addBackLink']) && (int)$options['addBackLink'] == 1) echo "checked"; ?> /> <?php _e('Add backlink to the post', 'nxs_snap') ?>
94
  </div>
95
  <br/>
96
+ <div style="width:100%;"><strong id="altFormatText">Post Type:</strong> &lt;-- (<a id="showShAtt" onmouseout="hidePopShAtt('<?php echo $ii; ?>VKX');" onmouseover="showPopShAtt('<?php echo $ii; ?>VKX', event);" onclick="return false;" class="underdash" href="http://www.nextscripts.com/blog/"><?php _e('What\'s the difference?', 'nxs_snap'); ?></a>) </div>
97
  <div style="margin-left: 10px;">
98
 
99
+ <input type="radio" name="vk[<?php echo $ii; ?>][postType]" value="T" <?php if ($options['postType'] == 'T') echo 'checked="checked"'; ?> /> <?php _e('Text Post', 'nxs_snap'); ?> - <i><?php _e('just text message', 'nxs_snap'); ?></i><br/>
100
+ <input type="radio" name="vk[<?php echo $ii; ?>][postType]" value="I" <?php if ($options['postType'] == 'I') echo 'checked="checked"'; ?> /> <?php _e('Image Post', 'nxs_snap'); ?> - <i><?php _e('big image with text message', 'nxs_snap'); ?></i><br/>
101
+ <input type="radio" <?php if( !function_exists("nxs_doPostToVK")) { ?> disabled="disabled" <?php } ?> name="vk[<?php echo $ii; ?>][postType]" value="A" <?php if ( !isset($options['postType']) || $options['postType'] == '' || $options['postType'] == 'A') echo 'checked="checked"'; ?> /> <span <?php if( !function_exists("nxs_doPostToVK")) { ?>style="color:#C0C0C0;"<?php } ?> ><?php _e('Text Post with "attached" link', 'nxs_snap'); ?></span><br/>
102
  <?php if( function_exists("nxs_doPostToVK")) { ?>
103
+ <div style="width:100%; margin-left: 15px;"><strong><?php _e('Link attachment type:', 'nxs_snap'); ?>&nbsp;</strong>
104
  <div style="margin-bottom: 5px; margin-left: 10px; "><input value="1" id="apattchAsVid" type="checkbox" name="vk[<?php echo $ii; ?>][attchAsVid]" <?php if (isset($options['attchAsVid']) && (int)$options['attchAsVid'] == 1) echo "checked"; ?> />
105
+ <?php _e('<strong>If post has video use it as an attachment thumbnail.</strong> <i>Video will be used for an attachment thumbnail instead of featured image. Only Youtube is supported at this time.</i>', 'nxs_snap'); ?><br/>
106
 
107
  </div>
108
+ <strong><?php _e('Attachment Text Format:', 'nxs_snap'); ?></strong><br/>
109
+ <input value="1" id="apVKMsgAFrmtA<?php echo $ii; ?>" <?php if (trim($options['msgAFormat'])=='') echo "checked"; ?> onchange="if (jQuery(this).is(':checked')) { jQuery('#apVKMsgAFrmtDiv<?php echo $ii; ?>').hide(); jQuery('#apVKMsgAFrmt<?php echo $ii; ?>').val(''); }else jQuery('#apVKMsgAFrmtDiv<?php echo $ii; ?>').show();" type="checkbox" name="vk[<?php echo $ii; ?>][msgAFormat]"/> <strong><?php _e('Auto', 'nxs_snap'); ?></strong>
110
+ <i> - <?php _e('Recommended. Info from SEO Plugins will be used, then post excerpt, then post text', 'nxs_snap'); ?> </i><br/>
111
+ <div id="apVKMsgAFrmtDiv<?php echo $ii; ?>" style="<?php if ($options['msgAFormat']=='') echo "display:none;"; ?>" >&nbsp;&nbsp;&nbsp; <?php _e('Set your own format:', 'nxs_snap'); ?><input name="vk[<?php echo $ii; ?>][msgAFormat]" id="apVKMsgAFrmt<?php echo $ii; ?>" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['msgAFormat'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" /><br/></div>
112
  </div><br/>
113
 
114
  <?php } ?>
115
+ </div><br/>
116
+ <div class="popShAtt" style="z-index: 9999" id="popShAtt<?php echo $ii; ?>VKX"><h3>vKontakte(VK) Post Types</h3><img src="<?php echo $nxs_plurl; ?>img/vkPostTypesDiff6.png" width="600" height="257" alt="vKontakte(VK) Post Types"/></div>
 
 
117
 
118
 
119
+ <?php if ($options['vkPgID']!='') {?><div style="width:100%;"><strong>Your vKontakte(VK) Page ID:</strong> <?php _e(apply_filters('format_to_edit', htmlentities($options['vkPgID'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?> </div><?php } ?>
 
 
120
 
121
  <?php if(isset($options['vkAppAuthUser']) && $options['vkAppAuthUser']>0) { ?>
122
  <?php wp_nonce_field( 'rePostToVK', 'rePostToVK_wpnonce' ); ?>
123
+ <br/><br/><b><?php _e('Test your settings', 'nxs_snap'); ?>:</b>&nbsp;&nbsp;&nbsp; <a href="#" class="NXSButton" onclick="testPost('VK','<?php echo $ii; ?>'); return false;"><?php printf( __( 'Submit Test Post to %s', 'nxs_snap' ), $nType); ?></a>
124
  <?php }?>
125
+ <div class="submit"><input type="submit" class="button-primary" name="update_NS_SNAutoPoster_settings" value="<?php _e('Update Settings', 'nxs_snap') ?>" /></div>
126
 
127
  </div>
128
  <?php
134
  if (isset($pval['apVKAppID']) && $pval['apVKAppID']!='') { if (!isset($options[$ii])) $options[$ii] = array();
135
  if (isset($pval['apDoVK'])) $options[$ii]['doVK'] = $pval['apDoVK']; else $options[$ii]['doVK'] = 0;
136
  if (isset($pval['nName'])) $options[$ii]['nName'] = trim($pval['nName']);
137
+ if (isset($pval['apVKAppID'])) $options[$ii]['vkAppID'] = trim($pval['apVKAppID']);
138
+
139
+ if (isset($pval['uName'])) $options[$ii]['uName'] = trim($pval['uName']);
140
+ if (isset($pval['uPass'])) $options[$ii]['uPass'] = 'n5g9a'.nsx_doEncode($pval['uPass']); else $options[$ii]['uPass'] = '';
141
 
142
 
143
  if (isset($pval['apVKAuthResp'])) { $options[$ii]['apVKAuthResp'] = trim($pval['apVKAuthResp']);
145
  $options[$ii]['vkAppAuthUser'] = trim( CutFromTo($pval['apVKAuthResp']."&", 'user_id=','&'));
146
  $hdrsArr = nxs_getVKHeaders($pval['url']);
147
  $response = wp_remote_get($pval['url'], array( 'method' => 'GET', 'timeout' => 45, 'redirection' => 0, 'headers' => $hdrsArr)); $contents = $response['body'];
148
+ if (stripos($contents, '"group_id":')!==false) { $options[$ii]['pgIntID'] = '-'.CutFromTo($contents, '"group_id":', ','); $type='all'; }
149
  if (stripos($contents, '"public_id":')!==false) { $options[$ii]['pgIntID'] = '-'.CutFromTo($contents, '"public_id":', ','); $type='all'; }
150
  if (stripos($contents, '"user_id":')!==false) { $options[$ii]['pgIntID'] = CutFromTo($contents, '"user_id":', ','); $type='own'; }
151
  }
178
  }
179
  //#### Show Post->Edit Meta Box Settings
180
  function showEdPostNTSettings($ntOpts, $post){ global $nxs_plurl; $post_id = $post->ID;
181
+ foreach($ntOpts as $ii=>$ntOpt) { $pMeta = maybe_unserialize(get_post_meta($post_id, 'snapVK', true)); if (is_array($pMeta)) $ntOpt = $this->adjMetaOpt($ntOpt, $pMeta[$ii]);
182
+ $doVK = $ntOpt['doVK'] && (is_array($pMeta) || $ntOpt['catSel']!='1');
183
  $isAvailVK = $ntOpt['url']!='' && $ntOpt['vkAppID']!='' || $ntOpt['uPass']!=''; $isAttachVK = $ntOpt['attch']; $msgFrmt = htmlentities($ntOpt['msgFrmt'], ENT_COMPAT, "UTF-8"); $postType = $ntOpt['postType'];
184
  ?>
185
  <tr><th style="text-align:left;" colspan="2"> <?php if ( $ntOpt['catSel']=='1' && trim($ntOpt['catSelEd'])!='' ) { ?> <input type="hidden" class="nxs_SC" id="nxs_SC_VK<?php echo $ii; ?>" value="<?php echo $ntOpt['catSelEd']; ?>" /> <?php } ?>
186
+ <?php if ($isAvailVK) { ?><input class="nxsGrpDoChb" value="1" id="doVK<?php echo $ii; ?>" <?php if ($post->post_status == "publish") echo 'disabled="disabled"';?> type="checkbox" name="vk[<?php echo $ii; ?>][doVK]" <?php if (($post->post_status == "publish" && $ntOpt['isPosted'] == '1') || ($post->post_status != "publish" && ((int)$doVK == 1)) ) echo 'checked="checked" title="def"'; ?> /> <?php } ?>
187
+ <div class="nsx_iconedTitle" style="display: inline; font-size: 13px; background-image: url(<?php echo $nxs_plurl; ?>img/vk16.png);">vKontakte(VK) - <?php _e('publish to', 'nxs_snap') ?> (<i style="color: #005800;"><?php echo $ntOpt['nName']; ?></i>)</div></th>
188
  <td><?php //## Only show RePost button if the post is "published"
189
  if ($post->post_status == "publish" && $isAvailVK) { ?>
190
+ <input alt="<?php echo $ii; ?>" style="float: right;" onmouseout="hidePopShAtt('SV');" onmouseover="showPopShAtt('SV', event);" onclick="return false;" type="button" class="button" name="rePostToVK_repostButton" id="rePostToVK_button" value="<?php _e('Repost to vKontakte(VK)', 'nxs_snap') ?>" />
191
  <?php wp_nonce_field( 'rePostToVK', 'rePostToVK_wpnonce' ); } ?>
192
  <?php if (is_array($pMeta) && is_array($pMeta[$ii]) && isset($pMeta[$ii]['pgID'])) { ?> <span id="pstdVK<?php echo $ii; ?>" style="float: right;padding-top: 4px; padding-right: 10px;">
193
+ <a style="font-size: 10px;" href="http://vk.com/wall<?php echo $pMeta[$ii]['pgID']; ?>" target="_blank"><?php $nType="vKontakte(VK)"; printf( __( 'Posted on', 'nxs_snap' ), $nType); ?> <?php echo (isset($pMeta[$ii]['pDate']) && $pMeta[$ii]['pDate']!='')?(" (".$pMeta[$ii]['pDate'].")"):""; ?></a>
194
  </span>
195
  <?php } ?>
196
  </td></tr>
197
  <?php if (!$isAvailVK) { ?><tr><th scope="row" style="text-align:right; width:150px; padding-top: 5px; padding-right:10px;"></th> <td><b>Setup and Authorize your vKontakte(VK) Account to AutoPost to vKontakte(VK)</b>
198
  <?php } elseif ($post->post_status != "puZblish") {?>
199
+ <tr id="altFormat1" style=""><th scope="row" valign="top" style="text-align:right; width:60px; padding-right:10px;"><?php _e('Message Format:', 'nxs_snap') ?></th>
200
  <td><input value="<?php echo $msgFrmt ?>" type="text" name="vk[<?php echo $ii; ?>][SNAPformat]" style="width:60%;max-width: 610px;" onfocus="jQuery('.nxs_FRMTHint').hide();mxs_showFrmtInfo('apVKTMsgFrmt<?php echo $ii; ?>');"/><?php nxs_doShowHint("apVKTMsgFrmt".$ii); ?>
201
  <br/><div ><input value="0" type="hidden" name="vk[<?php echo $ii; ?>][addBackLink]" />
202
+ <input value="1" type="checkbox" name="vk[<?php echo $ii; ?>][addBackLink]" <?php if (isset($ntOpt['addBackLink']) && (int)$ntOpt['addBackLink'] == 1) echo "checked"; ?> /> <?php _e('Add backlink to the post', 'nxs_snap') ?>
203
  </div>
204
  </td></tr>
205
+ <tr><th scope="row" style="text-align:right; width:150px; vertical-align:top; padding-top: 0px; padding-right:10px;"> <?php _e('Post Type:', 'nxs_snap') ?> <br/>
206
+ (<a id="showShAtt" style="font-weight: normal" onmouseout="hidePopShAtt('<?php echo $ii; ?>VKX');" onmouseover="showPopShAtt('<?php echo $ii; ?>VKX', event);" onclick="return false;" class="underdash" href="http://www.nextscripts.com/blog/"><?php _e('What\'s the difference?', 'nxs_snap'); ?></a>)</th><td>
207
+ <input type="radio" name="vk[<?php echo $ii; ?>][PostType]" value="T" <?php if ($postType == 'T') echo 'checked="checked"'; ?> /> <?php _e('Text Post', 'nxs_snap') ?> - <i><?php _e('just text message', 'nxs_snap') ?></i><br/>
208
+ <input type="radio" name="vk[<?php echo $ii; ?>][PostType]" value="I" <?php if ($postType == 'I') echo 'checked="checked"'; ?> /> <?php _e('Image Post', 'nxs_snap') ?> - <i><?php _e('big image with text message', 'nxs_snap') ?></i>
209
  <?php if( function_exists("nxs_doPostToVK")) { ?> <br/>
210
+ <input type="radio" name="vk[<?php echo $ii; ?>][PostType]" value="A" <?php if ( !isset($postType) || $postType == '' || $postType == 'A') echo 'checked="checked"'; ?> /> <?php _e('Text Post with "attached" blogpost', 'nxs_snap') ?>
211
+ <?php } ?><br/><div class="popShAtt" id="popShAtt<?php echo $ii; ?>VKX"><h3>vKontakte(VK) <?php _e('Post Types', 'nxs_snap') ?></h3><img src="<?php echo $nxs_plurl; ?>img/vkPostTypesDiff6.png" width="600" height="257" alt="<?php _e('Post Types', 'nxs_snap') ?>"/></div>
212
  </td></tr><?php }
213
  }
214
 
219
  if (isset($pMeta['AttachPost'])) $optMt['attch'] = ($pMeta['AttachPost'] != '')?$pMeta['AttachPost']:0; else { if (isset($pMeta['SNAPformat'])) $optMt['attch'] = 0; }
220
  if (isset($pMeta['addBackLink'])) $optMt['addBackLink'] = ($pMeta['addBackLink'] != '')?$pMeta['addBackLink']:0; else { if (isset($pMeta['SNAPformat'])) $optMt['addBackLink'] = 0; }
221
  if (isset($pMeta['PostType'])) $optMt['postType'] = ($pMeta['PostType'] != '')?$pMeta['PostType']:0; else { if (isset($pMeta['SNAPformat'])) $optMt['postType'] = 'T'; }
222
+ if (isset($pMeta['doVK'])) $optMt['doVK'] = $pMeta['doVK'] == 1?1:0; else { if (isset($pMeta['SNAPformat'])) $optMt['doVK'] = 0; }
223
+ if (isset($pMeta['SNAPincludeVK']) && $pMeta['SNAPincludeVK'] == '1' ) $optMt['doVK'] = 1;
224
  return $optMt;
225
  }
226
  }}
278
  $msgFormat = $options['msgFrmt']; $msg = nsFormatMessage($msgFormat, $postID); $link = get_permalink($postID); nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPrePosted'=>'1'));
279
  }
280
  $dusername = $options['uName']; $postType = $options['postType']; //$link = urlencode($link); $desc = urlencode(substr($msg, 0, 500));
281
+ $extInfo = ' | PostID: '.$postID." - ".$post->post_title; $logNT = '<span style="color:#000080">vKontakte</span> - '.$options['nName'];
282
 
283
  $msgOpts = array(); $msgOpts['type'] = $postType; $msgOpts['uid'] = $options['vkPgID']; $imgURL = nxs_getPostImage($postID);// if ($link!='') $msgOpts['link'] = $link;
284
  if ($postType=='I' && trim($imgURL)=='') $postType='T';
309
  if (is_array($atts)) $atts = implode(',', $atts);
310
  $postUrl = 'https://api.vkontakte.ru/method/wall.post?owner_id='.$options['pgIntID'].'&access_token='.$options['vkAppAuthToken'].'&from_group=1&message='.urlencode($msg).'&attachment='.urlencode($atts);
311
  $response = wp_remote_get($postUrl);
312
+ if ( is_wp_error($response) || (is_object($response) && (isset($response->errors))) || (is_array($response) && stripos($response['body'],'"error":')!==false )) {
313
+ $ret = $response['body'];
314
+ } else { $respJ = json_decode($response['body'], true); $ret = array("code"=>"OK", "post_id"=>$options['pgIntID'].'_'.$respJ['response']['post_id']); }
315
 
316
  }
317
  if (is_array($ret) && $ret['code']=='OK') { if ($postID=='0') { nxs_addToLog($logNT, 'M', 'OK - TEST Message Posted '); echo ' OK - Message Posted, please see your VK Page '; } else
inc-cl/wp.php CHANGED
@@ -4,70 +4,74 @@ $nxs_snapAvNts[] = array('code'=>'WP', 'lcode'=>'wp', 'name'=>'WP Based Blog');
4
 
5
  if (!class_exists("nxs_snapClassWP")) { class nxs_snapClassWP {
6
  //#### Show Common Settings
7
- function showGenNTSettings($ntOpts){ global $nxs_snapThisPageUrl, $nxs_plurl, $nxsOne; $code = 'WP'; $lcode = 'wp'; wp_nonce_field( 'ns'.$code, 'ns'.$code.'_wpnonce' ); ?>
8
- <hr/><div class="nsx_iconedTitle" style="background-image: url(<?php echo $nxs_plurl; ?>img/<?php echo $lcode; ?>16.png);">Wordpress Compatible Blog Settings:
9
- <?php $cgpo = count($ntOpts); $mgpo = 1+max(array_keys($ntOpts)); $nxsOne .= "&g=1"; ?>
10
- <div class="nsBigText">You have <?php echo $cgpo=='0'?'No':$cgpo; ?> Blog account<?php if ($cgpo!=1){ ?>s<?php } ?> </div></div>
11
- <?php //if (function_exists('nxs_doSMAS1')) nxs_doSMAS1($this, $mgpo); else nxs_doSMAS('Google+', 'GP'.$mgpo); ?>
12
- <?php foreach ($ntOpts as $indx=>$gpo){ if (trim($gpo['nName']=='')) $gpo['nName'] = str_ireplace('/xmlrpc.php','', str_ireplace('http://','', str_ireplace('https://','', $gpo['wpURL']))); ?>
13
- <p style="margin: 0px; margin-left: 5px;">
14
- <input value="1" id="apDoWP" name="wp[<?php echo $indx; ?>][apDoWP]"type="checkbox" <?php if ((int)$gpo['doWP'] == 1) echo "checked"; ?> />
15
- <strong>Auto-publish your Posts to your Blog <i style="color: #005800;"><?php if($gpo['nName']!='') echo "(".$gpo['nName'].")"; ?></i></strong>
16
- &nbsp;&nbsp;<a id="doWP<?php echo $indx; ?>A" href="#" onclick="doShowHideBlocks2('WP<?php echo $indx; ?>');return false;">[Show Settings]</a> &nbsp;&nbsp;
17
- <a href="#" onclick="doDelAcct('wp','<?php echo $indx; ?>', '<?php echo $gpo['wpUName']; ?>');return false;">[Remove Account]</a>
18
- </p>
19
- <?php $this->showNTSettings($indx, $gpo);
20
- } ?>
21
- <?php
22
- }
 
 
 
 
23
  //#### Show NEW Settings Page
24
  function showNewNTSettings($mgpo){ $gpo = array('nName'=>'', 'doWP'=>'1', 'wpUName'=>'', 'wpPageID'=>'', 'wpAttch'=>'', 'wpPass'=>'', 'wpURL'=>''); $this->showNTSettings($mgpo, $gpo, true);}
25
  //#### Show Unit Settings
26
  function showNTSettings($ii, $gpo, $isNew=false){ global $nxs_plurl; ?>
27
- <div id="doWP<?php echo $ii; ?>Div" <?php if ($isNew){ ?>class="clNewNTSets"<?php } ?> style="max-width: 1000px; background-color: #EBF4FB; background-image: url(<?php echo $nxs_plurl; ?>img/wp-bg.png); background-position:90% 10%; background-repeat: no-repeat; margin: 10px; border: 1px solid #808080; padding: 10px; display:none;"> <input type="hidden" name="apDoSWP<?php echo $ii; ?>" value="0" id="apDoSWP<?php echo $ii; ?>" />
28
 
29
- <div class="nsx_iconedTitle" style="float: right; background-image: url(<?php echo $nxs_plurl; ?>img/wp16.png);"><a style="font-size: 12px;" target="_blank" href="http://www.nextscripts.com/setup-installation-wp-based-social-networks-auto-poster-wordpress/">Detailed Wordpress Blog Installation/Configuration Instructions</a></div>
30
 
31
  <?php if ($isNew){ ?> <br/>You can setup any Wordpress based blog with activated XML-RPC support (WP Admin->Settimgs->Writing->Remote Publishing->Check XML-RPC). Wordpress.com and Blog.com supported as well.<br/><br/> <?php } ?>
32
 
33
- <div style="width:100%;"><strong>Account Nickname:</strong> <i>Just so you can easely identify it</i> </div><input name="wp[<?php echo $ii; ?>][nName]" id="wpnName<?php echo $ii; ?>" style="font-weight: bold; color: #005800; border: 1px solid #ACACAC; width: 40%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($gpo['nName'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" /><br/>
34
  <?php echo nxs_addQTranslSel('wp', $ii, $gpo['qTLng']); ?><?php echo nxs_addPostingDelaySel('wp', $ii, $gpo['nHrs'], $gpo['nMin']); ?>
35
 
36
  <?php if (!$isNew) { ?>
37
- <div style="width:100%;"><strong>Auto-Post Categories:</strong>
38
  <input value="0" id="catSelA<?php echo $ii; ?>" type="radio" name="wp[<?php echo $ii; ?>][catSel]" <?php if ((int)$gpo['catSel'] != 1) echo "checked"; ?> /> All
39
  <input value="1" id="catSelSWP<?php echo $ii; ?>" type="radio" name="wp[<?php echo $ii; ?>][catSel]" <?php if ((int)$gpo['catSel'] == 1) echo "checked"; ?> /> <a href="#" style="text-decoration: none;" class="showCats" id="nxs_SCA_WP<?php echo $ii; ?>" onclick="jQuery('#catSelSWP<?php echo $ii; ?>').attr('checked', true); jQuery('#tmpCatSelNT').val('WP<?php echo $ii; ?>'); nxs_markCats( jQuery('#nxs_SC_WP<?php echo $ii; ?>').val() ); jQuery('#showCatSel').bPopup({ modalClose: false, appendTo: '#nsStForm', opacity: 0.6, follow: [false, false], position: [75, 'auto']}); return false;">Selected<?php if ($gpo['catSelEd']!='') echo "[".(substr_count($gpo['catSelEd'], ",")+1)."]"; ?></a>
40
  <input type="hidden" name="wp[<?php echo $ii; ?>][catSelEd]" id="nxs_SC_WP<?php echo $ii; ?>" value="<?php echo $gpo['catSelEd']; ?>" />
41
- </div>
42
  <br/>
43
  <?php } ?>
44
 
45
- <div style="width:100%;"><strong>XMLRPC URL:</strong> </div><input name="wp[<?php echo $ii; ?>][apWPURL]" id="apWPURL" style="width: 50%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($gpo['wpURL'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" />
46
  <p style="font-size: 11px; margin: 0px;">Usually its a URL of your Wordpress installation with /xmlrpc.php at the end.<br/> Please use <b style="color: #005800;">http://YourUserName.wordpress.com/xmlrpc.php</b> (replace YourUserName with your user name - for example <i style="color: #005800;">http://nextscripts.wordpress.com/xmlrpc.php</i>) for Wordpress.com blogs. <br/> Please use <b style="color: #005800;">http://YourUserName.blog.com/xmlrpc.php</b> (replace YourUserName with your user name - for example <i style="color: #005800;">http://nextscripts.blog.com/xmlrpc.php</i> for Blog.com blogs</p>
47
 
48
- <div style="width:100%;"><br/><strong>Blog Username:</strong> </div><input name="wp[<?php echo $ii; ?>][apWPUName]" id="apWPUName" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($gpo['wpUName'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" />
49
- <div style="width:100%;"><strong>Blog Password:</strong> </div><input name="wp[<?php echo $ii; ?>][apWPPass]" id="apWPPass" type="password" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities(substr($gpo['wpPass'], 0, 5)=='n5g9a'?nsx_doDecode(substr($gpo['wpPass'], 5)):$gpo['wpPass'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster') ?>" /> <br/>
50
 
51
  <?php if ($isNew) { ?> <input type="hidden" name="wp[<?php echo $ii; ?>][apDoWP]" value="1" id="apDoNewWP<?php echo $ii; ?>" /> <?php } ?>
52
 
53
  <br/><strong id="altFormatText">Post Title and Post Text Formats</strong>
54
  <p style="font-size: 11px; margin: 0px;">%SITENAME% - Inserts the Your Blog/Site Name. &nbsp; %TITLE% - Inserts the Title of your post. &nbsp; %URL% - Inserts the URL of your post. &nbsp; %TEXT% - Inserts the excerpt of your post. &nbsp; %FULLTEXT% - Inserts the body(text) of your post, %AUTHORNAME% - Inserts the author's name.</p>
55
  <div id="altFormat" style="">
56
- <div style="width:100%;"><strong id="altFormatText">Post Title Format</strong>
57
- </div><input name="wp[<?php echo $ii; ?>][apWPMsgTFrmt]" id="apWPMsgTFrmt" style="width: 50%;" value="<?php if ($isNew) echo "%TITLE%"; else _e(apply_filters('format_to_edit', htmlentities($gpo['wpMsgTFormat'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster'); ?>" />
58
  </div>
59
  <div id="altFormat" style="">
60
- <div style="width:100%;"><strong id="altFormatText">Post Text Format</strong>
61
- </div><input name="wp[<?php echo $ii; ?>][apWPMsgFrmt]" id="apWPMsgFrmt" style="width: 50%;" value="<?php if ($isNew) echo "%TEXT%"; else _e(apply_filters('format_to_edit', htmlentities($gpo['wpMsgFormat'], ENT_COMPAT, "UTF-8")), 'NS_SNAutoPoster'); ?>" />
62
  </div><br/>
63
 
64
  <?php if ($gpo['wpPass']!='') { ?>
65
  <?php wp_nonce_field( 'rePostToWP', 'rePostToWP_wpnonce' ); ?>
66
- <b>Test your settings:</b>&nbsp;&nbsp;&nbsp; <a href="#" class="NXSButton" onclick="testPost('WP', '<?php echo $ii; ?>'); return false;">Submit Test Post to WP Blog</a>
67
 
68
  <?php }
69
 
70
- ?><div class="submit"><input type="submit" class="button-primary" name="update_NS_SNAutoPoster_settings" value="<?php _e('Update Settings', 'NS_SNAutoPoster') ?>" /></div></div><?php
71
  }
72
  //#### Set Unit Settings from POST
73
  function setNTSettings($post, $options){ global $nxs_snapThisPageUrl; $code = 'WP'; $lcode = 'wp';
@@ -91,19 +95,20 @@ if (!class_exists("nxs_snapClassWP")) { class nxs_snapClassWP {
91
  }
92
  //#### Show Post->Edit Meta Box Settings
93
  function showEdPostNTSettings($ntOpts, $post){ global $nxs_plurl; $post_id = $post->ID;
94
- foreach($ntOpts as $ii=>$ntOpt) { $pMeta = maybe_unserialize(get_post_meta($post_id, 'snapWP', true)); if (is_array($pMeta)) $ntOpt = $this->adjMetaOpt($ntOpt, $pMeta[$ii]); $doWP = $ntOpt['doWP'] && $ntOpt['catSel']!='1';
 
95
  $isAvailWP = $ntOpt['wpUName']!='' && $ntOpt['wpPass']!=''; $wpMsgFormat = htmlentities($ntOpt['wpMsgFormat'], ENT_COMPAT, "UTF-8"); $wpMsgTFormat = htmlentities($ntOpt['wpMsgTFormat'], ENT_COMPAT, "UTF-8");
96
  ?>
97
  <tr><th style="text-align:left;" colspan="2"><?php if ( $ntOpt['catSel']=='1' && trim($ntOpt['catSelEd'])!='' ) { ?> <input type="hidden" class="nxs_SC" id="nxs_SC_WP<?php echo $ii; ?>" value="<?php echo $ntOpt['catSelEd']; ?>" /> <?php } ?>
98
- <?php if ($isAvailWP) { ?><input class="nxsGrpDoChb" value="1" id="doWP<?php echo $ii; ?>" <?php if ($post->post_status == "publish") echo 'disabled="disabled"';?> type="checkbox" name="wp[<?php echo $ii; ?>][SNAPincludeWP]" <?php if (($post->post_status == "publish" && $ntOpt['isPosted'] == '1') || ($post->post_status != "publish" && ((int)$doWP == 1)) ) echo 'checked="checked" title="def"'; ?> /> <?php } ?>
99
- <div class="nsx_iconedTitle" style="display: inline; font-size: 13px; background-image: url(<?php echo $nxs_plurl; ?>img/wp16.png);">WP Blog - publish to (<i style="color: #005800;"><?php echo $ntOpt['nName']; ?></i>)</div></th> <td><?php //## Only show RePost button if the post is "published"
100
- if ($post->post_status == "publish" && $isAvailWP) { ?><input alt="<?php echo $ii; ?>" style="float: right;" onmouseout="hidePopShAtt('SV');" onmouseover="showPopShAtt('SV', event);" onclick="return false;" type="button" class="button" name="rePostToWP_repostButton" id="rePostToWP_button" value="<?php _e('Repost to WP Blog', 're-post') ?>" />
101
  <?php wp_nonce_field( 'rePostToWP', 'rePostToWP_wpnonce' ); } ?>
102
 
103
  <?php if (is_array($pMeta) && is_array($pMeta[$ii]) && isset($pMeta[$ii]['pgID']) ) { $wpURL = str_ireplace('/xmlrpc.php', '', $ntOpt['wpURL']);
104
  if (substr($wpURL, -1)=='/') $wpURL = substr($wpURL, 0, -1); $wpURL = $wpURL."/";
105
  ?> <span id="pstdWP<?php echo $ii; ?>" style="float: right;padding-top: 4px; padding-right: 10px;">
106
- <a style="font-size: 10px;" href="<?php echo $wpURL; ?>?p=<?php echo $pMeta[$ii]['pgID']; ?>" target="_blank">Posted on Wordpress Blog <?php echo (isset($pMeta[$ii]['pDate']) && $pMeta[$ii]['pDate']!='')?(" (".$pMeta[$ii]['pDate'].")"):""; ?></a>
107
  </span><?php } ?>
108
 
109
  </td></tr>
@@ -111,10 +116,10 @@ if (!class_exists("nxs_snapClassWP")) { class nxs_snapClassWP {
111
  <?php if (!$isAvailWP) { ?><tr><th scope="row" style="text-align:right; width:150px; padding-top: 5px; padding-right:10px;"></th> <td><b>Setup your WP Blog Account to AutoPost to WP Blogs</b>
112
  <?php } elseif ($post->post_status != "puZblish") { ?>
113
 
114
- <tr id="altFormat1" style=""><th scope="row" style="text-align:right; width:60px; padding-right:10px;"><?php _e('Title Format:', 'NS_SPAP') ?></th>
115
  <td><input value="<?php echo $wpMsgTFormat ?>" type="text" name="wp[<?php echo $ii; ?>][SNAPformatT]" style="width:60%;max-width: 610px;" onfocus="jQuery('.nxs_FRMTHint').hide();mxs_showFrmtInfo('apWPTMsgFrmt<?php echo $ii; ?>');"/><?php nxs_doShowHint("apWPTMsgFrmt".$ii); ?></td></tr>
116
 
117
- <tr id="altFormat1" style=""><th scope="row" style="text-align:right; width:60px; padding-right:10px;"><?php _e('Text Format:', 'NS_SPAP') ?></th>
118
  <td><input value="<?php echo $wpMsgFormat ?>" type="text" name="wp[<?php echo $ii; ?>][SNAPformat]" style="width:60%;max-width: 610px;" onfocus="jQuery('.nxs_FRMTHint').hide();mxs_showFrmtInfo('apWPMsgFrmt<?php echo $ii; ?>');"/><?php nxs_doShowHint("apWPMsgFrmt".$ii); ?></td></tr>
119
 
120
  <?php }
@@ -124,7 +129,9 @@ if (!class_exists("nxs_snapClassWP")) { class nxs_snapClassWP {
124
  function adjMetaOpt($optMt, $pMeta){ if (isset($pMeta['isPosted'])) $optMt['isPosted'] = $pMeta['isPosted']; else $optMt['isPosted'] = '';
125
  if (isset($pMeta['SNAPformat'])) $optMt['wpMsgFormat'] = $pMeta['SNAPformat'];
126
  if (isset($pMeta['SNAPformatT'])) $optMt['wpMsgTFormat'] = $pMeta['SNAPformatT'];
127
- if (isset($pMeta['SNAPincludeWP'])) $optMt['doWP'] = $pMeta['SNAPincludeWP'] == 1?1:0; else { if (isset($pMeta['SNAPformat'])) $optMt['doWP'] = 0; } return $optMt;
 
 
128
  }
129
  }}
130
  if (!function_exists("nxs_rePostToWP_ajax")) {
@@ -157,7 +164,8 @@ if (!function_exists("nxs_doPublishToWP")) { //## Second Function to Post to WP
157
  //## Post
158
  require_once ('apis/xmlrpc-client.php'); $nxsToWPclient = new NXS_XMLRPC_Client($options['wpURL']); $nxsToWPclient->debug = false;
159
  if ($imgURL!=='' && stripos($imgURL, 'http')!==false) {
160
- $handle = fopen($imgURL, "rb"); $filedata = ''; while (!feof($handle)) {$filedata .= fread($handle, 8192);} fclose($handle);
 
161
  $data = array('name' => 'image-'.$postID.'.jpg', 'type' => 'image/jpg', 'bits' => new NXS_XMLRPC_Base64($filedata), true);
162
  $status = $nxsToWPclient->query('metaWeblog.newMediaObject', $postID, $options['wpUName'], $pass, $data); $imgResp = $nxsToWPclient->getResponse(); $gid = $imgResp['id'];
163
  } else $gid = '';
4
 
5
  if (!class_exists("nxs_snapClassWP")) { class nxs_snapClassWP {
6
  //#### Show Common Settings
7
+ function showGenNTSettings($ntOpts){ global $nxs_plurl; $ntInfo = array('code'=>'WP', 'lcode'=>'wp', 'name'=>'WP Based Blog', 'defNName'=>'dlUName', 'tstReq' => false); ?>
8
+ <div class="nxs_box">
9
+ <div class="nxs_box_header">
10
+ <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']; ?>
11
+ <?php $cbo = count($ntOpts); ?> <?php wp_nonce_field( 'ns'.$ntInfo['code'], 'ns'.$ntInfo['code'].'_wpnonce' ); ?>
12
+ <?php if ($cbo>1){ ?><div class="nsBigText"><?php echo "(".($cbo=='0'?'No':$cbo)." "; _e('accounts', 'nxs_snap'); echo ")"; ?></div><?php } ?>
13
+ </div>
14
+ </div>
15
+ <div class="nxs_box_inside">
16
+ <?php foreach ($ntOpts as $indx=>$pbo){ if (trim($pbo['nName']=='')) $pbo['nName'] = str_ireplace('/xmlrpc.php','', str_ireplace('http://','', str_ireplace('https://','', $pbo['wpURL']))); ?>
17
+ <p style="margin:0px;margin-left:5px;">
18
+ <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"; ?> />
19
+ <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>
20
+ &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;
21
+ <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>
22
+ </p><?php $this->showNTSettings($indx, $pbo);
23
+ }?>
24
+ </div>
25
+ </div> <?php
26
+ }
27
  //#### Show NEW Settings Page
28
  function showNewNTSettings($mgpo){ $gpo = array('nName'=>'', 'doWP'=>'1', 'wpUName'=>'', 'wpPageID'=>'', 'wpAttch'=>'', 'wpPass'=>'', 'wpURL'=>''); $this->showNTSettings($mgpo, $gpo, true);}
29
  //#### Show Unit Settings
30
  function showNTSettings($ii, $gpo, $isNew=false){ global $nxs_plurl; ?>
31
+ <div id="doWP<?php echo $ii; ?>Div" class="insOneDiv<?php if ($isNew) echo " clNewNTSets"; ?>" style="background-image: url(<?php echo $nxs_plurl; ?>img/wp-bg.png); background-position:90% 10%;"> <input type="hidden" name="apDoSWP<?php echo $ii; ?>" value="0" id="apDoSWP<?php echo $ii; ?>" />
32
 
33
+ <div class="nsx_iconedTitle" style="float: right; background-image: url(<?php echo $nxs_plurl; ?>img/wp16.png);"><a style="font-size: 12px;" target="_blank" href="http://www.nextscripts.com/setup-installation-wp-based-social-networks-auto-poster-wordpress/"><?php $nType="Wordpress"; printf( __( 'Detailed %s Installation/Configuration Instructions', 'nxs_snap' ), $nType); ?></a></div>
34
 
35
  <?php if ($isNew){ ?> <br/>You can setup any Wordpress based blog with activated XML-RPC support (WP Admin->Settimgs->Writing->Remote Publishing->Check XML-RPC). Wordpress.com and Blog.com supported as well.<br/><br/> <?php } ?>
36
 
37
+ <div style="width:100%;"><strong><?php _e('Account Nickname', 'nxs_snap'); ?>:</strong> <i><?php _e('Just so you can easely identify it', 'nxs_snap'); ?></i> </div><input name="wp[<?php echo $ii; ?>][nName]" id="wpnName<?php echo $ii; ?>" style="font-weight: bold; color: #005800; border: 1px solid #ACACAC; width: 40%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($gpo['nName'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" /><br/>
38
  <?php echo nxs_addQTranslSel('wp', $ii, $gpo['qTLng']); ?><?php echo nxs_addPostingDelaySel('wp', $ii, $gpo['nHrs'], $gpo['nMin']); ?>
39
 
40
  <?php if (!$isNew) { ?>
41
+ <div style="width:100%;"><strong><?php _e('Categories', 'nxs_snap'); ?>:</strong>
42
  <input value="0" id="catSelA<?php echo $ii; ?>" type="radio" name="wp[<?php echo $ii; ?>][catSel]" <?php if ((int)$gpo['catSel'] != 1) echo "checked"; ?> /> All
43
  <input value="1" id="catSelSWP<?php echo $ii; ?>" type="radio" name="wp[<?php echo $ii; ?>][catSel]" <?php if ((int)$gpo['catSel'] == 1) echo "checked"; ?> /> <a href="#" style="text-decoration: none;" class="showCats" id="nxs_SCA_WP<?php echo $ii; ?>" onclick="jQuery('#catSelSWP<?php echo $ii; ?>').attr('checked', true); jQuery('#tmpCatSelNT').val('WP<?php echo $ii; ?>'); nxs_markCats( jQuery('#nxs_SC_WP<?php echo $ii; ?>').val() ); jQuery('#showCatSel').bPopup({ modalClose: false, appendTo: '#nsStForm', opacity: 0.6, follow: [false, false], position: [75, 'auto']}); return false;">Selected<?php if ($gpo['catSelEd']!='') echo "[".(substr_count($gpo['catSelEd'], ",")+1)."]"; ?></a>
44
  <input type="hidden" name="wp[<?php echo $ii; ?>][catSelEd]" id="nxs_SC_WP<?php echo $ii; ?>" value="<?php echo $gpo['catSelEd']; ?>" />
45
+ <br/><i><?php _e('Only selected categories will be autoposted to this account', 'nxs_snap'); ?></i></div>
46
  <br/>
47
  <?php } ?>
48
 
49
+ <div style="width:100%;"><strong>XMLRPC URL:</strong> </div><input name="wp[<?php echo $ii; ?>][apWPURL]" id="apWPURL" style="width: 50%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($gpo['wpURL'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" />
50
  <p style="font-size: 11px; margin: 0px;">Usually its a URL of your Wordpress installation with /xmlrpc.php at the end.<br/> Please use <b style="color: #005800;">http://YourUserName.wordpress.com/xmlrpc.php</b> (replace YourUserName with your user name - for example <i style="color: #005800;">http://nextscripts.wordpress.com/xmlrpc.php</i>) for Wordpress.com blogs. <br/> Please use <b style="color: #005800;">http://YourUserName.blog.com/xmlrpc.php</b> (replace YourUserName with your user name - for example <i style="color: #005800;">http://nextscripts.blog.com/xmlrpc.php</i> for Blog.com blogs</p>
51
 
52
+ <div style="width:100%;"><br/><strong>Blog Username:</strong> </div><input name="wp[<?php echo $ii; ?>][apWPUName]" id="apWPUName" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($gpo['wpUName'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" />
53
+ <div style="width:100%;"><strong>Blog Password:</strong> </div><input name="wp[<?php echo $ii; ?>][apWPPass]" id="apWPPass" type="password" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities(substr($gpo['wpPass'], 0, 5)=='n5g9a'?nsx_doDecode(substr($gpo['wpPass'], 5)):$gpo['wpPass'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" /> <br/>
54
 
55
  <?php if ($isNew) { ?> <input type="hidden" name="wp[<?php echo $ii; ?>][apDoWP]" value="1" id="apDoNewWP<?php echo $ii; ?>" /> <?php } ?>
56
 
57
  <br/><strong id="altFormatText">Post Title and Post Text Formats</strong>
58
  <p style="font-size: 11px; margin: 0px;">%SITENAME% - Inserts the Your Blog/Site Name. &nbsp; %TITLE% - Inserts the Title of your post. &nbsp; %URL% - Inserts the URL of your post. &nbsp; %TEXT% - Inserts the excerpt of your post. &nbsp; %FULLTEXT% - Inserts the body(text) of your post, %AUTHORNAME% - Inserts the author's name.</p>
59
  <div id="altFormat" style="">
60
+ <div style="width:100%;"><strong id="altFormatText"><?php _e('Post Title Format', 'nxs_snap'); ?></strong>
61
+ </div><input name="wp[<?php echo $ii; ?>][apWPMsgTFrmt]" id="apWPMsgTFrmt" style="width: 50%;" value="<?php if ($isNew) echo "%TITLE%"; else _e(apply_filters('format_to_edit', htmlentities($gpo['wpMsgTFormat'], ENT_COMPAT, "UTF-8")), 'nxs_snap'); ?>" />
62
  </div>
63
  <div id="altFormat" style="">
64
+ <div style="width:100%;"><strong id="altFormatText"><?php _e('Post Text Format', 'nxs_snap'); ?></strong>
65
+ </div><input name="wp[<?php echo $ii; ?>][apWPMsgFrmt]" id="apWPMsgFrmt" style="width: 50%;" value="<?php if ($isNew) echo "%TEXT%"; else _e(apply_filters('format_to_edit', htmlentities($gpo['wpMsgFormat'], ENT_COMPAT, "UTF-8")), 'nxs_snap'); ?>" />
66
  </div><br/>
67
 
68
  <?php if ($gpo['wpPass']!='') { ?>
69
  <?php wp_nonce_field( 'rePostToWP', 'rePostToWP_wpnonce' ); ?>
70
+ <b><?php _e('Test your settings', 'nxs_snap'); ?>:</b>&nbsp;&nbsp;&nbsp; <a href="#" class="NXSButton" onclick="testPost('WP', '<?php echo $ii; ?>'); return false;"><?php printf( __( 'Submit Test Post to %s', 'nxs_snap' ), $nType); ?></a>
71
 
72
  <?php }
73
 
74
+ ?><div class="submit"><input type="submit" class="button-primary" name="update_NS_SNAutoPoster_settings" value="<?php _e('Update Settings', 'nxs_snap') ?>" /></div></div><?php
75
  }
76
  //#### Set Unit Settings from POST
77
  function setNTSettings($post, $options){ global $nxs_snapThisPageUrl; $code = 'WP'; $lcode = 'wp';
95
  }
96
  //#### Show Post->Edit Meta Box Settings
97
  function showEdPostNTSettings($ntOpts, $post){ global $nxs_plurl; $post_id = $post->ID;
98
+ foreach($ntOpts as $ii=>$ntOpt) { $pMeta = maybe_unserialize(get_post_meta($post_id, 'snapWP', true)); if (is_array($pMeta)) $ntOpt = $this->adjMetaOpt($ntOpt, $pMeta[$ii]);
99
+ $doWP = $ntOpt['doWP'] && (is_array($pMeta) || $ntOpt['catSel']!='1');
100
  $isAvailWP = $ntOpt['wpUName']!='' && $ntOpt['wpPass']!=''; $wpMsgFormat = htmlentities($ntOpt['wpMsgFormat'], ENT_COMPAT, "UTF-8"); $wpMsgTFormat = htmlentities($ntOpt['wpMsgTFormat'], ENT_COMPAT, "UTF-8");
101
  ?>
102
  <tr><th style="text-align:left;" colspan="2"><?php if ( $ntOpt['catSel']=='1' && trim($ntOpt['catSelEd'])!='' ) { ?> <input type="hidden" class="nxs_SC" id="nxs_SC_WP<?php echo $ii; ?>" value="<?php echo $ntOpt['catSelEd']; ?>" /> <?php } ?>
103
+ <?php if ($isAvailWP) { ?><input class="nxsGrpDoChb" value="1" id="doWP<?php echo $ii; ?>" <?php if ($post->post_status == "publish") echo 'disabled="disabled"';?> type="checkbox" name="wp[<?php echo $ii; ?>][doWP]" <?php if (($post->post_status == "publish" && $ntOpt['isPosted'] == '1') || ($post->post_status != "publish" && ((int)$doWP == 1)) ) echo 'checked="checked" title="def"'; ?> /> <?php } ?>
104
+ <div class="nsx_iconedTitle" style="display: inline; font-size: 13px; background-image: url(<?php echo $nxs_plurl; ?>img/wp16.png);">WP Blog - <?php _e('publish to', 'nxs_snap') ?> (<i style="color: #005800;"><?php echo $ntOpt['nName']; ?></i>)</div></th> <td><?php //## Only show RePost button if the post is "published"
105
+ if ($post->post_status == "publish" && $isAvailWP) { ?><input alt="<?php echo $ii; ?>" style="float: right;" onmouseout="hidePopShAtt('SV');" onmouseover="showPopShAtt('SV', event);" onclick="return false;" type="button" class="button" name="rePostToWP_repostButton" id="rePostToWP_button" value="<?php _e('Repost to WP Blog', 'nxs_snap') ?>" />
106
  <?php wp_nonce_field( 'rePostToWP', 'rePostToWP_wpnonce' ); } ?>
107
 
108
  <?php if (is_array($pMeta) && is_array($pMeta[$ii]) && isset($pMeta[$ii]['pgID']) ) { $wpURL = str_ireplace('/xmlrpc.php', '', $ntOpt['wpURL']);
109
  if (substr($wpURL, -1)=='/') $wpURL = substr($wpURL, 0, -1); $wpURL = $wpURL."/";
110
  ?> <span id="pstdWP<?php echo $ii; ?>" style="float: right;padding-top: 4px; padding-right: 10px;">
111
+ <a style="font-size: 10px;" href="<?php echo $wpURL; ?>?p=<?php echo $pMeta[$ii]['pgID']; ?>" target="_blank"><?php $nType="Wordpress Blog"; printf( __( 'Posted on', 'nxs_snap' ), $nType); ?> <?php echo (isset($pMeta[$ii]['pDate']) && $pMeta[$ii]['pDate']!='')?(" (".$pMeta[$ii]['pDate'].")"):""; ?></a>
112
  </span><?php } ?>
113
 
114
  </td></tr>
116
  <?php if (!$isAvailWP) { ?><tr><th scope="row" style="text-align:right; width:150px; padding-top: 5px; padding-right:10px;"></th> <td><b>Setup your WP Blog Account to AutoPost to WP Blogs</b>
117
  <?php } elseif ($post->post_status != "puZblish") { ?>
118
 
119
+ <tr id="altFormat1" style=""><th scope="row" style="text-align:right; width:60px; padding-right:10px;"><?php _e('Title Format:', 'nxs_snap') ?></th>
120
  <td><input value="<?php echo $wpMsgTFormat ?>" type="text" name="wp[<?php echo $ii; ?>][SNAPformatT]" style="width:60%;max-width: 610px;" onfocus="jQuery('.nxs_FRMTHint').hide();mxs_showFrmtInfo('apWPTMsgFrmt<?php echo $ii; ?>');"/><?php nxs_doShowHint("apWPTMsgFrmt".$ii); ?></td></tr>
121
 
122
+ <tr id="altFormat1" style=""><th scope="row" style="text-align:right; width:60px; padding-right:10px;"><?php _e('Text Format:', 'nxs_snap') ?></th>
123
  <td><input value="<?php echo $wpMsgFormat ?>" type="text" name="wp[<?php echo $ii; ?>][SNAPformat]" style="width:60%;max-width: 610px;" onfocus="jQuery('.nxs_FRMTHint').hide();mxs_showFrmtInfo('apWPMsgFrmt<?php echo $ii; ?>');"/><?php nxs_doShowHint("apWPMsgFrmt".$ii); ?></td></tr>
124
 
125
  <?php }
129
  function adjMetaOpt($optMt, $pMeta){ if (isset($pMeta['isPosted'])) $optMt['isPosted'] = $pMeta['isPosted']; else $optMt['isPosted'] = '';
130
  if (isset($pMeta['SNAPformat'])) $optMt['wpMsgFormat'] = $pMeta['SNAPformat'];
131
  if (isset($pMeta['SNAPformatT'])) $optMt['wpMsgTFormat'] = $pMeta['SNAPformatT'];
132
+ if (isset($pMeta['doWP'])) $optMt['doWP'] = $pMeta['doWP'] == 1?1:0; else { if (isset($pMeta['SNAPformat'])) $optMt['doWP'] = 0; }
133
+ if (isset($pMeta['SNAPincludeWP']) && $pMeta['SNAPincludeWP'] == '1' ) $optMt['doWP'] = 1;
134
+ return $optMt;
135
  }
136
  }}
137
  if (!function_exists("nxs_rePostToWP_ajax")) {
164
  //## Post
165
  require_once ('apis/xmlrpc-client.php'); $nxsToWPclient = new NXS_XMLRPC_Client($options['wpURL']); $nxsToWPclient->debug = false;
166
  if ($imgURL!=='' && stripos($imgURL, 'http')!==false) {
167
+ // $handle = fopen($imgURL, "rb"); $filedata = ''; while (!feof($handle)) {$filedata .= fread($handle, 8192);} fclose($handle);
168
+ $filedata = wp_remote_get($imgURL); if (! is_wp_error($filedata) ) $filedata = $filedata['body']; // echo "AWC?";
169
  $data = array('name' => 'image-'.$postID.'.jpg', 'type' => 'image/jpg', 'bits' => new NXS_XMLRPC_Base64($filedata), true);
170
  $status = $nxsToWPclient->query('metaWeblog.newMediaObject', $postID, $options['wpUName'], $pass, $data); $imgResp = $nxsToWPclient->getResponse(); $gid = $imgResp['id'];
171
  } else $gid = '';
js/js.js CHANGED
@@ -24,6 +24,11 @@ function getBoards(u,p,ii){ jQuery("#pnLoadingImg"+ii).show();
24
  jQuery("select#apPNBoard"+ii).html(j); jQuery("#pnLoadingImg"+ii).hide();
25
  }, "html")
26
  }
 
 
 
 
 
27
 
28
  //## Select/Unselect Categories
29
  function nxs_chAllCatsL(ch, divID){ jQuery("#"+divID+" input:checkbox[name='post_category[]']").attr('checked', ch==1); }
@@ -111,6 +116,12 @@ function nxsTRURLVal(ii){ var val = jQuery('#apTRURL'+ii).val(); var srch = val.
111
  if (srch>-1) { jQuery('#apTRURL'+ii).css({"background-color":"#FFC0C0"}); jQuery('#apTRURLerr'+ii).html('<br/>Incorrect URL: Please note that URL of your Tumblr Blog should be your public URL. (i.e. like http://nextscripts.tumblr.com/, not http://www.tumblr.com/blog/nextscripts'); } else { jQuery('#apTRURL'+ii).css({"background-color":"#ffffff"}); jQuery('#apTRURLerr'+ii).text(''); }
112
  }
113
 
 
 
 
 
 
 
114
  (function($) {
115
  $(function() {
116
  $('#nxs_snapAddNew').bind('click', function(e) { e.preventDefault(); $('#nxs_spPopup').bPopup({ modalClose: false, appendTo: '#nsStForm', opacity: 0.6, follow: [false, false], position: [65, 50]}); });
24
  jQuery("select#apPNBoard"+ii).html(j); jQuery("#pnLoadingImg"+ii).hide();
25
  }, "html")
26
  }
27
+ function getWLBoards(u,p,ii){ jQuery("#wlLoadingImg"+ii).show();
28
+ jQuery.post(ajaxurl,{u:u,p:p,ii:ii, action: 'getWLBoards', id: 0, _wpnonce: jQuery('input#getWLBoards_wpnonce').val(), ajax: 'true'}, function(j){ var options = '';
29
+ jQuery("select#apWLBoard"+ii).html(j); jQuery("#wlLoadingImg"+ii).hide();
30
+ }, "html")
31
+ }
32
 
33
  //## Select/Unselect Categories
34
  function nxs_chAllCatsL(ch, divID){ jQuery("#"+divID+" input:checkbox[name='post_category[]']").attr('checked', ch==1); }
116
  if (srch>-1) { jQuery('#apTRURL'+ii).css({"background-color":"#FFC0C0"}); jQuery('#apTRURLerr'+ii).html('<br/>Incorrect URL: Please note that URL of your Tumblr Blog should be your public URL. (i.e. like http://nextscripts.tumblr.com/, not http://www.tumblr.com/blog/nextscripts'); } else { jQuery('#apTRURL'+ii).css({"background-color":"#ffffff"}); jQuery('#apTRURLerr'+ii).text(''); }
117
  }
118
 
119
+ function nxs_hideTip(id){
120
+ jQuery.post(ajaxurl,{action: 'nxs_hideTip', id: id, _wpnonce: jQuery('input#nxsSsPageWPN_wpnonce').val(), ajax: 'true'}, function(j){ var options = '';
121
+ jQuery('#'+id).hide();
122
+ }, "html")
123
+ }
124
+
125
  (function($) {
126
  $(function() {
127
  $('#nxs_snapAddNew').bind('click', function(e) { e.preventDefault(); $('#nxs_spPopup').bPopup({ modalClose: false, appendTo: '#nsStForm', opacity: 0.6, follow: [false, false], position: [65, 50]}); });
lang/nxs_snap-ru_RU.po ADDED
@@ -0,0 +1,724 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2013 NextScripts: Social Networks Auto-Poster
2
+ # This file is distributed under the same license as the NextScripts: Social Networks Auto-Poster package.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: NextScripts: Social Networks Auto-Poster 2.6.0\n"
6
+ "Report-Msgid-Bugs-To: http://wordpress.org/tag/social-networks-auto-poster-"
7
+ "facebook-twitter-g\n"
8
+ "POT-Creation-Date: 2013-01-24 19:11:08+00:00\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "PO-Revision-Date: 2013-MO-DA HO:MI+ZONE\n"
13
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
+ "Language-Team: LANGUAGE <LL@li.org>\n"
15
+
16
+ #: inc-cl/bg.php:12 inc-cl/di.php:13 inc-cl/dl.php:12 inc-cl/fb.php:44
17
+ #: inc-cl/gp.php:12 inc-cl/li.php:61 inc-cl/lj.php:12 inc-cl/pk.php:50
18
+ #: inc-cl/pn.php:12 inc-cl/su.php:12 inc-cl/tr.php:40 inc-cl/tw.php:12
19
+ #: inc-cl/vb.php:12 inc-cl/vk.php:12 inc-cl/wp.php:12
20
+ msgid "accounts"
21
+ msgstr ""
22
+
23
+ #: inc-cl/bg.php:19 inc-cl/di.php:20 inc-cl/dl.php:19 inc-cl/fb.php:52
24
+ #: inc-cl/gp.php:20 inc-cl/li.php:70 inc-cl/lj.php:19 inc-cl/pk.php:58
25
+ #: inc-cl/pn.php:20 inc-cl/su.php:19 inc-cl/tr.php:48 inc-cl/tw.php:19
26
+ #: inc-cl/vb.php:19 inc-cl/vk.php:19 inc-cl/wp.php:19
27
+ msgid "Auto-publish to"
28
+ msgstr ""
29
+
30
+ #: inc-cl/bg.php:20 inc-cl/di.php:21 inc-cl/dl.php:20 inc-cl/fb.php:53
31
+ #: inc-cl/gp.php:21 inc-cl/li.php:71 inc-cl/lj.php:20 inc-cl/pk.php:59
32
+ #: inc-cl/pn.php:21 inc-cl/su.php:20 inc-cl/tr.php:49 inc-cl/tw.php:20
33
+ #: inc-cl/vb.php:20 inc-cl/vk.php:20 inc-cl/wp.php:20
34
+ msgid "Attention requred. Unfinished setup"
35
+ msgstr ""
36
+
37
+ #: inc-cl/bg.php:20 inc-cl/di.php:21 inc-cl/dl.php:20 inc-cl/fb.php:53
38
+ #: inc-cl/gp.php:21 inc-cl/li.php:71 inc-cl/lj.php:20 inc-cl/pk.php:59
39
+ #: inc-cl/pn.php:21 inc-cl/su.php:20 inc-cl/tr.php:49 inc-cl/tw.php:20
40
+ #: inc-cl/vb.php:20 inc-cl/vk.php:20 inc-cl/wp.php:20
41
+ msgid "Show Settings"
42
+ msgstr ""
43
+
44
+ #: inc-cl/bg.php:21 inc-cl/di.php:22 inc-cl/dl.php:21 inc-cl/fb.php:54
45
+ #: inc-cl/gp.php:22 inc-cl/li.php:72 inc-cl/lj.php:21 inc-cl/pk.php:60
46
+ #: inc-cl/pn.php:22 inc-cl/su.php:21 inc-cl/tr.php:50 inc-cl/tw.php:21
47
+ #: inc-cl/vb.php:21 inc-cl/vk.php:21 inc-cl/wp.php:21
48
+ msgid "Remove Account"
49
+ msgstr ""
50
+
51
+ #: inc-cl/bg.php:36 inc-cl/di.php:36 inc-cl/dl.php:33 inc-cl/fb.php:70
52
+ #: inc-cl/gp.php:37 inc-cl/li.php:86 inc-cl/lj.php:33 inc-cl/pk.php:73
53
+ #: inc-cl/pn.php:41 inc-cl/su.php:35 inc-cl/tr.php:63 inc-cl/tw.php:33
54
+ #: inc-cl/vb.php:35 inc-cl/vk.php:35 inc-cl/wp.php:33
55
+ msgid "Detailed %s Installation/Configuration Instructions"
56
+ msgstr ""
57
+
58
+ #: inc-cl/bg.php:38 inc-cl/di.php:38 inc-cl/dl.php:35 inc-cl/fb.php:75
59
+ #: inc-cl/gp.php:39 inc-cl/li.php:88 inc-cl/lj.php:36 inc-cl/pk.php:75
60
+ #: inc-cl/pn.php:42 inc-cl/su.php:37 inc-cl/tr.php:65 inc-cl/tw.php:35
61
+ #: inc-cl/vb.php:37 inc-cl/vk.php:40 inc-cl/wp.php:37
62
+ msgid "Account Nickname"
63
+ msgstr ""
64
+
65
+ #: inc-cl/bg.php:38 inc-cl/di.php:38 inc-cl/dl.php:35 inc-cl/fb.php:75
66
+ #: inc-cl/gp.php:39 inc-cl/li.php:88 inc-cl/lj.php:36 inc-cl/pk.php:75
67
+ #: inc-cl/pn.php:42 inc-cl/su.php:37 inc-cl/tr.php:65 inc-cl/tw.php:35
68
+ #: inc-cl/vb.php:37 inc-cl/vk.php:40 inc-cl/wp.php:37
69
+ msgid "Just so you can easely identify it"
70
+ msgstr ""
71
+
72
+ #: inc-cl/bg.php:43 inc-cl/di.php:43 inc-cl/dl.php:39 inc-cl/fb.php:80
73
+ #: inc-cl/gp.php:43 inc-cl/li.php:92 inc-cl/lj.php:40 inc-cl/pk.php:79
74
+ #: inc-cl/pn.php:46 inc-cl/su.php:41 inc-cl/tr.php:69 inc-cl/tw.php:39
75
+ #: inc-cl/vb.php:41 inc-cl/vk.php:45 inc-cl/wp.php:41
76
+ msgid "Categories"
77
+ msgstr ""
78
+
79
+ #: inc-cl/bg.php:47 inc-cl/di.php:47 inc-cl/dl.php:43 inc-cl/fb.php:84
80
+ #: inc-cl/gp.php:47 inc-cl/li.php:96 inc-cl/lj.php:44 inc-cl/pk.php:83
81
+ #: inc-cl/pn.php:50 inc-cl/su.php:45 inc-cl/tr.php:73 inc-cl/tw.php:43
82
+ #: inc-cl/vb.php:45 inc-cl/vk.php:49 inc-cl/wp.php:45
83
+ msgid "Only selected categories will be autoposted to this account"
84
+ msgstr ""
85
+
86
+ #: inc-cl/bg.php:55
87
+ msgid ""
88
+ "Log to your Blogger management panel and look at the URL of your blog: "
89
+ "http://www.blogger.com/blogger.g?blogID=8959085979163812093#allposts. Your "
90
+ "Blog ID will be: 8959085979163812093"
91
+ msgstr ""
92
+
93
+ #: inc-cl/bg.php:59 inc-cl/di.php:64 inc-cl/dl.php:54 inc-cl/lj.php:53
94
+ #: inc-cl/tr.php:87 inc-cl/vb.php:68 inc-cl/wp.php:60
95
+ msgid "Post Title Format"
96
+ msgstr ""
97
+
98
+ #: inc-cl/bg.php:59 inc-cl/bg.php:64 inc-cl/di.php:64 inc-cl/di.php:69
99
+ #: inc-cl/dl.php:54 inc-cl/dl.php:60 inc-cl/fb.php:94 inc-cl/gp.php:63
100
+ #: inc-cl/lj.php:53 inc-cl/lj.php:57 inc-cl/pk.php:105 inc-cl/pn.php:76
101
+ #: inc-cl/su.php:72 inc-cl/tr.php:87 inc-cl/tr.php:115 inc-cl/vb.php:68
102
+ #: inc-cl/vb.php:73 inc-cl/vk.php:89
103
+ msgid "Show format info"
104
+ msgstr ""
105
+
106
+ #: inc-cl/bg.php:64 inc-cl/di.php:69 inc-cl/dl.php:60 inc-cl/lj.php:57
107
+ #: inc-cl/pk.php:105 inc-cl/su.php:72 inc-cl/tr.php:115 inc-cl/vb.php:73
108
+ #: inc-cl/wp.php:64
109
+ msgid "Post Text Format"
110
+ msgstr ""
111
+
112
+ #: inc-cl/bg.php:72 inc-cl/di.php:60
113
+ msgid "Post with tags"
114
+ msgstr ""
115
+
116
+ #: inc-cl/bg.php:72
117
+ msgid "Tags from the blogpost will be auto-posted to Blogger/Blogspot"
118
+ msgstr ""
119
+
120
+ #: inc-cl/bg.php:77 inc-cl/di.php:75 inc-cl/dl.php:66 inc-cl/fb.php:144
121
+ #: inc-cl/gp.php:81 inc-cl/li.php:168 inc-cl/lj.php:63 inc-cl/pk.php:123
122
+ #: inc-cl/pn.php:84 inc-cl/su.php:78 inc-cl/tr.php:138 inc-cl/tw.php:63
123
+ #: inc-cl/vb.php:79 inc-cl/vk.php:123 inc-cl/wp.php:70
124
+ msgid "Test your settings"
125
+ msgstr ""
126
+
127
+ #: inc-cl/bg.php:77
128
+ msgid "Submit Test Post to Complete"
129
+ msgstr ""
130
+
131
+ #: inc-cl/bg.php:77 inc-cl/di.php:75 inc-cl/dl.php:66 inc-cl/fb.php:144
132
+ #: inc-cl/gp.php:81 inc-cl/li.php:168 inc-cl/lj.php:63 inc-cl/pk.php:123
133
+ #: inc-cl/pn.php:84 inc-cl/su.php:78 inc-cl/tr.php:138 inc-cl/tw.php:63
134
+ #: inc-cl/vb.php:79 inc-cl/vk.php:123 inc-cl/wp.php:70
135
+ msgid "Submit Test Post to %s"
136
+ msgstr ""
137
+
138
+ #: inc-cl/bg.php:80 inc-cl/di.php:76 inc-cl/dl.php:70 inc-cl/fb.php:146
139
+ #: inc-cl/gp.php:82 inc-cl/li.php:173 inc-cl/lj.php:67 inc-cl/pk.php:125
140
+ #: inc-cl/pn.php:87 inc-cl/su.php:82 inc-cl/tr.php:140 inc-cl/tw.php:65
141
+ #: inc-cl/vb.php:83 inc-cl/vk.php:125 inc-cl/wp.php:74
142
+ #: social-networks-auto-poster-facebook-twitter-g.php:227
143
+ #: social-networks-auto-poster-facebook-twitter-g.php:380
144
+ msgid "Update Settings"
145
+ msgstr ""
146
+
147
+ #: inc-cl/bg.php:119 inc-cl/di.php:107 inc-cl/dl.php:99 inc-cl/fb.php:195
148
+ #: inc-cl/gp.php:117 inc-cl/li.php:212 inc-cl/lj.php:95 inc-cl/pk.php:166
149
+ #: inc-cl/pn.php:119 inc-cl/su.php:113 inc-cl/tr.php:184 inc-cl/tw.php:98
150
+ #: inc-cl/vb.php:115 inc-cl/vk.php:185 inc-cl/wp.php:103
151
+ msgid "publish to"
152
+ msgstr ""
153
+
154
+ #: inc-cl/bg.php:121
155
+ msgid "Repost to Blogger"
156
+ msgstr ""
157
+
158
+ #: inc-cl/bg.php:126 inc-cl/di.php:112 inc-cl/dl.php:105 inc-cl/fb.php:202
159
+ #: inc-cl/gp.php:124 inc-cl/li.php:218 inc-cl/lj.php:101 inc-cl/pk.php:172
160
+ #: inc-cl/pn.php:125 inc-cl/su.php:120 inc-cl/tr.php:190 inc-cl/tw.php:103
161
+ #: inc-cl/vb.php:122 inc-cl/vk.php:191 inc-cl/wp.php:110
162
+ msgid "Posted on"
163
+ msgstr ""
164
+
165
+ #: inc-cl/bg.php:130
166
+ msgid "Setup your Blogger Account to AutoPost to Blogger"
167
+ msgstr ""
168
+
169
+ #: inc-cl/bg.php:132 inc-cl/di.php:117 inc-cl/dl.php:113 inc-cl/lj.php:109
170
+ #: inc-cl/wp.php:118
171
+ msgid "Title Format:"
172
+ msgstr ""
173
+
174
+ #: inc-cl/bg.php:134 inc-cl/fb.php:232 inc-cl/gp.php:141 inc-cl/li.php:229
175
+ #: inc-cl/tw.php:109 inc-cl/vk.php:197
176
+ msgid "Message Format:"
177
+ msgstr ""
178
+
179
+ #: inc-cl/di.php:60
180
+ msgid "Tags from the blogpost will be auto posted to Diigo"
181
+ msgstr ""
182
+
183
+ #: inc-cl/di.php:108
184
+ msgid "Repost to Diigo"
185
+ msgstr ""
186
+
187
+ #: inc-cl/di.php:119 inc-cl/dl.php:116 inc-cl/lj.php:112 inc-cl/pk.php:190
188
+ #: inc-cl/su.php:138 inc-cl/tr.php:211 inc-cl/vb.php:130 inc-cl/vb.php:133
189
+ #: inc-cl/wp.php:121
190
+ msgid "Text Format:"
191
+ msgstr ""
192
+
193
+ #: inc-cl/dl.php:100
194
+ msgid "Repost to Delicious"
195
+ msgstr ""
196
+
197
+ #: inc-cl/fb.php:89
198
+ msgid "Could be your Facebook Profile, Facebook Page, Facebook Group"
199
+ msgstr ""
200
+
201
+ #: inc-cl/fb.php:94 inc-cl/gp.php:63 inc-cl/li.php:159 inc-cl/pn.php:76
202
+ #: inc-cl/tw.php:56 inc-cl/vk.php:89
203
+ msgid "Message text Format"
204
+ msgstr ""
205
+
206
+ #: inc-cl/fb.php:98 inc-cl/fb.php:107 inc-cl/fb.php:115 inc-cl/fb.php:217
207
+ #: inc-cl/fb.php:221 inc-cl/gp.php:67 inc-cl/gp.php:133 inc-cl/vk.php:96
208
+ #: inc-cl/vk.php:204
209
+ msgid "What's the difference?"
210
+ msgstr ""
211
+
212
+ #: inc-cl/fb.php:101 inc-cl/fb.php:219 inc-cl/gp.php:73 inc-cl/vk.php:99
213
+ #: inc-cl/vk.php:205
214
+ msgid "Text Post"
215
+ msgstr ""
216
+
217
+ #: inc-cl/fb.php:101 inc-cl/fb.php:219 inc-cl/gp.php:73 inc-cl/gp.php:136
218
+ #: inc-cl/vk.php:99 inc-cl/vk.php:205
219
+ msgid "just text message"
220
+ msgstr ""
221
+
222
+ #: inc-cl/fb.php:103 inc-cl/fb.php:220 inc-cl/vk.php:206
223
+ msgid "Image Post"
224
+ msgstr ""
225
+
226
+ #: inc-cl/fb.php:103 inc-cl/fb.php:220 inc-cl/gp.php:74 inc-cl/gp.php:137
227
+ #: inc-cl/vk.php:100 inc-cl/vk.php:206
228
+ msgid "big image with text message"
229
+ msgstr ""
230
+
231
+ #: inc-cl/fb.php:104
232
+ msgid "Upload Images to"
233
+ msgstr ""
234
+
235
+ #: inc-cl/fb.php:105
236
+ msgid "App Album"
237
+ msgstr ""
238
+
239
+ #: inc-cl/fb.php:105 inc-cl/fb.php:113 inc-cl/fb.php:224
240
+ msgid "or"
241
+ msgstr ""
242
+
243
+ #: inc-cl/fb.php:107
244
+ msgid "Timeline"
245
+ msgstr ""
246
+
247
+ #: inc-cl/fb.php:110 inc-cl/vk.php:101
248
+ msgid "Text Post with \"attached\" link"
249
+ msgstr ""
250
+
251
+ #: inc-cl/fb.php:112
252
+ msgid "Link attachment type"
253
+ msgstr ""
254
+
255
+ #: inc-cl/fb.php:113 inc-cl/fb.php:224
256
+ msgid "Share a link to your blogpost"
257
+ msgstr ""
258
+
259
+ #: inc-cl/fb.php:115 inc-cl/fb.php:226
260
+ msgid "Attach your blogpost"
261
+ msgstr ""
262
+
263
+ #: inc-cl/fb.php:116
264
+ msgid "If post has video use it as an attachment thumbnail."
265
+ msgstr ""
266
+
267
+ #: inc-cl/fb.php:116
268
+ msgid ""
269
+ "Video will be used for an attachment thumbnail instead of featured image. "
270
+ "Only Youtube is supported at this time."
271
+ msgstr ""
272
+
273
+ #: inc-cl/fb.php:118
274
+ msgid "Attachment Text Format"
275
+ msgstr ""
276
+
277
+ #: inc-cl/fb.php:119 inc-cl/vk.php:109
278
+ msgid "Auto"
279
+ msgstr ""
280
+
281
+ #: inc-cl/fb.php:120 inc-cl/vk.php:110
282
+ msgid ""
283
+ "Recommended. Info from SEO Plugins will be used, then post excerpt, then "
284
+ "post text"
285
+ msgstr ""
286
+
287
+ #: inc-cl/fb.php:121
288
+ msgid "Set your own format"
289
+ msgstr ""
290
+
291
+ #: inc-cl/fb.php:125
292
+ msgid "Where to upload Images"
293
+ msgstr ""
294
+
295
+ #: inc-cl/fb.php:125
296
+ msgid "(App Album)"
297
+ msgstr ""
298
+
299
+ #: inc-cl/fb.php:125
300
+ msgid ""
301
+ "Facebook automatically creates an album for your app. Images will be grouped "
302
+ "there as in any regular album."
303
+ msgstr ""
304
+
305
+ #: inc-cl/fb.php:125
306
+ msgid "(Timeline)"
307
+ msgstr ""
308
+
309
+ #: inc-cl/fb.php:125
310
+ msgid ""
311
+ "Images will be posted to the special \"Wall/Timeline\" album and won't be "
312
+ "grouped. \"Wall/Timeline\" album must exist. It's created when first image "
313
+ "posted to timeline manually."
314
+ msgstr ""
315
+
316
+ #: inc-cl/fb.php:126 inc-cl/fb.php:228
317
+ msgid "Two ways of attaching post on Facebook"
318
+ msgstr ""
319
+
320
+ #: inc-cl/fb.php:127 inc-cl/fb.php:229
321
+ msgid "Facebook Post Types"
322
+ msgstr ""
323
+
324
+ #: inc-cl/fb.php:133
325
+ msgid "Authorize Your Facebook Account"
326
+ msgstr ""
327
+
328
+ #: inc-cl/fb.php:133
329
+ msgid "Please click \"Update Settings\" to be able to Authorize your account."
330
+ msgstr ""
331
+
332
+ #: inc-cl/fb.php:135
333
+ msgid "Your Facebook Account has been authorized."
334
+ msgstr ""
335
+
336
+ #: inc-cl/fb.php:136 inc-cl/vk.php:68
337
+ msgid "You can"
338
+ msgstr ""
339
+
340
+ #: inc-cl/fb.php:138 inc-cl/vk.php:71
341
+ msgid "Authorize your account"
342
+ msgstr ""
343
+
344
+ #: inc-cl/fb.php:139
345
+ msgid "If you get Facebook message:"
346
+ msgstr ""
347
+
348
+ #: inc-cl/fb.php:139
349
+ msgid ""
350
+ "please make sure that domain name in your Facebook App matches your website "
351
+ "domain exactly. Please note that www. and non www. versions are different "
352
+ "domains."
353
+ msgstr ""
354
+
355
+ #: inc-cl/fb.php:196
356
+ msgid "Repost to Facebook"
357
+ msgstr ""
358
+
359
+ #: inc-cl/fb.php:216 inc-cl/vk.php:203
360
+ msgid "Post Type:"
361
+ msgstr ""
362
+
363
+ #: inc-cl/fb.php:221 inc-cl/gp.php:138 inc-cl/vk.php:208
364
+ msgid "Text Post with \"attached\" blogpost"
365
+ msgstr ""
366
+
367
+ #: inc-cl/fb.php:223 inc-cl/vk.php:103
368
+ msgid "Link attachment type:"
369
+ msgstr ""
370
+
371
+ #: inc-cl/fb.php:327
372
+ msgid "OK - Message Posted, please see your Facebook Page"
373
+ msgstr ""
374
+
375
+ #: inc-cl/gp.php:34
376
+ msgid "Google+ API Library not found"
377
+ msgstr ""
378
+
379
+ #: inc-cl/gp.php:35
380
+ msgid "Google+ doesn't have a built-in API for automated posts yet."
381
+ msgstr ""
382
+
383
+ #: inc-cl/gp.php:35
384
+ msgid ""
385
+ "The current <a target=\"_blank\" href=\"http://developers.google.com/+/api/"
386
+ "\">Google+ API</a> is \"Read Only\" and can't be used for posting. <br/><br/"
387
+ ">You need to get a special <a target=\"_blank\" href=\"http://www."
388
+ "nextscripts.com/google-plus-automated-posting\"><b>API Library Module</b></"
389
+ "a> to be able to publish your content to Google+."
390
+ msgstr ""
391
+
392
+ #: inc-cl/gp.php:53
393
+ msgid "Leave Empty to publish to your profile or community"
394
+ msgstr ""
395
+
396
+ #: inc-cl/gp.php:54
397
+ msgid "Leave Empty to publish to your profile or community."
398
+ msgstr ""
399
+
400
+ #: inc-cl/gp.php:57 inc-cl/gp.php:58
401
+ msgid "Leave Empty to publish to your profile or page"
402
+ msgstr ""
403
+
404
+ #: inc-cl/gp.php:74
405
+ msgid "Google+ Image Post"
406
+ msgstr ""
407
+
408
+ #: inc-cl/gp.php:75
409
+ msgid "Add blogpost to Google+ message as an attachment"
410
+ msgstr ""
411
+
412
+ #: inc-cl/gp.php:76 inc-cl/gp.php:139
413
+ msgid "Google+ Post Types"
414
+ msgstr ""
415
+
416
+ #: inc-cl/gp.php:118 inc-cl/gp.php:132 inc-cl/gp.php:136
417
+ msgid "Repost to Google+"
418
+ msgstr ""
419
+
420
+ #: inc-cl/gp.php:137
421
+ msgid "Post to Google+ as \"Image post\""
422
+ msgstr ""
423
+
424
+ #: inc-cl/gp.php:186
425
+ msgid "OK - Message Posted, please see your Google+ Page"
426
+ msgstr ""
427
+
428
+ #: inc-cl/li.php:213
429
+ msgid "Repost to LinkedIn"
430
+ msgstr ""
431
+
432
+ #: inc-cl/lj.php:34
433
+ msgid "You can setup LiveJournal blog."
434
+ msgstr ""
435
+
436
+ #: inc-cl/lj.php:51
437
+ msgid "Post Title and Post Text Formats"
438
+ msgstr ""
439
+
440
+ #: inc-cl/lj.php:96
441
+ msgid "Repost to LiveJournal"
442
+ msgstr ""
443
+
444
+ #: inc-cl/pk.php:167
445
+ msgid "Repost to Plurk"
446
+ msgstr ""
447
+
448
+ #: inc-cl/pn.php:120
449
+ msgid "Repost to Pinterest"
450
+ msgstr ""
451
+
452
+ #: inc-cl/pn.php:142
453
+ msgid "Text Message Format:"
454
+ msgstr ""
455
+
456
+ #: inc-cl/su.php:114
457
+ msgid "Repost to StumbleUpon"
458
+ msgstr ""
459
+
460
+ #: inc-cl/tr.php:185
461
+ msgid "Repost to Tumblr"
462
+ msgstr ""
463
+
464
+ #: inc-cl/tr.php:200
465
+ msgid "Text Post. Title Format:"
466
+ msgstr ""
467
+
468
+ #: inc-cl/tw.php:100
469
+ msgid "Repost to Twitter"
470
+ msgstr ""
471
+
472
+ #: inc-cl/vb.php:116
473
+ msgid "Repost to vBulletin"
474
+ msgstr ""
475
+
476
+ #: inc-cl/vk.php:54
477
+ msgid "Could be your vKontakte(VK) Profile or vKontakte(VK) Group Page"
478
+ msgstr ""
479
+
480
+ #: inc-cl/vk.php:57
481
+ msgid "(It could be used for \"Text\" and \"Image\" posts)"
482
+ msgstr ""
483
+
484
+ #: inc-cl/vk.php:61
485
+ msgid "[Create VK App]"
486
+ msgstr ""
487
+
488
+ #: inc-cl/vk.php:61
489
+ msgid "[Manage VK Apps]"
490
+ msgstr ""
491
+
492
+ #: inc-cl/vk.php:65
493
+ msgid ""
494
+ "<b>Authorize Your vKontakte(VK) Account</b>. Please click \"Update Settings"
495
+ "\" to be able to Authorize your account."
496
+ msgstr ""
497
+
498
+ #: inc-cl/vk.php:67
499
+ msgid "Your vKontakte(VK) Account has been authorized."
500
+ msgstr ""
501
+
502
+ #: inc-cl/vk.php:79
503
+ msgid "(It could be used for \"Text with attached link\" posts)"
504
+ msgstr ""
505
+
506
+ #: inc-cl/vk.php:85
507
+ msgid "Please upgrade the plugin to \"PRO\" get NextScripts VK API"
508
+ msgstr ""
509
+
510
+ #: inc-cl/vk.php:93 inc-cl/vk.php:200
511
+ msgid "Add backlink to the post"
512
+ msgstr ""
513
+
514
+ #: inc-cl/vk.php:100
515
+ msgid "mage Post"
516
+ msgstr ""
517
+
518
+ #: inc-cl/vk.php:105
519
+ msgid ""
520
+ "<strong>If post has video use it as an attachment thumbnail.</strong> "
521
+ "<i>Video will be used for an attachment thumbnail instead of featured image. "
522
+ "Only Youtube is supported at this time.</i>"
523
+ msgstr ""
524
+
525
+ #: inc-cl/vk.php:108
526
+ msgid "Attachment Text Format:"
527
+ msgstr ""
528
+
529
+ #: inc-cl/vk.php:111
530
+ msgid "Set your own format:"
531
+ msgstr ""
532
+
533
+ #: inc-cl/vk.php:188
534
+ msgid "Repost to vKontakte(VK)"
535
+ msgstr ""
536
+
537
+ #: inc-cl/vk.php:209
538
+ msgid "Post Types"
539
+ msgstr ""
540
+
541
+ #: inc-cl/wp.php:104
542
+ msgid "Repost to WP Blog"
543
+ msgstr ""
544
+
545
+ #: nxs_functions.php:156
546
+ msgid "Wrong key, please contact support"
547
+ msgstr ""
548
+
549
+ #: nxs_functions.php:243
550
+ msgid "Inserts the Your Blog/Site Name"
551
+ msgstr ""
552
+
553
+ #: nxs_functions.php:243
554
+ msgid "Inserts the Title of your post"
555
+ msgstr ""
556
+
557
+ #: nxs_functions.php:243
558
+ msgid "Inserts the URL of your post"
559
+ msgstr ""
560
+
561
+ #: nxs_functions.php:243
562
+ msgid "Inserts the <b>Shortened URL</b> of your post"
563
+ msgstr ""
564
+
565
+ #: nxs_functions.php:243
566
+ msgid "Inserts the featured image"
567
+ msgstr ""
568
+
569
+ #: nxs_functions.php:243
570
+ msgid "Inserts the excerpt of your post"
571
+ msgstr ""
572
+
573
+ #: nxs_functions.php:243
574
+ msgid "Inserts the body(text) as typed"
575
+ msgstr ""
576
+
577
+ #: nxs_functions.php:243
578
+ msgid "Inserts the processed body(text) of your post"
579
+ msgstr ""
580
+
581
+ #: nxs_functions.php:243
582
+ msgid "Inserts the author's name"
583
+ msgstr ""
584
+
585
+ #: nxs_functions.php:247
586
+ msgid ""
587
+ "You already have %s configured. This plugin supports only one %s account. "
588
+ "<br/><br/> Please consider getting <a target=\"_blank\" href=\"http://www."
589
+ "nextscripts.com/social-networks-auto-poster-for-wp-multiple-accounts"
590
+ "\">Multiple Accounts Edition</a> if you would like to add another %s account "
591
+ "for auto-posting."
592
+ msgstr ""
593
+
594
+ #: social-networks-auto-poster-facebook-twitter-g.php:163
595
+ msgid "Settings Updated."
596
+ msgstr ""
597
+
598
+ #: social-networks-auto-poster-facebook-twitter-g.php:223
599
+ msgid "Export Settings"
600
+ msgstr ""
601
+
602
+ #: social-networks-auto-poster-facebook-twitter-g.php:224
603
+ msgid "Import Settings"
604
+ msgstr ""
605
+
606
+ #: social-networks-auto-poster-facebook-twitter-g.php:520
607
+ msgid "Contact support"
608
+ msgstr ""
609
+
610
+ #: social-networks-auto-poster-facebook-twitter-g.php:521
611
+ msgid ""
612
+ "Ready to to Upgrade to Multiple Accounts Edition<br/> and get Google+ and "
613
+ "Pinterest Auto-Posting?"
614
+ msgstr ""
615
+
616
+ #: social-networks-auto-poster-facebook-twitter-g.php:522
617
+ msgid "Enter your Activation Key"
618
+ msgstr ""
619
+
620
+ #: social-networks-auto-poster-facebook-twitter-g.php:523
621
+ msgid "Get It here"
622
+ msgstr ""
623
+
624
+ #: social-networks-auto-poster-facebook-twitter-g.php:525
625
+ msgid "Activation"
626
+ msgstr ""
627
+
628
+ #: social-networks-auto-poster-facebook-twitter-g.php:527
629
+ msgid "Multiple Accounts Edition and Google+ and Pinterest Auto-Posting"
630
+ msgstr ""
631
+
632
+ #: social-networks-auto-poster-facebook-twitter-g.php:527
633
+ msgid "You can find your key on this page"
634
+ msgstr ""
635
+
636
+ #: social-networks-auto-poster-facebook-twitter-g.php:528
637
+ msgid "Enter your Key"
638
+ msgstr ""
639
+
640
+ #: social-networks-auto-poster-facebook-twitter-g.php:530
641
+ msgid "Your plugin will be automatically upgraded"
642
+ msgstr ""
643
+
644
+ #: social-networks-auto-poster-facebook-twitter-g.php:535
645
+ msgid "Next Scripts: Social Networks Auto Poster Options"
646
+ msgstr ""
647
+
648
+ #: social-networks-auto-poster-facebook-twitter-g.php:535
649
+ msgid "Plugin Version"
650
+ msgstr ""
651
+
652
+ #: social-networks-auto-poster-facebook-twitter-g.php:538
653
+ msgid "Get"
654
+ msgstr ""
655
+
656
+ #: social-networks-auto-poster-facebook-twitter-g.php:540
657
+ msgid "Here you can setup \"Social Networks Auto Poster\"."
658
+ msgstr ""
659
+
660
+ #: social-networks-auto-poster-facebook-twitter-g.php:540
661
+ msgid ""
662
+ "You can start by clicking \"Add new account\" button and choosing the Social "
663
+ "Network you would like to add."
664
+ msgstr ""
665
+
666
+ #: social-networks-auto-poster-facebook-twitter-g.php:553
667
+ msgid "You have Google Analytics Plugin installed and activated."
668
+ msgstr ""
669
+
670
+ #: social-networks-auto-poster-facebook-twitter-g.php:553
671
+ msgid "This plugin hijacks the authorization workflow."
672
+ msgstr ""
673
+
674
+ #: social-networks-auto-poster-facebook-twitter-g.php:554
675
+ msgid ""
676
+ "Please temporary <a href=\"%s\">deactivate</a> Google Analytics plugin, do "
677
+ "all authorizations and then activate it back."
678
+ msgstr ""
679
+
680
+ #: social-networks-auto-poster-facebook-twitter-g.php:585
681
+ msgid ""
682
+ "If you made any changes to the format, please \"Update\" the post before "
683
+ "reposting, "
684
+ msgstr ""
685
+
686
+ #: social-networks-auto-poster-facebook-twitter-g.php:588
687
+ msgid "Check All"
688
+ msgstr ""
689
+
690
+ #: social-networks-auto-poster-facebook-twitter-g.php:588
691
+ msgid "Uncheck All"
692
+ msgstr ""
693
+
694
+ #: social-networks-auto-poster-facebook-twitter-g.php:598
695
+ #: social-networks-auto-poster-facebook-twitter-g.php:601
696
+ #: social-networks-auto-poster-facebook-twitter-g.php:606
697
+ msgid "NextScripts: Social Networks Auto Poster - Post Options"
698
+ msgstr ""
699
+
700
+ #: social-networks-auto-poster-facebook-twitter-g.php:692
701
+ msgid "Settings"
702
+ msgstr ""
703
+
704
+ #. Plugin Name of the plugin/theme
705
+ msgid "NextScripts: Social Networks Auto-Poster"
706
+ msgstr ""
707
+
708
+ #. Plugin URI of the plugin/theme
709
+ msgid "http://www.nextscripts.com/social-networks-auto-poster-for-wordpress"
710
+ msgstr ""
711
+
712
+ #. Description of the plugin/theme
713
+ msgid ""
714
+ "This plugin automatically publishes posts from your blog to multiple "
715
+ "accounts on Facebook, Twitter, and Google+ profiles and/or pages."
716
+ msgstr ""
717
+
718
+ #. Author of the plugin/theme
719
+ msgid "Next Scripts"
720
+ msgstr ""
721
+
722
+ #. Author URI of the plugin/theme
723
+ msgid "http://www.nextscripts.com"
724
+ msgstr ""
nxs_functions.php CHANGED
@@ -74,6 +74,7 @@ if (!function_exists('nxs_chckRmImage')){function nxs_chckRmImage($url, $chType=
74
  }
75
  }}
76
  if (!function_exists('nxs_getPostImage')){ function nxs_getPostImage($postID, $size='large', $def='') { $imgURL = ''; global $plgn_NS_SNAutoPoster; if (!isset($plgn_NS_SNAutoPoster)) return; $options = $plgn_NS_SNAutoPoster->nxs_options;
 
77
  if (isset($options['featImgLoc']) && $options['featImgLoc']!=='') { $imgURL = trim(get_post_meta($postID, $options['featImgLocPrefix'], true)).trim(get_post_meta($postID, $options['featImgLoc'], true));
78
  if ($imgURL!='' && stripos($imgURL, 'http')===false) $imgURL = home_url().$imgURL;
79
  }
@@ -91,7 +92,17 @@ if (!function_exists('nxs_getPostImage')){ function nxs_getPostImage($postID, $s
91
 
92
  return $imgURL;
93
  }}
94
-
 
 
 
 
 
 
 
 
 
 
95
  //## CSS && JS
96
  if (!function_exists("jsPostToSNAP")) { function jsPostToSNAP() { global $nxs_snapAvNts, $nxs_plurl; ?>
97
  <script type="text/javascript" >
@@ -99,6 +110,9 @@ if (!function_exists("jsPostToSNAP")) { function jsPostToSNAP() { global $nxs_s
99
  <?php
100
  foreach ($nxs_snapAvNts as $avNt) {?>
101
  $('input#rePostTo<?php echo $avNt['code']; ?>_button').click(function() { var data = { action: 'rePostTo<?php echo $avNt['code']; ?>', id: $('input#post_ID').val(), nid:$(this).attr('alt'), _wpnonce: $('input#rePostTo<?php echo $avNt['code']; ?>_wpnonce').val()}; callAjSNAP(data, '<?php echo $avNt['name']; ?>'); });
 
 
 
102
  <?php } ?>
103
  function callAjSNAP(data, label) {
104
  var style = "position: fixed; display: none; z-index: 1000; top: 50%; left: 50%; background-color: #E8E8E8; border: 1px solid #555; padding: 15px; width: 350px; min-height: 80px; margin-left: -175px; margin-top: -40px; text-align: center; vertical-align: middle;";
@@ -143,7 +157,7 @@ if (!function_exists("nxs_jsPostToSNAP2")){ function nxs_jsPostToSNAP2() { glob
143
  });
144
  }
145
  function doLic(){ var lk = jQuery('#eLic').val(); jQuery.post(ajaxurl,{lk:lk, action: 'nxsDoLic', id: 0, _wpnonce: jQuery('input#doLic_wpnonce').val(), ajax: 'true'}, function(j){
146
- if (jQuery.trim(j)=='OK') window.location = "<?php echo $nxs_snapThisPageUrl; ?>"; else alert('Wrong key, please contact support');
147
  }, "html")
148
  }
149
  function testPost(nt, nid){ jQuery(".blnkg").hide(); <?php foreach ($nxs_snapAvNts as $avNt) {?>
@@ -217,14 +231,25 @@ html ul.nsx_tabs li.active, html ul.nsx_tabs li.active a:hover { background: #f
217
  padding: 1px 0 1px 23px !important;
218
  }
219
 
 
 
 
 
 
 
 
 
 
220
  </style>
221
  <?php }}
222
 
223
  if (!function_exists('nxs_doShowHint')){ function nxs_doShowHint($t){ ?>
224
- <div id="<?php echo $t; ?>Hint" class="nxs_FRMTHint" style="font-size: 11px; margin: 2px; margin-top: 0px; padding:7px; border: 1px solid #C0C0C0; width: 49%; background: #fff; display: none;"><span class="nxs_hili">%SITENAME%</span> - Inserts the Your Blog/Site Name, <span class="nxs_hili">%TITLE%</span> - Inserts the Title of your post, <span class="nxs_hili">%URL%</span> - Inserts the URL of your post, <span class="nxs_hili">%SURL%</span> - Inserts the <b>Shortened URL</b> of your post, <span class="nxs_hili">%IMG%</span> - Inserts the featured image, <span class="nxs_hili">%TEXT%</span> - Inserts the excerpt of your post, <span class="nxs_hili">%RAWTEXT%</span> - Inserts the body(text) as typed, <span class="nxs_hili">%FULLTEXT%</span> - Inserts the processed body(text) of your post, <span class="nxs_hili">%AUTHORNAME%</span> - Inserts the author's name.</div>
225
  <?php }}
226
 
227
- if (!function_exists('nxs_doSMAS')){ function nxs_doSMAS($nType, $typeii) { ?><div id="do<?php echo $typeii; ?>Div" class="clNewNTSets" style="margin-left: 10px; display:none; "><div style="font-size: 15px; text-align: center;"><br/><br/>You already have <?php echo $nType; ?> configured. This plugin supports only one <?php echo $nType; ?> account. <br/><br/> Please consider getting <a target="_blank" href="http://www.nextscripts.com/social-networks-auto-poster-for-wp-multiple-accounts">Multiple Accounts Edition</a> if you would like to add another <?php echo $nType; ?> account for auto-posting.</div></div><?php
 
 
228
  }}
229
 
230
  if (!function_exists('nxs_snapCleanup')){ function nxs_snapCleanup($options){ global $nxs_snapAvNts;
@@ -280,15 +305,61 @@ if (!function_exists('nxs_addQTranslSel')){function nxs_addQTranslSel($nt, $ii,
280
  if (function_exists('nxs_doSMAS5')) return nxs_doSMAS5($nt, $ii, $selLng); else return '<br/>';
281
  }}
282
 
 
 
 
 
 
283
  if (!function_exists("nxs_mkShortURL")) { function nxs_mkShortURL($url, $postID=''){ $rurl = ''; global $plgn_NS_SNAutoPoster; if (!isset($plgn_NS_SNAutoPoster)) return; $options = $plgn_NS_SNAutoPoster->nxs_options;
284
  if ($options['nxsURLShrtnr']=='B' && trim($options['bitlyUname']!='') && trim($options['bitlyAPIKey']!='')) {
285
- $response = wp_remote_get('http://api-ssl.bitly.com/v3/shorten?login='.$options['bitlyUname'].'&apiKey='.$options['bitlyAPIKey'].'&longUrl='.urlencode($url)); $rtr = json_decode($response['body'],true);
 
 
286
  if ($rtr['status_code']=='200') $rurl = $rtr['data']['url'];
287
  } //echo "###".$rurl;
288
  if ($options['nxsURLShrtnr']=='W' && function_exists('wp_get_shortlink')) { global $post; $post = get_post($postID); $rurl = wp_get_shortlink($postID, 'post'); }
289
  if ($rurl=='') { $response = wp_remote_get('http://gd.is/gtq/'.$url); if ((is_array($response) && ($response['response']['code']=='200'))) $rurl = $response['body']; }
290
  if ($rurl!='') $url = $rurl; return $url;
291
  }}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
292
 
293
  class NXS_HtmlFixer { public $dirtyhtml; public $fixedhtml; public $allowed_styles; private $matrix; public $debug; private $fixedhtmlDisplayCode;
294
  public function __construct() { $this->dirtyhtml = ""; $this->fixedhtml = ""; $this->debug = false; $this->fixedhtmlDisplayCode = ""; $this->allowed_styles = array();}
74
  }
75
  }}
76
  if (!function_exists('nxs_getPostImage')){ function nxs_getPostImage($postID, $size='large', $def='') { $imgURL = ''; global $plgn_NS_SNAutoPoster; if (!isset($plgn_NS_SNAutoPoster)) return; $options = $plgn_NS_SNAutoPoster->nxs_options;
77
+ $imgURL = "https://www.google.com/images/srpr/logo3w.png"; $res = nxs_chckRmImage($imgURL); $imgURL = ''; if (!$res) $options['imgNoCheck'] = '1';
78
  if (isset($options['featImgLoc']) && $options['featImgLoc']!=='') { $imgURL = trim(get_post_meta($postID, $options['featImgLocPrefix'], true)).trim(get_post_meta($postID, $options['featImgLoc'], true));
79
  if ($imgURL!='' && stripos($imgURL, 'http')===false) $imgURL = home_url().$imgURL;
80
  }
92
 
93
  return $imgURL;
94
  }}
95
+ if (!function_exists('nxs_makeURLParams')){ function nxs_makeURLParams($params) { global $plgn_NS_SNAutoPoster; if (!isset($plgn_NS_SNAutoPoster)) return; $options = $plgn_NS_SNAutoPoster->nxs_options;
96
+ if (!isset($options['addURLParams']) || $options['addURLParams']=='') return false; else $templ = $options['addURLParams'];
97
+ if (preg_match('%NTNAME%', $templ)) $templ = str_ireplace("%NTNAME%", urlencode($params['NTNAME']), $templ);
98
+ if (preg_match('%NTCODE%', $templ)) $templ = str_ireplace("%NTCODE%", urlencode($params['NTCODE']), $templ);
99
+ if (preg_match('%ACCNAME%', $templ)) $templ = str_ireplace("%ACCNAME%", urlencode($params['ACCNAME']), $templ);
100
+ if (preg_match('%POSTID%', $templ)) $templ = str_ireplace("%POSTID%", urlencode($params['POSTID']), $templ);
101
+ if (preg_match('%POSTTITLE%', $templ)) { $post = $params['POSTID']; if (is_object($post)) {$postName = $post->post_title; $templ = str_ireplace("%POSTTITLE%", urlencode($postName), $templ);}}
102
+ if (preg_match('%SITENAME%', $templ)) { $siteTitle = urlencode(htmlspecialchars_decode(get_bloginfo('name'), ENT_QUOTES)); $templ = str_ireplace("%SITENAME%", $siteTitle, $templ); }
103
+ return $templ;
104
+ }}
105
+
106
  //## CSS && JS
107
  if (!function_exists("jsPostToSNAP")) { function jsPostToSNAP() { global $nxs_snapAvNts, $nxs_plurl; ?>
108
  <script type="text/javascript" >
110
  <?php
111
  foreach ($nxs_snapAvNts as $avNt) {?>
112
  $('input#rePostTo<?php echo $avNt['code']; ?>_button').click(function() { var data = { action: 'rePostTo<?php echo $avNt['code']; ?>', id: $('input#post_ID').val(), nid:$(this).attr('alt'), _wpnonce: $('input#rePostTo<?php echo $avNt['code']; ?>_wpnonce').val()}; callAjSNAP(data, '<?php echo $avNt['name']; ?>'); });
113
+ <?php }
114
+ foreach ($nxs_snapAvNts as $avNt) {?>
115
+ $('input#riTo<?php echo $avNt['code']; ?>_button').click(function() { var data = { action: 'rePostTo<?php echo $avNt['code']; ?>', id: $('input#post_ID').val(), ri:1, nid:$(this).attr('alt'), _wpnonce: $('input#rePostTo<?php echo $avNt['code']; ?>_wpnonce').val()}; callAjSNAP(data, '<?php echo $avNt['name']; ?>'); });
116
  <?php } ?>
117
  function callAjSNAP(data, label) {
118
  var style = "position: fixed; display: none; z-index: 1000; top: 50%; left: 50%; background-color: #E8E8E8; border: 1px solid #555; padding: 15px; width: 350px; min-height: 80px; margin-left: -175px; margin-top: -40px; text-align: center; vertical-align: middle;";
157
  });
158
  }
159
  function doLic(){ var lk = jQuery('#eLic').val(); jQuery.post(ajaxurl,{lk:lk, action: 'nxsDoLic', id: 0, _wpnonce: jQuery('input#doLic_wpnonce').val(), ajax: 'true'}, function(j){
160
+ if (jQuery.trim(j)=='OK') window.location = "<?php echo $nxs_snapThisPageUrl; ?>"; else alert('<?php _e('Wrong key, please contact support', 'nxs_snap'); ?>');
161
  }, "html")
162
  }
163
  function testPost(nt, nid){ jQuery(".blnkg").hide(); <?php foreach ($nxs_snapAvNts as $avNt) {?>
231
  padding: 1px 0 1px 23px !important;
232
  }
233
 
234
+ .nxs_box{border-color: #DFDFDF; border-radius: 3px 3px 3px 3px; box-shadow: 0 1px 0 #FFFFFF inset; border-style: solid; border-width: 1px; line-height: 1; margin-bottom: 10px; padding: 0; max-width: 1080px;}
235
+ .nxs_box_header{border-bottom-color: #DFDFDF; box-shadow: 0 1px 0 #FFFFFF; text-shadow: 0 1px 0 #FFFFFF;font-size: 15px;font-weight: normal;line-height: 1;margin: 0;padding: 6px;
236
+ background:#f1f1f1;background-image:-webkit-gradient(linear,left bottom,left top,from(#ececec),to(#f9f9f9));background-image:-webkit-linear-gradient(bottom,#ececec,#f9f9f9);background-image:-moz-linear-gradient(bottom,#ececec,#f9f9f9);background-image:-o-linear-gradient(bottom,#ececec,#f9f9f9);background-image:linear-gradient(to top,#ececec,#f9f9f9)
237
+ -moz-user-select: none;border-bottom-style: solid;border-bottom-width: 1px;}
238
+ .nxs_box_inside{line-height: 1.4em; padding: 10px;}
239
+ .nxs_box_inside input{ padding: 5px; border: 1px solid #ACACAC;}
240
+ .nxs_box_inside .insOneDiv, #nsx_addNT .insOneDiv{max-width: 1020px; background-color: #f8f9f9; background-repeat: no-repeat; margin: 10px; border: 1px solid #808080; padding: 10px; display:none;}
241
+
242
+
243
  </style>
244
  <?php }}
245
 
246
  if (!function_exists('nxs_doShowHint')){ function nxs_doShowHint($t){ ?>
247
+ <div id="<?php echo $t; ?>Hint" class="nxs_FRMTHint" style="font-size: 11px; margin: 2px; margin-top: 0px; padding:7px; border: 1px solid #C0C0C0; width: 49%; background: #fff; display: none;"><span class="nxs_hili">%SITENAME%</span> - <?php _e('Inserts the Your Blog/Site Name', 'nxs_snap'); ?>, <span class="nxs_hili">%TITLE%</span> - <?php _e('Inserts the Title of your post', 'nxs_snap'); ?>, <span class="nxs_hili">%URL%</span> - <?php _e('Inserts the URL of your post', 'nxs_snap'); ?>, <span class="nxs_hili">%SURL%</span> - <?php _e('Inserts the <b>Shortened URL</b> of your post', 'nxs_snap'); ?>, <span class="nxs_hili">%IMG%</span> - <?php _e('Inserts the featured image', 'nxs_snap'); ?>, <span class="nxs_hili">%TEXT%</span> - <?php _e('Inserts the excerpt of your post', 'nxs_snap'); ?>, <span class="nxs_hili">%RAWTEXT%</span> - <?php _e('Inserts the body(text) as typed', 'nxs_snap'); ?>, <span class="nxs_hili">%FULLTEXT%</span> - <?php _e('Inserts the processed body(text) of your post', 'nxs_snap'); ?>, <span class="nxs_hili">%AUTHORNAME%</span> - <?php _e('Inserts the author\'s name', 'nxs_snap'); ?>.</div>
248
  <?php }}
249
 
250
+ if (!function_exists('nxs_doSMAS')){ function nxs_doSMAS($nType, $typeii) { ?><div id="do<?php echo $typeii; ?>Div" class="clNewNTSets" style="margin-left: 10px; display:none; "><div style="font-size: 15px; text-align: center;"><br/><br/>
251
+ <?php printf( __( 'You already have %s configured. This plugin supports only one %s account. <br/><br/> Please consider getting <a target="_blank" href="http://www.nextscripts.com/social-networks-auto-poster-for-wp-multiple-accounts">Multiple Accounts Edition</a> if you would like to add another %s account for auto-posting.', 'nxs_snap' ), $nType, $nType, $nType ); ?>
252
+ </div></div><?php
253
  }}
254
 
255
  if (!function_exists('nxs_snapCleanup')){ function nxs_snapCleanup($options){ global $nxs_snapAvNts;
305
  if (function_exists('nxs_doSMAS5')) return nxs_doSMAS5($nt, $ii, $selLng); else return '<br/>';
306
  }}
307
 
308
+ if (!function_exists("nxs_hideTip_ajax")) { function nxs_hideTip_ajax() { check_ajax_referer('nxsSsPageWPN');
309
+ global $plgn_NS_SNAutoPoster, $nxs_plurl; if (!isset($plgn_NS_SNAutoPoster)) return; $options = $plgn_NS_SNAutoPoster->nxs_options;
310
+ $options['hideTopTip'] = '1'; update_option($plgn_NS_SNAutoPoster->dbOptionsName, $options);
311
+ }}
312
+
313
  if (!function_exists("nxs_mkShortURL")) { function nxs_mkShortURL($url, $postID=''){ $rurl = ''; global $plgn_NS_SNAutoPoster; if (!isset($plgn_NS_SNAutoPoster)) return; $options = $plgn_NS_SNAutoPoster->nxs_options;
314
  if ($options['nxsURLShrtnr']=='B' && trim($options['bitlyUname']!='') && trim($options['bitlyAPIKey']!='')) {
315
+ $response = wp_remote_get('http://api-ssl.bitly.com/v3/shorten?login='.$options['bitlyUname'].'&apiKey='.$options['bitlyAPIKey'].'&longUrl='.urlencode($url));
316
+ if (is_wp_error($response)) { nxs_addToLog('bit.ly', 'E', '-=ERROR=- '.print_r($response, true), ''); return false; }
317
+ $rtr = json_decode($response['body'],true);
318
  if ($rtr['status_code']=='200') $rurl = $rtr['data']['url'];
319
  } //echo "###".$rurl;
320
  if ($options['nxsURLShrtnr']=='W' && function_exists('wp_get_shortlink')) { global $post; $post = get_post($postID); $rurl = wp_get_shortlink($postID, 'post'); }
321
  if ($rurl=='') { $response = wp_remote_get('http://gd.is/gtq/'.$url); if ((is_array($response) && ($response['response']['code']=='200'))) $rurl = $response['body']; }
322
  if ($rurl!='') $url = $rurl; return $url;
323
  }}
324
+ //## Comments
325
+ if (!function_exists("nxs_postNewComment")) { function nxs_postNewComment($cmnt, $aa = false) { $cmnt['comment_post_ID'] = (int) $cmnt['comment_post_ID'];
326
+ $cmnt['comment_parent'] = isset($cmnt['comment_parent']) ? absint($cmnt['comment_parent']) : 0;
327
+ $parent_status = ( 0 < $cmnt['comment_parent'] ) ? wp_get_comment_status($cmnt['comment_parent']) : '';
328
+ $cmnt['comment_parent'] = ( 'approved' == $parent_status || 'unapproved' == $parent_status ) ? $cmnt['comment_parent'] : 0;
329
+ $cmnt['comment_author_IP'] = ''; $cmnt['comment_agent'] = 'SNAP'; $cmnt['comment_date'] = get_date_from_gmt( $cmnt['comment_date_gmt'] );
330
+ $cmnt = wp_filter_comment($cmnt); if ($aa) $cmnt['comment_approved'] = 1; else $cmnt['comment_approved'] = wp_allow_comment($cmnt); $cmntID = wp_insert_comment($cmnt);
331
+ if ( 'spam' !== $cmnt['comment_approved'] ) { if ( '0' == $cmnt['comment_approved'] ) wp_notify_moderator($cmntID); $post = &get_post($cmnt['comment_post_ID']);
332
+ if ( get_option('comments_notify') && $cmnt['comment_approved'] && ( ! isset( $cmnt['user_id'] ) || $post->post_author != $cmnt['user_id'] ) ) wp_notify_postauthor($cmntID, isset( $cmnt['comment_type'] ) ? $cmnt['comment_type'] : '' );
333
+ } return $cmntID;
334
+ }}
335
+
336
+
337
+ if (!function_exists("nxs_psCron")) { function nxs_psCron() { $sh =_get_cron_array();
338
+ foreach ($sh as $evTime => $evData){ $evFunc = key($evData); if (strpos($evFunc, 'ns_doPublishTo')!==false) {
339
+ // echo key($evData)." | ".$evTime." = ".time()." - ".date("Y-m-d H:i:s", $evTime)." - ".date("Y-m-d H:i:s")."<br/>";
340
+ if ($evTime>'1359495839' && $evTime<time()-5) { //## Missed? Let's post it. We will post just one, so no hold ups.
341
+ $args = array_values($evData[$evFunc]); $args = $args[0]['args']; do_action($evFunc, $args[0], $args[1]); wp_unschedule_event( $evTime, $evFunc ); return true;
342
+ }
343
+ }}
344
+ }}
345
+
346
+ if (!function_exists("nxs_addToRI")) { function nxs_addToRI($postID) { global $plgn_NS_SNAutoPoster; if (!isset($plgn_NS_SNAutoPoster)) return; $options = $plgn_NS_SNAutoPoster->nxs_options;
347
+ $riPosts = get_option('NS_SNriPosts'); if (!is_array($riPosts)) $riPosts = array(); $options['riHowManyPostsToTrack'] = (int) $options['riHowManyPostsToTrack']; if ($options['riHowManyPostsToTrack']==0) return;
348
+ array_unshift($riPosts, $postID); $riPosts = array_unique($riPosts); $riPosts = array_slice($riPosts, 0, $options['riHowManyPostsToTrack']); update_option('NS_SNriPosts', $riPosts);
349
+ }}
350
+
351
+ function nxs_activation(){ if (!wp_next_scheduled('nxs_hourly_event')){wp_schedule_event(time(), 'hourly', 'nxs_hourly_event');} }
352
+ function nxs_do_this_hourly() { $options = get_option('NS_SNAutoPoster'); $riPosts = get_option('NS_SNriPosts'); if (!is_array($riPosts)) $riPosts = array(); //## Check for Incoming Comments if nessesary.
353
+
354
+ //## Facebook
355
+ foreach ($options['fb'] as $ii=>$fbo) if ($fbo['riComments']=='1') { $fbo['ii'] = $ii; $fbo['pType'] = 'aj';
356
+ foreach ($riPosts as $postID) {
357
+ $fbpo = get_post_meta($postID, 'snapFB', true); $fbpo = maybe_unserialize($fbpo);
358
+ if (is_array($fbpo) && isset($fbpo[$ii]) && is_array($fbpo[$ii]) ){ $ntClInst = new nxs_snapClassFB(); $fbo = $ntClInst->adjMetaOpt($fbo, $fbpo[$ii]); }
359
+ nxs_getBackFBComments($postID, $fbo, $fbpo[$ii]);
360
+ }
361
+ }
362
+ }
363
 
364
  class NXS_HtmlFixer { public $dirtyhtml; public $fixedhtml; public $allowed_styles; private $matrix; public $debug; private $fixedhtmlDisplayCode;
365
  public function __construct() { $this->dirtyhtml = ""; $this->fixedhtml = ""; $this->debug = false; $this->fixedhtmlDisplayCode = ""; $this->allowed_styles = array();}
readme.txt CHANGED
@@ -4,21 +4,18 @@ Contributors: NextScripts
4
  Donate link: http://www.nextscripts.com/social-networks-auto-poster-for-wordpress
5
  Tags: automation, autopost, auto-post, auto post, socialnetworks, socialnetwork, social networks, social network, facebook, google, google+, twitter, google plus, pinterest, tumblr, blogger, blogspot, blogpost, linkedin, delicious, delicious.com, plugin, links, Post, posts, api, automatic, seo, integration, bookmark, bookmarking, bookmarks, admin, images, image, social, sharing, share, repost, re-post, wordpress.com, StumbleUpon, Diigo, vBulletin, Plurk, forums, vKontakte, open graph, LiveJournal
6
  Requires at least: 3.0
7
- Tested up to: 3.5
8
- Stable tag: 2.5.5
9
  License: GPLv2 or later
10
 
11
  Automatically re-publishes blogposts to Facebook, Twitter, Google+, Pinterest, LinkedIn, Blogger, Tumblr, Delicious, Plurk, etc profiles and/or pages
12
 
13
  == Description ==
14
 
15
- **This plugin automatically publishes posts from your blog to your Social Network accounts** such as Facebook, Twitter, Google+(Google Plus), Blogger, LiveJournal, Delicious, Diigo, Stumbleupon, LinkedIn, Pinterest, Plurk, VKontakte(VK.com), Wordpress, and Tumblr profiles and/or pages. The whole process is completely automated. Just write a new post and either entire post or it's announcement with back link will be published to all your configured social networks.
16
 
17
- **Plugin makes 100% White Labeled Posts** The main idea behind the plugin is to give you the ability to promote only yourself. Plugin uses your own apps and all posts to all networks come only from you. No "Shared via NextScripts.com" or "Posted by SNAP for Wordpress" messages.
18
-
19
- Social Networks Auto Poster can automatically publish nicely formatted announcements to your Facebook, Twitter, LinkedIn, Tumblr, Wordpress, vBulletin, Delicious, Stumbleupon, LiveJournal, VKontakte(VK.com), Diigo, Plurk, Blogger, and Google+ (Google Plus) accounts, so you can reach the most audience and tell all your friends, readers and followers about your new post. Plugin works with profiles, business pages, community pages, Facebook groups, etc. Plugin supports custom WordPress post types.
20
-
21
- * **Latest version 2.5** - Export/Import Plugin settings, direct links to the published posts from the "Edit" page, ability to assign categories to each Social Network. LiveJournal Support.
22
  * *Version 2.4* - "Image" posts for Facebook and Twitter, bit.ly support, Plurk Support
23
  * *Version 2.3* - Google+ image posts, delayed postings (Pro Only), new networks - Stumbleupon, vBulletin, Diigo
24
 
@@ -28,9 +25,10 @@ Social Networks Auto Poster can automatically publish nicely formatted announcem
28
  * **Delicious** - Auto-submit bookmark to your account.
29
  * **Diigo** - Auto-submit bookmark to your account.
30
  * **Facebook** - Autopost to your profile, business page, community page, or Facebook group page. Ability to attach your blogpost to Facebook post. Ability to make "Image" posts.
 
31
  * **Google+** (*with third party API library*) - Autopost to your profile or business page. Ability to attach your blogpost to Google+ post. Ability to make "Image" posts.
32
  * **LinkedIn** - Autopost to your account. Ability to attach your blogpost to LinkedIn post. Autopost to LinkedIn Company pages and/or Groups (*with third party API library*)
33
- * **LiveJournal** - Auto-submit your blogpost to LiveJournal.
34
  * **Pinterest** (*with third party API library*) - Pin your blogpost's featured image to your Pinterest board.
35
  * **Stumbleupon** - Auto-submit bookmark to your account.
36
  * **Tumblr** - Autopost to your account. Ability to attach your blogpost to Tumblr post. HTML is supported.
@@ -42,15 +40,17 @@ Social Networks Auto Poster can automatically publish nicely formatted announcem
42
 
43
  ... more networks are coming soon ...
44
 
 
 
45
  Please see <a href="http://www.nextscripts.com/installation-of-social-networks-auto-poster-for-wordpress/">complete installation instructions with screenshots</a>
46
 
47
  <a href="http://www.nextscripts.com/support/">Contact support/Open Support Ticket</a>
48
 
49
  == Installation ==
50
 
51
- You need to have account with either Facebook, Tumblr, Google+, LinkedIn, Pinterest, Blogger, Twitter, Delicious, Diigo, Plurk, LiveJournal, Stumbleupon or all of them.
52
 
53
- **Please, see more detailed installation instructions with screenshots here: http://www.nextscripts.com/installation-of-social-networks-auto-poster-for-wordpress **
54
 
55
  Below are the quick instructions for Facebook, Twitter and Google+. Please see other networks at the link above...
56
 
@@ -154,11 +154,51 @@ Please see more <a href="http://www.nextscripts.com/faq/">Frequently asked quest
154
 
155
  1. Add new post metadata box (Pro Version)
156
  2. Settings Page (Pro Version)
157
- 3. Facebook Types of Post
158
- 4. Google+ Types of Post
159
 
160
  == Changelog ==
161
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
162
  = 2.5.5 [01/18/2013] =
163
 
164
  * New/Improvement - Tumblr - Audio and Video Post types
4
  Donate link: http://www.nextscripts.com/social-networks-auto-poster-for-wordpress
5
  Tags: automation, autopost, auto-post, auto post, socialnetworks, socialnetwork, social networks, social network, facebook, google, google+, twitter, google plus, pinterest, tumblr, blogger, blogspot, blogpost, linkedin, delicious, delicious.com, plugin, links, Post, posts, api, automatic, seo, integration, bookmark, bookmarking, bookmarks, admin, images, image, social, sharing, share, repost, re-post, wordpress.com, StumbleUpon, Diigo, vBulletin, Plurk, forums, vKontakte, open graph, LiveJournal
6
  Requires at least: 3.0
7
+ Tested up to: 3.5.1
8
+ Stable tag: 2.6.3
9
  License: GPLv2 or later
10
 
11
  Automatically re-publishes blogposts to Facebook, Twitter, Google+, Pinterest, LinkedIn, Blogger, Tumblr, Delicious, Plurk, etc profiles and/or pages
12
 
13
  == Description ==
14
 
15
+ **This plugin automatically publishes posts from your blog to your Social Network accounts** such as Facebook, Twitter, Google+(Google Plus), Blogger, Tumblr, LiveJournal, DreamWidth, Delicious, Diigo, Instapaper, Stumbleupon, LinkedIn, Pinterest, Plurk, VKontakte(VK.com), Wordpress, etc. The whole process is completely automated. Just write a new post and either entire post or it's nicely formatted announcement with backlink will be published to all your configured social networks. You can reach the most audience and tell all your friends, readers and followers about your new post. Plugin works with profiles, business pages, community pages, groups, etc.
16
 
17
+ * **Latest version 2.6** - Better Interface, DreamWidth support, Instapaper support, ability to auto-import comments from social networks
18
+ * *Version 2.5* - Export/Import Plugin settings, direct links to the published posts from the "Edit" page, ability to assign categories to each Social Network. LiveJournal Support.
 
 
 
19
  * *Version 2.4* - "Image" posts for Facebook and Twitter, bit.ly support, Plurk Support
20
  * *Version 2.3* - Google+ image posts, delayed postings (Pro Only), new networks - Stumbleupon, vBulletin, Diigo
21
 
25
  * **Delicious** - Auto-submit bookmark to your account.
26
  * **Diigo** - Auto-submit bookmark to your account.
27
  * **Facebook** - Autopost to your profile, business page, community page, or Facebook group page. Ability to attach your blogpost to Facebook post. Ability to make "Image" posts.
28
+ * **Instapaper** - Auto-submit bookmark to your account.
29
  * **Google+** (*with third party API library*) - Autopost to your profile or business page. Ability to attach your blogpost to Google+ post. Ability to make "Image" posts.
30
  * **LinkedIn** - Autopost to your account. Ability to attach your blogpost to LinkedIn post. Autopost to LinkedIn Company pages and/or Groups (*with third party API library*)
31
+ * **LiveJournal** - Auto-submit your blogpost to LiveJournal blog or community. "LiveJournal Engine" based website DreamWidth.org is also supported.
32
  * **Pinterest** (*with third party API library*) - Pin your blogpost's featured image to your Pinterest board.
33
  * **Stumbleupon** - Auto-submit bookmark to your account.
34
  * **Tumblr** - Autopost to your account. Ability to attach your blogpost to Tumblr post. HTML is supported.
40
 
41
  ... more networks are coming soon ...
42
 
43
+ **Plugin makes 100% White Labeled Posts** The main idea behind the plugin is to give you the ability to promote only yourself. Plugin uses your own apps and all posts to all networks come only from you. No "Shared via NextScripts.com" or "Posted by SNAP for Wordpress" messages.
44
+
45
  Please see <a href="http://www.nextscripts.com/installation-of-social-networks-auto-poster-for-wordpress/">complete installation instructions with screenshots</a>
46
 
47
  <a href="http://www.nextscripts.com/support/">Contact support/Open Support Ticket</a>
48
 
49
  == Installation ==
50
 
51
+ You need to have account with either Facebook, Tumblr, Google+, LinkedIn, Pinterest, Blogger, Twitter, Delicious, Diigo, Plurk, LiveJournal, Stumbleupon, DreamWidth or all of them.
52
 
53
+ **Please, see more detailed installation instructions with screenshots here:** http://www.nextscripts.com/installation-of-social-networks-auto-poster-for-wordpress
54
 
55
  Below are the quick instructions for Facebook, Twitter and Google+. Please see other networks at the link above...
56
 
154
 
155
  1. Add new post metadata box (Pro Version)
156
  2. Settings Page (Pro Version)
157
+ 3. Facebook: Types of Post
158
+ 4. Google+: Types of Post
159
 
160
  == Changelog ==
161
 
162
+ = 2.6.3 [02/07/2013] =
163
+
164
+ * Improvement/Bug fix - Twitter - Better hashtags support.
165
+ * Improvement - Bigger "text format" area for facebook and G+
166
+ * Bug fix - Previously shedulled posts were not autoposted.
167
+ * Bug fix - VK - Open community autoposting fixed.
168
+ * Bug fix - LinkedIn - Immideate Posting problems fixed.
169
+
170
+ = 2.6.2 [02/05/2013] =
171
+
172
+ * New - New network "Instapaper"
173
+ * New - Livejournal and DreamWidth - autoposting to communities and shared blogs.
174
+ * Bug fix - LinkedIN SHARE errorfixed.
175
+ * Bug fix - StumbleUpon wrong category selection fix.
176
+ * Bug fix - Delicious better error handling.
177
+ * Bug fix - Facebook better error handling.
178
+ * Bug fix - Twitter text post fix.
179
+
180
+ = 2.6.1 [02/01/2013] =
181
+
182
+ * Bug fix - Critical bugfix for Facebook Authorization.
183
+ * Bug fix - "Import comments" interface tweaks.
184
+ * Bug fix - "Add new network" interface tweaks.
185
+
186
+ = 2.6.0 [01/31/2013] =
187
+
188
+ * New - Ability to auto-import Comments from Social Networks and post them as WP Comments (Facebook only so far)
189
+ * New/Improvement - New Settings Interface
190
+ * New - New network (kind of): DreamWidth.org - LJ Based Website
191
+ * New - Additional URL Parameters
192
+ * New/Improvement - Plugin will invoke it's own cron in case of broken WP Cron.
193
+ * Bug fix - vKontakte - NXS API Fixed.
194
+ * Bug fix - Pinterest - fixed "board retreive" that could break the settings.
195
+ * Bug fix - Pinterest - fixed "0" board ID problem.
196
+ * Bug fix - Pinterest - fixed problem with wrong default image.
197
+ * Bug fix - Plurk - Better error handling.
198
+ * Bug fix - Fixed broken posting to selected categories only.
199
+ * Bug fix - Account assigned categories were not saved.
200
+ * Many other minor bug fixes and improvements
201
+
202
  = 2.5.5 [01/18/2013] =
203
 
204
  * New/Improvement - Tumblr - Audio and Video Post types