Version Description
[02/07/2014] =
- Improvement - More networks show the links to the created posts in the log.
- Bug Fix - Flickr was missing from the "add new network" list
- Bug Fix - Reddit failed to retrieve reddits with "Moderation" rights.
- Bug Fix - Fixed(removed) an ability for super admin to disable himself for WPMU installations.
- Bug Fix - Twitter - %ANOUNCE% tag was causing message to go over 140 characters.
Download this release
Release Info
Developer | NextScripts |
Plugin | NextScripts: Social Networks Auto-Poster |
Version | 3.2.3 |
Comparing to | |
See all releases |
Code changes from version 3.1.2 to 3.2.3
- NextScripts_SNAP.php +135 -15
- img/fl-bg.png +0 -0
- img/fl16.png +0 -0
- img/sc-bg.png +0 -0
- img/sc16.png +0 -0
- inc-cl/ap.api.php +2 -1
- inc-cl/ap.php +15 -8
- inc-cl/apis/scOAuth.php +233 -0
- inc-cl/bg.api.php +2 -1
- inc-cl/bg.php +11 -7
- inc-cl/da.api.php +2 -1
- inc-cl/da.php +6 -3
- inc-cl/di.api.php +2 -1
- inc-cl/di.php +5 -2
- inc-cl/dl.api.php +2 -1
- inc-cl/dl.php +5 -2
- inc-cl/fb.api.php +4 -3
- inc-cl/fb.php +33 -19
- inc-cl/ff.api.php +2 -1
- inc-cl/ff.php +5 -2
- inc-cl/fl.api.php +82 -0
- inc-cl/fl.php +305 -0
- inc-cl/gp.api.php +3 -1
- inc-cl/gp.php +10 -6
- inc-cl/ip.api.php +2 -1
- inc-cl/ip.php +5 -2
- inc-cl/li.api.php +4 -3
- inc-cl/li.php +8 -5
- inc-cl/lj.api.php +2 -1
- inc-cl/lj.php +5 -2
- inc-cl/pk.api.php +3 -2
- inc-cl/pk.php +9 -6
- inc-cl/pn.api.php +2 -1
- inc-cl/pn.php +11 -7
- inc-cl/rd.api.php +2 -1
- inc-cl/rd.php +8 -4
- inc-cl/sc.api.php +67 -0
- inc-cl/sc.php +309 -0
- inc-cl/su.api.php +2 -2
- inc-cl/su.php +7 -3
- inc-cl/tr.api.php +9 -7
- inc-cl/tr.php +9 -6
- inc-cl/tw.api.php +5 -1
- inc-cl/tw.php +14 -8
- inc-cl/vb.api.php +2 -1
- inc-cl/vb.php +5 -2
- inc-cl/vk.api.php +2 -1
- inc-cl/vk.php +5 -2
- inc-cl/wp.api.php +3 -1
- inc-cl/wp.php +5 -2
- inc-cl/yt.api.php +1 -1
- inc-cl/yt.php +5 -2
- inc/nxs_functions_adv.php +20 -15
- inc/nxs_snap_class.php +12 -8
- js/js.js +33 -18
- nxs_functions.php +14 -12
- readme.txt +45 -8
NextScripts_SNAP.php
CHANGED
@@ -4,12 +4,12 @@ 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: 3.
|
8 |
Author URI: http://www.nextscripts.com
|
9 |
Text Domain: nxs_snap
|
10 |
Copyright 2012 Next Scripts, Inc
|
11 |
*/
|
12 |
-
define( 'NextScripts_SNAP_Version' , '3.
|
13 |
|
14 |
$nxs_mLimit = ini_get('memory_limit'); if (strpos($nxs_mLimit, 'G')) {$nxs_mLimit = (int)$nxs_mLimit * 1024;} else {$nxs_mLimit = (int)$nxs_mLimit;}
|
15 |
if ($nxs_mLimit>0 && $nxs_mLimit<64) { add_filter('plugin_action_links','ns_add_nomem_link', 10, 2 );
|
@@ -100,8 +100,7 @@ if (!function_exists("nsGetWLBoards_ajax")) {
|
|
100 |
}
|
101 |
//## Set all posts to Include/exclude from/to Auto-Reposting
|
102 |
if (!function_exists("nxs_SetRpstAll_ajax")) {
|
103 |
-
function nxs_SetRpstAll_ajax() { check_ajax_referer('nxsSsPageWPN'); global $plgn_NS_SNAutoPoster; if (!isset($plgn_NS_SNAutoPoster)) return; $options = $plgn_NS_SNAutoPoster->nxs_options;// prr($options[$_POST['t']][$_POST['ii']]);
|
104 |
-
if ($_POST['ed']=='2') {echo "OK"; die();} //## !!FIX THIS!!
|
105 |
if ($_POST['ed']=='X' || $_POST['ed']=='L') { // prr($options[$_POST['t']][$_POST['ii']]); prr($options); die();
|
106 |
if ($_POST['ed']=='X') { $options[$_POST['t']][$_POST['ii']]['rpstLastPostID'] = '';
|
107 |
$options[$_POST['t']][$_POST['ii']]['rpstLastShTime'] = ''; $options[$_POST['t']][$_POST['ii']]['rpstLastPostTime'] = ''; $options[$_POST['t']][$_POST['ii']]['rpstNxTime'] = '';
|
@@ -118,7 +117,13 @@ if (!function_exists("nxs_SetRpstAll_ajax")) {
|
|
118 |
while (count($posts)>0){
|
119 |
foreach ($posts as $postID){ $pMeta = maybe_unserialize(get_post_meta($postID, 'snap'.strtoupper($_POST['t']), true));
|
120 |
if (!isset($pMeta) || !is_array($pMeta)) $pMeta = array(); if (!isset($pMeta[$_POST['ii']]) || !is_array($pMeta[$_POST['ii']])) $pMeta[$_POST['ii']] = array();
|
121 |
-
$pMeta[$_POST['ii']]['rpstPostIncl'] = $_POST['ed']=='0'?'0':'nxsi'.$_POST['ii'].$_POST['t'];
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
} $args['offset'] = $args['offset']+30; $posts = get_posts( $args );
|
123 |
}
|
124 |
}
|
@@ -146,7 +151,7 @@ if (!function_exists("nxs_AddSUASettings")) { function nxs_AddSUASettings() { g
|
|
146 |
//## Initialize the admin panel if the plugin has been activated
|
147 |
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;
|
148 |
if (function_exists('add_options_page')) { add_options_page('Social Networks Auto Poster',
|
149 |
-
'<span style="font-weight:bold; color:#2ecc2e;">{SNAP} </span>Social Networks Auto Poster', 'manage_options', basename(__FILE__), array(&$plgn_NS_SNAutoPoster, 'showSNAutoPosterOptionsPage'));
|
150 |
}}}
|
151 |
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;
|
152 |
if (function_exists('add_options_page')) { add_options_page('Social Networks Auto Poster',
|
@@ -154,7 +159,9 @@ if (!function_exists("NS_SNAutoPoster_apx")) { function NS_SNAutoPoster_apx() {
|
|
154 |
}}}
|
155 |
//## Main Function to Post
|
156 |
if (!function_exists("nxs_snapLogPublishTo")) { function nxs_snapLogPublishTo( $new_status, $old_status, $post ) {
|
157 |
-
if ( $old_status!='publish' && $old_status!='trash' && $new_status == 'publish' ) nxs_addToLogN('BG', "*** ID: {$post->ID}, Type: {$post->post_type}", '', ' Status Changed: '."{$old_status}_to_{$new_status}".'. Autopost requested.');
|
|
|
|
|
158 |
}}
|
159 |
if (!function_exists("nxs_snapPublishTo")) { function nxs_snapPublishTo($postArr, $type='', $aj=false) { global $plgn_NS_SNAutoPoster, $nxs_snapAvNts, $blog_id, $nxs_tpWMPU; // echo " | nxs_doSMAS2 | "; prr($postArr);
|
160 |
if (!isset($plgn_NS_SNAutoPoster)) return; $options = $plgn_NS_SNAutoPoster->nxs_options;
|
@@ -164,7 +171,8 @@ if (!function_exists("nxs_snapPublishTo")) { function nxs_snapPublishTo($postArr
|
|
164 |
if ($post->post_status != 'publish') { nxs_addToLogN('I', 'Cancelled', '', 'Autopost Cancelled - Post is not "Published" Right now - Post ID:('.$postID.') - Current Post status -'.$post->post_status ); return; }
|
165 |
}
|
166 |
//nxs_addToLogN('BG', 'Post Status Changed', '', '-=## Autopost requested.'.($blog_id>1?'BlogID:'.$blog_id:'').' PostID:('.$postID.') Post Type: '.$post->post_type.' ##=-');
|
167 |
-
$args=array('public'=>true, '_builtin'=>false); $output = 'names'; $operator = 'and'; $post_types = array();
|
|
|
168 |
if ( isset($options['nxsCPTSeld']) && $options['nxsCPTSeld']!='') $nxsCPTSeld = unserialize($options['nxsCPTSeld']); else $nxsCPTSeld = array(); // $nxsCPTSeld = array_keys($post_types); - why we needed it?
|
169 |
|
170 |
if ($post->post_type == 'post' || ($options['useForPages']=='1' && $post->post_type == 'page') || (in_array($post->post_type, $post_types) && in_array($post->post_type, $nxsCPTSeld))) {
|
@@ -236,7 +244,9 @@ if (!function_exists("nxs_adminInitFunc")) { function nxs_adminInitFunc(){ globa
|
|
236 |
if (function_exists('nxsDoLic_ajax')) { add_action('wp_ajax_nxsDoLic', 'nxsDoLic_ajax'); }
|
237 |
}}
|
238 |
if (!function_exists("nxs_adminInitFunc2")) { function nxs_adminInitFunc2(){ global $plgn_NS_SNAutoPoster, $nxs_snapThisPageUrl, $pagenow; $nxs_snapThisPageUrl = nxs_get_admin_url().($pagenow=='admin.php'?'network/':'').$pagenow.'?page=NextScripts_SNAP.php'; //## Add MEtaBox to Post Edit Page
|
239 |
-
if (current_user_can("see_snap_box") || current_user_can("manage_options")) add_action('add_meta_boxes', array($plgn_NS_SNAutoPoster, 'NS_SNAP_addCustomBoxes'));
|
|
|
|
|
240 |
}}
|
241 |
|
242 |
function nxs_saveSiteSets_ajax(){ check_ajax_referer('nxssnap');
|
@@ -245,7 +255,7 @@ function nxs_saveSiteSets_ajax(){ check_ajax_referer('nxssnap');
|
|
245 |
$options = get_option('NS_SNAutoPoster'); $options['suaMode'] = $_POST['sset']; update_option('NS_SNAutoPoster', $options);
|
246 |
}
|
247 |
} else { switch_to_blog($_POST['sid']);
|
248 |
-
$options = get_option('NS_SNAutoPoster'); $options['suaMode'] = $_POST['sset'];
|
249 |
}
|
250 |
echo "OK"; die();
|
251 |
}
|
@@ -286,9 +296,9 @@ function nxs_ogtgCallback($content){ global $post, $plgn_NS_SNAutoPoster;
|
|
286 |
echo '<meta property="og:type" content="video" />'."\n";
|
287 |
} */
|
288 |
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
if ($imgsFromPost !== false && is_singular() && is_array($ogimgs) && is_array($imgsFromPost)) $ogimgs = array_merge($ogimgs, $imgsFromPost);
|
293 |
}
|
294 |
//## Add default image to the endof the array
|
@@ -302,7 +312,7 @@ function nxs_ogtgCallback($content){ global $post, $plgn_NS_SNAutoPoster;
|
|
302 |
function nxs_addOGTagsPreHolder() { echo "<!-- ## NXS/OG ## --><!-- ## NXSOGTAGS ## --><!-- ## NXS/OG ## -->\n\r";}
|
303 |
|
304 |
if (!function_exists("nxssnap_enqueue_scripts")) { function nxssnap_enqueue_scripts(){
|
305 |
-
wp_enqueue_script( 'nxssnap-scripts', plugin_dir_url( __FILE__ ) . 'js/js.js', array( 'jquery' )
|
306 |
wp_localize_script( 'nxssnap-scripts', 'MyAjax', array( 'ajaxurl' => nxs_get_admin_url( 'admin-ajax.php' ), 'nxsnapWPnonce' => wp_create_nonce( 'nxsnapWPnonce' ),));
|
307 |
}}
|
308 |
|
@@ -314,13 +324,121 @@ if (!function_exists("nxs_getExpSettings_ajax")) { function nxs_getExpSettings_a
|
|
314 |
|
315 |
function cron_add_nxsreposter( $schedules ) { $schedules['nxsreposter'] = array( 'interval' => 90, 'display' => __( 'NXS Reposter' )); return $schedules;} // Do this every 90 seconds
|
316 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
317 |
if (!function_exists("nxs_snapAjax")) { function nxs_snapAjax() { check_ajax_referer('nxsSsPageWPN'); global $plgn_NS_SNAutoPoster; if (!isset($plgn_NS_SNAutoPoster)) return; $options = $plgn_NS_SNAutoPoster->nxs_options;
|
318 |
if ($_POST['nxsact']=='getNTset') { $ii = $_POST['ii']; $nt = $_POST['nt']; $ntl = strtolower($nt); $pbo = $options[$ntl][$ii]; $pbo['ntInfo']['lcode'] = $ntl; $clName = 'nxs_snapClass'.$nt; $ntObj = new $clName();
|
319 |
$ntObj->showNTSettings($ii, $pbo);
|
320 |
}
|
|
|
|
|
321 |
die();
|
322 |
}}
|
323 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
324 |
|
325 |
//## Actions and filters
|
326 |
add_action('shutdown', 'nxs_psCron', 25); //add_action( 'transition_post_status', 'nxs_snapLogPublishTo', 10, 3 );
|
@@ -359,6 +477,7 @@ if (isset($plgn_NS_SNAutoPoster)) { //## Actions
|
|
359 |
|
360 |
if ($isO || $isS) {
|
361 |
add_action( 'transition_post_status', 'nxs_snapLogPublishTo', 10, 3 );
|
|
|
362 |
//## Whenever you publish a post, post to Social Networks
|
363 |
add_action('future_to_publish', 'nxs_snapPublishTo');
|
364 |
add_action('new_to_publish', 'nxs_snapPublishTo');
|
@@ -367,6 +486,7 @@ if (isset($plgn_NS_SNAutoPoster)) { //## Actions
|
|
367 |
add_action('private_to_publish', 'nxs_snapPublishTo');
|
368 |
add_action('auto-draft_to_publish', 'nxs_snapPublishTo');
|
369 |
//## Add nxs_snapPublishTo to custom post types
|
|
|
370 |
|
371 |
foreach ($nxs_snapAvNts as $avNt) { add_action('ns_doPublishTo'.$avNt['code'], 'nxs_doPublishTo'.$avNt['code'], 1, 2); }
|
372 |
foreach ($nxs_snapAvNts as $avNt) { add_action('wp_ajax_rePostTo'.$avNt['code'], 'nxs_rePostTo'.$avNt['code'].'_ajax'); }
|
@@ -384,7 +504,7 @@ if (isset($plgn_NS_SNAutoPoster)) { //## Actions
|
|
384 |
|
385 |
if ($isO) {
|
386 |
add_action('admin_menu', 'NS_SNAutoPoster_ap');
|
387 |
-
add_action('admin_init', 'nxs_adminInitFunc2');
|
388 |
//## Initialize options on plugin activation
|
389 |
$myrelpath = preg_replace( '/.*wp-content.plugins./', '', __FILE__ );
|
390 |
add_action("activate_".$myrelpath, array(&$plgn_NS_SNAutoPoster, 'init'));
|
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: 3.2.3
|
8 |
Author URI: http://www.nextscripts.com
|
9 |
Text Domain: nxs_snap
|
10 |
Copyright 2012 Next Scripts, Inc
|
11 |
*/
|
12 |
+
define( 'NextScripts_SNAP_Version' , '3.2.3' );
|
13 |
|
14 |
$nxs_mLimit = ini_get('memory_limit'); if (strpos($nxs_mLimit, 'G')) {$nxs_mLimit = (int)$nxs_mLimit * 1024;} else {$nxs_mLimit = (int)$nxs_mLimit;}
|
15 |
if ($nxs_mLimit>0 && $nxs_mLimit<64) { add_filter('plugin_action_links','ns_add_nomem_link', 10, 2 );
|
100 |
}
|
101 |
//## Set all posts to Include/exclude from/to Auto-Reposting
|
102 |
if (!function_exists("nxs_SetRpstAll_ajax")) {
|
103 |
+
function nxs_SetRpstAll_ajax() { check_ajax_referer('nxsSsPageWPN'); global $plgn_NS_SNAutoPoster; if (!isset($plgn_NS_SNAutoPoster)) return; $options = $plgn_NS_SNAutoPoster->nxs_options;// prr($options[$_POST['t']][$_POST['ii']]);
|
|
|
104 |
if ($_POST['ed']=='X' || $_POST['ed']=='L') { // prr($options[$_POST['t']][$_POST['ii']]); prr($options); die();
|
105 |
if ($_POST['ed']=='X') { $options[$_POST['t']][$_POST['ii']]['rpstLastPostID'] = '';
|
106 |
$options[$_POST['t']][$_POST['ii']]['rpstLastShTime'] = ''; $options[$_POST['t']][$_POST['ii']]['rpstLastPostTime'] = ''; $options[$_POST['t']][$_POST['ii']]['rpstNxTime'] = '';
|
117 |
while (count($posts)>0){
|
118 |
foreach ($posts as $postID){ $pMeta = maybe_unserialize(get_post_meta($postID, 'snap'.strtoupper($_POST['t']), true));
|
119 |
if (!isset($pMeta) || !is_array($pMeta)) $pMeta = array(); if (!isset($pMeta[$_POST['ii']]) || !is_array($pMeta[$_POST['ii']])) $pMeta[$_POST['ii']] = array();
|
120 |
+
if ($_POST['ed']!='2') $pMeta[$_POST['ii']]['rpstPostIncl'] = $_POST['ed']=='0'?'0':'nxsi'.$_POST['ii'].$_POST['t']; else {
|
121 |
+
$doPost = true; $exclCats = maybe_unserialize($options['exclCats']); $postCats = wp_get_post_categories($postID);
|
122 |
+
foreach ($postCats as $pCat) { if ( (is_array($exclCats)) && in_array($pCat, $exclCats)) $doPost = false; else {$doPost = true; break;}}
|
123 |
+
$optMt = $options[$_POST['t']][$_POST['ii']];
|
124 |
+
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;}} }
|
125 |
+
$pMeta[$_POST['ii']]['rpstPostIncl'] = $doPost?'nxsi'.$_POST['ii'].$_POST['t']:'0';
|
126 |
+
} delete_post_meta($postID, 'snap'.strtoupper($_POST['t'])); add_post_meta($postID, 'snap'.strtoupper($_POST['t']), serialize($pMeta));
|
127 |
} $args['offset'] = $args['offset']+30; $posts = get_posts( $args );
|
128 |
}
|
129 |
}
|
151 |
//## Initialize the admin panel if the plugin has been activated
|
152 |
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;
|
153 |
if (function_exists('add_options_page')) { add_options_page('Social Networks Auto Poster',
|
154 |
+
'<span style="font-weight:bold; color:#2ecc2e;">{SNAP} </span>Social Networks Auto Poster', 'manage_options', basename(__FILE__), array(&$plgn_NS_SNAutoPoster, 'showSNAutoPosterOptionsPage'));
|
155 |
}}}
|
156 |
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;
|
157 |
if (function_exists('add_options_page')) { add_options_page('Social Networks Auto Poster',
|
159 |
}}}
|
160 |
//## Main Function to Post
|
161 |
if (!function_exists("nxs_snapLogPublishTo")) { function nxs_snapLogPublishTo( $new_status, $old_status, $post ) {
|
162 |
+
if ( $old_status!='publish' && $old_status!='trash' && $new_status == 'publish' ) { nxs_addToLogN('BG', "*** ID: {$post->ID}, Type: {$post->post_type}", '', ' Status Changed: '."{$old_status}_to_{$new_status}".'. Autopost requested.');
|
163 |
+
nxs_snapPublishTo($post);
|
164 |
+
}
|
165 |
}}
|
166 |
if (!function_exists("nxs_snapPublishTo")) { function nxs_snapPublishTo($postArr, $type='', $aj=false) { global $plgn_NS_SNAutoPoster, $nxs_snapAvNts, $blog_id, $nxs_tpWMPU; // echo " | nxs_doSMAS2 | "; prr($postArr);
|
167 |
if (!isset($plgn_NS_SNAutoPoster)) return; $options = $plgn_NS_SNAutoPoster->nxs_options;
|
171 |
if ($post->post_status != 'publish') { nxs_addToLogN('I', 'Cancelled', '', 'Autopost Cancelled - Post is not "Published" Right now - Post ID:('.$postID.') - Current Post status -'.$post->post_status ); return; }
|
172 |
}
|
173 |
//nxs_addToLogN('BG', 'Post Status Changed', '', '-=## Autopost requested.'.($blog_id>1?'BlogID:'.$blog_id:'').' PostID:('.$postID.') Post Type: '.$post->post_type.' ##=-');
|
174 |
+
$args=array('public'=>true, '_builtin'=>false); $output = 'names'; $operator = 'and'; $post_types = array();
|
175 |
+
if (function_exists('get_post_types')) $post_types=get_post_types($args, $output, $operator);
|
176 |
if ( isset($options['nxsCPTSeld']) && $options['nxsCPTSeld']!='') $nxsCPTSeld = unserialize($options['nxsCPTSeld']); else $nxsCPTSeld = array(); // $nxsCPTSeld = array_keys($post_types); - why we needed it?
|
177 |
|
178 |
if ($post->post_type == 'post' || ($options['useForPages']=='1' && $post->post_type == 'page') || (in_array($post->post_type, $post_types) && in_array($post->post_type, $nxsCPTSeld))) {
|
244 |
if (function_exists('nxsDoLic_ajax')) { add_action('wp_ajax_nxsDoLic', 'nxsDoLic_ajax'); }
|
245 |
}}
|
246 |
if (!function_exists("nxs_adminInitFunc2")) { function nxs_adminInitFunc2(){ global $plgn_NS_SNAutoPoster, $nxs_snapThisPageUrl, $pagenow; $nxs_snapThisPageUrl = nxs_get_admin_url().($pagenow=='admin.php'?'network/':'').$pagenow.'?page=NextScripts_SNAP.php'; //## Add MEtaBox to Post Edit Page
|
247 |
+
if (current_user_can("see_snap_box") || current_user_can("manage_options")) { add_action('add_meta_boxes', array($plgn_NS_SNAutoPoster, 'NS_SNAP_addCustomBoxes'));
|
248 |
+
if (!($pagenow=='options-general.php' && !empty($_GET['page']) && $_GET['page']=='NextScripts_SNAP.php')) add_action( 'admin_bar_menu', 'toolbar_link_to_mypage', 999 );
|
249 |
+
}
|
250 |
}}
|
251 |
|
252 |
function nxs_saveSiteSets_ajax(){ check_ajax_referer('nxssnap');
|
255 |
$options = get_option('NS_SNAutoPoster'); $options['suaMode'] = $_POST['sset']; update_option('NS_SNAutoPoster', $options);
|
256 |
}
|
257 |
} else { switch_to_blog($_POST['sid']);
|
258 |
+
$options = get_option('NS_SNAutoPoster'); $options['suaMode'] = $_POST['sset']; if( is_super_admin() && $_POST['sid']=='1' && $options['suaMode']!='O') $options['suaMode'] = 'O'; update_option('NS_SNAutoPoster', $options);
|
259 |
}
|
260 |
echo "OK"; die();
|
261 |
}
|
296 |
echo '<meta property="og:type" content="video" />'."\n";
|
297 |
} */
|
298 |
|
299 |
+
|
300 |
+
$imgURL = nxs_getPostImage($post->ID, 'full', $options['ogImgDef']); if (!empty($imgURL)) $ogimgs[] = $imgURL;
|
301 |
+
$imgsFromPost = nsFindImgsInPost($post, (int)$options['advFindOGImg']==1);
|
302 |
if ($imgsFromPost !== false && is_singular() && is_array($ogimgs) && is_array($imgsFromPost)) $ogimgs = array_merge($ogimgs, $imgsFromPost);
|
303 |
}
|
304 |
//## Add default image to the endof the array
|
312 |
function nxs_addOGTagsPreHolder() { echo "<!-- ## NXS/OG ## --><!-- ## NXSOGTAGS ## --><!-- ## NXS/OG ## -->\n\r";}
|
313 |
|
314 |
if (!function_exists("nxssnap_enqueue_scripts")) { function nxssnap_enqueue_scripts(){
|
315 |
+
wp_enqueue_script( 'nxssnap-scripts', plugin_dir_url( __FILE__ ) . 'js/js.js', array( 'jquery' ), NextScripts_SNAP_Version);
|
316 |
wp_localize_script( 'nxssnap-scripts', 'MyAjax', array( 'ajaxurl' => nxs_get_admin_url( 'admin-ajax.php' ), 'nxsnapWPnonce' => wp_create_nonce( 'nxsnapWPnonce' ),));
|
317 |
}}
|
318 |
|
324 |
|
325 |
function cron_add_nxsreposter( $schedules ) { $schedules['nxsreposter'] = array( 'interval' => 90, 'display' => __( 'NXS Reposter' )); return $schedules;} // Do this every 90 seconds
|
326 |
|
327 |
+
function nxs_showNewPostForm($options) { global $nxs_snapAvNts, $nxs_plurl; ?>
|
328 |
+
<div id="nxsNewSNPost" style="width: 880px;">
|
329 |
+
|
330 |
+
<div><h2>New Post to the Configured Social Networks</h2></div>
|
331 |
+
<div class="nxsNPRow"><label class="nxsNPLabel">Title (Will be used where possible):</label><br/><input id="nxsNPTitle" type="text" size="80"></div>
|
332 |
+
<div class="nxsNPRow"><label class="nxsNPLabel">Message:</label><br/><textarea id="nxsNPText" name="textarea" cols="100" rows="8"></textarea></div>
|
333 |
+
|
334 |
+
<div class="nxsNPRow"><label class="nxsNPLabel">Post Type:</label><br/><input type="radio" name="nxsNPType" id="nxsNPTypeT" value="T" checked="checked" /><label class="nxsNPRowSm">Text Post</label><br/>
|
335 |
+
|
336 |
+
<br/><input type="radio" name="nxsNPType" id="nxsNPTypeL" value="A"><label class="nxsNPRowSm">Link Post</label>
|
337 |
+
<div class="nxsNPRowSm"><label class="nxsNPLabel">URL (Will be attached where possible, text post will be made where not):</label><br/><input id="nxsNPLink" onfocus="jQuery('#nxsNPTypeL').attr('checked', 'checked')" type="text" size="80" /></div>
|
338 |
+
<br/><input type="radio" name="nxsNPType" id="nxsNPTypeI" value="I"><label class="nxsNPRowSm">Image Post</label>
|
339 |
+
<div class="nxsNPRowSm"><label class="nxsNPLabel">Image URL (Will be used where possible, text post will be made where not):</label><br/><input id="nxsNPImg" onfocus="jQuery('#nxsNPTypeI').attr('checked', 'checked')" type="text" size="80" /></div>
|
340 |
+
</div>
|
341 |
+
<div class="nxsNPRow">
|
342 |
+
<div class="nxsNPLeft">
|
343 |
+
|
344 |
+
<div id="nxsNPLoaderPost" style="display: none";> <img src="<?php echo $nxs_plurl; ?>img/ajax-loader-med.gif" /> Posting...., it could take some time... </div>
|
345 |
+
|
346 |
+
<div class="submit"><input style="font-weight: bold; width: 70px;" type="button" onclick="nxs_doNP();" value="Post"> <input id="nxsNPCloseBt" style="width: 70px;" class="bClose" type="button" value="Cancel"></div>
|
347 |
+
<div id="nxsNPResult"> </div>
|
348 |
+
</div>
|
349 |
+
<div class="nxsNPRight">
|
350 |
+
|
351 |
+
<div class="nxsNPRow">
|
352 |
+
<div style="float: right; font-size: 12px;" >
|
353 |
+
<a href="#" onclick="jQuery('.nxsNPDoChb').attr('checked','checked'); return false;"><?php _e('Check All', 'nxs_snap'); ?></a> <a href="#" onclick="jQuery('.nxsNPDoChb').removeAttr('checked'); return false;"><?php _e('Uncheck All', 'nxs_snap'); ?></a>
|
354 |
+
</div>
|
355 |
+
<label class="nxsNPLabel">Networks:</label><br/>
|
356 |
+
<div class="nxsNPRow" style="font-size: 12px;">
|
357 |
+
<?php
|
358 |
+
foreach ($nxs_snapAvNts as $avNt) { $clName = 'nxs_snapClass'.$avNt['code']; $ntClInst = new $clName();
|
359 |
+
if ( isset($options[$avNt['lcode']]) && count($options[$avNt['lcode']])>0) { ?>
|
360 |
+
|
361 |
+
<div class="nsx_iconedTitle" style="margin-bottom:1px;background-image:url(<?php echo $nxs_plurl;?>img/<?php echo $avNt['lcode']; ?>16.png);"><?php echo $avNt['name']; ?><br/>
|
362 |
+
<?php $ntOpts = $options[$avNt['lcode']]; foreach ($ntOpts as $indx=>$pbo){ ?>
|
363 |
+
<input class="nxsNPDoChb" value="<?php echo $avNt['lcode']; ?>--<?php echo $indx; ?>" name="nxsNPNts" type="checkbox" <?php if ((int)$pbo['do'.$avNt['code']] == 1 && $pbo['catSel']!='1') echo "checked"; ?> />
|
364 |
+
|
365 |
+
<?php echo $avNt['name']; ?> <i style="color: #005800;"><?php if($pbo['nName']!='') echo "(".$pbo['nName'].")"; ?></i></br>
|
366 |
+
|
367 |
+
<?php } ?>
|
368 |
+
</div> <?php
|
369 |
+
} } ?>
|
370 |
+
</div>
|
371 |
+
|
372 |
+
</div>
|
373 |
+
</div>
|
374 |
+
</div>
|
375 |
+
</div>
|
376 |
+
|
377 |
+
<?php
|
378 |
+
}
|
379 |
+
function nxs_doNewNPPost($options){ global $nxs_snapAvNts, $nxs_plurl; $postResults = '';
|
380 |
+
if (!empty($_POST['mNts']) && is_array($_POST['mNts'])) { nxs_addToLogN('S', '-=== New Form Post requested ===-', 'Form', count($_POST['mNts']).' Networks', print_r($_POST['mNts'], true));
|
381 |
+
$message = array('title'=>'', 'text'=>'', 'siteName'=>'', 'url'=>'', 'imageURL'=>'', 'videoURL'=>'', 'tags'=>'', 'urlDescr'=>'', 'urlTitle'=>'');
|
382 |
+
if (get_magic_quotes_gpc() || $_POST['nxs_mqTest']=="\'") { $_POST['mText'] = stripslashes($_POST['mText']); $_POST['mTitle'] = stripslashes($_POST['mTitle']); }
|
383 |
+
$message['pText'] = $_POST['mText']; $message['pTitle'] = $_POST['mTitle'];
|
384 |
+
//## Get URL info
|
385 |
+
if (!empty($_POST['mLink']) && substr($_POST['mLink'], 0, 4)=='http') { $message['url'] = $_POST['mLink'];
|
386 |
+
$flds = array('id'=>$message['url'], 'scrape'=>'true'); $response = wp_remote_post('http://graph.facebook.com', array('body' => $flds));
|
387 |
+
if (is_wp_error($response)) $badOut['Error'] = print_r($response, true)." - ERROR"; else { $response = json_decode($response['body'], true);
|
388 |
+
if (!empty($response['description'])) $message['urlDescr'] = $response['description']; if (!empty($response['title'])) $message['urlTitle'] = $response['title'];
|
389 |
+
if (!empty($response['site_name'])) $message['siteName'] = $response['site_name'];
|
390 |
+
if (!empty($response['image'][0]['url'])) $message['imageURL'] = $response['image'][0]['url'];
|
391 |
+
}
|
392 |
+
}
|
393 |
+
if (!empty($_POST['mImg']) && substr($_POST['mImg'], 0, 4)=='http') $message['imageURL'] = $_POST['mImg'];
|
394 |
+
|
395 |
+
foreach ($_POST['mNts'] as $ntC){ $ntA = explode('--',$ntC); $ntOpts = $options[$ntA[0]][$ntA[1]];
|
396 |
+
if (!empty($ntOpts) && is_array($ntOpts)) { $logNT = $ntA[0]; $clName = 'nxs_class_SNAP_'.strtoupper($logNT);
|
397 |
+
$logNT = '<span style="color:#800000">'.strtoupper($logNT).'</span> - '.$ntOpts['nName'];
|
398 |
+
$ntOpts['postType'] = $_POST['mType']; $ntToPost = new $clName(); $ret = $ntToPost->doPostToNT($ntOpts, $message);
|
399 |
+
if (!is_array($ret) || $ret['isPosted']!='1') { //## Error
|
400 |
+
nxs_addToLogN('E', 'Error', $logNT, '-=ERROR=- '.print_r($ret, true), ''); $postResults .= $logNT ." - Error (Please see log)<br/>";
|
401 |
+
} else { // ## All Good - log it.
|
402 |
+
if (!empty($ret['postURL'])) $extInfo = '<a href="'.$ret['postURL'].'" target="_blank">Post Link</a>';
|
403 |
+
nxs_addToLogN('S', 'Posted', $logNT, 'OK - Message Posted ', $extInfo); $postResults .= $logNT ." - OK - ".$extInfo."<br/>";
|
404 |
+
}
|
405 |
+
}
|
406 |
+
} echo "Done. Results:<br/> ".$postResults; }
|
407 |
+
}
|
408 |
+
|
409 |
if (!function_exists("nxs_snapAjax")) { function nxs_snapAjax() { check_ajax_referer('nxsSsPageWPN'); global $plgn_NS_SNAutoPoster; if (!isset($plgn_NS_SNAutoPoster)) return; $options = $plgn_NS_SNAutoPoster->nxs_options;
|
410 |
if ($_POST['nxsact']=='getNTset') { $ii = $_POST['ii']; $nt = $_POST['nt']; $ntl = strtolower($nt); $pbo = $options[$ntl][$ii]; $pbo['ntInfo']['lcode'] = $ntl; $clName = 'nxs_snapClass'.$nt; $ntObj = new $clName();
|
411 |
$ntObj->showNTSettings($ii, $pbo);
|
412 |
}
|
413 |
+
if ($_POST['nxsact']=='getNewPostDlg') nxs_showNewPostForm($options);
|
414 |
+
if ($_POST['nxsact']=='doNewPost') nxs_doNewNPPost($options);
|
415 |
die();
|
416 |
}}
|
417 |
|
418 |
+
function nxs_admin_footer() {global $nxs_plurl; ?> <div style="display: none;" id="nxs_popupDiv"><span class="nxspButton bClose"><span>X</span></span>
|
419 |
+
<div id="nxsNPLoader" style="text-align: center; width: 100%; height: 80px; padding-top: 60px;";> <img src="<?php echo $nxs_plurl; ?>img/ajax-loader-med.gif" /> </div>
|
420 |
+
<div id="nxs_popupDivCont" style="right: 10px; top:10px; font-size: 16px; font-weight: lighter;"> </div></div> <?php
|
421 |
+
}
|
422 |
+
function nxs_admin_header() { wp_nonce_field( 'nxsSsPageWPN', 'nxsSsPageWPN_wpnonce' ); }
|
423 |
+
function nxs_popupCSS() {?><style type="text/css">
|
424 |
+
.nxspButton:hover { background-color: #1E1E1E;}
|
425 |
+
.nxspButton { background-color: #2B91AF; color: #FFFFFF; cursor: pointer; display: inline-block; text-align: center; text-decoration: none; border-radius: 6px 6px 6px 6px; box-shadow: none; font: bold 131% sans-serif; padding: 0 6px 2px; position: absolute; right: -7px; top: -7px;}
|
426 |
+
#nxs_spPopup, #nxs_popupDiv, #showLicForm{ min-height: 250px; z-index:999991; background-color: #FFFFFF; border-radius: 5px 5px 5px 5px; box-shadow: 0 0 3px 2px #999999; color: #111111; display: none; min-width: 850px; padding: 25px;}
|
427 |
+
#nxsNewSNPost .nxsNPLabel {position: relative;}
|
428 |
+
#nxsNewSNPost .nxsNPRow {position: relative; padding: 8px;}
|
429 |
+
#nxsNewSNPost input {position: relative; font-size: 16px;}
|
430 |
+
.nsx_iconedTitle {font-size: 17px; font-weight: bold; margin-bottom: 15px; padding-left: 20px; background-repeat: no-repeat; }
|
431 |
+
.nxsNPRowSm, .nxsNPRow .nsx_iconedTitle {font-size: 12px; }
|
432 |
+
.nxsNPLeft, .nxsNPRight {position: relative; float: left;}
|
433 |
+
.nxsNPLeft {width: 40%;} .nxsNPRight {width: 60%;}
|
434 |
+
|
435 |
+
|
436 |
+
</style><?php
|
437 |
+
}
|
438 |
+
|
439 |
+
add_action('admin_head', 'nxs_popupCSS');
|
440 |
+
add_action('in_admin_footer', 'nxs_admin_footer');
|
441 |
+
add_action('in_admin_header', 'nxs_admin_header');
|
442 |
|
443 |
//## Actions and filters
|
444 |
add_action('shutdown', 'nxs_psCron', 25); //add_action( 'transition_post_status', 'nxs_snapLogPublishTo', 10, 3 );
|
477 |
|
478 |
if ($isO || $isS) {
|
479 |
add_action( 'transition_post_status', 'nxs_snapLogPublishTo', 10, 3 );
|
480 |
+
/*
|
481 |
//## Whenever you publish a post, post to Social Networks
|
482 |
add_action('future_to_publish', 'nxs_snapPublishTo');
|
483 |
add_action('new_to_publish', 'nxs_snapPublishTo');
|
486 |
add_action('private_to_publish', 'nxs_snapPublishTo');
|
487 |
add_action('auto-draft_to_publish', 'nxs_snapPublishTo');
|
488 |
//## Add nxs_snapPublishTo to custom post types
|
489 |
+
*/
|
490 |
|
491 |
foreach ($nxs_snapAvNts as $avNt) { add_action('ns_doPublishTo'.$avNt['code'], 'nxs_doPublishTo'.$avNt['code'], 1, 2); }
|
492 |
foreach ($nxs_snapAvNts as $avNt) { add_action('wp_ajax_rePostTo'.$avNt['code'], 'nxs_rePostTo'.$avNt['code'].'_ajax'); }
|
504 |
|
505 |
if ($isO) {
|
506 |
add_action('admin_menu', 'NS_SNAutoPoster_ap');
|
507 |
+
add_action('admin_init', 'nxs_adminInitFunc2');
|
508 |
//## Initialize options on plugin activation
|
509 |
$myrelpath = preg_replace( '/.*wp-content.plugins./', '', __FILE__ );
|
510 |
add_action("activate_".$myrelpath, array(&$plgn_NS_SNAutoPoster, 'init'));
|
img/fl-bg.png
ADDED
Binary file
|
img/fl16.png
ADDED
Binary file
|
img/sc-bg.png
ADDED
Binary file
|
img/sc16.png
ADDED
Binary file
|
inc-cl/ap.api.php
CHANGED
@@ -62,8 +62,9 @@ if (!class_exists("nxs_class_SNAP_AP")) { class nxs_class_SNAP_AP {
|
|
62 |
//## Check settings
|
63 |
if (!is_array($options)) { $badOut['Error'] = 'No Options'; return $badOut; }
|
64 |
if (!isset($options['apAppAuthToken']) || trim($options['apAppAuthToken'])=='') { $badOut['Error'] = 'Not Authorized'; return $badOut; }
|
|
|
65 |
//## Format Post
|
66 |
-
$text = nxs_doFormatMsg($options['apTextFormat'], $message); $text = nsTrnc($text, 256);
|
67 |
//## Make Post
|
68 |
if (isset($message['imageURL'])) $img = trim(nxs_getImgfrOpt($message['imageURL'], $options['imgSize'])); else $img = '';
|
69 |
if ($options['attchImg']!=false && $img!='') $remoteImg = $this->createFile($img, $options['apAppAuthToken']); $ann = array();
|
62 |
//## Check settings
|
63 |
if (!is_array($options)) { $badOut['Error'] = 'No Options'; return $badOut; }
|
64 |
if (!isset($options['apAppAuthToken']) || trim($options['apAppAuthToken'])=='') { $badOut['Error'] = 'Not Authorized'; return $badOut; }
|
65 |
+
if (empty($options['imgSize'])) $options['imgSize'] = '';
|
66 |
//## Format Post
|
67 |
+
if (!empty($message['pText'])) $text = $message['pText']; else $text = nxs_doFormatMsg($options['apTextFormat'], $message); $text = nsTrnc($text, 256);
|
68 |
//## Make Post
|
69 |
if (isset($message['imageURL'])) $img = trim(nxs_getImgfrOpt($message['imageURL'], $options['imgSize'])); else $img = '';
|
70 |
if ($options['attchImg']!=false && $img!='') $remoteImg = $this->createFile($img, $options['apAppAuthToken']); $ann = array();
|
inc-cl/ap.php
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
//## NextScripts App.net Connection Class
|
3 |
$nxs_snapAvNts[] = array('code'=>'AP', 'lcode'=>'ap', 'name'=>'App.net');
|
4 |
|
5 |
-
if (!class_exists("nxs_snapClassAP")) { class nxs_snapClassAP {
|
6 |
//#### Show Common Settings
|
7 |
-
function showGenNTSettings($ntOpts){ global $nxs_plurl, $nxs_snapSetPgURL;
|
8 |
if ( isset($_GET['code']) && $_GET['code']!='' && (isset($_GET['auth']) && $_GET['auth']=='ap') ){ $at = $_GET['code'];
|
9 |
echo "-= This is normal technical authorization info that will dissapear (Unless you get some errors) =- <br/><br/><br/>";
|
10 |
$fbo = $ntOpts[$_GET['acc']]; $wprg = array(); $response = wp_remote_get('https://graph.facebook.com/nextscripts', $wprg);
|
@@ -31,8 +31,14 @@ if (!class_exists("nxs_snapClassAP")) { class nxs_snapClassAP {
|
|
31 |
<?php foreach ($ntOpts as $indx=>$pbo){ if (trim($pbo['nName']=='')) $pbo['nName'] = 'App.Net';
|
32 |
if (!isset($pbo[$ntInfo['lcode'].'OK']) || $pbo[$ntInfo['lcode'].'OK']=='') $pbo[$ntInfo['lcode'].'OK'] = (isset($pbo['appAppUserID']) && $pbo['appAppUserID']>1)?'1':'';
|
33 |
?>
|
34 |
-
|
35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
<?php if (isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);"><?php echo "*[".(substr_count($pbo['catSelEd'], ",")+1)."]*" ?></span><?php } ?>
|
37 |
<?php if (isset($pbo['rpstOn']) && (int)$pbo['rpstOn'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popReActive');" onmouseover="nxs_showPopUpInfo('popReActive', event);"><?php echo "*[R]*" ?></span><?php } ?>
|
38 |
<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>
|
@@ -52,7 +58,7 @@ if (!class_exists("nxs_snapClassAP")) { class nxs_snapClassAP {
|
|
52 |
if (!isset($options['nDays'])) $options['nDays'] = 0; if (!isset($options['qTLng'])) $options['qTLng'] = ''; if (!isset($options['attchImg'])) $options['attchImg'] = '';
|
53 |
if (!isset($options['appID'])) $options['appID'] = ''; if (!isset($options['appSec'])) $options['appSec'] = ''; ?>
|
54 |
<div id="doAP<?php echo $ii; ?>Div" class="insOneDiv<?php if ($isNew) echo " clNewNTSets"; ?>">
|
55 |
-
<input type="hidden"
|
56 |
<div class="nsx_iconedTitle" style="float: right; background-image: url(<?php echo $nxs_plurl; ?>img/ap16.png);"><a style="font-size: 12px;" target="_blank" href="http://www.nextscripts.com/setup-installation/app-net-social-networks-auto-poster-wordpress/"><?php $nType="App.Net"; printf( __( 'Detailed %s Installation/Configuration Instructions', 'nxs_snap' ), $nType); ?></a></div>
|
57 |
|
58 |
<div style="width:100%;"><strong><?php _e('Account Nickname', 'nxs_snap'); ?>:</strong> <i><?php _e('Just so you can easily identify it', 'nxs_snap'); ?></i> </div><input name="ap[<?php echo $ii; ?>][nName]" id="apnName<?php echo $ii; ?>" style="font-weight: bold; color: #005800; border: 1px solid #ACACAC; width: 40%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['nName'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" /><br/>
|
@@ -113,7 +119,7 @@ if (!class_exists("nxs_snapClassAP")) { class nxs_snapClassAP {
|
|
113 |
</div><?php
|
114 |
}
|
115 |
//#### Set Unit Settings from POST
|
116 |
-
function setNTSettings($post, $options){ $code =
|
117 |
foreach ($post as $ii => $pval){
|
118 |
if (isset($pval['appID']) && $pval['appID']!=''){ if (!isset($options[$ii])) $options[$ii] = array();
|
119 |
if (isset($pval['nName'])) $options[$ii]['nName'] = trim($pval['nName']);
|
@@ -135,7 +141,7 @@ if (!class_exists("nxs_snapClassAP")) { class nxs_snapClassAP {
|
|
135 |
if (isset($pval['delayDays'])) $options[$ii]['nDays'] = trim($pval['delayDays']);
|
136 |
if (isset($pval['delayHrs'])) $options[$ii]['nHrs'] = trim($pval['delayHrs']); if (isset($pval['delayMin'])) $options[$ii]['nMin'] = trim($pval['delayMin']);
|
137 |
if (isset($pval['qTLng'])) $options[$ii]['qTLng'] = trim($pval['qTLng']);
|
138 |
-
} elseif ((
|
139 |
} return $options;
|
140 |
}
|
141 |
//#### Show Post->Edit Meta Box Settings
|
@@ -241,7 +247,8 @@ if (!function_exists("nxs_doPublishToAP")) { //## Post to AP. // V3 - imgToUse -
|
|
241 |
if ($postID=='0') prr($ret); nxs_addToLogN('E', 'Error', $logNT, '-=ERROR=- '.print_r($ret, true), $extInfo);
|
242 |
} else { // ## All Good - log it.
|
243 |
if ($postID=='0') { nxs_addToLogN('S', 'Test', $logNT, 'OK - TEST Message Posted '); echo _e('OK - Message Posted, please see your '.$logNT.' Page. ', 'nxs_snap'); }
|
244 |
-
else { nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPosted'=>'1', 'pgID'=>$ret['postID'], 'postURL'=>$ret['postURL'], 'pDate'=>date('Y-m-d H:i:s')));
|
|
|
245 |
}
|
246 |
//## Return Result
|
247 |
if ($ret['isPosted']=='1') return 200; else return print_r($ret, true);
|
2 |
//## NextScripts App.net Connection Class
|
3 |
$nxs_snapAvNts[] = array('code'=>'AP', 'lcode'=>'ap', 'name'=>'App.net');
|
4 |
|
5 |
+
if (!class_exists("nxs_snapClassAP")) { class nxs_snapClassAP { var $ntInfo = array('code'=>'AP', 'lcode'=>'ap', 'name'=>'App.Net', 'defNName'=>'', 'tstReq' => true);
|
6 |
//#### Show Common Settings
|
7 |
+
function showGenNTSettings($ntOpts){ global $nxs_plurl, $nxs_snapSetPgURL; $ntInfo = $this->ntInfo;
|
8 |
if ( isset($_GET['code']) && $_GET['code']!='' && (isset($_GET['auth']) && $_GET['auth']=='ap') ){ $at = $_GET['code'];
|
9 |
echo "-= This is normal technical authorization info that will dissapear (Unless you get some errors) =- <br/><br/><br/>";
|
10 |
$fbo = $ntOpts[$_GET['acc']]; $wprg = array(); $response = wp_remote_get('https://graph.facebook.com/nextscripts', $wprg);
|
31 |
<?php foreach ($ntOpts as $indx=>$pbo){ if (trim($pbo['nName']=='')) $pbo['nName'] = 'App.Net';
|
32 |
if (!isset($pbo[$ntInfo['lcode'].'OK']) || $pbo[$ntInfo['lcode'].'OK']=='') $pbo[$ntInfo['lcode'].'OK'] = (isset($pbo['appAppUserID']) && $pbo['appAppUserID']>1)?'1':'';
|
33 |
?>
|
34 |
+
<p style="margin:0px;margin-left:5px;"> <img id="<?php echo $ntInfo['code'].$indx;?>LoadingImg" style="display: none;" src='<?php echo $nxs_plurl; ?>img/ajax-loader-sm.gif' />
|
35 |
+
|
36 |
+
<input value="0" name="<?php echo $ntInfo['lcode']; ?>[<?php echo $indx; ?>][apDo<?php echo $ntInfo['code']; ?>]" type="hidden" />
|
37 |
+
<?php if ((int)$pbo['do'.$ntInfo['code']] == 1 && isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <input type="radio" id="rbtn<?php echo $ntInfo['lcode'].$indx; ?>" checked="checked" onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);" /> <?php } else { ?>
|
38 |
+
<input value="1" name="<?php echo $ntInfo['lcode']; ?>[<?php echo $indx; ?>][apDo<?php echo $ntInfo['code']; ?>]" type="checkbox" <?php if ((int)$pbo['do'.$ntInfo['code']] == 1 && $pbo['catSel']!='1') echo "checked"; ?> />
|
39 |
+
|
40 |
+
<?php } ?>
|
41 |
+
|
42 |
<?php if (isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);"><?php echo "*[".(substr_count($pbo['catSelEd'], ",")+1)."]*" ?></span><?php } ?>
|
43 |
<?php if (isset($pbo['rpstOn']) && (int)$pbo['rpstOn'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popReActive');" onmouseover="nxs_showPopUpInfo('popReActive', event);"><?php echo "*[R]*" ?></span><?php } ?>
|
44 |
<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>
|
58 |
if (!isset($options['nDays'])) $options['nDays'] = 0; if (!isset($options['qTLng'])) $options['qTLng'] = ''; if (!isset($options['attchImg'])) $options['attchImg'] = '';
|
59 |
if (!isset($options['appID'])) $options['appID'] = ''; if (!isset($options['appSec'])) $options['appSec'] = ''; ?>
|
60 |
<div id="doAP<?php echo $ii; ?>Div" class="insOneDiv<?php if ($isNew) echo " clNewNTSets"; ?>">
|
61 |
+
<input type="hidden" value="0" id="apDoS<?php echo $ntU.$ii; ?>" />
|
62 |
<div class="nsx_iconedTitle" style="float: right; background-image: url(<?php echo $nxs_plurl; ?>img/ap16.png);"><a style="font-size: 12px;" target="_blank" href="http://www.nextscripts.com/setup-installation/app-net-social-networks-auto-poster-wordpress/"><?php $nType="App.Net"; printf( __( 'Detailed %s Installation/Configuration Instructions', 'nxs_snap' ), $nType); ?></a></div>
|
63 |
|
64 |
<div style="width:100%;"><strong><?php _e('Account Nickname', 'nxs_snap'); ?>:</strong> <i><?php _e('Just so you can easily identify it', 'nxs_snap'); ?></i> </div><input name="ap[<?php echo $ii; ?>][nName]" id="apnName<?php echo $ii; ?>" style="font-weight: bold; color: #005800; border: 1px solid #ACACAC; width: 40%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['nName'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" /><br/>
|
119 |
</div><?php
|
120 |
}
|
121 |
//#### Set Unit Settings from POST
|
122 |
+
function setNTSettings($post, $options){ $code = $this->ntInfo['code'];
|
123 |
foreach ($post as $ii => $pval){
|
124 |
if (isset($pval['appID']) && $pval['appID']!=''){ if (!isset($options[$ii])) $options[$ii] = array();
|
125 |
if (isset($pval['nName'])) $options[$ii]['nName'] = trim($pval['nName']);
|
141 |
if (isset($pval['delayDays'])) $options[$ii]['nDays'] = trim($pval['delayDays']);
|
142 |
if (isset($pval['delayHrs'])) $options[$ii]['nHrs'] = trim($pval['delayHrs']); if (isset($pval['delayMin'])) $options[$ii]['nMin'] = trim($pval['delayMin']);
|
143 |
if (isset($pval['qTLng'])) $options[$ii]['qTLng'] = trim($pval['qTLng']);
|
144 |
+
} elseif ( count($pval)==1 ) if (isset($pval['apDo'.$code])) $options[$ii]['do'.$code] = $pval['apDo'.$code]; else $options[$ii]['do'.$code] = 0;
|
145 |
} return $options;
|
146 |
}
|
147 |
//#### Show Post->Edit Meta Box Settings
|
247 |
if ($postID=='0') prr($ret); nxs_addToLogN('E', 'Error', $logNT, '-=ERROR=- '.print_r($ret, true), $extInfo);
|
248 |
} else { // ## All Good - log it.
|
249 |
if ($postID=='0') { nxs_addToLogN('S', 'Test', $logNT, 'OK - TEST Message Posted '); echo _e('OK - Message Posted, please see your '.$logNT.' Page. ', 'nxs_snap'); }
|
250 |
+
else { nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPosted'=>'1', 'pgID'=>$ret['postID'], 'postURL'=>$ret['postURL'], 'pDate'=>date('Y-m-d H:i:s')));
|
251 |
+
$extInfo .= ' | <a href="'.$ret['postURL'].'" target="_blank">Post Link</a>'; nxs_addToLogN('S', 'Posted', $logNT, 'OK - Message Posted ', $extInfo); }
|
252 |
}
|
253 |
//## Return Result
|
254 |
if ($ret['isPosted']=='1') return 200; else return print_r($ret, true);
|
inc-cl/apis/scOAuth.php
ADDED
@@ -0,0 +1,233 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
abstract class nxssc_SignatureMethod
|
4 |
+
{
|
5 |
+
abstract public function signing_base($request, $consumer, $token);
|
6 |
+
abstract public function sign($request, $consumer, $token);
|
7 |
+
public function check($request, $consumer, $token, $signature) {
|
8 |
+
$built = $this->sign($request, $consumer, $token);
|
9 |
+
return $built == $signature;
|
10 |
+
}
|
11 |
+
}
|
12 |
+
|
13 |
+
class nxssc_SigMethod_HMAC_SHA1 extends nxssc_SignatureMethod {
|
14 |
+
public $name = 'HMAC-SHA1';
|
15 |
+
public function signing_base($request, $consumer_secret, $token) {
|
16 |
+
$sig = array(rawurlencode($request['method']), rawurlencode($request['normalized_url']), rawurlencode($request['normalized_parameters']));
|
17 |
+
$key = sprintf("%s&", rawurlencode($consumer_secret));
|
18 |
+
if (isset($token)) $key .= rawurlencode($token->secret);
|
19 |
+
$raw = implode('&', $sig);
|
20 |
+
return array ($key, $raw);
|
21 |
+
}
|
22 |
+
public function sign($request, $consumer_secret, $token) {
|
23 |
+
$key_raw = $this->signing_base($request, $consumer_secret, $token);// prr($key_raw);
|
24 |
+
$basestring = base64_encode (hash_hmac('sha1', $key_raw[1], $key_raw[0], true)); //echo $basestring;
|
25 |
+
return rawurlencode($basestring);
|
26 |
+
}
|
27 |
+
|
28 |
+
public static function urlencode_rfc3986($input) {
|
29 |
+
if (is_array($input)) {
|
30 |
+
return array_map(array('nxssc_SigMethod_HMAC_SHA1', 'urlencode_rfc3986'), $input);
|
31 |
+
} else if (is_scalar($input)) {
|
32 |
+
return str_replace(
|
33 |
+
'+',
|
34 |
+
' ',
|
35 |
+
str_replace('%7E', '~', rawurlencode($input))
|
36 |
+
);
|
37 |
+
} else {
|
38 |
+
return '';
|
39 |
+
}
|
40 |
+
}
|
41 |
+
public function get_normalized_http_url($url) {
|
42 |
+
$parts = parse_url($url);
|
43 |
+
|
44 |
+
$port = @$parts['port'];
|
45 |
+
$scheme = $parts['scheme'];
|
46 |
+
$host = $parts['host'];
|
47 |
+
$path = @$parts['path'];
|
48 |
+
|
49 |
+
$port or $port = ($scheme == 'https') ? '443' : '80';
|
50 |
+
|
51 |
+
if (($scheme == 'https' && $port != '443')|| ($scheme == 'http' && $port != '80')) {
|
52 |
+
$host = "$host:$port";
|
53 |
+
}
|
54 |
+
return "$scheme://$host$path";
|
55 |
+
}
|
56 |
+
public function get_signature_base_string($url, $params) {
|
57 |
+
$parts = array( 'GET', $this->get_normalized_http_url($url), $params); //prr($parts);
|
58 |
+
$parts = $this->urlencode_rfc3986($parts);
|
59 |
+
return implode('&', $parts);
|
60 |
+
}
|
61 |
+
|
62 |
+
public function sign2($request, $consumer_secret, $token){
|
63 |
+
|
64 |
+
$base_string = $this->get_signature_base_string($request['normalized_url'], $request['normalized_parameters']);
|
65 |
+
//$request->base_string = $base_string;
|
66 |
+
|
67 |
+
//$key_parts = array( $consumer_secret); if ($token) $key_parts[] = $token->secret;
|
68 |
+
$key_parts = array( $consumer_secret, ($token) ? $token : "");
|
69 |
+
|
70 |
+
//$key_parts = array( $consumer_secret, "");
|
71 |
+
|
72 |
+
$key_parts = $this->urlencode_rfc3986($key_parts);
|
73 |
+
$key = implode('&', $key_parts); //prr($key); prr($base_string);
|
74 |
+
return rawurlencode(base64_encode(hash_hmac('sha1', $base_string, $key, true)));
|
75 |
+
}
|
76 |
+
|
77 |
+
|
78 |
+
public function check($request, $consumer_secret, $token, $signature) {
|
79 |
+
$built = $this->sign($request, $consumer_secret, $token);
|
80 |
+
return $built == $signature;
|
81 |
+
}
|
82 |
+
}
|
83 |
+
|
84 |
+
class wpScoopITOAuth{
|
85 |
+
public $baseURL = 'http://www.scoop.it';
|
86 |
+
public $request_token_path = '/oauth/request';
|
87 |
+
public $access_token_path = '/oauth/access';
|
88 |
+
public $http_code;
|
89 |
+
protected $version = '1.0';
|
90 |
+
protected $sign_method;
|
91 |
+
protected $request_token;
|
92 |
+
protected $access_token;
|
93 |
+
protected $access_secret;
|
94 |
+
protected $consumer_key;
|
95 |
+
protected $consumer_secret;
|
96 |
+
|
97 |
+
function __construct($consumer_key, $consumer_secret, $access_token = NULL, $access_secret = NULL) {
|
98 |
+
$this->sign_method = new nxssc_SigMethod_HMAC_SHA1();
|
99 |
+
$this->consumer_key = $consumer_key; $this->consumer_secret = $consumer_secret;
|
100 |
+
$this->access_token = $access_token; $this->access_secret = $access_secret;
|
101 |
+
// if (!empty($access_token) && !empty($access_secret)) $this->authorize($access_token, $access_secret);
|
102 |
+
}
|
103 |
+
|
104 |
+
function get_normalized_parameters($params) { $items = array();
|
105 |
+
foreach ($params as $key => $value) {
|
106 |
+
if ($key == 'oauth_signature') continue;
|
107 |
+
if (is_array($value)) $mtems = array_merge($value, $items); else $items[$key] = $value;
|
108 |
+
}
|
109 |
+
ksort($items);
|
110 |
+
$item_parts = array();
|
111 |
+
foreach ($items as $key => $value) {
|
112 |
+
$item_parts[] =
|
113 |
+
sprintf("%s=%s",rawurlencode($key),rawurlencode($value));
|
114 |
+
}
|
115 |
+
return implode('&', $item_parts);
|
116 |
+
}
|
117 |
+
function genRndString($length = 8) { $chars = '0123456789abcdefghijklmnopqrstuvwxyzz'; $string = '';
|
118 |
+
for ($p = 0; $p < $length; $p++) $string .= $chars[mt_rand(0, strlen($chars)-1)];
|
119 |
+
return $string;
|
120 |
+
}
|
121 |
+
function makeHTTPHeaders($ref, $post=false){ $hdrsArr = array();
|
122 |
+
$hdrsArr['X-Requested-With']='XMLHttpRequest'; $hdrsArr['Connection']='keep-alive'; $hdrsArr['Referer']=$ref;
|
123 |
+
$hdrsArr['User-Agent']='Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.22 Safari/537.11';
|
124 |
+
if($post) $hdrsArr['Content-Type']='application/x-www-form-urlencoded';
|
125 |
+
$hdrsArr['Accept']='application/json, text/javascript, */*; q=0.01';
|
126 |
+
$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;
|
127 |
+
}
|
128 |
+
|
129 |
+
function oAuthRespToArr($str){ $arr = explode('&', $str); $out = array();
|
130 |
+
foreach ($arr as $ar) { $strr = explode('=', $ar); $out[$strr[0]] = $strr[1];} return $out;
|
131 |
+
}
|
132 |
+
|
133 |
+
function getReqToken($cbu){
|
134 |
+
$args = array (
|
135 |
+
'oauth_consumer_key' => $this->consumer_key,
|
136 |
+
'oauth_timestamp' => time(),
|
137 |
+
'oauth_nonce' => $this->genRndString(),
|
138 |
+
'oauth_version' => $this->version,
|
139 |
+
'oauth_callback' => $cbu,
|
140 |
+
'oauth_signature_method' => 'HMAC-SHA1'
|
141 |
+
|
142 |
+
);
|
143 |
+
$req = array(); $req['method'] = 'GET'; $token = '';
|
144 |
+
$req['normalized_url'] = $this->baseURL.$this->request_token_path;
|
145 |
+
$req['normalized_parameters'] = $this->get_normalized_parameters($args);
|
146 |
+
$args['oauth_signature'] = $this->sign_method->sign2($req, $this->consumer_secret, $token);
|
147 |
+
$cbu = nxssc_SigMethod_HMAC_SHA1::urlencode_rfc3986($cbu);
|
148 |
+
$url = $this->baseURL.$this->request_token_path.'?oauth_nonce='.$args['oauth_nonce'].'&oauth_timestamp='.$args['oauth_timestamp'].'&oauth_consumer_key='.$this->consumer_key.'&oauth_signature_method='.$args['oauth_signature_method'].'&oauth_version='.$args['oauth_version'].'&oauth_callback='.$cbu.'&oauth_signature='.$args['oauth_signature'];
|
149 |
+
echo "<br/>REQ Token URL: ".$url."<br/>";
|
150 |
+
$hdrsArr = $this->makeHTTPHeaders($url); $ckArr = '';
|
151 |
+
$response = wp_remote_get($url, array( 'method' => 'GET', 'timeout' => 45, 'redirection' => 0, 'headers' => $hdrsArr, 'cookies' => $ckArr));
|
152 |
+
$this->http_code = $response['response']['code']; // prr($response);
|
153 |
+
if (stripos($response['body'],'oauth_token_secret=')===false) echo 'Bad oAuth Login:'.$response['body']; else return $this->oAuthRespToArr($response['body']);
|
154 |
+
}
|
155 |
+
function getAccToken($verifier){
|
156 |
+
$args = array (
|
157 |
+
'oauth_token' => $this->access_token,
|
158 |
+
'oauth_token_secret' => $this->access_secret,
|
159 |
+
'oauth_timestamp' => time(),
|
160 |
+
'oauth_nonce' => $this->genRndString(),
|
161 |
+
'oauth_version' => $this->version,
|
162 |
+
'oauth_consumer_key' => $this->consumer_key,
|
163 |
+
'oauth_verifier' => $verifier,
|
164 |
+
'oauth_signature_method' => 'HMAC-SHA1'
|
165 |
+
);
|
166 |
+
$req = array(); $req['method'] = 'GET'; $req['normalized_url'] = $this->baseURL.$this->access_token_path; // echo "ARGS:"; prr($args);
|
167 |
+
$req['normalized_parameters'] = $this->get_normalized_parameters($args);
|
168 |
+
$args['oauth_signature'] = $this->sign_method->sign2($req, $this->consumer_secret, $this->access_secret);
|
169 |
+
$url = $this->baseURL.$this->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'];
|
170 |
+
echo "<br/>REQ Token URL: ".$url."<br/>";
|
171 |
+
$hdrsArr = $this->makeHTTPHeaders($url); $ckArr = '';
|
172 |
+
$response = wp_remote_get($url, array( 'method' => 'GET', 'timeout' => 45, 'redirection' => 0, 'headers' => $hdrsArr, 'cookies' => $ckArr));
|
173 |
+
if ( is_wp_error($response) ) return $response;
|
174 |
+
$this->http_code = $response['response']['code'];
|
175 |
+
if (stripos($response['body'],'oauth_token_secret=')===false) echo 'Bad oAuth Login:'.$response['body']; else return $this->oAuthRespToArr($response['body']);
|
176 |
+
}
|
177 |
+
function makeReq($url, $params, $type='GET'){
|
178 |
+
$args = array (
|
179 |
+
'oauth_token' => $this->access_token,
|
180 |
+
'oauth_token_secret' => $this->access_secret,
|
181 |
+
'oauth_consumer_key' => $this->consumer_key,
|
182 |
+
'oauth_timestamp' => time(),
|
183 |
+
'oauth_nonce' => $this->genRndString(),
|
184 |
+
'oauth_version' => $this->version,
|
185 |
+
'oauth_signature_method' => 'HMAC-SHA1'
|
186 |
+
);
|
187 |
+
if (is_array($params)) { $argsTS = array_merge($args, $params);} else $argsTS = $args;
|
188 |
+
$req = array(); $req['method'] = $type; $req['normalized_url'] = $url;
|
189 |
+
// if (!empty($argsTS['photo'])) unset($argsTS['photo']);
|
190 |
+
$req['normalized_parameters'] = $this->get_normalized_parameters($argsTS); // prr($req);
|
191 |
+
$args['oauth_signature'] = $this->sign_method->sign2($req, $this->consumer_secret, $this->access_secret);
|
192 |
+
if (is_array($params)) { if (isset($params['tag']) && is_array($params['tag']) ) { $tags = $params['tag']; unset($params['tag']); $argsAddStr = ''; foreach ($tags as $tg) $argsAddStr .= '&tag='.urlencode($tg); }
|
193 |
+
$params = nxssc_SigMethod_HMAC_SHA1::urlencode_rfc3986($params); $args = array_merge($args, $params);
|
194 |
+
} $argsStr = ''; $argsT = array(); foreach ($args as $arN=>$arV){$argsT[] = $arN.'='.$arV;} $argsStr = implode('&', $argsT);
|
195 |
+
|
196 |
+
if ( $type=='GET') { $url .= '?'.$argsStr; $hdrsArr = $this->makeHTTPHeaders($url); $ckArr = ''; // prr($url);
|
197 |
+
$response = wp_remote_get($url, array( 'method' => 'GET', 'timeout' => 45, 'redirection' => 0, 'headers' => $hdrsArr)); //prr($response);
|
198 |
+
} else { $hdrsArr = $this->makeHTTPHeaders($url, true); if (!empty($argsAddStr)) $argsStr .= $argsAddStr;
|
199 |
+
$response = wp_remote_post($url, array( 'timeout' => 45, 'redirection' => 0, 'body'=>$argsStr, 'headers' => $hdrsArr));// prr($argsStr); prr($argsT); prr($response);
|
200 |
+
}
|
201 |
+
if ( is_wp_error($response) ) return $response;
|
202 |
+
$this->http_code = $response['response']['code']; $body = $response['body']; $body = maybe_unserialize($body); if (is_array($body)) return $body; else return json_decode($body, true);
|
203 |
+
}
|
204 |
+
|
205 |
+
private function joinParameters($parameters){ $keys = array_keys($parameters); sort($keys, SORT_STRING); $keyValuePairs = array();
|
206 |
+
foreach ($keys as $k) array_push($keyValuePairs, rawurlencode($k) . "=" . rawurlencode($parameters[$k])); return implode("&", $keyValuePairs);
|
207 |
+
}
|
208 |
+
private function sign($url, &$parameters) { $string = implode("&", array( 'POST', rawurlencode($url), rawurlencode($this->joinParameters($parameters))));
|
209 |
+
$parameters['oauth_signature'] = base64_encode(hash_hmac('sha1', $string, $this->consumer_secret.'&'.$this->access_secret, true));
|
210 |
+
}
|
211 |
+
private function httpRequest($url, $parameters) { $curl = curl_init();
|
212 |
+
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($curl, CURLOPT_TIMEOUT, '25'); curl_setopt($curl, CURLOPT_URL, $url);
|
213 |
+
curl_setopt($curl, CURLOPT_POST, TRUE); curl_setopt($curl, CURLOPT_POSTFIELDS, $parameters);
|
214 |
+
$response = curl_exec($curl); $headers = curl_getinfo($curl); $errmsg = curl_error($curl); curl_close($curl);
|
215 |
+
if (!empty($errmsg)) return $errmsg; else return $response;
|
216 |
+
}
|
217 |
+
|
218 |
+
public function flUploadPhoto ($imgFile, $parameters) { $url = 'http://www.flickr.com/services/upload/'; $requestParams = ($parameters == NULL ? array() : $parameters); $phid = '';
|
219 |
+
$oauthParams = array (
|
220 |
+
'oauth_nonce' => $this->genRndString(),
|
221 |
+
'oauth_timestamp' => time(),
|
222 |
+
'oauth_token' => $this->access_token,
|
223 |
+
'oauth_consumer_key' => $this->consumer_key,
|
224 |
+
'oauth_signature_method' => 'HMAC-SHA1',
|
225 |
+
'oauth_version' => '1.0',
|
226 |
+
);
|
227 |
+
$requestParams = array_merge($requestParams, $oauthParams); $this->sign($url, $requestParams); $requestParams['photo'] = $imgFile; // prr($requestParams);
|
228 |
+
$xml = $this->httpRequest($url, $requestParams); if (stripos($xml, '</photoid>')!==false && stripos($xml, 'stat="ok"')!==false) $phid = CutFromTo($xml, '<photoid>','</photoid>');
|
229 |
+
return empty($phid) ? "Problem: ".$xml."<pre>".print_r($requestParams, true)."</pre>" : $phid;
|
230 |
+
}
|
231 |
+
|
232 |
+
}
|
233 |
+
?>
|
inc-cl/bg.api.php
CHANGED
@@ -46,7 +46,8 @@ if (!class_exists("nxs_class_SNAP_BG")) { class nxs_class_SNAP_BG {
|
|
46 |
if (!is_array($options)) { $badOut['Error'] = 'No Options'; return $badOut; }
|
47 |
if (!isset($options['bgUName']) || trim($options['bgPass'])=='') { $badOut['Error'] = 'Not Configured'; return $badOut; }
|
48 |
//## Format
|
49 |
-
$msg =
|
|
|
50 |
if ($options['bgInclTags']=='1') $tags = nsTrnc($message['tags'], 195, ',', ''); else $tags = '';
|
51 |
//## Check/Fix HTML
|
52 |
if (class_exists('DOMDocument')) {$doc = new DOMDocument(); @$doc->loadHTML('<?xml encoding="UTF-8">' .$msg); $doc->encoding = 'UTF-8'; $msg = $doc->saveHTML(); $msg = CutFromTo($msg, '<body>', '</body>');
|
46 |
if (!is_array($options)) { $badOut['Error'] = 'No Options'; return $badOut; }
|
47 |
if (!isset($options['bgUName']) || trim($options['bgPass'])=='') { $badOut['Error'] = 'Not Configured'; return $badOut; }
|
48 |
//## Format
|
49 |
+
if (!empty($message['pText'])) $msg = $message['pText']; else $msg = nxs_doFormatMsg($options['bgMsgFormat'], $message);
|
50 |
+
if (!empty($message['pTitle'])) $msgT = $message['pTitle']; else $msgT = nxs_doFormatMsg($options['bgMsgTFormat'], $message);
|
51 |
if ($options['bgInclTags']=='1') $tags = nsTrnc($message['tags'], 195, ',', ''); else $tags = '';
|
52 |
//## Check/Fix HTML
|
53 |
if (class_exists('DOMDocument')) {$doc = new DOMDocument(); @$doc->loadHTML('<?xml encoding="UTF-8">' .$msg); $doc->encoding = 'UTF-8'; $msg = $doc->saveHTML(); $msg = CutFromTo($msg, '<body>', '</body>');
|
inc-cl/bg.php
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
//## NextScripts Facebook Connection Class
|
3 |
$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_plurl; $ntInfo =
|
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']; ?>
|
@@ -15,7 +15,10 @@ if (!class_exists("nxs_snapClassBG")) { class nxs_snapClassBG {
|
|
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;"><img id="<?php echo $ntInfo['code'].$indx;?>LoadingImg" style="display: none;" src='<?php echo $nxs_plurl; ?>img/ajax-loader-sm.gif' />
|
18 |
-
<input value="
|
|
|
|
|
|
|
19 |
<?php if (isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);"><?php echo "*[".(substr_count($pbo['catSelEd'], ",")+1)."]*" ?></span><?php } ?>
|
20 |
<?php if (isset($pbo['rpstOn']) && (int)$pbo['rpstOn'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popReActive');" onmouseover="nxs_showPopUpInfo('popReActive', event);"><?php echo "*[R]*" ?></span><?php } ?>
|
21 |
<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>
|
@@ -33,7 +36,7 @@ if (!class_exists("nxs_snapClassBG")) { class nxs_snapClassBG {
|
|
33 |
function showNTSettings($ii, $options, $isNew=false){ global $nxs_plurl; $nt = $options['ntInfo']['lcode']; $ntU = strtoupper($nt);
|
34 |
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'] = '';
|
35 |
if (!isset($options['nDays'])) $options['nDays'] = 0; if (!isset($options['qTLng'])) $options['qTLng'] = ''; ?>
|
36 |
-
<div id="doBG<?php echo $ii; ?>Div" class="insOneDiv<?php if ($isNew){ ?> clNewNTSets<?php } ?>"> <input type="hidden"
|
37 |
<?php if ($isNew) { ?> <input type="hidden" name="bg[<?php echo $ii; ?>][apDoBG]" value="1" id="apDoNewBG<?php echo $ii; ?>" /> <?php } ?>
|
38 |
|
39 |
<div style="display: none;"><input name="bg[<?php echo $ii; ?>][apBGPassChr]" id="apBGPassChr" type="password" value="" /></div>
|
@@ -107,7 +110,7 @@ if (!class_exists("nxs_snapClassBG")) { class nxs_snapClassBG {
|
|
107 |
|
108 |
}
|
109 |
//#### Set Unit Settings from POST
|
110 |
-
function setNTSettings($post, $options){
|
111 |
foreach ($post as $ii => $pval){// prr($pval);
|
112 |
if (isset($pval['apBGUName']) && trim($pval['apBGUName'])!='' && isset($pval['apBGPass']) && trim($pval['apBGPass'])!='') { if (!isset($options[$ii])) $options[$ii] = array();
|
113 |
|
@@ -130,7 +133,7 @@ if (!class_exists("nxs_snapClassBG")) { class nxs_snapClassBG {
|
|
130 |
if (isset($pval['delayHrs'])) $options[$ii]['nHrs'] = trim($pval['delayHrs']); if (isset($pval['delayMin'])) $options[$ii]['nMin'] = trim($pval['delayMin']);
|
131 |
if (isset($pval['qTLng'])) $options[$ii]['qTLng'] = trim($pval['qTLng']);
|
132 |
|
133 |
-
}
|
134 |
} return $options;
|
135 |
}
|
136 |
//#### Show Post->Edit Meta Box Settings
|
@@ -231,7 +234,8 @@ if (!function_exists("nxs_doPublishToBG")) { //## Second Function to Post to BG
|
|
231 |
if ($postID=='0') prr($ret); nxs_addToLogN('E', 'Error', $logNT, '-=ERROR=- '.print_r($ret, true), $extInfo);
|
232 |
} else { // ## All Good - log it.
|
233 |
if ($postID=='0') { nxs_addToLogN('S', 'Test', $logNT, 'OK - TEST Message Posted '); echo _e('OK - Message Posted, please see your '.$logNT.' Page. ', 'nxs_snap'); }
|
234 |
-
else { nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPosted'=>'1', 'pgID'=>$ret['postID'], 'pDate'=>date('Y-m-d H:i:s')));
|
|
|
235 |
}
|
236 |
//## Return Result
|
237 |
if ($ret['isPosted']=='1') return 200; else return print_r($ret, true);
|
2 |
//## NextScripts Facebook Connection Class
|
3 |
$nxs_snapAvNts[] = array('code'=>'BG', 'lcode'=>'bg', 'name'=>'Blogger');
|
4 |
|
5 |
+
if (!class_exists("nxs_snapClassBG")) { class nxs_snapClassBG { var $ntInfo = array('code'=>'BG', 'lcode'=>'bg', 'name'=>'Blogger', 'defNName'=>'bgUName', 'tstReq' => true);
|
6 |
//#### Show Common Settings
|
7 |
+
function showGenNTSettings($ntOpts){ global $nxs_plurl; $ntInfo = $this->ntInfo; ?>
|
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']; ?>
|
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;"><img id="<?php echo $ntInfo['code'].$indx;?>LoadingImg" style="display: none;" src='<?php echo $nxs_plurl; ?>img/ajax-loader-sm.gif' />
|
18 |
+
<input value="0" name="<?php echo $ntInfo['lcode']; ?>[<?php echo $indx; ?>][apDo<?php echo $ntInfo['code']; ?>]" type="hidden" />
|
19 |
+
<?php if ((int)$pbo['do'.$ntInfo['code']] == 1 && isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <input type="radio" id="rbtn<?php echo $ntInfo['lcode'].$indx; ?>" checked="checked" onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);" /> <?php } else { ?>
|
20 |
+
<input value="1" name="<?php echo $ntInfo['lcode']; ?>[<?php echo $indx; ?>][apDo<?php echo $ntInfo['code']; ?>]" type="checkbox" <?php if ((int)$pbo['do'.$ntInfo['code']] == 1 && $pbo['catSel']!='1') echo "checked"; ?> />
|
21 |
+
<?php } ?>
|
22 |
<?php if (isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);"><?php echo "*[".(substr_count($pbo['catSelEd'], ",")+1)."]*" ?></span><?php } ?>
|
23 |
<?php if (isset($pbo['rpstOn']) && (int)$pbo['rpstOn'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popReActive');" onmouseover="nxs_showPopUpInfo('popReActive', event);"><?php echo "*[R]*" ?></span><?php } ?>
|
24 |
<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>
|
36 |
function showNTSettings($ii, $options, $isNew=false){ global $nxs_plurl; $nt = $options['ntInfo']['lcode']; $ntU = strtoupper($nt);
|
37 |
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'] = '';
|
38 |
if (!isset($options['nDays'])) $options['nDays'] = 0; if (!isset($options['qTLng'])) $options['qTLng'] = ''; ?>
|
39 |
+
<div id="doBG<?php echo $ii; ?>Div" class="insOneDiv<?php if ($isNew){ ?> clNewNTSets<?php } ?>"> <input type="hidden" value="0" id="apDoS<?php echo $ntU.$ii; ?>" />
|
40 |
<?php if ($isNew) { ?> <input type="hidden" name="bg[<?php echo $ii; ?>][apDoBG]" value="1" id="apDoNewBG<?php echo $ii; ?>" /> <?php } ?>
|
41 |
|
42 |
<div style="display: none;"><input name="bg[<?php echo $ii; ?>][apBGPassChr]" id="apBGPassChr" type="password" value="" /></div>
|
110 |
|
111 |
}
|
112 |
//#### Set Unit Settings from POST
|
113 |
+
function setNTSettings($post, $options){ $code = $this->ntInfo['code'];
|
114 |
foreach ($post as $ii => $pval){// prr($pval);
|
115 |
if (isset($pval['apBGUName']) && trim($pval['apBGUName'])!='' && isset($pval['apBGPass']) && trim($pval['apBGPass'])!='') { if (!isset($options[$ii])) $options[$ii] = array();
|
116 |
|
133 |
if (isset($pval['delayHrs'])) $options[$ii]['nHrs'] = trim($pval['delayHrs']); if (isset($pval['delayMin'])) $options[$ii]['nMin'] = trim($pval['delayMin']);
|
134 |
if (isset($pval['qTLng'])) $options[$ii]['qTLng'] = trim($pval['qTLng']);
|
135 |
|
136 |
+
} elseif ( count($pval)==1 ) if (isset($pval['apDo'.$code])) $options[$ii]['do'.$code] = $pval['apDo'.$code]; else $options[$ii]['do'.$code] = 0;
|
137 |
} return $options;
|
138 |
}
|
139 |
//#### Show Post->Edit Meta Box Settings
|
234 |
if ($postID=='0') prr($ret); nxs_addToLogN('E', 'Error', $logNT, '-=ERROR=- '.print_r($ret, true), $extInfo);
|
235 |
} else { // ## All Good - log it.
|
236 |
if ($postID=='0') { nxs_addToLogN('S', 'Test', $logNT, 'OK - TEST Message Posted '); echo _e('OK - Message Posted, please see your '.$logNT.' Page. ', 'nxs_snap'); }
|
237 |
+
else { nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPosted'=>'1', 'pgID'=>$ret['postID'], 'pDate'=>date('Y-m-d H:i:s')));
|
238 |
+
$extInfo .= ' | <a href="'.$ret['postURL'].'" target="_blank">Post Link</a>'; nxs_addToLogN('S', 'Posted', $logNT, 'OK - Message Posted ', $extInfo); }
|
239 |
}
|
240 |
//## Return Result
|
241 |
if ($ret['isPosted']=='1') return 200; else return print_r($ret, true);
|
inc-cl/da.api.php
CHANGED
@@ -63,7 +63,8 @@ if (!class_exists("nxs_class_SNAP_DA")) { class nxs_class_SNAP_DA {
|
|
63 |
if (!is_array($options)) { $badOut['Error'] = 'No Options'; return $badOut; }
|
64 |
if (!isset($options['daUName']) || trim($options['daUName'])=='' || !isset($options['daPass']) || trim($options['daPass'])=='') { $badOut['Error'] = 'No username/password Found'; return $badOut; }
|
65 |
//## Format Post
|
66 |
-
$title = nxs_doFormatMsg($options['daTitleFormat'], $message); $title = nsTrnc($title, 300);
|
|
|
67 |
//## Make Post
|
68 |
$pass = substr($options['daPass'], 0, 5)=='n5g9a'?nsx_doDecode(substr($options['daPass'], 5)):$options['daPass']; $hdrsArr = nxs_getDAHeaders('http://okapy6.deviantart.com/journal/?edit', 'https://www.deviantart.com');
|
69 |
$loginInfo = doConnectToDeviantART($options['daUName'], $pass); if (!is_array($loginInfo)) { $badOut['Error'] = print_r($loginInfo, true)." - ERROR"; return $badOut; }
|
63 |
if (!is_array($options)) { $badOut['Error'] = 'No Options'; return $badOut; }
|
64 |
if (!isset($options['daUName']) || trim($options['daUName'])=='' || !isset($options['daPass']) || trim($options['daPass'])=='') { $badOut['Error'] = 'No username/password Found'; return $badOut; }
|
65 |
//## Format Post
|
66 |
+
if (!empty($message['pTitle'])) $title = $message['pTitle']; else $title = nxs_doFormatMsg($options['daTitleFormat'], $message); $title = nsTrnc($title, 300);
|
67 |
+
if (!empty($message['pText'])) $text = $message['pText']; else $text = nxs_doFormatMsg($options['daTextFormat'], $message);
|
68 |
//## Make Post
|
69 |
$pass = substr($options['daPass'], 0, 5)=='n5g9a'?nsx_doDecode(substr($options['daPass'], 5)):$options['daPass']; $hdrsArr = nxs_getDAHeaders('http://okapy6.deviantart.com/journal/?edit', 'https://www.deviantart.com');
|
70 |
$loginInfo = doConnectToDeviantART($options['daUName'], $pass); if (!is_array($loginInfo)) { $badOut['Error'] = print_r($loginInfo, true)." - ERROR"; return $badOut; }
|
inc-cl/da.php
CHANGED
@@ -16,7 +16,10 @@ if (!class_exists("nxs_snapClassDA")) { class nxs_snapClassDA {
|
|
16 |
<?php if(!function_exists('doConnectToDeviantART')) {?> deviantART 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/deviantart-automated-posting">library module</a> to be able to publish your content to deviantART.
|
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;"> <img id="<?php echo $ntInfo['code'].$indx;?>LoadingImg" style="display: none;" src='<?php echo $nxs_plurl; ?>img/ajax-loader-sm.gif' />
|
19 |
-
<input value="
|
|
|
|
|
|
|
20 |
<?php if (isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);"><?php echo "*[".(substr_count($pbo['catSelEd'], ",")+1)."]*" ?></span><?php } ?>
|
21 |
<?php if (isset($pbo['rpstOn']) && (int)$pbo['rpstOn'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popReActive');" onmouseover="nxs_showPopUpInfo('popReActive', event);"><?php echo "*[R]*" ?></span><?php } ?>
|
22 |
<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>
|
@@ -33,7 +36,7 @@ if (!class_exists("nxs_snapClassDA")) { class nxs_snapClassDA {
|
|
33 |
function showNTSettings($ii, $options, $isNew=false){ global $nxs_plurl; $nt = $options['ntInfo']['lcode']; $ntU = strtoupper($nt);
|
34 |
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'] = '';
|
35 |
if (!isset($options['nDays'])) $options['nDays'] = 0; if (!isset($options['qTLng'])) $options['qTLng'] = ''; ?>
|
36 |
-
<div id="doDA<?php echo $ii; ?>Div" class="insOneDiv<?php if ($isNew) echo " clNewNTSets"; ?>"> <input type="hidden"
|
37 |
|
38 |
<?php if(!function_exists('doConnectToDeviantART')) {?><span style="color:#580000; font-size: 16px;"><br/><br/>
|
39 |
<b><?php _e('deviantART API Library not found', 'nxs_snap'); ?></b>
|
@@ -117,7 +120,7 @@ if (!class_exists("nxs_snapClassDA")) { class nxs_snapClassDA {
|
|
117 |
if (isset($pval['delayDays'])) $options[$ii]['nDays'] = trim($pval['delayDays']);
|
118 |
if (isset($pval['delayHrs'])) $options[$ii]['nHrs'] = trim($pval['delayHrs']); if (isset($pval['delayMin'])) $options[$ii]['nMin'] = trim($pval['delayMin']);
|
119 |
if (isset($pval['qTLng'])) $options[$ii]['qTLng'] = trim($pval['qTLng']);
|
120 |
-
} elseif ((
|
121 |
} return $options;
|
122 |
}
|
123 |
//#### Show Post->Edit Meta Box Settings
|
16 |
<?php if(!function_exists('doConnectToDeviantART')) {?> deviantART 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/deviantart-automated-posting">library module</a> to be able to publish your content to deviantART.
|
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;"> <img id="<?php echo $ntInfo['code'].$indx;?>LoadingImg" style="display: none;" src='<?php echo $nxs_plurl; ?>img/ajax-loader-sm.gif' />
|
19 |
+
<input value="0" name="<?php echo $ntInfo['lcode']; ?>[<?php echo $indx; ?>][apDo<?php echo $ntInfo['code']; ?>]" type="hidden" />
|
20 |
+
<?php if ((int)$pbo['do'.$ntInfo['code']] == 1 && isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <input type="radio" id="rbtn<?php echo $ntInfo['lcode'].$indx; ?>" checked="checked" onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);" /> <?php } else { ?>
|
21 |
+
<input value="1" name="<?php echo $ntInfo['lcode']; ?>[<?php echo $indx; ?>][apDo<?php echo $ntInfo['code']; ?>]" type="checkbox" <?php if ((int)$pbo['do'.$ntInfo['code']] == 1 && $pbo['catSel']!='1') echo "checked"; ?> />
|
22 |
+
<?php } ?>
|
23 |
<?php if (isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);"><?php echo "*[".(substr_count($pbo['catSelEd'], ",")+1)."]*" ?></span><?php } ?>
|
24 |
<?php if (isset($pbo['rpstOn']) && (int)$pbo['rpstOn'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popReActive');" onmouseover="nxs_showPopUpInfo('popReActive', event);"><?php echo "*[R]*" ?></span><?php } ?>
|
25 |
<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>
|
36 |
function showNTSettings($ii, $options, $isNew=false){ global $nxs_plurl; $nt = $options['ntInfo']['lcode']; $ntU = strtoupper($nt);
|
37 |
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'] = '';
|
38 |
if (!isset($options['nDays'])) $options['nDays'] = 0; if (!isset($options['qTLng'])) $options['qTLng'] = ''; ?>
|
39 |
+
<div id="doDA<?php echo $ii; ?>Div" class="insOneDiv<?php if ($isNew) echo " clNewNTSets"; ?>"> <input type="hidden" value="0" id="apDoS<?php echo $ntU.$ii; ?>" />
|
40 |
|
41 |
<?php if(!function_exists('doConnectToDeviantART')) {?><span style="color:#580000; font-size: 16px;"><br/><br/>
|
42 |
<b><?php _e('deviantART API Library not found', 'nxs_snap'); ?></b>
|
120 |
if (isset($pval['delayDays'])) $options[$ii]['nDays'] = trim($pval['delayDays']);
|
121 |
if (isset($pval['delayHrs'])) $options[$ii]['nHrs'] = trim($pval['delayHrs']); if (isset($pval['delayMin'])) $options[$ii]['nMin'] = trim($pval['delayMin']);
|
122 |
if (isset($pval['qTLng'])) $options[$ii]['qTLng'] = trim($pval['qTLng']);
|
123 |
+
} elseif ( count($pval)==1 ) if (isset($pval['apDo'.$code])) $options[$ii]['do'.$code] = $pval['apDo'.$code]; else $options[$ii]['do'.$code] = 0;
|
124 |
} return $options;
|
125 |
}
|
126 |
//#### Show Post->Edit Meta Box Settings
|
inc-cl/di.api.php
CHANGED
@@ -25,7 +25,8 @@ if (!class_exists("nxs_class_SNAP_DI")) { class nxs_class_SNAP_DI {
|
|
25 |
if (!isset($options['diUName']) || trim($options['diPass'])=='') { $badOut['Error'] = 'Not Configured'; return $badOut; }
|
26 |
$email = $options['diUName']; $pass = substr($options['diPass'], 0, 5)=='n5g9a'?nsx_doDecode(substr($options['diPass'], 5)):$options['diPass3'];
|
27 |
//## Format
|
28 |
-
$msg =
|
|
|
29 |
$flds = array(); $flds['key']=$options['diAPIKey']; $flds['url']=$message['url']; $flds['title']=nsTrnc($msgT, 250); $flds['desc']=nsTrnc($msg, 250); $flds['tags']=$message['tags']; $flds['shared']='yes'; // prr($flds); die();
|
30 |
$hdrsArr = $this->nxs_getDIHeaders('https://secure.diigo.com/api/v2/bookmarks', $email, $pass, true);
|
31 |
$cnt = wp_remote_post( 'https://secure.diigo.com/api/v2/bookmarks', array( 'method' => 'POST', 'timeout' => 45, 'redirection' => 0, 'headers' => $hdrsArr, 'body' => $flds));
|
25 |
if (!isset($options['diUName']) || trim($options['diPass'])=='') { $badOut['Error'] = 'Not Configured'; return $badOut; }
|
26 |
$email = $options['diUName']; $pass = substr($options['diPass'], 0, 5)=='n5g9a'?nsx_doDecode(substr($options['diPass'], 5)):$options['diPass3'];
|
27 |
//## Format
|
28 |
+
if (!empty($message['pText'])) $msg = $message['pText']; else $msg = nxs_doFormatMsg($options['diMsgFormat'], $message);
|
29 |
+
if (!empty($message['pTitle'])) $msgT = $message['pTitle']; else $msgT = nxs_doFormatMsg($options['diMsgTFormat'], $message);
|
30 |
$flds = array(); $flds['key']=$options['diAPIKey']; $flds['url']=$message['url']; $flds['title']=nsTrnc($msgT, 250); $flds['desc']=nsTrnc($msg, 250); $flds['tags']=$message['tags']; $flds['shared']='yes'; // prr($flds); die();
|
31 |
$hdrsArr = $this->nxs_getDIHeaders('https://secure.diigo.com/api/v2/bookmarks', $email, $pass, true);
|
32 |
$cnt = wp_remote_post( 'https://secure.diigo.com/api/v2/bookmarks', array( 'method' => 'POST', 'timeout' => 45, 'redirection' => 0, 'headers' => $hdrsArr, 'body' => $flds));
|
inc-cl/di.php
CHANGED
@@ -16,7 +16,10 @@ if (!class_exists("nxs_snapClassDI")) { class nxs_snapClassDI {
|
|
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;"> <img id="<?php echo $ntInfo['code'].$indx;?>LoadingImg" style="display: none;" src='<?php echo $nxs_plurl; ?>img/ajax-loader-sm.gif' />
|
19 |
-
<input value="
|
|
|
|
|
|
|
20 |
<?php if (isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);"><?php echo "*[".(substr_count($pbo['catSelEd'], ",")+1)."]*" ?></span><?php } ?>
|
21 |
<?php if (isset($pbo['rpstOn']) && (int)$pbo['rpstOn'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popReActive');" onmouseover="nxs_showPopUpInfo('popReActive', event);"><?php echo "*[R]*" ?></span><?php } ?>
|
22 |
<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>
|
@@ -118,7 +121,7 @@ if (!class_exists("nxs_snapClassDI")) { class nxs_snapClassDI {
|
|
118 |
if (isset($pval['delayDays'])) $options[$ii]['nDays'] = trim($pval['delayDays']);
|
119 |
if (isset($pval['delayHrs'])) $options[$ii]['nHrs'] = trim($pval['delayHrs']); if (isset($pval['delayMin'])) $options[$ii]['nMin'] = trim($pval['delayMin']);
|
120 |
if (isset($pval['qTLng'])) $options[$ii]['qTLng'] = trim($pval['qTLng']);
|
121 |
-
} elseif ((
|
122 |
} return $options;
|
123 |
}
|
124 |
//#### Show Post->Edit Meta Box Settings
|
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;"> <img id="<?php echo $ntInfo['code'].$indx;?>LoadingImg" style="display: none;" src='<?php echo $nxs_plurl; ?>img/ajax-loader-sm.gif' />
|
19 |
+
<input value="0" name="<?php echo $ntInfo['lcode']; ?>[<?php echo $indx; ?>][apDo<?php echo $ntInfo['code']; ?>]" type="hidden" />
|
20 |
+
<?php if ((int)$pbo['do'.$ntInfo['code']] == 1 && isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <input type="radio" id="rbtn<?php echo $ntInfo['lcode'].$indx; ?>" checked="checked" onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);" /> <?php } else { ?>
|
21 |
+
<input value="1" name="<?php echo $ntInfo['lcode']; ?>[<?php echo $indx; ?>][apDo<?php echo $ntInfo['code']; ?>]" type="checkbox" <?php if ((int)$pbo['do'.$ntInfo['code']] == 1 && $pbo['catSel']!='1') echo "checked"; ?> />
|
22 |
+
<?php } ?>
|
23 |
<?php if (isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);"><?php echo "*[".(substr_count($pbo['catSelEd'], ",")+1)."]*" ?></span><?php } ?>
|
24 |
<?php if (isset($pbo['rpstOn']) && (int)$pbo['rpstOn'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popReActive');" onmouseover="nxs_showPopUpInfo('popReActive', event);"><?php echo "*[R]*" ?></span><?php } ?>
|
25 |
<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>
|
121 |
if (isset($pval['delayDays'])) $options[$ii]['nDays'] = trim($pval['delayDays']);
|
122 |
if (isset($pval['delayHrs'])) $options[$ii]['nHrs'] = trim($pval['delayHrs']); if (isset($pval['delayMin'])) $options[$ii]['nMin'] = trim($pval['delayMin']);
|
123 |
if (isset($pval['qTLng'])) $options[$ii]['qTLng'] = trim($pval['qTLng']);
|
124 |
+
} elseif ( count($pval)==1 ) if (isset($pval['apDo'.$code])) $options[$ii]['do'.$code] = $pval['apDo'.$code]; else $options[$ii]['do'.$code] = 0;
|
125 |
} return $options;
|
126 |
}
|
127 |
//#### Show Post->Edit Meta Box Settings
|
inc-cl/dl.api.php
CHANGED
@@ -25,7 +25,8 @@ if (!class_exists("nxs_class_SNAP_DL")) { class nxs_class_SNAP_DL {
|
|
25 |
if (!isset($options['dlUName']) || trim($options['dlPass'])=='') { $badOut['Error'] = 'Not Configured'; return $badOut; }
|
26 |
$email = $options['dlUName']; $pass = substr($options['dlPass'], 0, 5)=='n5g9a'?nsx_doDecode(substr($options['dlPass'], 5)):$options['dlPass'];
|
27 |
//## Format
|
28 |
-
|
|
|
29 |
|
30 |
$api = "api.del.icio.us/v1"; $link = urlencode($message['url']); $desc = urlencode(substr($msgT, 0, 250)); $ext = urlencode(substr($msg, 0, 1000));
|
31 |
$apicall = "https://$api/posts/add?red=api&url=$link&description=$desc&extended=$ext&tags=$tags";
|
25 |
if (!isset($options['dlUName']) || trim($options['dlPass'])=='') { $badOut['Error'] = 'Not Configured'; return $badOut; }
|
26 |
$email = $options['dlUName']; $pass = substr($options['dlPass'], 0, 5)=='n5g9a'?nsx_doDecode(substr($options['dlPass'], 5)):$options['dlPass'];
|
27 |
//## Format
|
28 |
+
if (!empty($message['pText'])) $msg = $message['pText']; else $msg = nxs_doFormatMsg($options['dlMsgFormat'], $message);
|
29 |
+
if (!empty($message['pTitle'])) $msgT = $message['pTitle']; else $msgT = nxs_doFormatMsg($options['dlMsgTFormat'], $message); $tags = nsTrnc($message['tags'], 195, ',', '');
|
30 |
|
31 |
$api = "api.del.icio.us/v1"; $link = urlencode($message['url']); $desc = urlencode(substr($msgT, 0, 250)); $ext = urlencode(substr($msg, 0, 1000));
|
32 |
$apicall = "https://$api/posts/add?red=api&url=$link&description=$desc&extended=$ext&tags=$tags";
|
inc-cl/dl.php
CHANGED
@@ -15,7 +15,10 @@ if (!class_exists("nxs_snapClassDL")) { class nxs_snapClassDL {
|
|
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;"> <img id="<?php echo $ntInfo['code'].$indx;?>LoadingImg" style="display: none;" src='<?php echo $nxs_plurl; ?>img/ajax-loader-sm.gif' />
|
18 |
-
<input value="
|
|
|
|
|
|
|
19 |
<?php if (isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);"><?php echo "*[".(substr_count($pbo['catSelEd'], ",")+1)."]*" ?></span><?php } ?>
|
20 |
<?php if (isset($pbo['rpstOn']) && (int)$pbo['rpstOn'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popReActive');" onmouseover="nxs_showPopUpInfo('popReActive', event);"><?php echo "*[R]*" ?></span><?php } ?>
|
21 |
<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>
|
@@ -108,7 +111,7 @@ if (!class_exists("nxs_snapClassDL")) { class nxs_snapClassDL {
|
|
108 |
if (isset($pval['delayDays'])) $options[$ii]['nDays'] = trim($pval['delayDays']);
|
109 |
if (isset($pval['delayHrs'])) $options[$ii]['nHrs'] = trim($pval['delayHrs']); if (isset($pval['delayMin'])) $options[$ii]['nMin'] = trim($pval['delayMin']);
|
110 |
if (isset($pval['qTLng'])) $options[$ii]['qTLng'] = trim($pval['qTLng']);
|
111 |
-
} elseif ((
|
112 |
} return $options;
|
113 |
}
|
114 |
//#### Show Post->Edit Meta Box Settings
|
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;"> <img id="<?php echo $ntInfo['code'].$indx;?>LoadingImg" style="display: none;" src='<?php echo $nxs_plurl; ?>img/ajax-loader-sm.gif' />
|
18 |
+
<input value="0" name="<?php echo $ntInfo['lcode']; ?>[<?php echo $indx; ?>][apDo<?php echo $ntInfo['code']; ?>]" type="hidden" />
|
19 |
+
<?php if ((int)$pbo['do'.$ntInfo['code']] == 1 && isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <input type="radio" id="rbtn<?php echo $ntInfo['lcode'].$indx; ?>" checked="checked" onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);" /> <?php } else { ?>
|
20 |
+
<input value="1" name="<?php echo $ntInfo['lcode']; ?>[<?php echo $indx; ?>][apDo<?php echo $ntInfo['code']; ?>]" type="checkbox" <?php if ((int)$pbo['do'.$ntInfo['code']] == 1 && $pbo['catSel']!='1') echo "checked"; ?> />
|
21 |
+
<?php } ?>
|
22 |
<?php if (isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);"><?php echo "*[".(substr_count($pbo['catSelEd'], ",")+1)."]*" ?></span><?php } ?>
|
23 |
<?php if (isset($pbo['rpstOn']) && (int)$pbo['rpstOn'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popReActive');" onmouseover="nxs_showPopUpInfo('popReActive', event);"><?php echo "*[R]*" ?></span><?php } ?>
|
24 |
<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>
|
111 |
if (isset($pval['delayDays'])) $options[$ii]['nDays'] = trim($pval['delayDays']);
|
112 |
if (isset($pval['delayHrs'])) $options[$ii]['nHrs'] = trim($pval['delayHrs']); if (isset($pval['delayMin'])) $options[$ii]['nMin'] = trim($pval['delayMin']);
|
113 |
if (isset($pval['qTLng'])) $options[$ii]['qTLng'] = trim($pval['qTLng']);
|
114 |
+
} elseif ( count($pval)==1 ) if (isset($pval['apDo'.$code])) $options[$ii]['do'.$code] = $pval['apDo'.$code]; else $options[$ii]['do'.$code] = 0;
|
115 |
} return $options;
|
116 |
}
|
117 |
//#### Show Post->Edit Meta Box Settings
|
inc-cl/fb.api.php
CHANGED
@@ -21,11 +21,11 @@ if (!class_exists("nxs_class_SNAP_FB")) { class nxs_class_SNAP_FB {
|
|
21 |
|
22 |
//## Some OLD Format Conversion
|
23 |
if (!isset($options['attachType']) && isset($options['fbAttch'])) $options['attachType'] = $options['fbAttch'];
|
24 |
-
if (!isset($options['postType']) && isset($options['fbPostType'])) $options['postType'] = $options['fbPostType']; $fbPostType = $options['postType'];
|
25 |
if (!isset($options['pgID']) && isset($options['fbPgID'])) $options['pgID'] = $options['fbPgID'];
|
26 |
|
27 |
//## Get URL info.
|
28 |
-
if ($fbPostType!='I' && $fbPostType!='T' && isset($options['useFBGURLInfo']) && $options['useFBGURLInfo']=='1') { $url = $message['url'];
|
29 |
$flds = array('id'=>$url, 'scrape'=>'true'); $response = wp_remote_post('http://graph.facebook.com', array('body' => $flds));
|
30 |
if (is_wp_error($response)) $badOut['Error'] = print_r($response, true)." - ERROR"; else { $response = json_decode($response['body'], true); // prr($response); die();
|
31 |
if (!empty($response['description'])) $message['urlDescr'] = $response['description']; if (!empty($response['title'])) $message['urlTitle'] = $response['title'];
|
@@ -33,7 +33,8 @@ if (!class_exists("nxs_class_SNAP_FB")) { class nxs_class_SNAP_FB {
|
|
33 |
if (!empty($response['image'][0]['url'])) $message['imageURL'] = $response['image'][0]['url'];
|
34 |
}
|
35 |
} // prr($message);
|
36 |
-
|
|
|
37 |
$attachType = $options['attachType']; if ($attachType=='1') $attachType = 'A'; else $attachType = 'S';
|
38 |
if ($options['imgUpl']!='2') $options['imgUpl'] = 'T'; else $options['imgUpl'] = 'A'; $page_id = $options['pgID'];
|
39 |
$msg = strip_tags($msg); $msg = str_ireplace('<(")','<(")', $msg); //## FB Smiles FIX 3
|
21 |
|
22 |
//## Some OLD Format Conversion
|
23 |
if (!isset($options['attachType']) && isset($options['fbAttch'])) $options['attachType'] = $options['fbAttch'];
|
24 |
+
if (!isset($options['postType']) && isset($options['fbPostType'])) $options['postType'] = $options['fbPostType']; $fbPostType = $options['postType']; //## Compatibility with v <3.2
|
25 |
if (!isset($options['pgID']) && isset($options['fbPgID'])) $options['pgID'] = $options['fbPgID'];
|
26 |
|
27 |
//## Get URL info.
|
28 |
+
if ($fbPostType!='I' && $fbPostType!='T' && isset($options['useFBGURLInfo']) && $options['useFBGURLInfo']=='1') { $url = $message['url'];
|
29 |
$flds = array('id'=>$url, 'scrape'=>'true'); $response = wp_remote_post('http://graph.facebook.com', array('body' => $flds));
|
30 |
if (is_wp_error($response)) $badOut['Error'] = print_r($response, true)." - ERROR"; else { $response = json_decode($response['body'], true); // prr($response); die();
|
31 |
if (!empty($response['description'])) $message['urlDescr'] = $response['description']; if (!empty($response['title'])) $message['urlTitle'] = $response['title'];
|
33 |
if (!empty($response['image'][0]['url'])) $message['imageURL'] = $response['image'][0]['url'];
|
34 |
}
|
35 |
} // prr($message);
|
36 |
+
if (!empty($message['pText'])) $msg = $message['pText']; else $msg = nxs_doFormatMsg($options['fbMsgFormat'], $message);
|
37 |
+
$imgURL = $message['imageURL']; $fbWhere = 'feed';
|
38 |
$attachType = $options['attachType']; if ($attachType=='1') $attachType = 'A'; else $attachType = 'S';
|
39 |
if ($options['imgUpl']!='2') $options['imgUpl'] = 'T'; else $options['imgUpl'] = 'A'; $page_id = $options['pgID'];
|
40 |
$msg = strip_tags($msg); $msg = str_ireplace('<(")','<(")', $msg); //## FB Smiles FIX 3
|
inc-cl/fb.php
CHANGED
@@ -51,7 +51,10 @@ if (!class_exists("nxs_snapClassFB")) { class nxs_snapClassFB {
|
|
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;"> <img id="<?php echo $ntInfo['code'].$indx;?>LoadingImg" style="display: none;" src='<?php echo $nxs_plurl; ?>img/ajax-loader-sm.gif' />
|
54 |
-
<input value="
|
|
|
|
|
|
|
55 |
<?php if (isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);"><?php echo "*[".(substr_count($pbo['catSelEd'], ",")+1)."]*" ?></span><?php } ?>
|
56 |
<?php if (isset($pbo['rpstOn']) && (int)$pbo['rpstOn'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popReActive');" onmouseover="nxs_showPopUpInfo('popReActive', event);"><?php echo "*[R]*" ?></span><?php } ?>
|
57 |
<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>
|
@@ -66,10 +69,12 @@ if (!class_exists("nxs_snapClassFB")) { class nxs_snapClassFB {
|
|
66 |
|
67 |
}
|
68 |
//#### Show NEW Settings Page
|
69 |
-
function showNewNTSettings($mfbo){ $fbo = array('nName'=>'', 'doFB'=>'1', 'fbURL'=>'', 'fbAppID'=>'', 'imgUpl'=>'1', '
|
70 |
//#### Show Unit Settings
|
71 |
function showNTSettings($ii, $options, $isNew=false){ global $nxs_plurl, $nxs_snapSetPgURL, $plgn_NS_SNAutoPoster; $nt = $options['ntInfo']['lcode']; $ntU = strtoupper($nt); $tmzFrmt = _x('Y-m-d G:i:s', 'timezone date format');
|
72 |
-
if ((
|
|
|
|
|
73 |
if (!isset($plgn_NS_SNAutoPoster)) return; $gOptions = $plgn_NS_SNAutoPoster->nxs_options;
|
74 |
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'] = '';
|
75 |
if (!isset($options['nDays'])) $options['nDays'] = 0; if (!isset($options['qTLng'])) $options['qTLng'] = ''; if (!isset($options['fbMsgAFrmt'])) $options['fbMsgAFrmt'] = '';
|
@@ -109,16 +114,16 @@ if (!class_exists("nxs_snapClassFB")) { class nxs_snapClassFB {
|
|
109 |
<div style="width:100%;"><strong style="font-size: 16px;" id="altFormatText">Post Type:</strong><-- (<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>
|
110 |
<div style="margin-left: 10px;">
|
111 |
|
112 |
-
<input type="radio" name="fb[<?php echo $ii; ?>][
|
113 |
|
114 |
-
<input type="radio" name="fb[<?php echo $ii; ?>][
|
115 |
<div style="width:100%; margin-left: 15px;"><strong><?php _e('Upload Images to', 'nxs_snap'); ?>: </strong>
|
116 |
<input value="2" id="apFBImgUplAPP<?php echo $ii; ?>" type="radio" name="fb[<?php echo $ii; ?>][apFBImgUpl]" <?php if ((int)$options['imgUpl'] == 2) echo "checked"; ?> /> <?php _e('App Album', 'nxs_snap'); ?> .. <?php _e('or', 'nxs_snap'); ?> ..
|
117 |
<input value="1" id="apFBImgUplTML<?php echo $ii; ?>" type="radio" name="fb[<?php echo $ii; ?>][apFBImgUpl]" <?php if ((int)$options['imgUpl'] != 2) echo "checked"; ?> />
|
118 |
<?php _e('Timeline', 'nxs_snap'); ?> <-- (<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>)
|
119 |
</div>
|
120 |
|
121 |
-
<input type="radio" name="fb[<?php echo $ii; ?>][
|
122 |
|
123 |
<div style="width:100%; margin-left: 15px;"><strong><?php _e('Link attachment type', 'nxs_snap'); ?>: </strong> <input value="2" id="apFBAttchShare<?php echo $ii; ?>" type="radio" name="fb[<?php echo $ii; ?>][apFBAttch]" <?php if ((int)$options['fbAttch'] == 2) echo "checked"; ?> />
|
124 |
<?php _e('Share a link to your blogpost', 'nxs_snap'); ?> .. <?php _e('or', 'nxs_snap'); ?> ..
|
@@ -210,7 +215,7 @@ if (!class_exists("nxs_snapClassFB")) { class nxs_snapClassFB {
|
|
210 |
if (isset($pval['catSel'])) $options[$ii]['catSel'] = trim($pval['catSel']); else $options[$ii]['catSel'] = 0;
|
211 |
if ($options[$ii]['catSel']=='1' && trim($pval['catSelEd'])!='') $options[$ii]['catSelEd'] = trim($pval['catSelEd']); else $options[$ii]['catSelEd'] = '';
|
212 |
|
213 |
-
if (isset($pval['
|
214 |
if (isset($pval['apFBAttch'])) $options[$ii]['fbAttch'] = $pval['apFBAttch']; else $options[$ii]['fbAttch'] = 0;
|
215 |
if (isset($pval['apFBAttchAsVid'])) $options[$ii]['fbAttchAsVid'] = $pval['apFBAttchAsVid']; else $options[$ii]['fbAttchAsVid'] = 0;
|
216 |
|
@@ -236,17 +241,23 @@ if (!class_exists("nxs_snapClassFB")) { class nxs_snapClassFB {
|
|
236 |
if (strpos($fbPgID, '?')!==false) $fbPgID = substr($fbPgID, 0, strpos($fbPgID, '?'));
|
237 |
$options[$ii]['fbPgID'] = $fbPgID; //echo $fbPgID;
|
238 |
if (strpos($options[$ii]['fbURL'], '?')!==false) $options[$ii]['fbURL'] = substr($options[$ii]['fbURL'], 0, strpos($options[$ii]['fbURL'], '?'));// prr($pval); prr($options[$ii]); // die();
|
239 |
-
}
|
240 |
-
|
|
|
|
|
|
|
|
|
241 |
} return $options;
|
242 |
}
|
243 |
//#### Show Post->Edit Meta Box Settings
|
244 |
function showEdPostNTSettings($ntOpts, $post){ global $nxs_plurl; $post_id = $post->ID; $nt = 'fb'; $ntU = 'FB';
|
245 |
-
foreach($ntOpts as $ii=>$ntOpt) { $pMeta = maybe_unserialize(get_post_meta($post_id, 'snapFB', true)); if (is_array($pMeta) && isset($pMeta[$ii]) && is_array($pMeta[$ii])) $ntOpt = $this->adjMetaOpt($ntOpt, $pMeta[$ii]);
|
|
|
|
|
246 |
if (empty($ntOpt['imgToUse'])) $ntOpt['imgToUse'] = ''; if (empty($ntOpt['urlToUse'])) $ntOpt['urlToUse'] = '';
|
247 |
$doFB = $ntOpt['doFB'] && (is_array($pMeta) || $ntOpt['catSel']!='1');
|
248 |
$imgToUse = $ntOpt['imgToUse']; $urlToUse = $ntOpt['urlToUse'];
|
249 |
-
$isAvailFB = $ntOpt['fbURL']!='' && $ntOpt['fbAppID']!='' && $ntOpt['fbAppSec']!=''; $isAttachFB = $ntOpt['fbAttch']; $fbMsgFormat = htmlentities($ntOpt['fbMsgFormat'], ENT_COMPAT, "UTF-8"); $fbPostType = $ntOpt['
|
250 |
?>
|
251 |
|
252 |
<tr><th style="text-align:left;" colspan="2">
|
@@ -294,9 +305,9 @@ if (!class_exists("nxs_snapClassFB")) { class nxs_snapClassFB {
|
|
294 |
<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/>
|
295 |
(<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>
|
296 |
|
297 |
-
<input type="radio" name="fb[<?php echo $ii; ?>][
|
298 |
-
<input type="radio" name="fb[<?php echo $ii; ?>][
|
299 |
-
<input type="radio" name="fb[<?php echo $ii; ?>][
|
300 |
|
301 |
<div style="width:100%; margin-left: 25px;"><strong><?php _e('Link attachment type:', 'nxs_snap'); ?> </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"; ?> />
|
302 |
<?php _e('Share a link to your blogpost', 'nxs_snap'); ?> .. <?php _e('or', 'nxs_snap'); ?> ..
|
@@ -327,7 +338,7 @@ if (!class_exists("nxs_snapClassFB")) { class nxs_snapClassFB {
|
|
327 |
if (isset($pMeta['imgToUse'])) $optMt['imgToUse'] = $pMeta['imgToUse']; if (isset($pMeta['urlToUse'])) $optMt['urlToUse'] = $pMeta['urlToUse'];
|
328 |
if (isset($pMeta['timeToRun'])) $optMt['timeToRun'] = $pMeta['timeToRun']; if (isset($pMeta['rpstPostIncl'])) $optMt['rpstPostIncl'] = $pMeta['rpstPostIncl'];
|
329 |
if (isset($pMeta['AttachPost'])) $optMt['fbAttch'] = ($pMeta['AttachPost'] != '')?$pMeta['AttachPost']:0; else { if (isset($pMeta['SNAPformat'])) $optMt['fbAttch'] = 0; }
|
330 |
-
if (isset($pMeta['
|
331 |
if (isset($pMeta['doFB'])) $optMt['doFB'] = $pMeta['doFB'] == 1?1:0; else { if (isset($pMeta['SNAPformat'])) $optMt['doFB'] = 0; }
|
332 |
if (isset($pMeta['SNAPincludeFB']) && $pMeta['SNAPincludeFB'] == '1' ) $optMt['doFB'] = 1; // <2.6 Compatibility fix
|
333 |
return $optMt;
|
@@ -390,6 +401,8 @@ if (!function_exists("nxs_doPublishToFB")) { //## Second Function to Post to FB
|
|
390 |
|
391 |
$fbWhere = 'feed'; $page_id = $options['fbPgID']; if (isset($ShownAds)) $ShownAdsL = $ShownAds; $addParams = nxs_makeURLParams(array('NTNAME'=>$ntNm, 'NTCODE'=>$ntCd, 'POSTID'=>$postID, 'ACCNAME'=>$options['nName']));
|
392 |
//## Some Common stuff
|
|
|
|
|
393 |
$ii = $options['ii']; if (!isset($options['pType'])) $options['pType'] = 'im'; if ($options['pType']=='sh') sleep(rand(1, 10));
|
394 |
$logNT = '<span style="color:#0000FF">Facebook</span> - '.$options['nName'];
|
395 |
$snap_ap = get_post_meta($postID, 'snap'.$ntCd, true); $snap_ap = maybe_unserialize($snap_ap);
|
@@ -402,12 +415,12 @@ if (!function_exists("nxs_doPublishToFB")) { //## Second Function to Post to FB
|
|
402 |
if (isset($options['qTLng'])) $lng = $options['qTLng']; else $lng = ''; if (!isset($options['fbAppPageAuthToken'])) $options['fbAppPageAuthToken'] = '';
|
403 |
$blogTitle = htmlspecialchars_decode(get_bloginfo('name'), ENT_QUOTES); if ($blogTitle=='') $blogTitle = home_url();
|
404 |
//## Initiate Posting Array
|
405 |
-
$message = array('message'=>'', 'link'=>'', 'title'=>'', 'description'=>'', 'imageURL'=>'', 'videoURL'=>'', 'siteName'=>$blogTitle);
|
406 |
|
407 |
-
if ($postID=='0') { $options['fbMsgFormat'] = 'Test Post, Please Ignore';
|
408 |
$dsc = 'Test Post, Description'; $urlTitle = 'Test Post - Title'; $urlToGo = home_url();
|
409 |
} else { $post = get_post($postID); if(!$post) return; $msg = nsFormatMessage($options['fbMsgFormat'], $postID, $addParams);
|
410 |
-
$fbPostType = $options['
|
411 |
nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPrePosted'=>'1'));
|
412 |
$extInfo = ' | PostID: '.$postID." - ".(isset($post) && is_object($post)?nxs_doQTrans($post->post_title, $lng):'').' |'.$options['pType'];
|
413 |
if ($fbPostType=='A') $imgURL = nxs_getPostImage($postID, 'medium'); // prr($options); echo "PP - ".$postID; prr($src);
|
@@ -456,7 +469,8 @@ if (!function_exists("nxs_doPublishToFB")) { //## Second Function to Post to FB
|
|
456 |
if ($postID=='0') prr($ret); nxs_addToLogN('E', 'Error', $logNT, '-=ERROR=- '.print_r($ret, true), $extInfo);
|
457 |
} else { // ## All Good - log it.
|
458 |
if ($postID=='0') { nxs_addToLogN('S', 'Test', $logNT, 'OK - TEST Message Posted '); echo _e('OK - Message Posted, please see your '.$logNT.' Page. ', 'nxs_snap'); }
|
459 |
-
else { nxs_addToRI($postID); nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPosted'=>'1', 'pgID'=>$ret['postID'], 'pDate'=>date('Y-m-d H:i:s')));
|
|
|
460 |
}
|
461 |
//## Return Result
|
462 |
if ($ret['isPosted']=='1') return 200; else return print_r($ret, true);
|
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;"> <img id="<?php echo $ntInfo['code'].$indx;?>LoadingImg" style="display: none;" src='<?php echo $nxs_plurl; ?>img/ajax-loader-sm.gif' />
|
54 |
+
<input value="0" name="<?php echo $ntInfo['lcode']; ?>[<?php echo $indx; ?>][apDo<?php echo $ntInfo['code']; ?>]" type="hidden" />
|
55 |
+
<?php if ((int)$pbo['do'.$ntInfo['code']] == 1 && isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <input type="radio" id="rbtn<?php echo $ntInfo['lcode'].$indx; ?>" checked="checked" onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);" /> <?php } else { ?>
|
56 |
+
<input value="1" name="<?php echo $ntInfo['lcode']; ?>[<?php echo $indx; ?>][apDo<?php echo $ntInfo['code']; ?>]" type="checkbox" <?php if ((int)$pbo['do'.$ntInfo['code']] == 1 && $pbo['catSel']!='1') echo "checked"; ?> />
|
57 |
+
<?php } ?>
|
58 |
<?php if (isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);"><?php echo "*[".(substr_count($pbo['catSelEd'], ",")+1)."]*" ?></span><?php } ?>
|
59 |
<?php if (isset($pbo['rpstOn']) && (int)$pbo['rpstOn'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popReActive');" onmouseover="nxs_showPopUpInfo('popReActive', event);"><?php echo "*[R]*" ?></span><?php } ?>
|
60 |
<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>
|
69 |
|
70 |
}
|
71 |
//#### Show NEW Settings Page
|
72 |
+
function showNewNTSettings($mfbo){ $fbo = array('nName'=>'', 'doFB'=>'1', 'fbURL'=>'', 'fbAppID'=>'', 'imgUpl'=>'1', 'postType'=>'A', 'fbMsgAFormat'=>'', 'fbAppSec'=>'', 'fbAttch'=>'2', 'fbPgID'=>'', 'fbAppAuthUser'=>'', 'fbMsgFormat'=>__('New post (%TITLE%) has been published on %SITENAME%', 'nxs_snap') ); $fbo['ntInfo']= array('lcode'=>'fb'); $this->showNTSettings($mfbo, $fbo, true);}
|
73 |
//#### Show Unit Settings
|
74 |
function showNTSettings($ii, $options, $isNew=false){ global $nxs_plurl, $nxs_snapSetPgURL, $plgn_NS_SNAutoPoster; $nt = $options['ntInfo']['lcode']; $ntU = strtoupper($nt); $tmzFrmt = _x('Y-m-d G:i:s', 'timezone date format');
|
75 |
+
if (empty($options['postType']) && !empty($options['fbPostType'])) { $options['postType'] = $options['fbPostType']; unset($options['fbPostType']); } //## Compatibility with V <3.2
|
76 |
+
if (empty($options['postType']) && !empty($options['PostType'])) { $pt = $options['PostType']; unset($options['PostType']); $options['postType'] = $pt; } //## Compatibility with V <3.2
|
77 |
+
if ((int)$options['fbAttch']==0 && empty($options['postType'])) $options['postType'] = 'T';
|
78 |
if (!isset($plgn_NS_SNAutoPoster)) return; $gOptions = $plgn_NS_SNAutoPoster->nxs_options;
|
79 |
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'] = '';
|
80 |
if (!isset($options['nDays'])) $options['nDays'] = 0; if (!isset($options['qTLng'])) $options['qTLng'] = ''; if (!isset($options['fbMsgAFrmt'])) $options['fbMsgAFrmt'] = '';
|
114 |
<div style="width:100%;"><strong style="font-size: 16px;" id="altFormatText">Post Type:</strong><-- (<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>
|
115 |
<div style="margin-left: 10px;">
|
116 |
|
117 |
+
<input type="radio" name="fb[<?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/>
|
118 |
|
119 |
+
<input type="radio" name="fb[<?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/>
|
120 |
<div style="width:100%; margin-left: 15px;"><strong><?php _e('Upload Images to', 'nxs_snap'); ?>: </strong>
|
121 |
<input value="2" id="apFBImgUplAPP<?php echo $ii; ?>" type="radio" name="fb[<?php echo $ii; ?>][apFBImgUpl]" <?php if ((int)$options['imgUpl'] == 2) echo "checked"; ?> /> <?php _e('App Album', 'nxs_snap'); ?> .. <?php _e('or', 'nxs_snap'); ?> ..
|
122 |
<input value="1" id="apFBImgUplTML<?php echo $ii; ?>" type="radio" name="fb[<?php echo $ii; ?>][apFBImgUpl]" <?php if ((int)$options['imgUpl'] != 2) echo "checked"; ?> />
|
123 |
<?php _e('Timeline', 'nxs_snap'); ?> <-- (<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>)
|
124 |
</div>
|
125 |
|
126 |
+
<input type="radio" name="fb[<?php echo $ii; ?>][postType]" value="A" <?php if ( !isset($options['postType']) || $options['postType'] == '' || $options['postType'] == 'A') echo 'checked="checked"'; ?> /> <?php _e('Text Post with "attached" link', 'nxs_snap'); ?><br/>
|
127 |
|
128 |
<div style="width:100%; margin-left: 15px;"><strong><?php _e('Link attachment type', 'nxs_snap'); ?>: </strong> <input value="2" id="apFBAttchShare<?php echo $ii; ?>" type="radio" name="fb[<?php echo $ii; ?>][apFBAttch]" <?php if ((int)$options['fbAttch'] == 2) echo "checked"; ?> />
|
129 |
<?php _e('Share a link to your blogpost', 'nxs_snap'); ?> .. <?php _e('or', 'nxs_snap'); ?> ..
|
215 |
if (isset($pval['catSel'])) $options[$ii]['catSel'] = trim($pval['catSel']); else $options[$ii]['catSel'] = 0;
|
216 |
if ($options[$ii]['catSel']=='1' && trim($pval['catSelEd'])!='') $options[$ii]['catSelEd'] = trim($pval['catSelEd']); else $options[$ii]['catSelEd'] = '';
|
217 |
|
218 |
+
if (isset($pval['postType'])) $options[$ii]['postType'] = trim($pval['postType']);
|
219 |
if (isset($pval['apFBAttch'])) $options[$ii]['fbAttch'] = $pval['apFBAttch']; else $options[$ii]['fbAttch'] = 0;
|
220 |
if (isset($pval['apFBAttchAsVid'])) $options[$ii]['fbAttchAsVid'] = $pval['apFBAttchAsVid']; else $options[$ii]['fbAttchAsVid'] = 0;
|
221 |
|
241 |
if (strpos($fbPgID, '?')!==false) $fbPgID = substr($fbPgID, 0, strpos($fbPgID, '?'));
|
242 |
$options[$ii]['fbPgID'] = $fbPgID; //echo $fbPgID;
|
243 |
if (strpos($options[$ii]['fbURL'], '?')!==false) $options[$ii]['fbURL'] = substr($options[$ii]['fbURL'], 0, strpos($options[$ii]['fbURL'], '?'));// prr($pval); prr($options[$ii]); // die();
|
244 |
+
}
|
245 |
+
//## Compatibility with ver <3.2
|
246 |
+
if (empty($options[$ii]['postType']) && !empty($options[$ii]['fbPostType'])) { $options[$ii]['postType'] = $options[$ii]['fbPostType']; unset($options[$ii]['fbPostType']); }
|
247 |
+
if (empty($options[$ii]['postType']) && !empty($options[$ii]['PostType'])) { $pt = $options[$ii]['PostType']; unset($options[$ii]['PostType']); $options[$ii]['postType'] = $pt; }
|
248 |
+
|
249 |
+
} elseif ( count($pval)==1 ) if (isset($pval['apDo'.$code])) $options[$ii]['do'.$code] = $pval['apDo'.$code]; else $options[$ii]['do'.$code] = 0;
|
250 |
} return $options;
|
251 |
}
|
252 |
//#### Show Post->Edit Meta Box Settings
|
253 |
function showEdPostNTSettings($ntOpts, $post){ global $nxs_plurl; $post_id = $post->ID; $nt = 'fb'; $ntU = 'FB';
|
254 |
+
foreach($ntOpts as $ii=>$ntOpt) { $pMeta = maybe_unserialize(get_post_meta($post_id, 'snapFB', true)); if (is_array($pMeta) && isset($pMeta[$ii]) && is_array($pMeta[$ii])) $ntOpt = $this->adjMetaOpt($ntOpt, $pMeta[$ii]);
|
255 |
+
if (empty($ntOpt['postType']) && !empty($ntOpt['fbPostType'])) { $ntOpt['postType'] = $ntOpt['fbPostType']; unset($ntOpt['fbPostType']); } //## Compatibility with ver <3.2
|
256 |
+
if (empty($ntOpt['postType']) && !empty($ntOpt['PostType'])) { $pt = $ntOpt['PostType']; unset($ntOpt['PostType']); $ntOpt['postType'] = $pt; } //## Compatibility with ver <3.2
|
257 |
if (empty($ntOpt['imgToUse'])) $ntOpt['imgToUse'] = ''; if (empty($ntOpt['urlToUse'])) $ntOpt['urlToUse'] = '';
|
258 |
$doFB = $ntOpt['doFB'] && (is_array($pMeta) || $ntOpt['catSel']!='1');
|
259 |
$imgToUse = $ntOpt['imgToUse']; $urlToUse = $ntOpt['urlToUse'];
|
260 |
+
$isAvailFB = $ntOpt['fbURL']!='' && $ntOpt['fbAppID']!='' && $ntOpt['fbAppSec']!=''; $isAttachFB = $ntOpt['fbAttch']; $fbMsgFormat = htmlentities($ntOpt['fbMsgFormat'], ENT_COMPAT, "UTF-8"); $fbPostType = $ntOpt['postType'];
|
261 |
?>
|
262 |
|
263 |
<tr><th style="text-align:left;" colspan="2">
|
305 |
<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/>
|
306 |
(<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>
|
307 |
|
308 |
+
<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/>
|
309 |
+
<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/>
|
310 |
+
<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'); ?> <-- (<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/>
|
311 |
|
312 |
<div style="width:100%; margin-left: 25px;"><strong><?php _e('Link attachment type:', 'nxs_snap'); ?> </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"; ?> />
|
313 |
<?php _e('Share a link to your blogpost', 'nxs_snap'); ?> .. <?php _e('or', 'nxs_snap'); ?> ..
|
338 |
if (isset($pMeta['imgToUse'])) $optMt['imgToUse'] = $pMeta['imgToUse']; if (isset($pMeta['urlToUse'])) $optMt['urlToUse'] = $pMeta['urlToUse'];
|
339 |
if (isset($pMeta['timeToRun'])) $optMt['timeToRun'] = $pMeta['timeToRun']; if (isset($pMeta['rpstPostIncl'])) $optMt['rpstPostIncl'] = $pMeta['rpstPostIncl'];
|
340 |
if (isset($pMeta['AttachPost'])) $optMt['fbAttch'] = ($pMeta['AttachPost'] != '')?$pMeta['AttachPost']:0; else { if (isset($pMeta['SNAPformat'])) $optMt['fbAttch'] = 0; }
|
341 |
+
if (isset($pMeta['postType'])) $optMt['postType'] = $pMeta['postType'];
|
342 |
if (isset($pMeta['doFB'])) $optMt['doFB'] = $pMeta['doFB'] == 1?1:0; else { if (isset($pMeta['SNAPformat'])) $optMt['doFB'] = 0; }
|
343 |
if (isset($pMeta['SNAPincludeFB']) && $pMeta['SNAPincludeFB'] == '1' ) $optMt['doFB'] = 1; // <2.6 Compatibility fix
|
344 |
return $optMt;
|
401 |
|
402 |
$fbWhere = 'feed'; $page_id = $options['fbPgID']; if (isset($ShownAds)) $ShownAdsL = $ShownAds; $addParams = nxs_makeURLParams(array('NTNAME'=>$ntNm, 'NTCODE'=>$ntCd, 'POSTID'=>$postID, 'ACCNAME'=>$options['nName']));
|
403 |
//## Some Common stuff
|
404 |
+
if (empty($options['postType']) && !empty($options['fbPostType'])) { $options['postType'] = $options['fbPostType']; unset($options['fbPostType']); } //## Compatibility with v <3.2
|
405 |
+
if (empty($options['postType']) && !empty($options['PostType'])) { $pt = $options['PostType']; unset($options['PostType']); $options['postType'] = $pt; } //## Compatibility with v <3.2
|
406 |
$ii = $options['ii']; if (!isset($options['pType'])) $options['pType'] = 'im'; if ($options['pType']=='sh') sleep(rand(1, 10));
|
407 |
$logNT = '<span style="color:#0000FF">Facebook</span> - '.$options['nName'];
|
408 |
$snap_ap = get_post_meta($postID, 'snap'.$ntCd, true); $snap_ap = maybe_unserialize($snap_ap);
|
415 |
if (isset($options['qTLng'])) $lng = $options['qTLng']; else $lng = ''; if (!isset($options['fbAppPageAuthToken'])) $options['fbAppPageAuthToken'] = '';
|
416 |
$blogTitle = htmlspecialchars_decode(get_bloginfo('name'), ENT_QUOTES); if ($blogTitle=='') $blogTitle = home_url();
|
417 |
//## Initiate Posting Array
|
418 |
+
$message = array('message'=>'', 'link'=>'', 'title'=>'', 'description'=>'', 'imageURL'=>'', 'videoURL'=>'', 'siteName'=>$blogTitle); $imgURL = '';
|
419 |
|
420 |
+
if ($postID=='0') { $options['fbMsgFormat'] = 'Test Post, Please Ignore';
|
421 |
$dsc = 'Test Post, Description'; $urlTitle = 'Test Post - Title'; $urlToGo = home_url();
|
422 |
} else { $post = get_post($postID); if(!$post) return; $msg = nsFormatMessage($options['fbMsgFormat'], $postID, $addParams);
|
423 |
+
$fbPostType = $options['postType']; if ($fbPostType=='A') $fbPostType = (int)$options['fbAttch']==2?'S':'A'; $isAttachVidFB = $options['fbAttchAsVid'];
|
424 |
nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPrePosted'=>'1'));
|
425 |
$extInfo = ' | PostID: '.$postID." - ".(isset($post) && is_object($post)?nxs_doQTrans($post->post_title, $lng):'').' |'.$options['pType'];
|
426 |
if ($fbPostType=='A') $imgURL = nxs_getPostImage($postID, 'medium'); // prr($options); echo "PP - ".$postID; prr($src);
|
469 |
if ($postID=='0') prr($ret); nxs_addToLogN('E', 'Error', $logNT, '-=ERROR=- '.print_r($ret, true), $extInfo);
|
470 |
} else { // ## All Good - log it.
|
471 |
if ($postID=='0') { nxs_addToLogN('S', 'Test', $logNT, 'OK - TEST Message Posted '); echo _e('OK - Message Posted, please see your '.$logNT.' Page. ', 'nxs_snap'); }
|
472 |
+
else { nxs_addToRI($postID); nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPosted'=>'1', 'pgID'=>$ret['postID'], 'pDate'=>date('Y-m-d H:i:s')));
|
473 |
+
$extInfo .= ' | <a href="'.$ret['postURL'].'" target="_blank">Post Link</a>'; nxs_addToLogN('S', 'Posted', $logNT, 'OK - Message Posted ', $extInfo); }
|
474 |
}
|
475 |
//## Return Result
|
476 |
if ($ret['isPosted']=='1') return 200; else return print_r($ret, true);
|
inc-cl/ff.api.php
CHANGED
@@ -25,8 +25,9 @@ if (!class_exists("nxs_class_SNAP_FF")) { class nxs_class_SNAP_FF {
|
|
25 |
if (!is_array($options)) { $badOut['Error'] = 'No Options'; return $badOut; }
|
26 |
if (!isset($options['ffUName']) || trim($options['ffPass'])=='') { $badOut['Error'] = 'Not Configured'; return $badOut; }
|
27 |
$dusername = $options['ffUName']; $pass = (substr($options['ffPass'], 0, 5)=='n5g9a'?nsx_doDecode(substr($options['ffPass'], 5)):$options['ffPass']);
|
|
|
28 |
//## Format
|
29 |
-
$msg = nxs_doFormatMsg($options['ffMsgFormat'], $message);
|
30 |
if ($options['attchImg']=='1') { if (isset($message['imageURL'])) $imgURL = trim(nxs_getImgfrOpt($message['imageURL'], $options['imgSize'])); else $imgURL = ''; } else $imgURL = '';
|
31 |
|
32 |
$postArr = array('title'=>$msg, 'image0_link'=>'', 'room'=>($options['grpID']!=''?strtolower($options['grpID']):''), 'image0_url'=>($imgURL!=''?$imgURL:''));
|
25 |
if (!is_array($options)) { $badOut['Error'] = 'No Options'; return $badOut; }
|
26 |
if (!isset($options['ffUName']) || trim($options['ffPass'])=='') { $badOut['Error'] = 'Not Configured'; return $badOut; }
|
27 |
$dusername = $options['ffUName']; $pass = (substr($options['ffPass'], 0, 5)=='n5g9a'?nsx_doDecode(substr($options['ffPass'], 5)):$options['ffPass']);
|
28 |
+
if (empty($options['imgSize'])) $options['imgSize'] = '';
|
29 |
//## Format
|
30 |
+
if (!empty($message['pText'])) $msg = $message['pText']; else $msg = nxs_doFormatMsg($options['ffMsgFormat'], $message);
|
31 |
if ($options['attchImg']=='1') { if (isset($message['imageURL'])) $imgURL = trim(nxs_getImgfrOpt($message['imageURL'], $options['imgSize'])); else $imgURL = ''; } else $imgURL = '';
|
32 |
|
33 |
$postArr = array('title'=>$msg, 'image0_link'=>'', 'room'=>($options['grpID']!=''?strtolower($options['grpID']):''), 'image0_url'=>($imgURL!=''?$imgURL:''));
|
inc-cl/ff.php
CHANGED
@@ -15,7 +15,10 @@ if (!class_exists("nxs_snapClassFF")) { class nxs_snapClassFF {
|
|
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;"> <img id="<?php echo $ntInfo['code'].$indx;?>LoadingImg" style="display: none;" src='<?php echo $nxs_plurl; ?>img/ajax-loader-sm.gif' />
|
18 |
-
|
|
|
|
|
|
|
19 |
<?php if (isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);"><?php echo "*[".(substr_count($pbo['catSelEd'], ",")+1)."]*" ?></span><?php } ?>
|
20 |
<?php if (isset($pbo['rpstOn']) && (int)$pbo['rpstOn'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popReActive');" onmouseover="nxs_showPopUpInfo('popReActive', event);"><?php echo "*[R]*" ?></span><?php } ?>
|
21 |
<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>
|
@@ -108,7 +111,7 @@ if (!class_exists("nxs_snapClassFF")) { class nxs_snapClassFF {
|
|
108 |
if (isset($pval['delayDays'])) $options[$ii]['nDays'] = trim($pval['delayDays']);
|
109 |
if (isset($pval['delayHrs'])) $options[$ii]['nHrs'] = trim($pval['delayHrs']); if (isset($pval['delayMin'])) $options[$ii]['nMin'] = trim($pval['delayMin']);
|
110 |
if (isset($pval['qTLng'])) $options[$ii]['qTLng'] = trim($pval['qTLng']);
|
111 |
-
} elseif ((
|
112 |
} return $options;
|
113 |
}
|
114 |
//#### Show Post->Edit Meta Box Settings
|
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;"> <img id="<?php echo $ntInfo['code'].$indx;?>LoadingImg" style="display: none;" src='<?php echo $nxs_plurl; ?>img/ajax-loader-sm.gif' />
|
18 |
+
<input value="0" name="<?php echo $ntInfo['lcode']; ?>[<?php echo $indx; ?>][apDo<?php echo $ntInfo['code']; ?>]" type="hidden" />
|
19 |
+
<?php if ((int)$pbo['do'.$ntInfo['code']] == 1 && isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <input type="radio" id="rbtn<?php echo $ntInfo['lcode'].$indx; ?>" checked="checked" onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);" /> <?php } else { ?>
|
20 |
+
<input value="1" name="<?php echo $ntInfo['lcode']; ?>[<?php echo $indx; ?>][apDo<?php echo $ntInfo['code']; ?>]" type="checkbox" <?php if ((int)$pbo['do'.$ntInfo['code']] == 1 && $pbo['catSel']!='1') echo "checked"; ?> />
|
21 |
+
<?php } ?>
|
22 |
<?php if (isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);"><?php echo "*[".(substr_count($pbo['catSelEd'], ",")+1)."]*" ?></span><?php } ?>
|
23 |
<?php if (isset($pbo['rpstOn']) && (int)$pbo['rpstOn'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popReActive');" onmouseover="nxs_showPopUpInfo('popReActive', event);"><?php echo "*[R]*" ?></span><?php } ?>
|
24 |
<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>
|
111 |
if (isset($pval['delayDays'])) $options[$ii]['nDays'] = trim($pval['delayDays']);
|
112 |
if (isset($pval['delayHrs'])) $options[$ii]['nHrs'] = trim($pval['delayHrs']); if (isset($pval['delayMin'])) $options[$ii]['nMin'] = trim($pval['delayMin']);
|
113 |
if (isset($pval['qTLng'])) $options[$ii]['qTLng'] = trim($pval['qTLng']);
|
114 |
+
} elseif ( count($pval)==1 ) if (isset($pval['apDo'.$code])) $options[$ii]['do'.$code] = $pval['apDo'.$code]; else $options[$ii]['do'.$code] = 0;
|
115 |
} return $options;
|
116 |
}
|
117 |
//#### Show Post->Edit Meta Box Settings
|
inc-cl/fl.api.php
ADDED
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
//## NextScripts App.net Connection Class
|
3 |
+
|
4 |
+
/*
|
5 |
+
1. Options
|
6 |
+
|
7 |
+
nName - Nickname of the account [Optional] (Presentation purposes only - No affect on functionality)
|
8 |
+
rdUName - Reddit User Name
|
9 |
+
rdPass - Reddit User Passord
|
10 |
+
rdSubReddit - Name of the Sub-Reddit
|
11 |
+
postType - A or T - "Attached link" or "Text"
|
12 |
+
|
13 |
+
rdTitleFormat
|
14 |
+
rdTextFormat
|
15 |
+
|
16 |
+
2. Post Info
|
17 |
+
|
18 |
+
url
|
19 |
+
title - [up to 300 characters long] - title of the submission
|
20 |
+
text
|
21 |
+
|
22 |
+
*/
|
23 |
+
$nxs_snapAPINts[] = array('code'=>'FL', 'lcode'=>'fl', 'name'=>'Flickr');
|
24 |
+
|
25 |
+
if (!class_exists("nxs_class_SNAP_FL")) { class nxs_class_SNAP_FL {
|
26 |
+
|
27 |
+
var $ntCode = 'FL';
|
28 |
+
var $ntLCode = 'fl';
|
29 |
+
|
30 |
+
function createFile($imgURL) {
|
31 |
+
$remImgURL = urldecode($imgURL); $urlParced = pathinfo($remImgURL); $remImgURLFilename = $urlParced['basename'];
|
32 |
+
$imgData = wp_remote_get($remImgURL); if (is_wp_error($imgData)) { $badOut['Error'] = print_r($imgData, true)." - ERROR"; return $badOut; }
|
33 |
+
$imgData = $imgData['body'];
|
34 |
+
$tmp=array_search('uri', @array_flip(stream_get_meta_data($GLOBALS[mt_rand()]=tmpfile())));
|
35 |
+
if (!is_writable($tmp)) return "Your temporary folder or file (file - ".$tmp.") is not witable. Can't upload images to Flickr";
|
36 |
+
rename($tmp, $tmp.='.png'); register_shutdown_function(create_function('', "unlink('{$tmp}');"));
|
37 |
+
file_put_contents($tmp, $imgData); if (!$tmp) return 'You must specify a path to a file'; if (!file_exists($tmp)) return 'File path specified does not exist';
|
38 |
+
if (!is_readable($tmp)) return 'File path specified is not readable';
|
39 |
+
// $data['name'] = basename($tmp);
|
40 |
+
return "@$tmp";
|
41 |
+
|
42 |
+
}
|
43 |
+
|
44 |
+
function doPost($options, $message){ if (!is_array($options)) return false; $out = array(); // return false;
|
45 |
+
foreach ($options as $ii=>$ntOpts) $out[$ii] = $this->doPostToNT($ntOpts, $message);
|
46 |
+
return $out;
|
47 |
+
}
|
48 |
+
|
49 |
+
function doPostToNT($options, $message){ global $nxs_urlLen; $badOut = array('pgID'=>'', 'isPosted'=>0, 'pDate'=>date('Y-m-d H:i:s'), 'Error'=>'');
|
50 |
+
//## Check settings
|
51 |
+
if (!is_array($options)) { $badOut['Error'] = 'No Options'; return $badOut; }
|
52 |
+
if (!isset($options['accessToken']) || trim($options['accessToken'])=='') { $badOut['Error'] = 'Not Authorized'; return $badOut; }
|
53 |
+
if (empty($options['imgSize'])) $options['imgSize'] = '';
|
54 |
+
//## Format Post
|
55 |
+
if (!empty($message['pText'])) $text = $message['pText']; else $text = nxs_doFormatMsg($options['msgFrmt'], $message);
|
56 |
+
if (!empty($message['pTitle'])) $msgT = $message['pTitle']; else $msgT = nxs_doFormatMsg($options['msgTFrmt'], $message);
|
57 |
+
//## Make Post
|
58 |
+
if (isset($message['imageURL'])) $imgURL = trim(nxs_getImgfrOpt($message['imageURL'], $options['imgSize'])); else $imgURL = ''; $postType = $options['postType'];
|
59 |
+
|
60 |
+
require_once('apis/scOAuth.php'); $tum_oauth = new wpScoopITOAuth($options['appKey'], $options['appSec'], $options['accessToken'], $options['accessTokenSec']);
|
61 |
+
$tum_oauth->baseURL = 'http://www.flickr.com/services'; $tum_oauth->request_token_path = '/oauth/request_token'; $tum_oauth->access_token_path = '/oauth/access_token';
|
62 |
+
|
63 |
+
$tags = $message['tags'];
|
64 |
+
|
65 |
+
$postArr = array('title'=>$msgT, 'description'=>$text, 'tags'=>$tags, 'is_public'=>1, 'safety_level'=>1, 'content_type'=>1, 'hidden'=>1);
|
66 |
+
$imgFile = $this->createFile($imgURL); $phiID = $tum_oauth->flUploadPhoto($imgFile, $postArr); // prr($phiID);
|
67 |
+
|
68 |
+
if (!empty($phiID) && strpos($phiID, 'Problem: ')===false) {
|
69 |
+
$params = array ('format' => 'php_serial', 'method'=>'flickr.photosets.addPhoto', 'photo_id'=>$phiID, 'photoset_id'=>$options['setID']);
|
70 |
+
$uinfo = $tum_oauth->makeReq('http://api.flickr.com/services/rest/',$params);
|
71 |
+
}
|
72 |
+
|
73 |
+
if (!empty($phiID) && strpos($phiID, 'Problem: ')===false) {
|
74 |
+
return array('postID'=>$phiID, 'isPosted'=>1, 'postURL'=> str_ireplace('people', 'photos', $options['userURL']).$phiID, 'pDate'=>date('Y-m-d H:i:s'));
|
75 |
+
} else { $badOut['Error'] .= print_r($phiID, true)." Code:".$tum_oauth->http_code;
|
76 |
+
return $badOut;
|
77 |
+
}
|
78 |
+
return $badOut;
|
79 |
+
}
|
80 |
+
|
81 |
+
}}
|
82 |
+
?>
|
inc-cl/fl.php
ADDED
@@ -0,0 +1,305 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
//## NextScripts App.net Connection Class
|
3 |
+
$nxs_snapAvNts[] = array('code'=>'FL', 'lcode'=>'fl', 'name'=>'Flickr');
|
4 |
+
|
5 |
+
if (!class_exists("nxs_snapClassFL")) { class nxs_snapClassFL { var $ntInfo = array('code'=>'FL', 'lcode'=>'fl', 'name'=>'Flickr', 'defNName'=>'', 'tstReq' => true);
|
6 |
+
//#### Show Common Settings
|
7 |
+
function showGenNTSettings($ntOpts){ global $nxs_plurl, $nxs_snapSetPgURL; $ntInfo = $this->ntInfo;
|
8 |
+
if ( isset($_GET['auth']) && $_GET['auth']==$ntInfo['lcode']){ require_once('apis/scOAuth.php'); $options = $ntOpts[$_GET['acc']];
|
9 |
+
|
10 |
+
$consumer_key = $options['appKey']; $consumer_secret = $options['appSec'];
|
11 |
+
$callback_url = $nxs_snapSetPgURL."&auth=".$ntInfo['lcode']."a&acc=".$_GET['acc'];
|
12 |
+
|
13 |
+
$tum_oauth = new wpScoopITOAuth($consumer_key, $consumer_secret);
|
14 |
+
$tum_oauth->baseURL = 'http://www.flickr.com/services'; $tum_oauth->request_token_path = '/oauth/request_token'; $tum_oauth->access_token_path = '/oauth/access_token';
|
15 |
+
$request_token = $tum_oauth->getReqToken($callback_url);
|
16 |
+
$options['oAuthToken'] = $request_token['oauth_token'];
|
17 |
+
$options['oAuthTokenSecret'] = $request_token['oauth_token_secret'];
|
18 |
+
|
19 |
+
switch ($tum_oauth->http_code) { case 200: $url = 'http://www.flickr.com/services/oauth/authorize?oauth_token='.$options['oAuthToken'];
|
20 |
+
$optionsG = get_option('NS_SNAutoPoster'); $optionsG[$ntInfo['lcode']][$_GET['acc']] = $options; update_option('NS_SNAutoPoster', $optionsG);
|
21 |
+
echo '<br/><br/>All good?! Redirecting ..... <script type="text/javascript">window.location = "'.$url.'"</script>'; break;
|
22 |
+
default: echo '<br/><b style="color:red">Could not connect to Flickr. Refresh the page or try again later.</b>'; die();
|
23 |
+
}
|
24 |
+
die();
|
25 |
+
}
|
26 |
+
if ( isset($_GET['auth']) && $_GET['auth']==$ntInfo['lcode'].'a'){ require_once('apis/scOAuth.php'); $options = $ntOpts[$_GET['acc']];
|
27 |
+
$consumer_key = $options['appKey']; $consumer_secret = $options['appSec'];
|
28 |
+
|
29 |
+
$tum_oauth = new wpScoopITOAuth($consumer_key, $consumer_secret, $options['oAuthToken'], $options['oAuthTokenSecret']); //prr($tum_oauth);
|
30 |
+
$tum_oauth->baseURL = 'http://www.flickr.com/services'; $tum_oauth->request_token_path = '/oauth/request_token'; $tum_oauth->access_token_path = '/oauth/access_token';
|
31 |
+
$access_token = $tum_oauth->getAccToken($_GET['oauth_verifier']); prr($access_token);
|
32 |
+
$options['accessToken'] = $access_token['oauth_token']; $options['accessTokenSec'] = $access_token['oauth_token_secret'];
|
33 |
+
$optionsG = get_option('NS_SNAutoPoster'); $optionsG[$ntInfo['lcode']][$_GET['acc']] = $options; update_option('NS_SNAutoPoster', $optionsG);
|
34 |
+
$tum_oauth = new wpScoopITOAuth($consumer_key, $consumer_secret, $options['accessToken'], $options['accessTokenSec']);
|
35 |
+
echo "OK. Let's Get Profile: "; prr($access_token);
|
36 |
+
$params = array ('format' => 'php_serial', 'method'=>'flickr.urls.getUserProfile');
|
37 |
+
$uinfo = $tum_oauth->makeReq('http://api.flickr.com/services/rest/',$params); // prr($uinfo);die();
|
38 |
+
|
39 |
+
|
40 |
+
if (is_array($uinfo) && isset($uinfo['user'])) { $options['appAppUserName'] = $access_token['username']."(".urldecode($access_token['fullname']).")";
|
41 |
+
$options['appAppUserID'] = urldecode($uinfo['user']['nsid']); $options['userURL'] = urldecode($uinfo['user']['url']);
|
42 |
+
$optionsG = get_option('NS_SNAutoPoster'); $optionsG[$ntInfo['lcode']][$_GET['acc']] = $options; update_option('NS_SNAutoPoster', $optionsG);
|
43 |
+
} //die();
|
44 |
+
if (!empty($options['appAppUserID'])) { echo '<br/><br/>All good?! Redirecting ..... <script type="text/javascript">window.location = "'.$nxs_snapSetPgURL.'"</script>'; break; die();}
|
45 |
+
else die("<span style='color:red;'>ERROR: Authorization Error: <span style='color:darkred; font-weight: bold;'>".print_r($uinfo, true)."</span></span>");
|
46 |
+
}
|
47 |
+
|
48 |
+
?>
|
49 |
+
<div class="nxs_box">
|
50 |
+
<div class="nxs_box_header">
|
51 |
+
<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']; ?>
|
52 |
+
<?php $cbo = count($ntOpts); ?>
|
53 |
+
<?php if ($cbo>1){ ?><div class="nsBigText"><?php echo "(".($cbo=='0'?'No':$cbo)." "; _e('accounts', 'nxs_snap'); echo ")"; ?></div><?php } ?>
|
54 |
+
</div>
|
55 |
+
</div>
|
56 |
+
<div class="nxs_box_inside">
|
57 |
+
<?php foreach ($ntOpts as $indx=>$pbo){ if (trim($pbo['nName']=='')) $pbo['nName'] = $ntInfo['name'];
|
58 |
+
if (!isset($pbo[$ntInfo['lcode'].'OK']) || $pbo[$ntInfo['lcode'].'OK']=='') $pbo[$ntInfo['lcode'].'OK'] = (isset($pbo['appAppUserID']) && $pbo['appAppUserID']>1)?'1':'';
|
59 |
+
?>
|
60 |
+
<p style="margin:0px;margin-left:5px;"> <img id="<?php echo $ntInfo['code'].$indx;?>LoadingImg" style="display: none;" src='<?php echo $nxs_plurl; ?>img/ajax-loader-sm.gif' />
|
61 |
+
|
62 |
+
<input value="0" name="<?php echo $ntInfo['lcode']; ?>[<?php echo $indx; ?>][apDo<?php echo $ntInfo['code']; ?>]" type="hidden" />
|
63 |
+
<?php if ((int)$pbo['do'.$ntInfo['code']] == 1 && isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <input type="radio" id="rbtn<?php echo $ntInfo['lcode'].$indx; ?>" checked="checked" onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);" /> <?php } else { ?>
|
64 |
+
<input value="1" name="<?php echo $ntInfo['lcode']; ?>[<?php echo $indx; ?>][apDo<?php echo $ntInfo['code']; ?>]" type="checkbox" <?php if ((int)$pbo['do'.$ntInfo['code']] == 1 && $pbo['catSel']!='1') echo "checked"; ?> />
|
65 |
+
|
66 |
+
<?php } ?>
|
67 |
+
|
68 |
+
<?php if (isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);"><?php echo "*[".(substr_count($pbo['catSelEd'], ",")+1)."]*" ?></span><?php } ?>
|
69 |
+
<?php if (isset($pbo['rpstOn']) && (int)$pbo['rpstOn'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popReActive');" onmouseover="nxs_showPopUpInfo('popReActive', event);"><?php echo "*[R]*" ?></span><?php } ?>
|
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 |
+
<?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'); ?> ==></b><?php } ?>
|
72 |
+
<a id="do<?php echo $ntInfo['code'].$indx; ?>AG" href="#" onclick="doGetHideNTBlock('<?php echo $ntInfo['code'];?>' , '<?php echo $indx; ?>');return false;">[<?php _e('Show Settings', 'nxs_snap'); ?>]</a>
|
73 |
+
<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>
|
74 |
+
</p><div id="nxsNTSetDiv<?php echo $ntInfo['code'].$indx; ?>"></div><?php //$pbo['ntInfo'] = $ntInfo; $this->showNTSettings($indx, $pbo);
|
75 |
+
}?>
|
76 |
+
</div>
|
77 |
+
</div> <?php
|
78 |
+
}
|
79 |
+
//#### Show NEW Settings Page
|
80 |
+
function showNewNTSettings($options){ $opts = array('nName'=>'', 'doFL'=>'1', 'appKey'=>'', 'appSec'=>'', 'setID'=>'', 'inclTags'=>'1', 'defImg'=>''); $opts['ntInfo']= $this->ntInfo; $this->showNTSettings($options, $opts, true);}
|
81 |
+
//#### Show Unit Settings
|
82 |
+
function showNTSettings($ii, $options, $isNew=false){ global $nxs_plurl, $nxs_snapSetPgURL; $ntInfo = $this->ntInfo; $nt = $ntInfo['lcode']; $ntU = $ntInfo['code'];
|
83 |
+
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'] = '';
|
84 |
+
if (!isset($options['nDays'])) $options['nDays'] = 0; if (!isset($options['qTLng'])) $options['qTLng'] = ''; if (!isset($options['setID'])) $options['setID'] = '';
|
85 |
+
if (!isset($options['appKey'])) $options['appKey'] = ''; if (!isset($options['appSec'])) $options['appSec'] = ''; ?>
|
86 |
+
<div id="do<?php echo $ntU; ?><?php echo $ii; ?>Div" class="insOneDiv<?php if ($isNew) echo " clNewNTSets"; ?>">
|
87 |
+
<input type="hidden" value="0" id="apDoS<?php echo $ntU.$ii; ?>" />
|
88 |
+
<div class="nsx_iconedTitle" style="float: right; background-image: url(<?php echo $nxs_plurl; ?>img/<?php echo $nt; ?>16.png);"><a style="font-size: 12px;" target="_blank" href="http://www.nextscripts.com/instructions/flickr-social-networks-auto-poster-setup-installation/"><?php $nType=$ntInfo['name']; printf( __( 'Detailed %s Installation/Configuration Instructions', 'nxs_snap' ), $nType); ?></a></div>
|
89 |
+
|
90 |
+
<div style="width:100%;"><strong><?php _e('Account Nickname', 'nxs_snap'); ?>:</strong> <i><?php _e('Just so you can easily identify it', 'nxs_snap'); ?></i> </div><input name="<?php echo $nt; ?>[<?php echo $ii; ?>][nName]" id="apnName<?php echo $ii; ?>" style="font-weight: bold; color: #005800; border: 1px solid #ACACAC; width: 40%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['nName'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" /><br/>
|
91 |
+
<?php echo nxs_addQTranslSel($nt, $ii, $options['qTLng']); ?>
|
92 |
+
<br/>
|
93 |
+
<ul class="nsx_tabs">
|
94 |
+
<li><a href="#nsx<?php echo $nt.$ii ?>_tab1"><?php _e('Account Info', 'nxs_snap'); ?></a></li>
|
95 |
+
<?php if (!$isNew) { ?> <li><a href="#nsx<?php echo $nt.$ii ?>_tab2"><?php _e('Advanced', 'nxs_snap'); ?></a></li> <?php } ?>
|
96 |
+
</ul>
|
97 |
+
<div class="nsx_tab_container"><?php /* ######################## Account Tab ####################### */ ?>
|
98 |
+
<div id="nsx<?php echo $nt.$ii ?>_tab1" class="nsx_tab_content" style="background-image: url(<?php echo $nxs_plurl; ?>img/<?php echo $nt; ?>-bg.png); background-repeat: no-repeat; background-position:90% 10%;">
|
99 |
+
|
100 |
+
<div style="width:100%;"><strong><?php echo $nType; ?> Consumer Key:</strong> </div><input name="<?php echo $nt; ?>[<?php echo $ii; ?>][appKey]" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['appKey'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" />
|
101 |
+
<div style="width:100%;"><strong><?php echo $nType; ?> Consumer Secret:</strong> </div><input name="<?php echo $nt; ?>[<?php echo $ii; ?>][appSec]" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['appSec'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" /> <br/>
|
102 |
+
<div style="width:100%;"><strong><?php echo $nType; ?> Set ID (Optional):</strong> </div><input name="<?php echo $nt; ?>[<?php echo $ii; ?>][setID]" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['setID'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" /> <br/>
|
103 |
+
<br/>
|
104 |
+
|
105 |
+
<div style="width:100%;"><strong id="altFormatText"><?php _e('Post Title Format', 'nxs_snap'); ?>:</strong> (<a href="#" id="msgFrmtT<?php echo $ntU.$ii; ?>HintInfo" onclick="mxs_showHideFrmtInfo('msgFrmtT<?php echo $ntU.$ii; ?>'); return false;"><?php _e('Show format info', 'nxs_snap'); ?></a>)</div>
|
106 |
+
<input name="<?php echo $nt; ?>[<?php echo $ii; ?>][msgTFrmt]" style="width: 50%;" value="<?php if (!empty($options['msgTFrmt'])) _e(apply_filters('format_to_edit', htmlentities($options['msgTFrmt'], ENT_COMPAT, "UTF-8")), 'nxs_snap'); else echo "%TITLE%"; ?>" onfocus="mxs_showFrmtInfo('msgFrmtT<?php echo $ntU.$ii; ?>');" /><?php nxs_doShowHint("msgFrmtT".$ntU.$ii); ?><br/>
|
107 |
+
|
108 |
+
<div id="altFormat" style="margin-left: 0px;">
|
109 |
+
<div style="width:100%;"><strong id="altFormatText"><?php _e('Text Format', 'nxs_snap'); ?>:</strong> (<a href="#" id="msgFrmt<?php echo $ntU; ?><?php echo $ii; ?>HintInfo" onclick="mxs_showHideFrmtInfo('msgFrmt<?php echo $ntU; ?><?php echo $ii; ?>'); return false;"><?php _e('Show format info', 'nxs_snap'); ?></a>)
|
110 |
+
</div>
|
111 |
+
|
112 |
+
<textarea cols="150" rows="3" id="<?php echo $nt; ?><?php echo $ii; ?>msgFrmt" name="<?php echo $nt; ?>[<?php echo $ii; ?>][msgFrmt]" style="width:51%;max-width: 650px;" onfocus="jQuery('#<?php echo $nt; ?><?php echo $ii; ?>msgFrmt').attr('rows', 6); mxs_showFrmtInfo('msgFrmt<?php echo $ntU.$ii; ?>');"><?php if ($isNew) _e("%EXCERPT% \r\n\r\n%URL%", 'nxs_snap'); else _e(apply_filters('format_to_edit', htmlentities($options['msgFrmt'], ENT_COMPAT, "UTF-8")), 'nxs_snap'); ?></textarea><?php nxs_doShowHint("msgFrmt".$ntU.$ii); ?>
|
113 |
+
</div>
|
114 |
+
|
115 |
+
<p style="margin-bottom: 20px;margin-top: 5px;"><input value="1" type="checkbox" name="<?php echo $nt; ?>[<?php echo $ii; ?>][inclTags]" <?php if ((int)$options['inclTags'] == 1) echo "checked"; ?> />
|
116 |
+
<strong><?php _e('Post with tags', 'nxs_snap'); ?></strong> <?php _e('Tags from the blogpost will be auto-posted to '.$ntInfo['name'], 'nxs_snap'); ?>
|
117 |
+
</p>
|
118 |
+
|
119 |
+
<div style="width:100%;"><strong>Default Image to use:</strong>
|
120 |
+
<p style="font-size: 11px; margin: 0px;">If your post does not have any images this will be used instead.</p>
|
121 |
+
</div><input name="<?php echo $nt; ?>[<?php echo $ii; ?>][defImg]" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['defImg'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" />
|
122 |
+
<br/><br/>
|
123 |
+
|
124 |
+
|
125 |
+
<?php if($options['appKey']=='') { ?>
|
126 |
+
<b><?php _e('Authorize Your '.$ntInfo['name'].' Account', 'nxs_snap'); ?></b> <?php _e('Please click "Update Settings" to be able to Authorize your account.', 'nxs_snap'); ?>
|
127 |
+
<?php } else { if(isset($options['appAppUserID']) && $options['appAppUserID']>0) { ?>
|
128 |
+
<?php _e('Your '.$ntInfo['name'].' Account has been authorized.', 'nxs_snap'); ?> User ID: <?php _e(apply_filters('format_to_edit', htmlentities($options['appAppUserID'].' - '.$options['appAppUserName'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>.
|
129 |
+
<?php _e('You can', 'nxs_snap'); ?> Re- <?php } ?>
|
130 |
+
<a href="<?php echo $nxs_snapSetPgURL;?>&auth=<?php echo $nt; ?>&acc=<?php echo $ii; ?>">Authorize Your <?php echo $ntInfo['name']; ?> Account</a>
|
131 |
+
|
132 |
+
<?php if (!isset($options['appAppUserID']) || $options['appAppUserID']<1) { ?> <div class="blnkg"><=== <?php _e('Authorize your account', 'nxs_snap'); ?> ===</div> <?php }?>
|
133 |
+
<?php } ?>
|
134 |
+
<br/><br/>
|
135 |
+
|
136 |
+
<?php if ($isNew) { ?> <input type="hidden" name="<?php echo $nt; ?>[<?php echo $ii; ?>][apDo<?php echo $ntU; ?>]" value="1" id="apDoNew<?php echo $ntU; ?><?php echo $ii; ?>" /> <?php } ?>
|
137 |
+
<?php if (isset($options['appAppUserID']) && $options['appAppUserID']>0) { ?>
|
138 |
+
|
139 |
+
<b><?php _e('Test your settings', 'nxs_snap'); ?>:</b> <a href="#" class="NXSButton" onclick="testPost('<?php echo $ntU; ?>', '<?php echo $ii; ?>'); return false;"><?php printf( __( 'Submit Test Post to %s', 'nxs_snap' ), $nType); ?></a> <?php }
|
140 |
+
?>
|
141 |
+
|
142 |
+
</div>
|
143 |
+
<?php /* ######################## Tools Tab ####################### */ ?>
|
144 |
+
<?php if (!$isNew) { ?><div id="nsx<?php echo $nt.$ii ?>_tab2" class="nsx_tab_content">
|
145 |
+
<?php nxs_showCatTagsCTFilters($nt, $ii, $options);
|
146 |
+
nxs_addPostingDelaySelV3($nt, $ii, $options['nHrs'], $options['nMin'], $options['nDays']);
|
147 |
+
nxs_showRepostSettings($nt, $ii, $options); ?>
|
148 |
+
</div> <?php } ?> <?php /* #### End of Tab #### */ ?>
|
149 |
+
</div><br/> <?php /* #### End of Tabs #### */ ?>
|
150 |
+
|
151 |
+
<div class="submit nxclear" style="padding-bottom: 0px;"><input type="submit" class="button-primary" name="update_NS_SNAutoPoster_settings" value="<?php _e('Update Settings', 'nxs_snap') ?>" /></div>
|
152 |
+
|
153 |
+
|
154 |
+
</div><?php
|
155 |
+
}
|
156 |
+
//#### Set Unit Settings from POST
|
157 |
+
function setNTSettings($post, $options){ $code = $this->ntInfo['code'];
|
158 |
+
foreach ($post as $ii => $pval){
|
159 |
+
if (isset($pval['appKey']) && $pval['appKey']!=''){ if (!isset($options[$ii])) $options[$ii] = array();
|
160 |
+
|
161 |
+
if (isset($pval['apDo'.$code])) $options[$ii]['do'.$code] = $pval['apDo'.$code]; else $options[$ii]['do'.$code] = 0;
|
162 |
+
if (isset($pval['nName'])) $options[$ii]['nName'] = trim($pval['nName']);
|
163 |
+
|
164 |
+
if (isset($pval['appKey'])) $options[$ii]['appKey'] = trim($pval['appKey']);
|
165 |
+
if (isset($pval['appSec'])) $options[$ii]['appSec'] = trim($pval['appSec']);
|
166 |
+
if (isset($pval['setID'])) $options[$ii]['setID'] = trim($pval['setID']);
|
167 |
+
|
168 |
+
|
169 |
+
if (isset($pval['catSel'])) $options[$ii]['catSel'] = trim($pval['catSel']); else $options[$ii]['catSel'] = 0;
|
170 |
+
if ($options[$ii]['catSel']=='1' && trim($pval['catSelEd'])!='') $options[$ii]['catSelEd'] = trim($pval['catSelEd']); else $options[$ii]['catSelEd'] = '';
|
171 |
+
|
172 |
+
if (isset($pval['defImg'])) $options[$ii]['defImg'] = $pval['defImg'];
|
173 |
+
if (isset($pval['inclTags'])) $options[$ii]['inclTags'] = trim($pval['inclTags']); else $options[$ii]['inclTags'] = 0;
|
174 |
+
if (isset($pval['msgFrmt'])) $options[$ii]['msgFrmt'] = trim($pval['msgFrmt']);
|
175 |
+
if (isset($pval['msgTFrmt'])) $options[$ii]['msgTFrmt'] = trim($pval['msgTFrmt']);
|
176 |
+
|
177 |
+
$options[$ii] = nxs_adjRpst($options[$ii], $pval);
|
178 |
+
|
179 |
+
if (isset($pval['delayDays'])) $options[$ii]['nDays'] = trim($pval['delayDays']);
|
180 |
+
if (isset($pval['delayHrs'])) $options[$ii]['nHrs'] = trim($pval['delayHrs']); if (isset($pval['delayMin'])) $options[$ii]['nMin'] = trim($pval['delayMin']);
|
181 |
+
if (isset($pval['qTLng'])) $options[$ii]['qTLng'] = trim($pval['qTLng']);
|
182 |
+
} elseif ( count($pval)==1 ) if (isset($pval['apDo'.$code])) $options[$ii]['do'.$code] = $pval['apDo'.$code]; else $options[$ii]['do'.$code] = 0;
|
183 |
+
} return $options;
|
184 |
+
}
|
185 |
+
//#### Show Post->Edit Meta Box Settings
|
186 |
+
function showEdPostNTSettings($ntOpts, $post){ global $nxs_plurl; $post_id = $post->ID; $nt = $this->ntInfo['lcode']; $ntU = $this->ntInfo['code'];
|
187 |
+
foreach($ntOpts as $ii=>$ntOpt) { $pMeta = maybe_unserialize(get_post_meta($post_id, 'snap'.$ntU, true));
|
188 |
+
if (is_array($pMeta) && isset($pMeta[$ii]) && is_array($pMeta[$ii])) $ntOpt = $this->adjMetaOpt($ntOpt, $pMeta[$ii]); if (empty($ntOpt['imgToUse'])) $ntOpt['imgToUse'] = '';
|
189 |
+
$doIT = $ntOpt['do'.$ntU] && (is_array($pMeta) || $ntOpt['catSel']!='1'); $imgToUse = $ntOpt['imgToUse'];
|
190 |
+
$isAvail = $ntOpt['appKey']!='' && $ntOpt['appSec']!=''; $msgFormat = htmlentities($ntOpt['msgFrmt'], ENT_COMPAT, "UTF-8"); $msgFormatT = htmlentities($ntOpt['msgTFrmt'], ENT_COMPAT, "UTF-8");
|
191 |
+
$postType = $ntOpt['postType'];
|
192 |
+
?>
|
193 |
+
<tr><th style="text-align:left;" colspan="2">
|
194 |
+
<?php if ($ntOpt['catSel']=='1' && trim($ntOpt['catSelEd'])!='') { ?> <input type="hidden" class="nxs_FL" id="nxs_FL_<?php echo $ntU; ?><?php echo $ii; ?>" value="<?php echo $ntOpt['catSelEd']; ?>" /> <?php } ?>
|
195 |
+
<?php if (!empty($ntOpt['tagsSelX'])) { ?> <input type="hidden" class="nxs_TG" id="nxs_TG_<?php echo $ntU; ?><?php echo $ii; ?>" value="<?php echo $ntOpt['tagsSelX']; ?>" /> <?php } ?>
|
196 |
+
<?php if ($isAvail) { ?><input class="nxsGrpDoChb" value="1" id="do<?php echo $ntU.$ii; ?>" <?php if ($post->post_status == "publish") echo 'disabled="disabled"';?> type="checkbox" name="<?php echo $nt; ?>[<?php echo $ii; ?>][do<?php echo $ntU; ?>]" <?php if ((int)$doIT == 1) echo 'checked="checked" title="def"'; ?> />
|
197 |
+
<?php if ($post->post_status == "publish") { ?> <input type="hidden" name="<?php echo $nt; ?>[<?php echo $ii; ?>][do<?php echo $ntU; ?>]" value="<?php echo $doIT;?>"> <?php } ?> <?php } ?>
|
198 |
+
|
199 |
+
<div class="nsx_iconedTitle" style="display: inline; font-size: 13px; background-image: url(<?php echo $nxs_plurl; ?>img/<?php echo $nt; ?>16.png);"><?php echo $this->ntInfo['name']; ?> - <?php _e('publish to', 'nxs_snap') ?> (<i style="color: #005800;"><?php echo $ntOpt['nName']; ?></i>)</div></th> <td><?php //## Only show RePost button if the post is "published"
|
200 |
+
if ($post->post_status == "publish" && $isAvail) { ?><input alt="<?php echo $ii; ?>" style="float: right;" onmouseout="hidePopShAtt('SV');" onmouseover="showPopShAtt('SV', event);" onclick="return false;" type="button" class="button" name="rePostTo<?php echo $ntU; ?>_repostButton" id="rePostTo<?php echo $ntU; ?>_button" value="<?php _e('Repost to '.$this->ntInfo['name'], 'nxs_snap') ?>" />
|
201 |
+
<?php } ?>
|
202 |
+
|
203 |
+
<?php if (is_array($pMeta) && is_array($pMeta[$ii]) && isset($pMeta[$ii]['pgID']) ) {
|
204 |
+
|
205 |
+
?> <span id="pstd<?php echo $ntU; ?><?php echo $ii; ?>" style="float: right;padding-top: 4px; padding-right: 10px;">
|
206 |
+
<a style="font-size: 10px;" href="<?php echo $pMeta[$ii]['postURL']; ?>" target="_blank"><?php $nType=$this->ntInfo['name']; printf( __( 'Posted on', 'nxs_snap' ), $nType); ?> <?php echo (isset($pMeta[$ii]['pDate']) && $pMeta[$ii]['pDate']!='')?(" (".$pMeta[$ii]['pDate'].")"):""; ?></a>
|
207 |
+
</span><?php } ?>
|
208 |
+
|
209 |
+
</td></tr>
|
210 |
+
|
211 |
+
<?php if (!$isAvail) { ?><tr><th scope="row" style="text-align:right; width:150px; padding-top: 5px; padding-right:10px;"></th> <td><b>Setup your <? echo $this->ntInfo['name']; ?> Account to AutoPost to <? echo $this->ntInfo['name']; ?></b></td></tr>
|
212 |
+
<?php } else { if ($post->post_status != "publish" && function_exists('nxs_doSMAS5') ) { $ntOpt['postTime'] = get_post_time('U', false, $post_id); nxs_doSMAS5($nt, $ii, $ntOpt); } ?>
|
213 |
+
|
214 |
+
<?php if ($ntOpt['rpstOn']=='1') { ?>
|
215 |
+
|
216 |
+
<tr id="altFormat1" style=""><th scope="row" class="nxsTHRow">
|
217 |
+
<input value="0" type="hidden" name="<?php echo $nt; ?>[<?php echo $ii; ?>][rpstPostIncl]"/><input value="nxsi<?php echo $ii; ?>ap" type="checkbox" name="<?php echo $nt; ?>[<?php echo $ii; ?>][rpstPostIncl]" <?php if (!empty($ntOpt['rpstPostIncl'])) echo "checked"; ?> />
|
218 |
+
</th>
|
219 |
+
<td> <?php _e('Include in "Auto-Reposting" to this network.', 'nxs_snap') ?>
|
220 |
+
</td></tr> <?php } ?>
|
221 |
+
|
222 |
+
<tr id="altFormat1" style=""><th scope="row" style="vertical-align:top; padding-top: 6px; text-align:right; width:60px; padding-right:10px;"><?php _e('Title Format:', 'NS_SPAP') ?></th>
|
223 |
+
<td><input value="<?php echo $msgFormatT; ?>" type="text" name="<?php echo $nt; ?>[<?php echo $ii; ?>][msgTFrmt]" style="width:60%;max-width: 610px;" onfocus="jQuery('.nxs_FRMTHint').hide();mxs_showFrmtInfo('msgFrmtT<?php echo $nt.$ii; ?>');"/><?php nxs_doShowHint("msgFrmtT".$nt.$ii, '', '58'); ?></td></tr>
|
224 |
+
|
225 |
+
<tr id="altFormat1" style=""><th scope="row" style="vertical-align:top; padding-top: 6px; text-align:right; width:60px; padding-right:10px;"><?php _e('Text Format:', 'nxs_snap') ?></th><td>
|
226 |
+
|
227 |
+
<textarea cols="150" rows="1" id="<?php echo $nt.$ii; ?>msgFrmt" name="<?php echo $nt; ?>[<?php echo $ii; ?>][msgFrmt]" style="width:60%;max-width: 610px;" onfocus="jQuery('#<?php echo $nt.$ii; ?>msgFrmt').attr('rows', 4); jQuery('.nxs_FRMTHint').hide();mxs_showFrmtInfo('msgFrmt<?php echo $nt.$ii; ?>');"><?php echo $msgFormat ?></textarea> <?php nxs_doShowHint("msgFrmt".$nt.$ii, '', '58'); ?>
|
228 |
+
|
229 |
+
</td></tr>
|
230 |
+
|
231 |
+
<?php /* ## Select Image & URL ## */ nxs_showImgToUseDlg($nt, $ii, $imgToUse); ?>
|
232 |
+
<?php }
|
233 |
+
|
234 |
+
}
|
235 |
+
}
|
236 |
+
//#### Save Meta Tags to the Post
|
237 |
+
function adjMetaOpt($optMt, $pMeta){ if (isset($pMeta['isPosted'])) $optMt['isPosted'] = $pMeta['isPosted']; else $optMt['isPosted'] = '';
|
238 |
+
if (isset($pMeta['doFL'])) $optMt['doFL'] = $pMeta['doFL'] == 1?1:0; else { if (isset($pMeta['msgFormat'])) $optMt['doFL'] = 0; }
|
239 |
+
|
240 |
+
if (isset($pMeta['msgFrmt'])) $optMt['msgFrmt'] = $pMeta['msgFrmt']; if (isset($pMeta['msgTFrmt'])) $optMt['msgTFrmt'] = $pMeta['msgTFrmt'];
|
241 |
+
|
242 |
+
if (isset($pMeta['imgToUse'])) $optMt['imgToUse'] = $pMeta['imgToUse']; if (isset($pMeta['urlToUse'])) $optMt['urlToUse'] = $pMeta['urlToUse'];
|
243 |
+
if (isset($pMeta['timeToRun'])) $optMt['timeToRun'] = $pMeta['timeToRun']; if (isset($pMeta['rpstPostIncl'])) $optMt['rpstPostIncl'] = $pMeta['rpstPostIncl'];
|
244 |
+
if (isset($pMeta['SNAPincludeFL']) && $pMeta['SNAPincludeFL'] == '1' ) $optMt['doFL'] = 1;
|
245 |
+
return $optMt;
|
246 |
+
}
|
247 |
+
}}
|
248 |
+
if (!function_exists("nxs_rePostToFL_ajax")) {
|
249 |
+
function nxs_rePostToFL_ajax() { check_ajax_referer('nxsSsPageWPN'); $postID = $_POST['id']; global $plgn_NS_SNAutoPoster; if (!isset($plgn_NS_SNAutoPoster)) return; $options = $plgn_NS_SNAutoPoster->nxs_options;
|
250 |
+
foreach ($options['fl'] as $ii=>$two) if ($ii==$_POST['nid']) { $two['ii'] = $ii; $two['pType'] = 'aj'; //if ($two['apPageID'].$two['apUName']==$_POST['nid']) {
|
251 |
+
$appo = get_post_meta($postID, 'snapFL', true); $appo = maybe_unserialize($appo);// prr($appo);
|
252 |
+
if (is_array($appo) && isset($appo[$ii]) && is_array($appo[$ii])){ $ntClInst = new nxs_snapClassFL(); $two = $ntClInst->adjMetaOpt($two, $appo[$ii]); }
|
253 |
+
$result = nxs_doPublishToFL($postID, $two); if ($result == 200) die("Successfully sent your post to Flickr. "); else die($result);
|
254 |
+
}
|
255 |
+
}
|
256 |
+
}
|
257 |
+
if (!function_exists("nxs_doPublishToFL")) { //## Post to FL. // V3 - imgToUse - Done, class_SNAP_AP - Done, New Format - Done
|
258 |
+
function nxs_doPublishToFL($postID, $options){ global $plgn_NS_SNAutoPoster; $ntCd = 'FL'; $ntCdL = 'fl'; $ntNm = 'Flickr'; if (!is_array($options)) $options = maybe_unserialize(get_post_meta($postID, $options, true));
|
259 |
+
$addParams = nxs_makeURLParams(array('NTNAME'=>$ntNm, 'NTCODE'=>$ntCd, 'POSTID'=>$postID, 'ACCNAME'=>$options['nName']));
|
260 |
+
if (empty($options['imgToUse'])) $options['imgToUse'] = ''; if (empty($options['imgSize'])) $options['imgSize'] = '';
|
261 |
+
$ii = $options['ii']; if (!isset($options['pType'])) $options['pType'] = 'im'; if ($options['pType']=='sh') sleep(rand(1, 10));
|
262 |
+
$logNT = '<span style="color:#800000">Flickr</span> - '.$options['nName'];
|
263 |
+
$snap_ap = get_post_meta($postID, 'snap'.$ntCd, true); $snap_ap = maybe_unserialize($snap_ap);
|
264 |
+
if ($options['pType']!='aj' && is_array($snap_ap) && (nxs_chArrVar($snap_ap[$ii], 'isPosted', '1') || nxs_chArrVar($snap_ap[$ii], 'isPrePosted', '1'))) {
|
265 |
+
$snap_isAutoPosted = get_post_meta($postID, 'snap_isAutoPosted', true); if ($snap_isAutoPosted!='2') {
|
266 |
+
nxs_addToLogN('W', 'Notice', $logNT, '-=Duplicate=- Post ID:'.$postID, 'Already posted. No reason for posting duplicate'.' |'.$uqID); return;
|
267 |
+
}
|
268 |
+
}
|
269 |
+
$message = array('message'=>'', 'link'=>'', 'imageURL'=>'', 'videoURL'=>'', 'announce'=>'');
|
270 |
+
|
271 |
+
if ($postID=='0') { echo "Testing ... <br/><br/>"; $message['description'] = 'Test Post, Description'; $message['title'] = 'Test Post - Title'; $message['url'] = home_url(); $message['tags']='';
|
272 |
+
if ($options['defImg']!='') $imgURL = $options['defImg']; else $imgURL ="http://direct.gtln.us/img/nxs/NXS-Lama.jpg"; $message['imageURL'] = $imgURL;
|
273 |
+
} else { nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPrePosted'=>'1')); $post = get_post($postID); if(!$post) return;
|
274 |
+
$isNoImg = false; $tags = '';
|
275 |
+
|
276 |
+
$options['msgFrmt'] = nsFormatMessage($options['msgFrmt'], $postID, $addParams); $options['msgTFrmt'] = nsFormatMessage($options['msgTFrmt'], $postID, $addParams);
|
277 |
+
|
278 |
+
$tggs = array(); if ($options['inclTags']=='1'){ $t = wp_get_post_tags($postID); $tggs = array(); foreach ($t as $tagA) {$tggs[] = $tagA->name;} $tags = '"'.implode('" "',$tggs).'"'; }
|
279 |
+
|
280 |
+
$imgURL = nxs_getPostImage($postID, 'full'); if (preg_match("/noImg.\.png/i", $imgURL)) { $imgURL = ''; $isNoImg = true; }
|
281 |
+
|
282 |
+
//## MyURL - URLToGo code
|
283 |
+
if (!isset($options['urlToUse']) || trim($options['urlToUse'])=='') $myurl = trim(get_post_meta($postID, 'snap_MYURL', true)); if ($myurl!='') $options['urlToUse'] = $myurl;
|
284 |
+
if (isset($options['urlToUse']) && trim($options['urlToUse'])!='') { $urlToGo = $options['urlToUse']; $options['useFBGURLInfo'] = true; } else $urlToGo = get_permalink($postID);
|
285 |
+
$gOptions = $plgn_NS_SNAutoPoster->nxs_options; $addURLParams = trim($gOptions['addURLParams']); if($addURLParams!='') $urlToGo .= (strpos($urlToGo,'?')!==false?'&':'?').$addURLParams;
|
286 |
+
$message = array('url'=>$urlToGo, 'imageURL'=>$imgURL, 'noImg'=>$isNoImg, 'tags'=>$tags);
|
287 |
+
$extInfo = ' | PostID: '.$postID." - ".(isset($post) && is_object($post)?$post->post_title:'');
|
288 |
+
}
|
289 |
+
//## Actual Post
|
290 |
+
$ntToPost = new nxs_class_SNAP_FL(); $ret = $ntToPost->doPostToNT($options, $message); //prr($ret);
|
291 |
+
//## Process Results
|
292 |
+
if (!is_array($ret) || $ret['isPosted']!='1') { //## Error
|
293 |
+
if ($postID=='0') prr($ret); nxs_addToLogN('E', 'Error', $logNT, '-=ERROR=- '.print_r($ret, true), $extInfo);
|
294 |
+
} else { // ## All Good - log it.
|
295 |
+
if ($postID=='0') { nxs_addToLogN('S', 'Test', $logNT, 'OK - TEST Message Posted '); echo _e('OK - Message Posted, please see your '.$logNT.' Page. ', 'nxs_snap'); }
|
296 |
+
else { nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPosted'=>'1', 'pgID'=>$ret['postID'], 'postURL'=>$ret['postURL'], 'pDate'=>date('Y-m-d H:i:s')));
|
297 |
+
$extInfo .= ' | <a href="'.$ret['postURL'].'" target="_blank">Post Link</a>'; nxs_addToLogN('S', 'Posted', $logNT, 'OK - Message Posted ', $extInfo);
|
298 |
+
}
|
299 |
+
}
|
300 |
+
//## Return Result
|
301 |
+
if ($ret['isPosted']=='1') return 200; else return print_r($ret, true);
|
302 |
+
|
303 |
+
}
|
304 |
+
}
|
305 |
+
?>
|
inc-cl/gp.api.php
CHANGED
@@ -18,8 +18,10 @@ if (!class_exists("nxs_class_SNAP_GP")) { class nxs_class_SNAP_GP {
|
|
18 |
//## Check settings
|
19 |
if (!is_array($options)) { $badOut['Error'] = 'No Options'; return $badOut; }
|
20 |
if (!isset($options['gpUName']) || trim($options['gpPass'])=='') { $badOut['Error'] = 'Not Configured'; return $badOut; }
|
|
|
21 |
//## Make Post
|
22 |
-
$gpPostType = $options['postType'];
|
|
|
23 |
if ($gpPostType=='I' || $gpPostType=='A') { if (isset($message['imageURL'])) $imgURL = trim(nxs_getImgfrOpt($message['imageURL'], $options['imgSize'])); else $imgURL = ''; }
|
24 |
|
25 |
$email = $options['gpUName']; $pass = substr($options['gpPass'], 0, 5)=='n5g9a'?nsx_doDecode(substr($options['gpPass'], 5)):$options['gpPass'];
|
18 |
//## Check settings
|
19 |
if (!is_array($options)) { $badOut['Error'] = 'No Options'; return $badOut; }
|
20 |
if (!isset($options['gpUName']) || trim($options['gpPass'])=='') { $badOut['Error'] = 'Not Configured'; return $badOut; }
|
21 |
+
if (empty($options['imgSize'])) $options['imgSize'] = '';
|
22 |
//## Make Post
|
23 |
+
$gpPostType = $options['postType'];
|
24 |
+
if (!empty($message['pText'])) $msg = $message['pText']; else $msg = nxs_doFormatMsg($options['gpMsgFormat'], $message); // Make "message default"
|
25 |
if ($gpPostType=='I' || $gpPostType=='A') { if (isset($message['imageURL'])) $imgURL = trim(nxs_getImgfrOpt($message['imageURL'], $options['imgSize'])); else $imgURL = ''; }
|
26 |
|
27 |
$email = $options['gpUName']; $pass = substr($options['gpPass'], 0, 5)=='n5g9a'?nsx_doDecode(substr($options['gpPass'], 5)):$options['gpPass'];
|
inc-cl/gp.php
CHANGED
@@ -16,7 +16,10 @@ if (!class_exists("nxs_snapClassGP")) { class nxs_snapClassGP {
|
|
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;"> <img id="<?php echo $ntInfo['code'].$indx;?>LoadingImg" style="display: none;" src='<?php echo $nxs_plurl; ?>img/ajax-loader-sm.gif' />
|
19 |
-
<input value="
|
|
|
|
|
|
|
20 |
<?php if (isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);"><?php echo "*[".(substr_count($pbo['catSelEd'], ",")+1)."]*" ?></span><?php } ?>
|
21 |
<?php if (isset($pbo['rpstOn']) && (int)$pbo['rpstOn'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popReActive');" onmouseover="nxs_showPopUpInfo('popReActive', event);"><?php echo "*[R]*" ?></span><?php } ?>
|
22 |
<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>
|
@@ -140,7 +143,7 @@ if (!class_exists("nxs_snapClassGP")) { class nxs_snapClassGP {
|
|
140 |
if (isset($pval['apDoGP'])) $options[$ii]['doGP'] = $pval['apDoGP']; else $options[$ii]['doGP'] = 0;
|
141 |
if (isset($pval['delayDays'])) $options[$ii]['nDays'] = trim($pval['delayDays']); if (isset($pval['delayHrs'])) $options[$ii]['nHrs'] = trim($pval['delayHrs']); if (isset($pval['delayMin'])) $options[$ii]['nMin'] = trim($pval['delayMin']);
|
142 |
if (isset($pval['qTLng'])) $options[$ii]['qTLng'] = trim($pval['qTLng']);
|
143 |
-
} elseif ((
|
144 |
} return $options;
|
145 |
}
|
146 |
//#### Show Post->Edit Meta Box Settings
|
@@ -267,9 +270,9 @@ if (!function_exists("nxs_doPublishToGP")) { //## Second Function to Post to G+
|
|
267 |
if (preg_match("/noImg.\.png/i", $imgURL)) { $imgURL = ''; $isNoImg = true; }
|
268 |
|
269 |
//## MyURL - URLToGo code
|
270 |
-
if (!isset($options['urlToUse']) || trim($options['urlToUse'])=='') $myurl =
|
271 |
-
if (isset($options['urlToUse']) && trim($options['urlToUse'])!='') { $urlToGo = $options['urlToUse']; $options['useFBGURLInfo'] = true; } else $urlToGo = get_permalink($postID);
|
272 |
-
|
273 |
|
274 |
$message = array('url'=>$urlToGo, 'imageURL'=>$imgURL, 'videoCode'=>$ytCode, 'noImg'=>$isNoImg); //prr($message);
|
275 |
}
|
@@ -280,7 +283,8 @@ if (!function_exists("nxs_doPublishToGP")) { //## Second Function to Post to G+
|
|
280 |
if ($postID=='0') prr($ret); nxs_addToLogN('E', 'Error', $logNT, '-=ERROR=- '.print_r($ret, true), $extInfo);
|
281 |
} else { // ## All Good - log it.
|
282 |
if ($postID=='0') { nxs_addToLogN('S', 'Test', $logNT, 'OK - TEST Message Posted '); echo _e('OK - Message Posted, please see your '.$logNT.' Page. ', 'nxs_snap'); }
|
283 |
-
else { nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPosted'=>'1', 'pgID'=>$ret['postID'], 'pDate'=>date('Y-m-d H:i:s')));
|
|
|
284 |
}
|
285 |
//## Return Result
|
286 |
if ($ret['isPosted']=='1') return 200; else return print_r($ret, true);
|
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;"> <img id="<?php echo $ntInfo['code'].$indx;?>LoadingImg" style="display: none;" src='<?php echo $nxs_plurl; ?>img/ajax-loader-sm.gif' />
|
19 |
+
<input value="0" name="<?php echo $ntInfo['lcode']; ?>[<?php echo $indx; ?>][apDo<?php echo $ntInfo['code']; ?>]" type="hidden" />
|
20 |
+
<?php if ((int)$pbo['do'.$ntInfo['code']] == 1 && isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <input type="radio" id="rbtn<?php echo $ntInfo['lcode'].$indx; ?>" checked="checked" onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);" /> <?php } else { ?>
|
21 |
+
<input value="1" name="<?php echo $ntInfo['lcode']; ?>[<?php echo $indx; ?>][apDo<?php echo $ntInfo['code']; ?>]" type="checkbox" <?php if ((int)$pbo['do'.$ntInfo['code']] == 1 && $pbo['catSel']!='1') echo "checked"; ?> />
|
22 |
+
<?php } ?>
|
23 |
<?php if (isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);"><?php echo "*[".(substr_count($pbo['catSelEd'], ",")+1)."]*" ?></span><?php } ?>
|
24 |
<?php if (isset($pbo['rpstOn']) && (int)$pbo['rpstOn'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popReActive');" onmouseover="nxs_showPopUpInfo('popReActive', event);"><?php echo "*[R]*" ?></span><?php } ?>
|
25 |
<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>
|
143 |
if (isset($pval['apDoGP'])) $options[$ii]['doGP'] = $pval['apDoGP']; else $options[$ii]['doGP'] = 0;
|
144 |
if (isset($pval['delayDays'])) $options[$ii]['nDays'] = trim($pval['delayDays']); if (isset($pval['delayHrs'])) $options[$ii]['nHrs'] = trim($pval['delayHrs']); if (isset($pval['delayMin'])) $options[$ii]['nMin'] = trim($pval['delayMin']);
|
145 |
if (isset($pval['qTLng'])) $options[$ii]['qTLng'] = trim($pval['qTLng']);
|
146 |
+
} elseif ( count($pval)==1 ) if (isset($pval['apDo'.$code])) $options[$ii]['do'.$code] = $pval['apDo'.$code]; else $options[$ii]['do'.$code] = 0;
|
147 |
} return $options;
|
148 |
}
|
149 |
//#### Show Post->Edit Meta Box Settings
|
270 |
if (preg_match("/noImg.\.png/i", $imgURL)) { $imgURL = ''; $isNoImg = true; }
|
271 |
|
272 |
//## MyURL - URLToGo code
|
273 |
+
if (!isset($options['urlToUse']) || trim($options['urlToUse'])=='') $myurl = trim(get_post_meta($postID, 'snap_MYURL', true)); if ($myurl!='') $options['urlToUse'] = $myurl;
|
274 |
+
if (isset($options['urlToUse']) && trim($options['urlToUse'])!='') { $urlToGo = $options['urlToUse']; $options['useFBGURLInfo'] = true; } else $urlToGo = get_permalink($postID);
|
275 |
+
if($addParams!='') $urlToGo .= (strpos($urlToGo,'?')!==false?'&':'?').$addParams;
|
276 |
|
277 |
$message = array('url'=>$urlToGo, 'imageURL'=>$imgURL, 'videoCode'=>$ytCode, 'noImg'=>$isNoImg); //prr($message);
|
278 |
}
|
283 |
if ($postID=='0') prr($ret); nxs_addToLogN('E', 'Error', $logNT, '-=ERROR=- '.print_r($ret, true), $extInfo);
|
284 |
} else { // ## All Good - log it.
|
285 |
if ($postID=='0') { nxs_addToLogN('S', 'Test', $logNT, 'OK - TEST Message Posted '); echo _e('OK - Message Posted, please see your '.$logNT.' Page. ', 'nxs_snap'); }
|
286 |
+
else { nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPosted'=>'1', 'pgID'=>$ret['postID'], 'pDate'=>date('Y-m-d H:i:s')));
|
287 |
+
$extInfo .= ' | <a href="'.$ret['postURL'].'" target="_blank">Post Link</a>'; nxs_addToLogN('S', 'Posted', $logNT, 'OK - Message Posted ', $extInfo); }
|
288 |
}
|
289 |
//## Return Result
|
290 |
if ($ret['isPosted']=='1') return 200; else return print_r($ret, true);
|
inc-cl/ip.api.php
CHANGED
@@ -25,7 +25,8 @@ if (!class_exists("nxs_class_SNAP_IP")) { class nxs_class_SNAP_IP {
|
|
25 |
if (!isset($options['ipUName']) || trim($options['ipPass'])=='') { $badOut['Error'] = 'Not Configured'; return $badOut; }
|
26 |
$dusername = $options['ipUName']; $pass = (substr($options['ipPass'], 0, 5)=='n5g9a'?nsx_doDecode(substr($options['ipPass'], 5)):$options['ipPass']);
|
27 |
//## Format
|
28 |
-
$msg =
|
|
|
29 |
$link = urlencode($message['url']); $desc = urlencode(substr($msgT, 0, 250)); $ext = urlencode(substr($msg, 0, 1000)); $tags = $message['tags'];
|
30 |
|
31 |
$apicall = "https://www.instapaper.com/api/add?red=api&url=$link&title=$desc&selection=$ext";// prr($apicall);
|
25 |
if (!isset($options['ipUName']) || trim($options['ipPass'])=='') { $badOut['Error'] = 'Not Configured'; return $badOut; }
|
26 |
$dusername = $options['ipUName']; $pass = (substr($options['ipPass'], 0, 5)=='n5g9a'?nsx_doDecode(substr($options['ipPass'], 5)):$options['ipPass']);
|
27 |
//## Format
|
28 |
+
if (!empty($message['pText'])) $msg = $message['pText']; else $msg = nxs_doFormatMsg($options['ipMsgFormat'], $message);
|
29 |
+
if (!empty($message['pTitle'])) $msgT = $message['pTitle']; else $msgT = nxs_doFormatMsg($options['ipMsgTFormat'], $message);
|
30 |
$link = urlencode($message['url']); $desc = urlencode(substr($msgT, 0, 250)); $ext = urlencode(substr($msg, 0, 1000)); $tags = $message['tags'];
|
31 |
|
32 |
$apicall = "https://www.instapaper.com/api/add?red=api&url=$link&title=$desc&selection=$ext";// prr($apicall);
|
inc-cl/ip.php
CHANGED
@@ -15,7 +15,10 @@ if (!class_exists("nxs_snapClassIP")) { class nxs_snapClassIP {
|
|
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;"> <img id="<?php echo $ntInfo['code'].$indx;?>LoadingImg" style="display: none;" src='<?php echo $nxs_plurl; ?>img/ajax-loader-sm.gif' />
|
18 |
-
<input value="
|
|
|
|
|
|
|
19 |
<?php if (isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);"><?php echo "*[".(substr_count($pbo['catSelEd'], ",")+1)."]*" ?></span><?php } ?>
|
20 |
<?php if (isset($pbo['rpstOn']) && (int)$pbo['rpstOn'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popReActive');" onmouseover="nxs_showPopUpInfo('popReActive', event);"><?php echo "*[R]*" ?></span><?php } ?>
|
21 |
<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>
|
@@ -108,7 +111,7 @@ if (!class_exists("nxs_snapClassIP")) { class nxs_snapClassIP {
|
|
108 |
if (isset($pval['delayDays'])) $options[$ii]['nDays'] = trim($pval['delayDays']);
|
109 |
if (isset($pval['delayHrs'])) $options[$ii]['nHrs'] = trim($pval['delayHrs']); if (isset($pval['delayMin'])) $options[$ii]['nMin'] = trim($pval['delayMin']);
|
110 |
if (isset($pval['qTLng'])) $options[$ii]['qTLng'] = trim($pval['qTLng']);
|
111 |
-
} elseif ((
|
112 |
} return $options;
|
113 |
}
|
114 |
//#### Show Post->Edit Meta Box Settings
|
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;"> <img id="<?php echo $ntInfo['code'].$indx;?>LoadingImg" style="display: none;" src='<?php echo $nxs_plurl; ?>img/ajax-loader-sm.gif' />
|
18 |
+
<input value="0" name="<?php echo $ntInfo['lcode']; ?>[<?php echo $indx; ?>][apDo<?php echo $ntInfo['code']; ?>]" type="hidden" />
|
19 |
+
<?php if ((int)$pbo['do'.$ntInfo['code']] == 1 && isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <input type="radio" id="rbtn<?php echo $ntInfo['lcode'].$indx; ?>" checked="checked" onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);" /> <?php } else { ?>
|
20 |
+
<input value="1" name="<?php echo $ntInfo['lcode']; ?>[<?php echo $indx; ?>][apDo<?php echo $ntInfo['code']; ?>]" type="checkbox" <?php if ((int)$pbo['do'.$ntInfo['code']] == 1 && $pbo['catSel']!='1') echo "checked"; ?> />
|
21 |
+
<?php } ?>
|
22 |
<?php if (isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);"><?php echo "*[".(substr_count($pbo['catSelEd'], ",")+1)."]*" ?></span><?php } ?>
|
23 |
<?php if (isset($pbo['rpstOn']) && (int)$pbo['rpstOn'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popReActive');" onmouseover="nxs_showPopUpInfo('popReActive', event);"><?php echo "*[R]*" ?></span><?php } ?>
|
24 |
<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>
|
111 |
if (isset($pval['delayDays'])) $options[$ii]['nDays'] = trim($pval['delayDays']);
|
112 |
if (isset($pval['delayHrs'])) $options[$ii]['nHrs'] = trim($pval['delayHrs']); if (isset($pval['delayMin'])) $options[$ii]['nMin'] = trim($pval['delayMin']);
|
113 |
if (isset($pval['qTLng'])) $options[$ii]['qTLng'] = trim($pval['qTLng']);
|
114 |
+
} elseif ( count($pval)==1 ) if (isset($pval['apDo'.$code])) $options[$ii]['do'.$code] = $pval['apDo'.$code]; else $options[$ii]['do'.$code] = 0;
|
115 |
} return $options;
|
116 |
}
|
117 |
//#### Show Post->Edit Meta Box Settings
|
inc-cl/li.api.php
CHANGED
@@ -16,12 +16,13 @@ if (!class_exists("nxs_class_SNAP_LI")) { class nxs_class_SNAP_LI {
|
|
16 |
//## Check settings
|
17 |
if (!is_array($options)) { $badOut['Error'] = 'No Options'; return $badOut; }
|
18 |
if ((!isset($options['ulName']) || trim($options['uPass'])=='') && (empty($options['liOAuthVerifier']))) { $badOut['Error'] = 'Not Configured'; return $badOut; }
|
|
|
19 |
//## Format
|
20 |
-
$msg =
|
21 |
-
|
22 |
if ($options['liAttch']=='1') {
|
23 |
if (isset($message['imageURL'])) $imgURL = trim(nxs_getImgfrOpt($message['imageURL'], $options['imgSize'])); else $imgURL = ''; if (preg_match("/noImg.\.png/i", $imgURL)) $imgURL = '';
|
24 |
-
if (
|
25 |
$dsc = strip_tags($dsc); $dsc = nxs_decodeEntitiesFull($dsc); $dsc = nxs_html_to_utf8($dsc); $dsc = nsTrnc($dsc, 300);
|
26 |
}
|
27 |
$msg = strip_tags($msg); $msg = nxs_html_to_utf8($msg); $msgT = nxs_html_to_utf8($msgT); $urlToGo = $message['url'];
|
16 |
//## Check settings
|
17 |
if (!is_array($options)) { $badOut['Error'] = 'No Options'; return $badOut; }
|
18 |
if ((!isset($options['ulName']) || trim($options['uPass'])=='') && (empty($options['liOAuthVerifier']))) { $badOut['Error'] = 'Not Configured'; return $badOut; }
|
19 |
+
if (empty($options['imgSize'])) $options['imgSize'] = '';
|
20 |
//## Format
|
21 |
+
if (!empty($message['pText'])) $msg = $message['pText']; else $msg = nxs_doFormatMsg($options['liMsgFormat'], $message);
|
22 |
+
if (!empty($message['pTitle'])) $msgT = $message['pTitle']; else $msgT = nxs_doFormatMsg($options['liMsgFormatT'], $message);
|
23 |
if ($options['liAttch']=='1') {
|
24 |
if (isset($message['imageURL'])) $imgURL = trim(nxs_getImgfrOpt($message['imageURL'], $options['imgSize'])); else $imgURL = ''; if (preg_match("/noImg.\.png/i", $imgURL)) $imgURL = '';
|
25 |
+
if (!empty($message['urlDescr'])) $dsc = $message['urlDescr']; else $dsc = $msg;
|
26 |
$dsc = strip_tags($dsc); $dsc = nxs_decodeEntitiesFull($dsc); $dsc = nxs_html_to_utf8($dsc); $dsc = nsTrnc($dsc, 300);
|
27 |
}
|
28 |
$msg = strip_tags($msg); $msg = nxs_html_to_utf8($msg); $msgT = nxs_html_to_utf8($msgT); $urlToGo = $message['url'];
|
inc-cl/li.php
CHANGED
@@ -48,9 +48,9 @@ function nxs_ntp_time($host='time.nist.gov') { $sock = socket_create(AF_INET, SO
|
|
48 |
$data = unpack('N12', $recv); $timestamp = sprintf('%u', $data[9]); $timestamp -= 2208988800; return $timestamp;
|
49 |
}
|
50 |
|
51 |
-
if (!class_exists("nxs_snapClassLI")) { class nxs_snapClassLI {
|
52 |
//#### Show Common Settings
|
53 |
-
function showGenNTSettings($ntOpts){ global $nxs_snapSetPgURL, $nxs_plurl;
|
54 |
|
55 |
if ( isset($_GET['auth']) && $_GET['auth']=='li'){ require_once('apis/liOAuth.php'); $options = $ntOpts[$_GET['acc']];
|
56 |
|
@@ -92,7 +92,10 @@ if (!class_exists("nxs_snapClassLI")) { class nxs_snapClassLI {
|
|
92 |
if (!isset($pbo[$ntInfo['lcode'].'OK']) || $pbo[$ntInfo['lcode'].'OK']=='') $pbo[$ntInfo['lcode'].'OK'] = (isset($pbo['liAccessToken']) && $pbo['liAccessTokenSecret']!='')?'1':'';
|
93 |
?>
|
94 |
<p style="margin:0px;margin-left:5px;"> <img id="<?php echo $ntInfo['code'].$indx;?>LoadingImg" style="display: none;" src='<?php echo $nxs_plurl; ?>img/ajax-loader-sm.gif' />
|
95 |
-
<input value="
|
|
|
|
|
|
|
96 |
<?php if (isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);"><?php echo "*[".(substr_count($pbo['catSelEd'], ",")+1)."]*" ?></span><?php } ?>
|
97 |
<?php if (isset($pbo['rpstOn']) && (int)$pbo['rpstOn'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popReActive');" onmouseover="nxs_showPopUpInfo('popReActive', event);"><?php echo "*[R]*" ?></span><?php } ?>
|
98 |
<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>
|
@@ -238,7 +241,7 @@ if (!class_exists("nxs_snapClassLI")) { class nxs_snapClassLI {
|
|
238 |
|
239 |
}
|
240 |
//#### Set Unit Settings from POST
|
241 |
-
function setNTSettings($post, $options){
|
242 |
foreach ($post as $ii => $pval){ // prr($ii); prr($pval);
|
243 |
if ( (isset($pval['apLIAPIKey']) && $pval['apLIAPISec']!='') || (isset($pval['uPass']) && $pval['uPass']!='') ) { if (!isset($options[$ii])) $options[$ii] = array(); $options[$ii]['ii'] = $ii;
|
244 |
if (isset($pval['apDoLI'])) $options[$ii]['doLI'] = $pval['apDoLI']; else $options[$ii]['doLI'] = 0;
|
@@ -263,7 +266,7 @@ if (!class_exists("nxs_snapClassLI")) { class nxs_snapClassLI {
|
|
263 |
if (isset($pval['delayDays'])) $options[$ii]['nDays'] = trim($pval['delayDays']);
|
264 |
if (isset($pval['delayHrs'])) $options[$ii]['nHrs'] = trim($pval['delayHrs']); if (isset($pval['delayMin'])) $options[$ii]['nMin'] = trim($pval['delayMin']);
|
265 |
if (isset($pval['qTLng'])) $options[$ii]['qTLng'] = trim($pval['qTLng']);
|
266 |
-
} elseif ((
|
267 |
} return $options;
|
268 |
}
|
269 |
//#### Show Post->Edit Meta Box Settings
|
48 |
$data = unpack('N12', $recv); $timestamp = sprintf('%u', $data[9]); $timestamp -= 2208988800; return $timestamp;
|
49 |
}
|
50 |
|
51 |
+
if (!class_exists("nxs_snapClassLI")) { class nxs_snapClassLI { var $ntInfo = array('code'=>'LI', 'lcode'=>'li', 'name'=>'LinkedIn', 'defNName'=>'ulName', 'tstReq' => true);
|
52 |
//#### Show Common Settings
|
53 |
+
function showGenNTSettings($ntOpts){ global $nxs_snapSetPgURL, $nxs_plurl; $ntInfo = $this->ntInfo;
|
54 |
|
55 |
if ( isset($_GET['auth']) && $_GET['auth']=='li'){ require_once('apis/liOAuth.php'); $options = $ntOpts[$_GET['acc']];
|
56 |
|
92 |
if (!isset($pbo[$ntInfo['lcode'].'OK']) || $pbo[$ntInfo['lcode'].'OK']=='') $pbo[$ntInfo['lcode'].'OK'] = (isset($pbo['liAccessToken']) && $pbo['liAccessTokenSecret']!='')?'1':'';
|
93 |
?>
|
94 |
<p style="margin:0px;margin-left:5px;"> <img id="<?php echo $ntInfo['code'].$indx;?>LoadingImg" style="display: none;" src='<?php echo $nxs_plurl; ?>img/ajax-loader-sm.gif' />
|
95 |
+
<input value="0" name="<?php echo $ntInfo['lcode']; ?>[<?php echo $indx; ?>][apDo<?php echo $ntInfo['code']; ?>]" type="hidden" />
|
96 |
+
<?php if ((int)$pbo['do'.$ntInfo['code']] == 1 && isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <input type="radio" id="rbtn<?php echo $ntInfo['lcode'].$indx; ?>" checked="checked" onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);" /> <?php } else { ?>
|
97 |
+
<input value="1" name="<?php echo $ntInfo['lcode']; ?>[<?php echo $indx; ?>][apDo<?php echo $ntInfo['code']; ?>]" type="checkbox" <?php if ((int)$pbo['do'.$ntInfo['code']] == 1 && $pbo['catSel']!='1') echo "checked"; ?> />
|
98 |
+
<?php } ?>
|
99 |
<?php if (isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);"><?php echo "*[".(substr_count($pbo['catSelEd'], ",")+1)."]*" ?></span><?php } ?>
|
100 |
<?php if (isset($pbo['rpstOn']) && (int)$pbo['rpstOn'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popReActive');" onmouseover="nxs_showPopUpInfo('popReActive', event);"><?php echo "*[R]*" ?></span><?php } ?>
|
101 |
<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>
|
241 |
|
242 |
}
|
243 |
//#### Set Unit Settings from POST
|
244 |
+
function setNTSettings($post, $options){ $code = $this->ntInfo['code'];
|
245 |
foreach ($post as $ii => $pval){ // prr($ii); prr($pval);
|
246 |
if ( (isset($pval['apLIAPIKey']) && $pval['apLIAPISec']!='') || (isset($pval['uPass']) && $pval['uPass']!='') ) { if (!isset($options[$ii])) $options[$ii] = array(); $options[$ii]['ii'] = $ii;
|
247 |
if (isset($pval['apDoLI'])) $options[$ii]['doLI'] = $pval['apDoLI']; else $options[$ii]['doLI'] = 0;
|
266 |
if (isset($pval['delayDays'])) $options[$ii]['nDays'] = trim($pval['delayDays']);
|
267 |
if (isset($pval['delayHrs'])) $options[$ii]['nHrs'] = trim($pval['delayHrs']); if (isset($pval['delayMin'])) $options[$ii]['nMin'] = trim($pval['delayMin']);
|
268 |
if (isset($pval['qTLng'])) $options[$ii]['qTLng'] = trim($pval['qTLng']);
|
269 |
+
} elseif ( count($pval)==1 ) if (isset($pval['apDo'.$code])) $options[$ii]['do'.$code] = $pval['apDo'.$code]; else $options[$ii]['do'.$code] = 0;
|
270 |
} return $options;
|
271 |
}
|
272 |
//#### Show Post->Edit Meta Box Settings
|
inc-cl/lj.api.php
CHANGED
@@ -25,7 +25,8 @@ if (!class_exists("nxs_class_SNAP_LJ")) { class nxs_class_SNAP_LJ {
|
|
25 |
if (!isset($options['ljUName']) || trim($options['ljPass'])=='') { $badOut['Error'] = 'Not Configured'; return $badOut; }
|
26 |
$pass = (substr($options['ljPass'], 0, 5)=='n5g9a'?nsx_doDecode(substr($options['ljPass'], 5)):$options['ljPass']);
|
27 |
//## Format
|
28 |
-
$msg =
|
|
|
29 |
|
30 |
require_once ('apis/xmlrpc-client.php'); if ($options['ljSrv']=='DW') $server = 'dreamwidth.org'; else $server = 'livejournal.com';
|
31 |
$nxsToLJclient = new NXS_XMLRPC_Client('http://www.'.$server.'/interface/xmlrpc'); $nxsToLJclient->debug = false;
|
25 |
if (!isset($options['ljUName']) || trim($options['ljPass'])=='') { $badOut['Error'] = 'Not Configured'; return $badOut; }
|
26 |
$pass = (substr($options['ljPass'], 0, 5)=='n5g9a'?nsx_doDecode(substr($options['ljPass'], 5)):$options['ljPass']);
|
27 |
//## Format
|
28 |
+
if (!empty($message['pText'])) $msg = $message['pText']; else $msg = nxs_doFormatMsg($options['ljMsgFormat'], $message);
|
29 |
+
if (!empty($message['pTitle'])) $msgT = $message['pTitle']; else $msgT = nxs_doFormatMsg($options['ljMsgTFormat'], $message);
|
30 |
|
31 |
require_once ('apis/xmlrpc-client.php'); if ($options['ljSrv']=='DW') $server = 'dreamwidth.org'; else $server = 'livejournal.com';
|
32 |
$nxsToLJclient = new NXS_XMLRPC_Client('http://www.'.$server.'/interface/xmlrpc'); $nxsToLJclient->debug = false;
|
inc-cl/lj.php
CHANGED
@@ -15,7 +15,10 @@ if (!class_exists("nxs_snapClassLJ")) { class nxs_snapClassLJ {
|
|
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;"> <img id="<?php echo $ntInfo['code'].$indx;?>LoadingImg" style="display: none;" src='<?php echo $nxs_plurl; ?>img/ajax-loader-sm.gif' />
|
18 |
-
<input value="
|
|
|
|
|
|
|
19 |
<?php if (isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);"><?php echo "*[".(substr_count($pbo['catSelEd'], ",")+1)."]*" ?></span><?php } ?>
|
20 |
<?php if (isset($pbo['rpstOn']) && (int)$pbo['rpstOn'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popReActive');" onmouseover="nxs_showPopUpInfo('popReActive', event);"><?php echo "*[R]*" ?></span><?php } ?>
|
21 |
<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>
|
@@ -124,7 +127,7 @@ if (!class_exists("nxs_snapClassLJ")) { class nxs_snapClassLJ {
|
|
124 |
if (isset($pval['delayDays'])) $options[$ii]['nDays'] = trim($pval['delayDays']);
|
125 |
if (isset($pval['delayHrs'])) $options[$ii]['nHrs'] = trim($pval['delayHrs']); if (isset($pval['delayMin'])) $options[$ii]['nMin'] = trim($pval['delayMin']);
|
126 |
if (isset($pval['qTLng'])) $options[$ii]['qTLng'] = trim($pval['qTLng']);
|
127 |
-
} elseif ((
|
128 |
} return $options;
|
129 |
}
|
130 |
//#### Show Post->Edit Meta Box Settings
|
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;"> <img id="<?php echo $ntInfo['code'].$indx;?>LoadingImg" style="display: none;" src='<?php echo $nxs_plurl; ?>img/ajax-loader-sm.gif' />
|
18 |
+
<input value="0" name="<?php echo $ntInfo['lcode']; ?>[<?php echo $indx; ?>][apDo<?php echo $ntInfo['code']; ?>]" type="hidden" />
|
19 |
+
<?php if ((int)$pbo['do'.$ntInfo['code']] == 1 && isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <input type="radio" id="rbtn<?php echo $ntInfo['lcode'].$indx; ?>" checked="checked" onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);" /> <?php } else { ?>
|
20 |
+
<input value="1" name="<?php echo $ntInfo['lcode']; ?>[<?php echo $indx; ?>][apDo<?php echo $ntInfo['code']; ?>]" type="checkbox" <?php if ((int)$pbo['do'.$ntInfo['code']] == 1 && $pbo['catSel']!='1') echo "checked"; ?> />
|
21 |
+
<?php } ?>
|
22 |
<?php if (isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);"><?php echo "*[".(substr_count($pbo['catSelEd'], ",")+1)."]*" ?></span><?php } ?>
|
23 |
<?php if (isset($pbo['rpstOn']) && (int)$pbo['rpstOn'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popReActive');" onmouseover="nxs_showPopUpInfo('popReActive', event);"><?php echo "*[R]*" ?></span><?php } ?>
|
24 |
<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>
|
127 |
if (isset($pval['delayDays'])) $options[$ii]['nDays'] = trim($pval['delayDays']);
|
128 |
if (isset($pval['delayHrs'])) $options[$ii]['nHrs'] = trim($pval['delayHrs']); if (isset($pval['delayMin'])) $options[$ii]['nMin'] = trim($pval['delayMin']);
|
129 |
if (isset($pval['qTLng'])) $options[$ii]['qTLng'] = trim($pval['qTLng']);
|
130 |
+
} elseif ( count($pval)==1 ) if (isset($pval['apDo'.$code])) $options[$ii]['do'.$code] = $pval['apDo'.$code]; else $options[$ii]['do'.$code] = 0;
|
131 |
} return $options;
|
132 |
}
|
133 |
//#### Show Post->Edit Meta Box Settings
|
inc-cl/pk.api.php
CHANGED
@@ -14,9 +14,10 @@ if (!class_exists("nxs_class_SNAP_PK")) { class nxs_class_SNAP_PK {
|
|
14 |
function doPostToNT($options, $message){ $badOut = array('pgID'=>'', 'isPosted'=>0, 'pDate'=>date('Y-m-d H:i:s'), 'Error'=>'');
|
15 |
//## Check settings
|
16 |
if (!is_array($options)) { $badOut['Error'] = 'No Options'; return $badOut; }
|
17 |
-
if (!isset($options['pkConsKey']) || trim($options['pkConsSec'])=='') { $badOut['Error'] = 'Not Configured'; return $badOut; }
|
|
|
18 |
//## Format
|
19 |
-
$msg = nxs_doFormatMsg($options['pkMsgFormat'], $message);
|
20 |
//## Post
|
21 |
require_once('apis/plurkOAuth.php'); $consumer_key = $options['pkConsKey']; $consumer_secret = $options['pkConsSec'];
|
22 |
$tum_oauth = new wpPlurkOAuth($consumer_key, $consumer_secret, $options['pkAccessTocken'], $options['pkAccessTockenSec']);
|
14 |
function doPostToNT($options, $message){ $badOut = array('pgID'=>'', 'isPosted'=>0, 'pDate'=>date('Y-m-d H:i:s'), 'Error'=>'');
|
15 |
//## Check settings
|
16 |
if (!is_array($options)) { $badOut['Error'] = 'No Options'; return $badOut; }
|
17 |
+
if (!isset($options['pkConsKey']) || trim($options['pkConsSec'])=='' || empty($options['pkAccessTocken'])) { $badOut['Error'] = 'Not Configured'; return $badOut; }
|
18 |
+
if (empty($options['imgSize'])) $options['imgSize'] = '';
|
19 |
//## Format
|
20 |
+
if (!empty($message['pText'])) $msg = $message['pText']; else $msg = nxs_doFormatMsg($options['pkMsgFormat'], $message);
|
21 |
//## Post
|
22 |
require_once('apis/plurkOAuth.php'); $consumer_key = $options['pkConsKey']; $consumer_secret = $options['pkConsSec'];
|
23 |
$tum_oauth = new wpPlurkOAuth($consumer_key, $consumer_secret, $options['pkAccessTocken'], $options['pkAccessTockenSec']);
|
inc-cl/pk.php
CHANGED
@@ -2,11 +2,11 @@
|
|
2 |
//## NextScripts Facebook Connection Class
|
3 |
$nxs_snapAvNts[] = array('code'=>'PK', 'lcode'=>'pk', 'name'=>'Plurk');
|
4 |
|
5 |
-
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_snapSetPgURL, $nxs_plurl;
|
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_snapSetPgURL."&auth=pka&acc=".$_GET['acc'];
|
@@ -55,7 +55,10 @@ if (!class_exists("nxs_snapClassPK")) { class nxs_snapClassPK {
|
|
55 |
<?php foreach ($ntOpts as $indx=>$pbo){ if (trim($pbo['nName']=='')) $pbo['nName'] = str_ireplace('https://','', str_ireplace('http://','', $pbo['pkURL']));
|
56 |
if (!isset($pbo[$ntInfo['lcode'].'OK']) || $pbo[$ntInfo['lcode'].'OK']=='') $pbo[$ntInfo['lcode'].'OK'] = (isset($pbo['pkOAuthTokenSecret']) && $pbo['pkOAuthTokenSecret']!='')?'1':''; ?>
|
57 |
<p style="margin:0px;margin-left:5px;"> <img id="<?php echo $ntInfo['code'].$indx;?>LoadingImg" style="display: none;" src='<?php echo $nxs_plurl; ?>img/ajax-loader-sm.gif' />
|
58 |
-
<input value="
|
|
|
|
|
|
|
59 |
<?php if (isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);"><?php echo "*[".(substr_count($pbo['catSelEd'], ",")+1)."]*" ?></span><?php } ?>
|
60 |
<?php if (isset($pbo['rpstOn']) && (int)$pbo['rpstOn'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popReActive');" onmouseover="nxs_showPopUpInfo('popReActive', event);"><?php echo "*[R]*" ?></span><?php } ?>
|
61 |
<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>
|
@@ -149,8 +152,8 @@ if (!class_exists("nxs_snapClassPK")) { class nxs_snapClassPK {
|
|
149 |
|
150 |
}
|
151 |
//#### Set Unit Settings from POST
|
152 |
-
function setNTSettings($post, $options){
|
153 |
-
foreach ($post as $ii => $pval){
|
154 |
if (isset($pval['apPKConsKey']) && $pval['apPKConsSec']!='') { if (!isset($options[$ii])) $options[$ii] = array();
|
155 |
|
156 |
if (isset($pval['apPKURL'])) { $options[$ii]['pkURL'] = trim($pval['apPKURL']); if ( substr($options[$ii]['pkURL'], 0, 4)!='http' ) $options[$ii]['pkURL'] = 'http://'.$options[$ii]['pkURL'];
|
@@ -174,7 +177,7 @@ if (!class_exists("nxs_snapClassPK")) { class nxs_snapClassPK {
|
|
174 |
if (isset($pval['delayDays'])) $options[$ii]['nDays'] = trim($pval['delayDays']);
|
175 |
if (isset($pval['delayHrs'])) $options[$ii]['nHrs'] = trim($pval['delayHrs']); if (isset($pval['delayMin'])) $options[$ii]['nMin'] = trim($pval['delayMin']);
|
176 |
if (isset($pval['qTLng'])) $options[$ii]['qTLng'] = trim($pval['qTLng']);
|
177 |
-
} elseif ((
|
178 |
} return $options;
|
179 |
}
|
180 |
//#### Show Post->Edit Meta Box Settings
|
2 |
//## NextScripts Facebook Connection Class
|
3 |
$nxs_snapAvNts[] = array('code'=>'PK', 'lcode'=>'pk', 'name'=>'Plurk');
|
4 |
|
5 |
+
if (!class_exists("nxs_snapClassPK")) { class nxs_snapClassPK { var $ntInfo = array('code'=>'PK', 'lcode'=>'pk', 'name'=>'Plurk', 'defNName'=>'', 'tstReq' => true);
|
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_snapSetPgURL, $nxs_plurl; $ntInfo = $this->ntInfo;
|
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_snapSetPgURL."&auth=pka&acc=".$_GET['acc'];
|
55 |
<?php foreach ($ntOpts as $indx=>$pbo){ if (trim($pbo['nName']=='')) $pbo['nName'] = str_ireplace('https://','', str_ireplace('http://','', $pbo['pkURL']));
|
56 |
if (!isset($pbo[$ntInfo['lcode'].'OK']) || $pbo[$ntInfo['lcode'].'OK']=='') $pbo[$ntInfo['lcode'].'OK'] = (isset($pbo['pkOAuthTokenSecret']) && $pbo['pkOAuthTokenSecret']!='')?'1':''; ?>
|
57 |
<p style="margin:0px;margin-left:5px;"> <img id="<?php echo $ntInfo['code'].$indx;?>LoadingImg" style="display: none;" src='<?php echo $nxs_plurl; ?>img/ajax-loader-sm.gif' />
|
58 |
+
<input value="0" name="<?php echo $ntInfo['lcode']; ?>[<?php echo $indx; ?>][apDo<?php echo $ntInfo['code']; ?>]" type="hidden" />
|
59 |
+
<?php if ((int)$pbo['do'.$ntInfo['code']] == 1 && isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <input type="radio" id="rbtn<?php echo $ntInfo['lcode'].$indx; ?>" checked="checked" onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);" /> <?php } else { ?>
|
60 |
+
<input value="1" name="<?php echo $ntInfo['lcode']; ?>[<?php echo $indx; ?>][apDo<?php echo $ntInfo['code']; ?>]" type="checkbox" <?php if ((int)$pbo['do'.$ntInfo['code']] == 1 && $pbo['catSel']!='1') echo "checked"; ?> />
|
61 |
+
<?php } ?>
|
62 |
<?php if (isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);"><?php echo "*[".(substr_count($pbo['catSelEd'], ",")+1)."]*" ?></span><?php } ?>
|
63 |
<?php if (isset($pbo['rpstOn']) && (int)$pbo['rpstOn'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popReActive');" onmouseover="nxs_showPopUpInfo('popReActive', event);"><?php echo "*[R]*" ?></span><?php } ?>
|
64 |
<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>
|
152 |
|
153 |
}
|
154 |
//#### Set Unit Settings from POST
|
155 |
+
function setNTSettings($post, $options){ $code = $this->ntInfo['code'];
|
156 |
+
foreach ($post as $ii => $pval){
|
157 |
if (isset($pval['apPKConsKey']) && $pval['apPKConsSec']!='') { if (!isset($options[$ii])) $options[$ii] = array();
|
158 |
|
159 |
if (isset($pval['apPKURL'])) { $options[$ii]['pkURL'] = trim($pval['apPKURL']); if ( substr($options[$ii]['pkURL'], 0, 4)!='http' ) $options[$ii]['pkURL'] = 'http://'.$options[$ii]['pkURL'];
|
177 |
if (isset($pval['delayDays'])) $options[$ii]['nDays'] = trim($pval['delayDays']);
|
178 |
if (isset($pval['delayHrs'])) $options[$ii]['nHrs'] = trim($pval['delayHrs']); if (isset($pval['delayMin'])) $options[$ii]['nMin'] = trim($pval['delayMin']);
|
179 |
if (isset($pval['qTLng'])) $options[$ii]['qTLng'] = trim($pval['qTLng']);
|
180 |
+
} elseif ( count($pval)==1 ) if (isset($pval['apDo'.$code])) $options[$ii]['do'.$code] = $pval['apDo'.$code]; else $options[$ii]['do'.$code] = 0;
|
181 |
} return $options;
|
182 |
}
|
183 |
//#### Show Post->Edit Meta Box Settings
|
inc-cl/pn.api.php
CHANGED
@@ -16,8 +16,9 @@ if (!class_exists("nxs_class_SNAP_PN")) { class nxs_class_SNAP_PN {
|
|
16 |
if (!is_array($options)) { $badOut['Error'] = 'No Options'; return $badOut; }
|
17 |
if (!isset($options['pnUName']) || trim($options['pnPass'])=='') { $badOut['Error'] = 'Not Configured'; return $badOut; }
|
18 |
$pass = substr($options['pnPass'], 0, 5)=='g9c1a'?nsx_doDecode(substr($options['pnPass'], 5)):$options['pnPass'];
|
|
|
19 |
//## Format
|
20 |
-
$msg = nxs_doFormatMsg($options['pnMsgFormat'], $message); $boardID = $options['pnBoard']; // prr($boardID); prr($_POST); die();
|
21 |
if (isset($message['imageURL'])) $imgURL = trim(nxs_getImgfrOpt($message['imageURL'], $options['imgSize'])); else $imgURL = ''; if ($imgURL=='') $badOut['Error'] .= 'NO Image.';
|
22 |
$urlToGo = (!empty($message['url']))?$message['url']:'';
|
23 |
//## Check for existing session
|
16 |
if (!is_array($options)) { $badOut['Error'] = 'No Options'; return $badOut; }
|
17 |
if (!isset($options['pnUName']) || trim($options['pnPass'])=='') { $badOut['Error'] = 'Not Configured'; return $badOut; }
|
18 |
$pass = substr($options['pnPass'], 0, 5)=='g9c1a'?nsx_doDecode(substr($options['pnPass'], 5)):$options['pnPass'];
|
19 |
+
if (empty($options['imgSize'])) $options['imgSize'] = '';
|
20 |
//## Format
|
21 |
+
if (!empty($message['pText'])) $msg = $message['pText']; else $msg = nxs_doFormatMsg($options['pnMsgFormat'], $message); $boardID = $options['pnBoard']; // prr($boardID); prr($_POST); die();
|
22 |
if (isset($message['imageURL'])) $imgURL = trim(nxs_getImgfrOpt($message['imageURL'], $options['imgSize'])); else $imgURL = ''; if ($imgURL=='') $badOut['Error'] .= 'NO Image.';
|
23 |
$urlToGo = (!empty($message['url']))?$message['url']:'';
|
24 |
//## Check for existing session
|
inc-cl/pn.php
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
//## NextScripts Facebook Connection Class
|
3 |
$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_plurl;
|
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']; ?>
|
@@ -16,7 +16,10 @@ if (!class_exists("nxs_snapClassPN")) { class nxs_snapClassPN {
|
|
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;"> <img id="<?php echo $ntInfo['code'].$indx;?>LoadingImg" style="display: none;" src='<?php echo $nxs_plurl; ?>img/ajax-loader-sm.gif' />
|
19 |
-
<input value="
|
|
|
|
|
|
|
20 |
<?php if (isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);"><?php echo "*[".(substr_count($pbo['catSelEd'], ",")+1)."]*" ?></span><?php } ?>
|
21 |
<?php if (isset($pbo['rpstOn']) && (int)$pbo['rpstOn'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popReActive');" onmouseover="nxs_showPopUpInfo('popReActive', event);"><?php echo "*[R]*" ?></span><?php } ?>
|
22 |
<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>
|
@@ -67,7 +70,7 @@ if (!class_exists("nxs_snapClassPN")) { class nxs_snapClassPN {
|
|
67 |
<input type="radio" name="pn[<?php echo $ii; ?>][cImgURL]" value="N" <?php if ($options['cImgURL'] == 'N') echo 'checked="checked"'; ?> /> No Clickthrough URL
|
68 |
|
69 |
<div style="width:100%;"><strong>Default Image to Pin:</strong>
|
70 |
-
<p style="font-size: 11px; margin: 0px;">If your post
|
71 |
</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') ?>" />
|
72 |
<br/><br/>
|
73 |
|
@@ -120,7 +123,7 @@ if (!class_exists("nxs_snapClassPN")) { class nxs_snapClassPN {
|
|
120 |
<?php
|
121 |
}
|
122 |
//#### Set Unit Settings from POST
|
123 |
-
function setNTSettings($post, $options){
|
124 |
foreach ($post as $ii => $pval){
|
125 |
if (isset($pval['apPNUName']) && $pval['apPNUName']!=''){ if (!isset($options[$ii])) $options[$ii] = array();
|
126 |
if (isset($pval['apDoPN'])) $options[$ii]['doPN'] = $pval['apDoPN']; else $options[$ii]['doPN'] = 0;
|
@@ -142,7 +145,7 @@ if (!class_exists("nxs_snapClassPN")) { class nxs_snapClassPN {
|
|
142 |
if (isset($pval['delayDays'])) $options[$ii]['nDays'] = trim($pval['delayDays']);
|
143 |
if (isset($pval['delayHrs'])) $options[$ii]['nHrs'] = trim($pval['delayHrs']); if (isset($pval['delayMin'])) $options[$ii]['nMin'] = trim($pval['delayMin']);
|
144 |
if (isset($pval['qTLng'])) $options[$ii]['qTLng'] = trim($pval['qTLng']);
|
145 |
-
} elseif ((
|
146 |
} return $options;
|
147 |
}
|
148 |
//#### Show Post->Edit Meta Box Settings
|
@@ -265,7 +268,8 @@ if (!function_exists("nxs_doPublishToPN")) { //## Second Function to Post to G+
|
|
265 |
if ($postID=='0') prr($ret); nxs_addToLogN('E', 'Error', $logNT, '-=ERROR=- '.print_r($ret, true), $extInfo);
|
266 |
} else { // ## All Good - log it.
|
267 |
if ($postID=='0') { nxs_addToLogN('S', 'Test', $logNT, 'OK - TEST Message Posted '); echo _e('OK - Message Posted, please see your '.$logNT.' Page. ', 'nxs_snap'); }
|
268 |
-
else { nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPosted'=>'1', 'pgID'=>$ret['postID'], 'postURL'=>$ret['postURL'], 'pDate'=>date('Y-m-d H:i:s')));
|
|
|
269 |
} //prr($ret);
|
270 |
//## Return Result
|
271 |
if ($ret['isPosted']=='1') return 200; else return print_r($ret, true);
|
2 |
//## NextScripts Facebook Connection Class
|
3 |
$nxs_snapAvNts[] = array('code'=>'PN', 'lcode'=>'pn', 'name'=>'Pinterest');
|
4 |
|
5 |
+
if (!class_exists("nxs_snapClassPN")) { class nxs_snapClassPN { var $ntInfo = array('code'=>'PN', 'lcode'=>'pn', 'name'=>'Pinterest', 'defNName'=>'pnUName', 'tstReq' => false);
|
6 |
//#### Show Common Settings
|
7 |
+
function showGenNTSettings($ntOpts){ global $nxs_plurl; $ntInfo = $this->ntInfo; ?>
|
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']; ?>
|
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;"> <img id="<?php echo $ntInfo['code'].$indx;?>LoadingImg" style="display: none;" src='<?php echo $nxs_plurl; ?>img/ajax-loader-sm.gif' />
|
19 |
+
<input value="0" name="<?php echo $ntInfo['lcode']; ?>[<?php echo $indx; ?>][apDo<?php echo $ntInfo['code']; ?>]" type="hidden" />
|
20 |
+
<?php if ((int)$pbo['do'.$ntInfo['code']] == 1 && isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <input type="radio" id="rbtn<?php echo $ntInfo['lcode'].$indx; ?>" checked="checked" onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);" /> <?php } else { ?>
|
21 |
+
<input value="1" name="<?php echo $ntInfo['lcode']; ?>[<?php echo $indx; ?>][apDo<?php echo $ntInfo['code']; ?>]" type="checkbox" <?php if ((int)$pbo['do'.$ntInfo['code']] == 1 && $pbo['catSel']!='1') echo "checked"; ?> />
|
22 |
+
<?php } ?>
|
23 |
<?php if (isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);"><?php echo "*[".(substr_count($pbo['catSelEd'], ",")+1)."]*" ?></span><?php } ?>
|
24 |
<?php if (isset($pbo['rpstOn']) && (int)$pbo['rpstOn'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popReActive');" onmouseover="nxs_showPopUpInfo('popReActive', event);"><?php echo "*[R]*" ?></span><?php } ?>
|
25 |
<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>
|
70 |
<input type="radio" name="pn[<?php echo $ii; ?>][cImgURL]" value="N" <?php if ($options['cImgURL'] == 'N') echo 'checked="checked"'; ?> /> No Clickthrough URL
|
71 |
|
72 |
<div style="width:100%;"><strong>Default Image to Pin:</strong>
|
73 |
+
<p style="font-size: 11px; margin: 0px;">If your post does not have any images this will be used instead.</p>
|
74 |
</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') ?>" />
|
75 |
<br/><br/>
|
76 |
|
123 |
<?php
|
124 |
}
|
125 |
//#### Set Unit Settings from POST
|
126 |
+
function setNTSettings($post, $options){ $code = $this->ntInfo['code'];
|
127 |
foreach ($post as $ii => $pval){
|
128 |
if (isset($pval['apPNUName']) && $pval['apPNUName']!=''){ if (!isset($options[$ii])) $options[$ii] = array();
|
129 |
if (isset($pval['apDoPN'])) $options[$ii]['doPN'] = $pval['apDoPN']; else $options[$ii]['doPN'] = 0;
|
145 |
if (isset($pval['delayDays'])) $options[$ii]['nDays'] = trim($pval['delayDays']);
|
146 |
if (isset($pval['delayHrs'])) $options[$ii]['nHrs'] = trim($pval['delayHrs']); if (isset($pval['delayMin'])) $options[$ii]['nMin'] = trim($pval['delayMin']);
|
147 |
if (isset($pval['qTLng'])) $options[$ii]['qTLng'] = trim($pval['qTLng']);
|
148 |
+
} elseif ( count($pval)==1 ) if (isset($pval['apDo'.$code])) $options[$ii]['do'.$code] = $pval['apDo'.$code]; else $options[$ii]['do'.$code] = 0;
|
149 |
} return $options;
|
150 |
}
|
151 |
//#### Show Post->Edit Meta Box Settings
|
268 |
if ($postID=='0') prr($ret); nxs_addToLogN('E', 'Error', $logNT, '-=ERROR=- '.print_r($ret, true), $extInfo);
|
269 |
} else { // ## All Good - log it.
|
270 |
if ($postID=='0') { nxs_addToLogN('S', 'Test', $logNT, 'OK - TEST Message Posted '); echo _e('OK - Message Posted, please see your '.$logNT.' Page. ', 'nxs_snap'); }
|
271 |
+
else { nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPosted'=>'1', 'pgID'=>$ret['postID'], 'postURL'=>$ret['postURL'], 'pDate'=>date('Y-m-d H:i:s')));
|
272 |
+
$extInfo .= ' | <a href="'.$ret['postURL'].'" target="_blank">Post Link</a>'; nxs_addToLogN('S', 'Posted', $logNT, 'OK - Message Posted ', $extInfo); }
|
273 |
} //prr($ret);
|
274 |
//## Return Result
|
275 |
if ($ret['isPosted']=='1') return 200; else return print_r($ret, true);
|
inc-cl/rd.api.php
CHANGED
@@ -36,7 +36,8 @@ if (!class_exists("nxs_class_SNAP_RD")) { class nxs_class_SNAP_RD {
|
|
36 |
if (!is_array($options)) { $badOut['Error'] = 'No Options'; return $badOut; }
|
37 |
if (!isset($options['rdUName']) || trim($options['rdUName'])=='' || !isset($options['rdPass']) || trim($options['rdPass'])=='') { $badOut['Error'] = 'No username/password Found'; return $badOut; }
|
38 |
//## Format Post
|
39 |
-
$title = nxs_doFormatMsg($options['rdTitleFormat'], $message); $title = nsTrnc($title, 300);
|
|
|
40 |
//## Make Post
|
41 |
$pass = substr($options['rdPass'], 0, 5)=='n5g9a'?nsx_doDecode(substr($options['rdPass'], 5)):$options['rdPass']; $hdrsArr = '';
|
42 |
$loginInfo = doConnectToRD($options['rdUName'], $pass); if (!is_array($loginInfo)) { $badOut['Error'] = print_r($loginInfo, true)." - ERROR"; return $badOut; }
|
36 |
if (!is_array($options)) { $badOut['Error'] = 'No Options'; return $badOut; }
|
37 |
if (!isset($options['rdUName']) || trim($options['rdUName'])=='' || !isset($options['rdPass']) || trim($options['rdPass'])=='') { $badOut['Error'] = 'No username/password Found'; return $badOut; }
|
38 |
//## Format Post
|
39 |
+
if (!empty($message['pTitle'])) $title = $message['pTitle']; else $title = nxs_doFormatMsg($options['rdTitleFormat'], $message); $title = nsTrnc($title, 300);
|
40 |
+
if (!empty($message['pText'])) $text = $message['pText']; else $text = nxs_doFormatMsg($options['rdTextFormat'], $message);
|
41 |
//## Make Post
|
42 |
$pass = substr($options['rdPass'], 0, 5)=='n5g9a'?nsx_doDecode(substr($options['rdPass'], 5)):$options['rdPass']; $hdrsArr = '';
|
43 |
$loginInfo = doConnectToRD($options['rdUName'], $pass); if (!is_array($loginInfo)) { $badOut['Error'] = print_r($loginInfo, true)." - ERROR"; return $badOut; }
|
inc-cl/rd.php
CHANGED
@@ -16,7 +16,10 @@ if (!class_exists("nxs_snapClassRD")) { class nxs_snapClassRD {
|
|
16 |
<?php if(!function_exists('doConnectToRD')) {?> Reddit 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/reddit-automated-posting">library module</a> to be able to publish your content to Reddit.
|
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;"> <img id="<?php echo $ntInfo['code'].$indx;?>LoadingImg" style="display: none;" src='<?php echo $nxs_plurl; ?>img/ajax-loader-sm.gif' />
|
19 |
-
<input value="
|
|
|
|
|
|
|
20 |
<?php if (isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);"><?php echo "*[".(substr_count($pbo['catSelEd'], ",")+1)."]*" ?></span><?php } ?>
|
21 |
<?php if (isset($pbo['rpstOn']) && (int)$pbo['rpstOn'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popReActive');" onmouseover="nxs_showPopUpInfo('popReActive', event);"><?php echo "*[R]*" ?></span><?php } ?>
|
22 |
<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>
|
@@ -60,7 +63,7 @@ if (!class_exists("nxs_snapClassRD")) { class nxs_snapClassRD {
|
|
60 |
<div style="width:100%;"><strong>Reddit Password:</strong> </div><input name="rd[<?php echo $ii; ?>][uPass]" id="apRDPass<?php echo $ii; ?>" type="password" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities(substr($options['rdPass'], 0, 5)=='n5g9a'?nsx_doDecode(substr($options['rdPass'], 5)):$options['rdPass'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" /> <br/>
|
61 |
|
62 |
<div style="width:100%;"><strong>Subreddit ID:</strong>
|
63 |
-
Please <a href="#" onclick="nxs_getBrdsOrCats(jQuery('<?php if ($isNew) echo "#nsx_addNT "; ?>#apRDUName<?php echo $ii; ?>').val(),jQuery('<?php if ($isNew) echo "#nsx_addNT "; ?>#apRDPass<?php echo $ii; ?>').val(), 'rd' , '<?php echo $ii; ?>', ''); return false;">click here to retrieve your subreddits</a>
|
64 |
</div>
|
65 |
<img id="rdLoadingImg<?php echo $ii; ?>" style="display: none;" src='<?php echo $nxs_plurl; ?>img/ajax-loader-sm.gif' />
|
66 |
<select name="rd[<?php echo $ii; ?>][rdSubReddit]" id="rdSubReddit<?php echo $ii; ?>">
|
@@ -149,7 +152,7 @@ if (!class_exists("nxs_snapClassRD")) { class nxs_snapClassRD {
|
|
149 |
if (isset($pval['delayDays'])) $options[$ii]['nDays'] = trim($pval['delayDays']);
|
150 |
if (isset($pval['delayHrs'])) $options[$ii]['nHrs'] = trim($pval['delayHrs']); if (isset($pval['delayMin'])) $options[$ii]['nMin'] = trim($pval['delayMin']);
|
151 |
if (isset($pval['qTLng'])) $options[$ii]['qTLng'] = trim($pval['qTLng']);
|
152 |
-
} elseif ((
|
153 |
} return $options;
|
154 |
}
|
155 |
//#### Show Post->Edit Meta Box Settings
|
@@ -252,7 +255,8 @@ if (!function_exists("nxs_doPublishToRD")) { //## Second Function to Post to RD
|
|
252 |
if ($postID=='0') prr($ret); nxs_addToLogN('E', 'Error', $logNT, '-=ERROR=- '.print_r($ret, true), $extInfo);
|
253 |
} else { // ## All Good - log it.
|
254 |
if ($postID=='0') { nxs_addToLogN('S', 'Test', $logNT, 'OK - TEST Message Posted '); echo _e('OK - Message Posted, please see your '.$logNT.' Page. ', 'nxs_snap'); }
|
255 |
-
else { nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPosted'=>'1', 'pgID'=>$ret['postID'], 'pDate'=>date('Y-m-d H:i:s')));
|
|
|
256 |
}
|
257 |
//## Return Result
|
258 |
if ($ret['isPosted']=='1') return 200; else return print_r($ret, true);
|
16 |
<?php if(!function_exists('doConnectToRD')) {?> Reddit 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/reddit-automated-posting">library module</a> to be able to publish your content to Reddit.
|
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;"> <img id="<?php echo $ntInfo['code'].$indx;?>LoadingImg" style="display: none;" src='<?php echo $nxs_plurl; ?>img/ajax-loader-sm.gif' />
|
19 |
+
<input value="0" name="<?php echo $ntInfo['lcode']; ?>[<?php echo $indx; ?>][apDo<?php echo $ntInfo['code']; ?>]" type="hidden" />
|
20 |
+
<?php if ((int)$pbo['do'.$ntInfo['code']] == 1 && isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <input type="radio" id="rbtn<?php echo $ntInfo['lcode'].$indx; ?>" checked="checked" onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);" /> <?php } else { ?>
|
21 |
+
<input value="1" name="<?php echo $ntInfo['lcode']; ?>[<?php echo $indx; ?>][apDo<?php echo $ntInfo['code']; ?>]" type="checkbox" <?php if ((int)$pbo['do'.$ntInfo['code']] == 1 && $pbo['catSel']!='1') echo "checked"; ?> />
|
22 |
+
<?php } ?>
|
23 |
<?php if (isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);"><?php echo "*[".(substr_count($pbo['catSelEd'], ",")+1)."]*" ?></span><?php } ?>
|
24 |
<?php if (isset($pbo['rpstOn']) && (int)$pbo['rpstOn'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popReActive');" onmouseover="nxs_showPopUpInfo('popReActive', event);"><?php echo "*[R]*" ?></span><?php } ?>
|
25 |
<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>
|
63 |
<div style="width:100%;"><strong>Reddit Password:</strong> </div><input name="rd[<?php echo $ii; ?>][uPass]" id="apRDPass<?php echo $ii; ?>" type="password" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities(substr($options['rdPass'], 0, 5)=='n5g9a'?nsx_doDecode(substr($options['rdPass'], 5)):$options['rdPass'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" /> <br/>
|
64 |
|
65 |
<div style="width:100%;"><strong>Subreddit ID:</strong>
|
66 |
+
Please <a href="#" onclick="nxs_getBrdsOrCats(jQuery('<?php if ($isNew) echo "#nsx_addNT "; ?>#apRDUName<?php echo $ii; ?>').val(),jQuery('<?php if ($isNew) echo "#nsx_addNT "; ?>#apRDPass<?php echo $ii; ?>').val(), 'rd' , '<?php echo $ii; ?>', 'rdSubReddit'); return false;">click here to retrieve your subreddits</a>
|
67 |
</div>
|
68 |
<img id="rdLoadingImg<?php echo $ii; ?>" style="display: none;" src='<?php echo $nxs_plurl; ?>img/ajax-loader-sm.gif' />
|
69 |
<select name="rd[<?php echo $ii; ?>][rdSubReddit]" id="rdSubReddit<?php echo $ii; ?>">
|
152 |
if (isset($pval['delayDays'])) $options[$ii]['nDays'] = trim($pval['delayDays']);
|
153 |
if (isset($pval['delayHrs'])) $options[$ii]['nHrs'] = trim($pval['delayHrs']); if (isset($pval['delayMin'])) $options[$ii]['nMin'] = trim($pval['delayMin']);
|
154 |
if (isset($pval['qTLng'])) $options[$ii]['qTLng'] = trim($pval['qTLng']);
|
155 |
+
} elseif ( count($pval)==1 ) if (isset($pval['apDo'.$code])) $options[$ii]['do'.$code] = $pval['apDo'.$code]; else $options[$ii]['do'.$code] = 0;
|
156 |
} return $options;
|
157 |
}
|
158 |
//#### Show Post->Edit Meta Box Settings
|
255 |
if ($postID=='0') prr($ret); nxs_addToLogN('E', 'Error', $logNT, '-=ERROR=- '.print_r($ret, true), $extInfo);
|
256 |
} else { // ## All Good - log it.
|
257 |
if ($postID=='0') { nxs_addToLogN('S', 'Test', $logNT, 'OK - TEST Message Posted '); echo _e('OK - Message Posted, please see your '.$logNT.' Page. ', 'nxs_snap'); }
|
258 |
+
else { nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPosted'=>'1', 'pgID'=>$ret['postID'], 'pDate'=>date('Y-m-d H:i:s')));
|
259 |
+
$extInfo .= ' | <a href="'.$ret['postURL'].'" target="_blank">Post Link</a>'; nxs_addToLogN('S', 'Posted', $logNT, 'OK - Message Posted ', $extInfo); }
|
260 |
}
|
261 |
//## Return Result
|
262 |
if ($ret['isPosted']=='1') return 200; else return print_r($ret, true);
|
inc-cl/sc.api.php
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
//## NextScripts App.net Connection Class
|
3 |
+
|
4 |
+
/*
|
5 |
+
1. Options
|
6 |
+
|
7 |
+
nName - Nickname of the account [Optional] (Presentation purposes only - No affect on functionality)
|
8 |
+
rdUName - Reddit User Name
|
9 |
+
rdPass - Reddit User Passord
|
10 |
+
rdSubReddit - Name of the Sub-Reddit
|
11 |
+
postType - A or T - "Attached link" or "Text"
|
12 |
+
|
13 |
+
rdTitleFormat
|
14 |
+
rdTextFormat
|
15 |
+
|
16 |
+
2. Post Info
|
17 |
+
|
18 |
+
url
|
19 |
+
title - [up to 300 characters long] - title of the submission
|
20 |
+
text
|
21 |
+
|
22 |
+
*/
|
23 |
+
$nxs_snapAPINts[] = array('code'=>'SC', 'lcode'=>'sc', 'name'=>'Scoop.It');
|
24 |
+
|
25 |
+
if (!class_exists("nxs_class_SNAP_SC")) { class nxs_class_SNAP_SC {
|
26 |
+
|
27 |
+
var $ntCode = 'SC';
|
28 |
+
var $ntLCode = 'sc';
|
29 |
+
|
30 |
+
function doPost($options, $message){ if (!is_array($options)) return false; $out = array(); // return false;
|
31 |
+
foreach ($options as $ii=>$ntOpts) $out[$ii] = $this->doPostToNT($ntOpts, $message);
|
32 |
+
return $out;
|
33 |
+
}
|
34 |
+
|
35 |
+
function doPostToNT($options, $message){ global $nxs_urlLen; $badOut = array('pgID'=>'', 'isPosted'=>0, 'pDate'=>date('Y-m-d H:i:s'), 'Error'=>'');
|
36 |
+
//## Check settings
|
37 |
+
if (!is_array($options)) { $badOut['Error'] = 'No Options'; return $badOut; }
|
38 |
+
if (!isset($options['accessToken']) || trim($options['accessToken'])=='') { $badOut['Error'] = 'Not Authorized'; return $badOut; }
|
39 |
+
if (empty($options['imgSize'])) $options['imgSize'] = '';
|
40 |
+
//## Format Post
|
41 |
+
if (!empty($message['pText'])) $text = $message['pText']; else $text = nxs_doFormatMsg($options['msgFrmt'], $message);
|
42 |
+
if (!empty($message['pTitle'])) $msgT = $message['pTitle']; else $msgT = nxs_doFormatMsg($options['msgTFrmt'], $message);
|
43 |
+
//## Make Post
|
44 |
+
if (isset($message['imageURL'])) $imgURL = trim(nxs_getImgfrOpt($message['imageURL'], $options['imgSize'])); else $imgURL = ''; $postType = $options['postType'];
|
45 |
+
|
46 |
+
require_once('apis/scOAuth.php'); $tum_oauth = new wpScoopITOAuth($options['appKey'], $options['appSec'], $options['accessToken'], $options['accessTokenSec']);
|
47 |
+
$tiID = $tum_oauth->makeReq('http://www.scoop.it/api/1/topic', array('urlName'=>$options['topicURL']));
|
48 |
+
if (!empty($tiID) && !empty($tiID['topic']) && !empty($tiID['topic']['id'])) $tiID = $tiID['topic']['id']; else { $badOut['Error'] .= print_r($tiID, true); return $badOut; }
|
49 |
+
$postArr = array('action'=>'create', 'title'=>$msgT, 'content'=>$text, 'url'=>$postType=='A'?$message['url']:'', 'imageUrl'=>(($postType=='I' || $postType=='A') && !empty($imgURL))?$imgURL:'', 'topicId'=>$tiID);
|
50 |
+
$postinfo = $tum_oauth->makeReq('http://www.scoop.it/api/1/post', $postArr, 'POST'); // prr($postinfo);
|
51 |
+
|
52 |
+
if (is_array($postinfo) && isset($postinfo['post'])) { $apNewPostID = $postinfo['post']['id']; $apNewPostURL = $postinfo['post']['scoopUrl'];
|
53 |
+
if ($options['inclTags']=='1') { $postArr = array('action'=>'edit', 'tag'=>$message['tags'], 'id'=>$apNewPostID);
|
54 |
+
$postinfo = $tum_oauth->makeReq('http://www.scoop.it/api/1/post', $postArr, 'POST');
|
55 |
+
}
|
56 |
+
|
57 |
+
} $code = $tum_oauth->http_code;
|
58 |
+
if (!empty($apNewPostID)) {
|
59 |
+
return array('postID'=>$apNewPostID, 'isPosted'=>1, 'postURL'=>$apNewPostURL, 'pDate'=>date('Y-m-d H:i:s'));
|
60 |
+
} else { $badOut['Error'] .= print_r($postinfo, true)." Code:".$tum_oauth->http_code;
|
61 |
+
return $badOut;
|
62 |
+
}
|
63 |
+
return $badOut;
|
64 |
+
}
|
65 |
+
|
66 |
+
}}
|
67 |
+
?>
|
inc-cl/sc.php
ADDED
@@ -0,0 +1,309 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
//## NextScripts App.net Connection Class
|
3 |
+
$nxs_snapAvNts[] = array('code'=>'SC', 'lcode'=>'sc', 'name'=>'Scoop.It');
|
4 |
+
|
5 |
+
if (!class_exists("nxs_snapClassSC")) { class nxs_snapClassSC { var $ntInfo = array('code'=>'SC', 'lcode'=>'sc', 'name'=>'Scoop.It', 'defNName'=>'', 'tstReq' => true);
|
6 |
+
//#### Show Common Settings
|
7 |
+
function showGenNTSettings($ntOpts){ global $nxs_plurl, $nxs_snapSetPgURL; $ntInfo = $this->ntInfo;
|
8 |
+
if ( isset($_GET['auth']) && $_GET['auth']==$ntInfo['lcode']){ require_once('apis/scOAuth.php'); $options = $ntOpts[$_GET['acc']];
|
9 |
+
|
10 |
+
$consumer_key = $options['appKey']; $consumer_secret = $options['appSec'];
|
11 |
+
$callback_url = $nxs_snapSetPgURL."&auth=".$ntInfo['lcode']."a&acc=".$_GET['acc'];
|
12 |
+
|
13 |
+
$tum_oauth = new wpScoopITOAuth($consumer_key, $consumer_secret);
|
14 |
+
$request_token = $tum_oauth->getReqToken($callback_url);
|
15 |
+
$options['oAuthToken'] = $request_token['oauth_token'];
|
16 |
+
$options['oAuthTokenSecret'] = $request_token['oauth_token_secret'];
|
17 |
+
|
18 |
+
//prr($tum_oauth); prr($options); die();
|
19 |
+
|
20 |
+
switch ($tum_oauth->http_code) { case 200: $url = 'http://www.scoop.it/oauth/authorize?oauth_token='.$options['oAuthToken'];
|
21 |
+
$optionsG = get_option('NS_SNAutoPoster'); $optionsG[$ntInfo['lcode']][$_GET['acc']] = $options; update_option('NS_SNAutoPoster', $optionsG);
|
22 |
+
echo '<br/><br/>All good?! Redirecting ..... <script type="text/javascript">window.location = "'.$url.'"</script>'; break;
|
23 |
+
default: echo '<br/><b style="color:red">Could not connect to ScoopIT. Refresh the page or try again later.</b>'; die();
|
24 |
+
}
|
25 |
+
die();
|
26 |
+
}
|
27 |
+
if ( isset($_GET['auth']) && $_GET['auth']==$ntInfo['lcode'].'a'){ require_once('apis/scOAuth.php'); $options = $ntOpts[$_GET['acc']];
|
28 |
+
$consumer_key = $options['appKey']; $consumer_secret = $options['appSec'];
|
29 |
+
|
30 |
+
$tum_oauth = new wpScoopITOAuth($consumer_key, $consumer_secret, $options['oAuthToken'], $options['oAuthTokenSecret']); //prr($tum_oauth);
|
31 |
+
$access_token = $tum_oauth->getAccToken($_GET['oauth_verifier']); prr($access_token);
|
32 |
+
$options['accessToken'] = $access_token['oauth_token']; $options['accessTokenSec'] = $access_token['oauth_token_secret'];
|
33 |
+
$optionsG = get_option('NS_SNAutoPoster'); $optionsG[$ntInfo['lcode']][$_GET['acc']] = $options; update_option('NS_SNAutoPoster', $optionsG);
|
34 |
+
$tum_oauth = new wpScoopITOAuth($consumer_key, $consumer_secret, $options['accessToken'], $options['accessTokenSec']);
|
35 |
+
$uinfo = $tum_oauth->makeReq('http://www.scoop.it/api/1/profile', '');
|
36 |
+
if (is_array($uinfo) && isset($uinfo['user'])) { $options['appAppUserName'] = $uinfo['user']['name']."(".$uinfo['user']['shortName'].")";
|
37 |
+
$options['appAppUserID'] = $uinfo['user']['id']; $optionsG = get_option('NS_SNAutoPoster'); $optionsG[$ntInfo['lcode']][$_GET['acc']] = $options; update_option('NS_SNAutoPoster', $optionsG);
|
38 |
+
} //die();
|
39 |
+
if (!empty($options['appAppUserID'])) { echo '<br/><br/>All good?! Redirecting ..... <script type="text/javascript">window.location = "'.$nxs_snapSetPgURL.'"</script>'; break; die();}
|
40 |
+
else die("<span style='color:red;'>ERROR: Authorization Error: <span style='color:darkred; font-weight: bold;'>".print_r($uinfo, true)."</span></span>");
|
41 |
+
}
|
42 |
+
|
43 |
+
?>
|
44 |
+
<div class="nxs_box">
|
45 |
+
<div class="nxs_box_header">
|
46 |
+
<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']; ?>
|
47 |
+
<?php $cbo = count($ntOpts); ?>
|
48 |
+
<?php if ($cbo>1){ ?><div class="nsBigText"><?php echo "(".($cbo=='0'?'No':$cbo)." "; _e('accounts', 'nxs_snap'); echo ")"; ?></div><?php } ?>
|
49 |
+
</div>
|
50 |
+
</div>
|
51 |
+
<div class="nxs_box_inside">
|
52 |
+
<?php foreach ($ntOpts as $indx=>$pbo){ if (trim($pbo['nName']=='')) $pbo['nName'] = $ntInfo['name'];
|
53 |
+
if (!isset($pbo[$ntInfo['lcode'].'OK']) || $pbo[$ntInfo['lcode'].'OK']=='') $pbo[$ntInfo['lcode'].'OK'] = (isset($pbo['appAppUserID']) && $pbo['appAppUserID']>1)?'1':'';
|
54 |
+
?>
|
55 |
+
<p style="margin:0px;margin-left:5px;"> <img id="<?php echo $ntInfo['code'].$indx;?>LoadingImg" style="display: none;" src='<?php echo $nxs_plurl; ?>img/ajax-loader-sm.gif' />
|
56 |
+
|
57 |
+
<input value="0" name="<?php echo $ntInfo['lcode']; ?>[<?php echo $indx; ?>][apDo<?php echo $ntInfo['code']; ?>]" type="hidden" />
|
58 |
+
<?php if ((int)$pbo['do'.$ntInfo['code']] == 1 && isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <input type="radio" id="rbtn<?php echo $ntInfo['lcode'].$indx; ?>" checked="checked" onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);" /> <?php } else { ?>
|
59 |
+
<input value="1" name="<?php echo $ntInfo['lcode']; ?>[<?php echo $indx; ?>][apDo<?php echo $ntInfo['code']; ?>]" type="checkbox" <?php if ((int)$pbo['do'.$ntInfo['code']] == 1 && $pbo['catSel']!='1') echo "checked"; ?> />
|
60 |
+
|
61 |
+
<?php } ?>
|
62 |
+
|
63 |
+
<?php if (isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);"><?php echo "*[".(substr_count($pbo['catSelEd'], ",")+1)."]*" ?></span><?php } ?>
|
64 |
+
<?php if (isset($pbo['rpstOn']) && (int)$pbo['rpstOn'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popReActive');" onmouseover="nxs_showPopUpInfo('popReActive', event);"><?php echo "*[R]*" ?></span><?php } ?>
|
65 |
+
<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>
|
66 |
+
<?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'); ?> ==></b><?php } ?>
|
67 |
+
<a id="do<?php echo $ntInfo['code'].$indx; ?>AG" href="#" onclick="doGetHideNTBlock('<?php echo $ntInfo['code'];?>' , '<?php echo $indx; ?>');return false;">[<?php _e('Show Settings', 'nxs_snap'); ?>]</a>
|
68 |
+
<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>
|
69 |
+
</p><div id="nxsNTSetDiv<?php echo $ntInfo['code'].$indx; ?>"></div><?php //$pbo['ntInfo'] = $ntInfo; $this->showNTSettings($indx, $pbo);
|
70 |
+
}?>
|
71 |
+
</div>
|
72 |
+
</div> <?php
|
73 |
+
}
|
74 |
+
//#### Show NEW Settings Page
|
75 |
+
function showNewNTSettings($options){ $opts = array('nName'=>'', 'doSC'=>'1', 'appKey'=>'', 'appSec'=>'', 'topicURL'=>'', 'inclTags'=>'1', 'postType'=>'A'); $opts['ntInfo']= $this->ntInfo; $this->showNTSettings($options, $opts, true);}
|
76 |
+
//#### Show Unit Settings
|
77 |
+
function showNTSettings($ii, $options, $isNew=false){ global $nxs_plurl, $nxs_snapSetPgURL; $ntInfo = $this->ntInfo; $nt = $ntInfo['lcode']; $ntU = $ntInfo['code'];
|
78 |
+
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'] = '';
|
79 |
+
if (!isset($options['nDays'])) $options['nDays'] = 0; if (!isset($options['qTLng'])) $options['qTLng'] = ''; if (!isset($options['topicURL'])) $options['topicURL'] = '';
|
80 |
+
if (!isset($options['appKey'])) $options['appKey'] = ''; if (!isset($options['appSec'])) $options['appSec'] = ''; ?>
|
81 |
+
<div id="do<?php echo $ntU; ?><?php echo $ii; ?>Div" class="insOneDiv<?php if ($isNew) echo " clNewNTSets"; ?>">
|
82 |
+
<input type="hidden" value="0" id="apDoS<?php echo $ntU.$ii; ?>" />
|
83 |
+
<div class="nsx_iconedTitle" style="float: right; background-image: url(<?php echo $nxs_plurl; ?>img/<?php echo $nt; ?>16.png);"><a style="font-size: 12px;" target="_blank" href="http://www.nextscripts.com/instructions/scoopit-social-networks-auto-poster-setup-installation/"><?php $nType=$ntInfo['name']; printf( __( 'Detailed %s Installation/Configuration Instructions', 'nxs_snap' ), $nType); ?></a></div>
|
84 |
+
|
85 |
+
<div style="width:100%;"><strong><?php _e('Account Nickname', 'nxs_snap'); ?>:</strong> <i><?php _e('Just so you can easily identify it', 'nxs_snap'); ?></i> </div><input name="<?php echo $nt; ?>[<?php echo $ii; ?>][nName]" id="apnName<?php echo $ii; ?>" style="font-weight: bold; color: #005800; border: 1px solid #ACACAC; width: 40%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['nName'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" /><br/>
|
86 |
+
<?php echo nxs_addQTranslSel($nt, $ii, $options['qTLng']); ?>
|
87 |
+
<br/>
|
88 |
+
<ul class="nsx_tabs">
|
89 |
+
<li><a href="#nsx<?php echo $nt.$ii ?>_tab1"><?php _e('Account Info', 'nxs_snap'); ?></a></li>
|
90 |
+
<?php if (!$isNew) { ?> <li><a href="#nsx<?php echo $nt.$ii ?>_tab2"><?php _e('Advanced', 'nxs_snap'); ?></a></li> <?php } ?>
|
91 |
+
</ul>
|
92 |
+
<div class="nsx_tab_container"><?php /* ######################## Account Tab ####################### */ ?>
|
93 |
+
<div id="nsx<?php echo $nt.$ii ?>_tab1" class="nsx_tab_content" style="background-image: url(<?php echo $nxs_plurl; ?>img/<?php echo $nt; ?>-bg.png); background-repeat: no-repeat; background-position:90% 10%;">
|
94 |
+
|
95 |
+
<div style="width:100%;"><strong><?php echo $nType; ?> Consumer Key:</strong> </div><input name="<?php echo $nt; ?>[<?php echo $ii; ?>][appKey]" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['appKey'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" />
|
96 |
+
<div style="width:100%;"><strong><?php echo $nType; ?> Consumer Secret:</strong> </div><input name="<?php echo $nt; ?>[<?php echo $ii; ?>][appSec]" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['appSec'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" /> <br/>
|
97 |
+
<div style="width:100%;"><strong><?php echo $nType; ?> Topic URL:</strong> </div>http://www.scoop.it/t/<input name="<?php echo $nt; ?>[<?php echo $ii; ?>][topicURL]" style="width: 30%;" value="<?php _e(apply_filters('format_to_edit', htmlentities($options['topicURL'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>" /> <br/>
|
98 |
+
<br/>
|
99 |
+
|
100 |
+
<div style="width:100%;"><strong id="altFormatText"><?php _e('Post Title Format', 'nxs_snap'); ?>:</strong> (<a href="#" id="msgFrmtT<?php echo $ntU.$ii; ?>HintInfo" onclick="mxs_showHideFrmtInfo('msgFrmtT<?php echo $ntU.$ii; ?>'); return false;"><?php _e('Show format info', 'nxs_snap'); ?></a>)</div>
|
101 |
+
<input name="<?php echo $nt; ?>[<?php echo $ii; ?>][msgTFrmt]" style="width: 50%;" value="<?php if (!empty($options['msgTFrmt'])) _e(apply_filters('format_to_edit', htmlentities($options['msgTFrmt'], ENT_COMPAT, "UTF-8")), 'nxs_snap'); else echo "%TITLE%"; ?>" onfocus="mxs_showFrmtInfo('msgFrmtT<?php echo $ntU.$ii; ?>');" /><?php nxs_doShowHint("msgFrmtT".$ntU.$ii); ?><br/>
|
102 |
+
|
103 |
+
<div id="altFormat" style="margin-left: 0px;">
|
104 |
+
<div style="width:100%;"><strong id="altFormatText"><?php _e('Text Format', 'nxs_snap'); ?>:</strong> (<a href="#" id="msgFrmt<?php echo $ntU; ?><?php echo $ii; ?>HintInfo" onclick="mxs_showHideFrmtInfo('msgFrmt<?php echo $ntU; ?><?php echo $ii; ?>'); return false;"><?php _e('Show format info', 'nxs_snap'); ?></a>)
|
105 |
+
</div>
|
106 |
+
|
107 |
+
<textarea cols="150" rows="3" id="<?php echo $nt; ?><?php echo $ii; ?>msgFrmt" name="<?php echo $nt; ?>[<?php echo $ii; ?>][msgFrmt]" style="width:51%;max-width: 650px;" onfocus="jQuery('#<?php echo $nt; ?><?php echo $ii; ?>msgFrmt').attr('rows', 6); mxs_showFrmtInfo('msgFrmt<?php echo $ntU.$ii; ?>');"><?php if ($isNew) _e("%EXCERPT% \r\n\r\n%URL%", 'nxs_snap'); else _e(apply_filters('format_to_edit', htmlentities($options['msgFrmt'], ENT_COMPAT, "UTF-8")), 'nxs_snap'); ?></textarea><?php nxs_doShowHint("msgFrmt".$ntU.$ii); ?>
|
108 |
+
</div>
|
109 |
+
|
110 |
+
<p style="margin-bottom: 20px;margin-top: 5px;"><input value="1" type="checkbox" name="<?php echo $nt; ?>[<?php echo $ii; ?>][inclTags]" <?php if ((int)$options['inclTags'] == 1) echo "checked"; ?> />
|
111 |
+
<strong><?php _e('Post with tags', 'nxs_snap'); ?></strong> <?php _e('Tags from the blogpost will be auto-posted to '.$ntInfo['name'], 'nxs_snap'); ?>
|
112 |
+
</p>
|
113 |
+
|
114 |
+
<div style="width:100%;"><strong id="altFormatText">Post Type:</strong></div>
|
115 |
+
<div style="margin-left: 10px;">
|
116 |
+
<input type="radio" name="<?php echo $nt; ?>[<?php echo $ii; ?>][postType]" value="T" <?php if ($options['postType'] == 'T') echo 'checked="checked"'; ?> /> <?php _e('Text Post', 'nxs_snap'); ?> - <i><?php _e('just text message', 'nxs_snap'); ?></i><br/>
|
117 |
+
<input type="radio" name="<?php echo $nt; ?>[<?php echo $ii; ?>][postType]" value="I" <?php if ($options['postType'] == 'I') echo 'checked="checked"'; ?> /> <?php _e('Image Post', 'nxs_snap'); ?> - <i><?php _e('big image with text message', 'nxs_snap'); ?></i><br/>
|
118 |
+
<input type="radio" name="<?php echo $nt; ?>[<?php echo $ii; ?>][postType]" value="A" <?php if ( !isset($options['postType']) || $options['postType'] == '' || $options['postType'] == 'A') echo 'checked="checked"'; ?> /> <?php _e('Add blogpost to message as an attachment', 'nxs_snap'); ?><br/>
|
119 |
+
</div>
|
120 |
+
|
121 |
+
<br/><br/>
|
122 |
+
<?php if($options['appKey']=='') { ?>
|
123 |
+
<b><?php _e('Authorize Your '.$ntInfo['name'].' Account', 'nxs_snap'); ?></b> <?php _e('Please click "Update Settings" to be able to Authorize your account.', 'nxs_snap'); ?>
|
124 |
+
<?php } else { if(isset($options['appAppUserID']) && $options['appAppUserID']>0) { ?>
|
125 |
+
<?php _e('Your '.$ntInfo['name'].' Account has been authorized.', 'nxs_snap'); ?> User ID: <?php _e(apply_filters('format_to_edit', htmlentities($options['appAppUserID'].' - '.$options['appAppUserName'], ENT_COMPAT, "UTF-8")), 'nxs_snap') ?>.
|
126 |
+
<?php _e('You can', 'nxs_snap'); ?> Re- <?php } ?>
|
127 |
+
<a href="<?php echo $nxs_snapSetPgURL;?>&auth=<?php echo $nt; ?>&acc=<?php echo $ii; ?>">Authorize Your <?php echo $ntInfo['name']; ?> Account</a>
|
128 |
+
|
129 |
+
<?php if (!isset($options['appAppUserID']) || $options['appAppUserID']<1) { ?> <div class="blnkg"><=== <?php _e('Authorize your account', 'nxs_snap'); ?> ===</div> <?php }?>
|
130 |
+
<?php } ?>
|
131 |
+
<br/><br/>
|
132 |
+
|
133 |
+
<?php if ($isNew) { ?> <input type="hidden" name="<?php echo $nt; ?>[<?php echo $ii; ?>][apDo<?php echo $ntU; ?>]" value="1" id="apDoNew<?php echo $ntU; ?><?php echo $ii; ?>" /> <?php } ?>
|
134 |
+
<?php if (isset($options['appAppUserID']) && $options['appAppUserID']>0) { ?>
|
135 |
+
|
136 |
+
<b><?php _e('Test your settings', 'nxs_snap'); ?>:</b> <a href="#" class="NXSButton" onclick="testPost('<?php echo $ntU; ?>', '<?php echo $ii; ?>'); return false;"><?php printf( __( 'Submit Test Post to %s', 'nxs_snap' ), $nType); ?></a> <?php }
|
137 |
+
?>
|
138 |
+
|
139 |
+
</div>
|
140 |
+
<?php /* ######################## Tools Tab ####################### */ ?>
|
141 |
+
<?php if (!$isNew) { ?><div id="nsx<?php echo $nt.$ii ?>_tab2" class="nsx_tab_content">
|
142 |
+
<?php nxs_showCatTagsCTFilters($nt, $ii, $options);
|
143 |
+
nxs_addPostingDelaySelV3($nt, $ii, $options['nHrs'], $options['nMin'], $options['nDays']);
|
144 |
+
nxs_showRepostSettings($nt, $ii, $options); ?>
|
145 |
+
</div> <?php } ?> <?php /* #### End of Tab #### */ ?>
|
146 |
+
</div><br/> <?php /* #### End of Tabs #### */ ?>
|
147 |
+
|
148 |
+
<div class="submit nxclear" style="padding-bottom: 0px;"><input type="submit" class="button-primary" name="update_NS_SNAutoPoster_settings" value="<?php _e('Update Settings', 'nxs_snap') ?>" /></div>
|
149 |
+
|
150 |
+
|
151 |
+
</div><?php
|
152 |
+
}
|
153 |
+
//#### Set Unit Settings from POST
|
154 |
+
function setNTSettings($post, $options){ $code = $this->ntInfo['code'];
|
155 |
+
foreach ($post as $ii => $pval){
|
156 |
+
if (isset($pval['appKey']) && $pval['appKey']!=''){ if (!isset($options[$ii])) $options[$ii] = array();
|
157 |
+
|
158 |
+
if (isset($pval['apDo'.$code])) $options[$ii]['do'.$code] = $pval['apDo'.$code]; else $options[$ii]['do'.$code] = 0;
|
159 |
+
if (isset($pval['nName'])) $options[$ii]['nName'] = trim($pval['nName']);
|
160 |
+
|
161 |
+
if (isset($pval['appKey'])) $options[$ii]['appKey'] = trim($pval['appKey']);
|
162 |
+
if (isset($pval['appSec'])) $options[$ii]['appSec'] = trim($pval['appSec']);
|
163 |
+
if (isset($pval['topicURL'])) $options[$ii]['topicURL'] = trim($pval['topicURL']);
|
164 |
+
|
165 |
+
|
166 |
+
if (isset($pval['catSel'])) $options[$ii]['catSel'] = trim($pval['catSel']); else $options[$ii]['catSel'] = 0;
|
167 |
+
if ($options[$ii]['catSel']=='1' && trim($pval['catSelEd'])!='') $options[$ii]['catSelEd'] = trim($pval['catSelEd']); else $options[$ii]['catSelEd'] = '';
|
168 |
+
|
169 |
+
if (isset($pval['postType'])) $options[$ii]['postType'] = $pval['postType'];
|
170 |
+
if (isset($pval['inclTags'])) $options[$ii]['inclTags'] = trim($pval['inclTags']); else $options[$ii]['inclTags'] = 0;
|
171 |
+
if (isset($pval['msgFrmt'])) $options[$ii]['msgFrmt'] = trim($pval['msgFrmt']);
|
172 |
+
if (isset($pval['msgTFrmt'])) $options[$ii]['msgTFrmt'] = trim($pval['msgTFrmt']);
|
173 |
+
|
174 |
+
$options[$ii] = nxs_adjRpst($options[$ii], $pval);
|
175 |
+
|
176 |
+
if (isset($pval['delayDays'])) $options[$ii]['nDays'] = trim($pval['delayDays']);
|
177 |
+
if (isset($pval['delayHrs'])) $options[$ii]['nHrs'] = trim($pval['delayHrs']); if (isset($pval['delayMin'])) $options[$ii]['nMin'] = trim($pval['delayMin']);
|
178 |
+
if (isset($pval['qTLng'])) $options[$ii]['qTLng'] = trim($pval['qTLng']);
|
179 |
+
} elseif ( count($pval)==1 ) if (isset($pval['apDo'.$code])) $options[$ii]['do'.$code] = $pval['apDo'.$code]; else $options[$ii]['do'.$code] = 0;
|
180 |
+
} return $options;
|
181 |
+
}
|
182 |
+
//#### Show Post->Edit Meta Box Settings
|
183 |
+
function showEdPostNTSettings($ntOpts, $post){ global $nxs_plurl; $post_id = $post->ID; $nt = $this->ntInfo['lcode']; $ntU = $this->ntInfo['code'];
|
184 |
+
foreach($ntOpts as $ii=>$ntOpt) { $pMeta = maybe_unserialize(get_post_meta($post_id, 'snap'.$ntU, true));
|
185 |
+
if (is_array($pMeta) && isset($pMeta[$ii]) && is_array($pMeta[$ii])) $ntOpt = $this->adjMetaOpt($ntOpt, $pMeta[$ii]); if (empty($ntOpt['imgToUse'])) $ntOpt['imgToUse'] = '';
|
186 |
+
$doIT = $ntOpt['do'.$ntU] && (is_array($pMeta) || $ntOpt['catSel']!='1'); $imgToUse = $ntOpt['imgToUse'];
|
187 |
+
$isAvail = $ntOpt['appKey']!='' && $ntOpt['appSec']!=''; $msgFormat = htmlentities($ntOpt['msgFrmt'], ENT_COMPAT, "UTF-8"); $msgFormatT = htmlentities($ntOpt['msgTFrmt'], ENT_COMPAT, "UTF-8");
|
188 |
+
$postType = $ntOpt['postType'];
|
189 |
+
?>
|
190 |
+
<tr><th style="text-align:left;" colspan="2">
|
191 |
+
<?php if ($ntOpt['catSel']=='1' && trim($ntOpt['catSelEd'])!='') { ?> <input type="hidden" class="nxs_SC" id="nxs_SC_<?php echo $ntU; ?><?php echo $ii; ?>" value="<?php echo $ntOpt['catSelEd']; ?>" /> <?php } ?>
|
192 |
+
<?php if (!empty($ntOpt['tagsSelX'])) { ?> <input type="hidden" class="nxs_TG" id="nxs_TG_<?php echo $ntU; ?><?php echo $ii; ?>" value="<?php echo $ntOpt['tagsSelX']; ?>" /> <?php } ?>
|
193 |
+
<?php if ($isAvail) { ?><input class="nxsGrpDoChb" value="1" id="do<?php echo $ntU.$ii; ?>" <?php if ($post->post_status == "publish") echo 'disabled="disabled"';?> type="checkbox" name="<?php echo $nt; ?>[<?php echo $ii; ?>][do<?php echo $ntU; ?>]" <?php if ((int)$doIT == 1) echo 'checked="checked" title="def"'; ?> />
|
194 |
+
<?php if ($post->post_status == "publish") { ?> <input type="hidden" name="<?php echo $nt; ?>[<?php echo $ii; ?>][do<?php echo $ntU; ?>]" value="<?php echo $doIT;?>"> <?php } ?> <?php } ?>
|
195 |
+
|
196 |
+
<div class="nsx_iconedTitle" style="display: inline; font-size: 13px; background-image: url(<?php echo $nxs_plurl; ?>img/<?php echo $nt; ?>16.png);"><?php echo $this->ntInfo['name']; ?> - <?php _e('publish to', 'nxs_snap') ?> (<i style="color: #005800;"><?php echo $ntOpt['nName']; ?></i>)</div></th> <td><?php //## Only show RePost button if the post is "published"
|
197 |
+
if ($post->post_status == "publish" && $isAvail) { ?><input alt="<?php echo $ii; ?>" style="float: right;" onmouseout="hidePopShAtt('SV');" onmouseover="showPopShAtt('SV', event);" onclick="return false;" type="button" class="button" name="rePostTo<?php echo $ntU; ?>_repostButton" id="rePostTo<?php echo $ntU; ?>_button" value="<?php _e('Repost to '.$this->ntInfo['name'], 'nxs_snap') ?>" />
|
198 |
+
<?php } ?>
|
199 |
+
|
200 |
+
<?php if (is_array($pMeta) && is_array($pMeta[$ii]) && isset($pMeta[$ii]['pgID']) ) {
|
201 |
+
|
202 |
+
?> <span id="pstd<?php echo $ntU; ?><?php echo $ii; ?>" style="float: right;padding-top: 4px; padding-right: 10px;">
|
203 |
+
<a style="font-size: 10px;" href="<?php echo $pMeta[$ii]['postURL']; ?>" target="_blank"><?php $nType=$this->ntInfo['name']; printf( __( 'Posted on', 'nxs_snap' ), $nType); ?> <?php echo (isset($pMeta[$ii]['pDate']) && $pMeta[$ii]['pDate']!='')?(" (".$pMeta[$ii]['pDate'].")"):""; ?></a>
|
204 |
+
</span><?php } ?>
|
205 |
+
|
206 |
+
</td></tr>
|
207 |
+
|
208 |
+
<?php if (!$isAvail) { ?><tr><th scope="row" style="text-align:right; width:150px; padding-top: 5px; padding-right:10px;"></th> <td><b>Setup your <? echo $this->ntInfo['name']; ?> Account to AutoPost to <? echo $this->ntInfo['name']; ?></b></td></tr>
|
209 |
+
<?php } else { if ($post->post_status != "publish" && function_exists('nxs_doSMAS5') ) { $ntOpt['postTime'] = get_post_time('U', false, $post_id); nxs_doSMAS5($nt, $ii, $ntOpt); } ?>
|
210 |
+
|
211 |
+
<?php if ($ntOpt['rpstOn']=='1') { ?>
|
212 |
+
|
213 |
+
<tr id="altFormat1" style=""><th scope="row" class="nxsTHRow">
|
214 |
+
<input value="0" type="hidden" name="<?php echo $nt; ?>[<?php echo $ii; ?>][rpstPostIncl]"/><input value="nxsi<?php echo $ii; ?>ap" type="checkbox" name="<?php echo $nt; ?>[<?php echo $ii; ?>][rpstPostIncl]" <?php if (!empty($ntOpt['rpstPostIncl'])) echo "checked"; ?> />
|
215 |
+
</th>
|
216 |
+
<td> <?php _e('Include in "Auto-Reposting" to this network.', 'nxs_snap') ?>
|
217 |
+
</td></tr> <?php } ?>
|
218 |
+
|
219 |
+
<tr id="altFormat1" style=""><th scope="row" style="vertical-align:top; padding-top: 6px; text-align:right; width:60px; padding-right:10px;"><?php _e('Title Format:', 'NS_SPAP') ?></th>
|
220 |
+
<td><input value="<?php echo $msgFormatT; ?>" type="text" name="<?php echo $nt; ?>[<?php echo $ii; ?>][msgTFrmt]" style="width:60%;max-width: 610px;" onfocus="jQuery('.nxs_FRMTHint').hide();mxs_showFrmtInfo('msgFrmtT<?php echo $nt.$ii; ?>');"/><?php nxs_doShowHint("msgFrmtT".$nt.$ii, '', '58'); ?></td></tr>
|
221 |
+
|
222 |
+
<tr id="altFormat1" style=""><th scope="row" style="vertical-align:top; padding-top: 6px; text-align:right; width:60px; padding-right:10px;"><?php _e('Text Format:', 'nxs_snap') ?></th><td>
|
223 |
+
|
224 |
+
<textarea cols="150" rows="1" id="<?php echo $nt.$ii; ?>msgFrmt" name="<?php echo $nt; ?>[<?php echo $ii; ?>][msgFrmt]" style="width:60%;max-width: 610px;" onfocus="jQuery('#<?php echo $nt.$ii; ?>msgFrmt').attr('rows', 4); jQuery('.nxs_FRMTHint').hide();mxs_showFrmtInfo('msgFrmt<?php echo $nt.$ii; ?>');"><?php echo $msgFormat ?></textarea> <?php nxs_doShowHint("msgFrmt".$nt.$ii, '', '58'); ?>
|
225 |
+
|
226 |
+
</td></tr>
|
227 |
+
|
228 |
+
<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/></th><td>
|
229 |
+
<input type="radio" name="<?php echo $nt; ?>[<?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/>
|
230 |
+
<input type="radio" name="<?php echo $nt; ?>[<?php echo $ii; ?>][postType]" value="I" <?php if ($postType == 'I') echo 'checked="checked"'; ?> /> <?php _e('Post as "Image post"', 'nxs_snap') ?> - <i><?php _e('big image with text message', 'nxs_snap') ?></i><br/>
|
231 |
+
<input type="radio" name="<?php echo $nt; ?>[<?php echo $ii; ?>][postType]" value="A" <?php if ( !isset($postType) || $postType == '' || $postType == 'A') echo 'checked="checked"'; ?> /><?php _e('Text Post with "attached" blogpost', 'nxs_snap') ?>
|
232 |
+
</td></tr>
|
233 |
+
|
234 |
+
<?php /* ## Select Image & URL ## */ nxs_showImgToUseDlg($nt, $ii, $imgToUse); ?>
|
235 |
+
<?php }
|
236 |
+
|
237 |
+
}
|
238 |
+
}
|
239 |
+
//#### Save Meta Tags to the Post
|
240 |
+
function adjMetaOpt($optMt, $pMeta){ if (isset($pMeta['isPosted'])) $optMt['isPosted'] = $pMeta['isPosted']; else $optMt['isPosted'] = '';
|
241 |
+
if (isset($pMeta['doSC'])) $optMt['doSC'] = $pMeta['doSC'] == 1?1:0; else { if (isset($pMeta['msgFormat'])) $optMt['doSC'] = 0; }
|
242 |
+
|
243 |
+
if (isset($pMeta['msgFrmt'])) $optMt['msgFrmt'] = $pMeta['msgFrmt']; if (isset($pMeta['msgTFrmt'])) $optMt['msgTFrmt'] = $pMeta['msgTFrmt'];
|
244 |
+
if (isset($pMeta['postType'])) $optMt['postType'] = $pMeta['postType'];
|
245 |
+
|
246 |
+
if (isset($pMeta['imgToUse'])) $optMt['imgToUse'] = $pMeta['imgToUse']; if (isset($pMeta['urlToUse'])) $optMt['urlToUse'] = $pMeta['urlToUse'];
|
247 |
+
if (isset($pMeta['timeToRun'])) $optMt['timeToRun'] = $pMeta['timeToRun']; if (isset($pMeta['rpstPostIncl'])) $optMt['rpstPostIncl'] = $pMeta['rpstPostIncl'];
|
248 |
+
if (isset($pMeta['SNAPincludeSC']) && $pMeta['SNAPincludeSC'] == '1' ) $optMt['doSC'] = 1;
|
249 |
+
return $optMt;
|
250 |
+
}
|
251 |
+
}}
|
252 |
+
if (!function_exists("nxs_rePostToSC_ajax")) {
|
253 |
+
function nxs_rePostToSC_ajax() { check_ajax_referer('nxsSsPageWPN'); $postID = $_POST['id']; global $plgn_NS_SNAutoPoster; if (!isset($plgn_NS_SNAutoPoster)) return; $options = $plgn_NS_SNAutoPoster->nxs_options;
|
254 |
+
foreach ($options['sc'] as $ii=>$two) if ($ii==$_POST['nid']) { $two['ii'] = $ii; $two['pType'] = 'aj'; //if ($two['apPageID'].$two['apUName']==$_POST['nid']) {
|
255 |
+
$appo = get_post_meta($postID, 'snapSC', true); $appo = maybe_unserialize($appo);// prr($appo);
|
256 |
+
if (is_array($appo) && isset($appo[$ii]) && is_array($appo[$ii])){ $ntClInst = new nxs_snapClassSC(); $two = $ntClInst->adjMetaOpt($two, $appo[$ii]); }
|
257 |
+
$result = nxs_doPublishToSC($postID, $two); if ($result == 200) die("Successfully sent your post to Scoop.It. "); else die($result);
|
258 |
+
}
|
259 |
+
}
|
260 |
+
}
|
261 |
+
if (!function_exists("nxs_doPublishToSC")) { //## Post to SC. // V3 - imgToUse - Done, class_SNAP_AP - Done, New Format - Done
|
262 |
+
function nxs_doPublishToSC($postID, $options){ global $plgn_NS_SNAutoPoster; $ntCd = 'SC'; $ntCdL = 'sc'; $ntNm = 'Scoop.It'; if (!is_array($options)) $options = maybe_unserialize(get_post_meta($postID, $options, true));
|
263 |
+
$addParams = nxs_makeURLParams(array('NTNAME'=>$ntNm, 'NTCODE'=>$ntCd, 'POSTID'=>$postID, 'ACCNAME'=>$options['nName']));
|
264 |
+
if (empty($options['imgToUse'])) $options['imgToUse'] = ''; if (empty($options['imgSize'])) $options['imgSize'] = '';
|
265 |
+
$ii = $options['ii']; if (!isset($options['pType'])) $options['pType'] = 'im'; if ($options['pType']=='sh') sleep(rand(1, 10));
|
266 |
+
$logNT = '<span style="color:#800000">Scoop.It</span> - '.$options['nName'];
|
267 |
+
$snap_ap = get_post_meta($postID, 'snap'.$ntCd, true); $snap_ap = maybe_unserialize($snap_ap);
|
268 |
+
if ($options['pType']!='aj' && is_array($snap_ap) && (nxs_chArrVar($snap_ap[$ii], 'isPosted', '1') || nxs_chArrVar($snap_ap[$ii], 'isPrePosted', '1'))) {
|
269 |
+
$snap_isAutoPosted = get_post_meta($postID, 'snap_isAutoPosted', true); if ($snap_isAutoPosted!='2') {
|
270 |
+
nxs_addToLogN('W', 'Notice', $logNT, '-=Duplicate=- Post ID:'.$postID, 'Already posted. No reason for posting duplicate'.' |'.$uqID); return;
|
271 |
+
}
|
272 |
+
}
|
273 |
+
$message = array('message'=>'', 'link'=>'', 'imageURL'=>'', 'videoURL'=>'');
|
274 |
+
|
275 |
+
if ($postID=='0') { echo "Testing ... <br/><br/>"; $message['description'] = 'Test Post, Description'; $message['title'] = 'Test Post - Title'; $message['url'] = home_url();
|
276 |
+
} else { nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPrePosted'=>'1')); $post = get_post($postID); if(!$post) return;
|
277 |
+
$postType = $options['postType']; $isNoImg = false; $tags = '';
|
278 |
+
|
279 |
+
$options['msgFrmt'] = nsFormatMessage($options['msgFrmt'], $postID, $addParams); $options['msgTFrmt'] = nsFormatMessage($options['msgTFrmt'], $postID, $addParams);
|
280 |
+
|
281 |
+
$tggs = array(); if ($options['inclTags']=='1'){ $t = wp_get_post_tags($postID); $tggs = array(); foreach ($t as $tagA) {$tggs[] = $tagA->name;} $tags = $tggs; }
|
282 |
+
|
283 |
+
if ($postType=='A') if (trim($options['imgToUse'])!='') $imgURL = $options['imgToUse']; else $imgURL = nxs_getPostImage($postID, 'medium');
|
284 |
+
if ($postType=='I') if (trim($options['imgToUse'])!='') $imgURL = $options['imgToUse']; else $imgURL = nxs_getPostImage($postID, 'full');
|
285 |
+
if (preg_match("/noImg.\.png/i", $imgURL)) { $imgURL = ''; $isNoImg = true; }
|
286 |
+
|
287 |
+
//## MyURL - URLToGo code
|
288 |
+
if (!isset($options['urlToUse']) || trim($options['urlToUse'])=='') $myurl = trim(get_post_meta($postID, 'snap_MYURL', true)); if ($myurl!='') $options['urlToUse'] = $myurl;
|
289 |
+
if (isset($options['urlToUse']) && trim($options['urlToUse'])!='') { $urlToGo = $options['urlToUse']; $options['useFBGURLInfo'] = true; } else $urlToGo = get_permalink($postID);
|
290 |
+
$gOptions = $plgn_NS_SNAutoPoster->nxs_options; $addURLParams = trim($gOptions['addURLParams']); if($addURLParams!='') $urlToGo .= (strpos($urlToGo,'?')!==false?'&':'?').$addURLParams;
|
291 |
+
$message = array('url'=>$urlToGo, 'imageURL'=>$imgURL, 'noImg'=>$isNoImg, 'tags'=>$tags);
|
292 |
+
$extInfo = ' | PostID: '.$postID." - ".(isset($post) && is_object($post)?$post->post_title:'');
|
293 |
+
}
|
294 |
+
//## Actual Post
|
295 |
+
$ntToPost = new nxs_class_SNAP_SC(); $ret = $ntToPost->doPostToNT($options, $message); //prr($ret);
|
296 |
+
//## Process Results
|
297 |
+
if (!is_array($ret) || $ret['isPosted']!='1') { //## Error
|
298 |
+
if ($postID=='0') prr($ret); nxs_addToLogN('E', 'Error', $logNT, '-=ERROR=- '.print_r($ret, true), $extInfo);
|
299 |
+
} else { // ## All Good - log it.
|
300 |
+
if ($postID=='0') { nxs_addToLogN('S', 'Test', $logNT, 'OK - TEST Message Posted '); echo _e('OK - Message Posted, please see your '.$logNT.' Page. ', 'nxs_snap'); }
|
301 |
+
else { nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPosted'=>'1', 'pgID'=>$ret['postID'], 'postURL'=>$ret['postURL'], 'pDate'=>date('Y-m-d H:i:s')));
|
302 |
+
$extInfo .= ' | <a href="'.$ret['postURL'].'" target="_blank">Post Link</a>'; nxs_addToLogN('S', 'Posted', $logNT, 'OK - Message Posted ', $extInfo); }
|
303 |
+
}
|
304 |
+
//## Return Result
|
305 |
+
if ($ret['isPosted']=='1') return 200; else return print_r($ret, true);
|
306 |
+
|
307 |
+
}
|
308 |
+
}
|
309 |
+
?>
|
inc-cl/su.api.php
CHANGED
@@ -92,7 +92,7 @@ if (!class_exists("nxs_class_SNAP_SU")) { class nxs_class_SNAP_SU {
|
|
92 |
if (!isset($options['suUName']) || trim($options['suPass'])=='') { $badOut['Error'] = 'Not Configured'; return $badOut; }
|
93 |
$pass = (substr($options['suPass'], 0, 5)=='n5g9a'?nsx_doDecode(substr($options['suPass'], 5)):$options['suPass']);
|
94 |
//## Format
|
95 |
-
$msg = nxs_doFormatMsg($options['suMsgFormat'], $message); $urlToGo = (!empty($message['url']))?$message['url']:''; $tags = $message['tags'];
|
96 |
|
97 |
if (isset($options['suSvC'])) $nxs_suCkArray = maybe_unserialize( $options['suSvC']); $loginError = true;
|
98 |
if (is_array($nxs_suCkArray)) $loginError = $this->nxs_doCheckSU(); if ($loginError!=false) $loginError = $this->nxs_doConnectToSU($options['suUName'], $pass);
|
@@ -102,7 +102,7 @@ if (!class_exists("nxs_class_SNAP_SU")) { class nxs_class_SNAP_SU {
|
|
102 |
|
103 |
if ($ret=='OK') $ret = array("code"=>"OK", "post_id"=>'');
|
104 |
if ( (!is_array($ret)) && $ret!='OK') { $badOut['Error'] .= 'Something went wrong - '.print_r($ret, true); }
|
105 |
-
elseif (isset($ret['code']) && $ret['code']=='OK') return array('isPosted'=>'1', 'postID'=>$ret['post_id'], 'postURL'
|
106 |
return $badOut;
|
107 |
}
|
108 |
}}
|
92 |
if (!isset($options['suUName']) || trim($options['suPass'])=='') { $badOut['Error'] = 'Not Configured'; return $badOut; }
|
93 |
$pass = (substr($options['suPass'], 0, 5)=='n5g9a'?nsx_doDecode(substr($options['suPass'], 5)):$options['suPass']);
|
94 |
//## Format
|
95 |
+
if (!empty($message['pText'])) $msg = $message['pText']; else $msg = nxs_doFormatMsg($options['suMsgFormat'], $message); $urlToGo = (!empty($message['url']))?$message['url']:''; $tags = $message['tags'];
|
96 |
|
97 |
if (isset($options['suSvC'])) $nxs_suCkArray = maybe_unserialize( $options['suSvC']); $loginError = true;
|
98 |
if (is_array($nxs_suCkArray)) $loginError = $this->nxs_doCheckSU(); if ($loginError!=false) $loginError = $this->nxs_doConnectToSU($options['suUName'], $pass);
|
102 |
|
103 |
if ($ret=='OK') $ret = array("code"=>"OK", "post_id"=>'');
|
104 |
if ( (!is_array($ret)) && $ret!='OK') { $badOut['Error'] .= 'Something went wrong - '.print_r($ret, true); }
|
105 |
+
elseif (isset($ret['code']) && $ret['code']=='OK') return array('isPosted'=>'1', 'postID'=>$ret['post_id'], 'postURL'=>'http://www.stumbleupon.com/content/'.$ret['post_id'].'/comments', 'pDate'=>date('Y-m-d H:i:s')); else $badOut['Error'] .= 'Error - '.print_r($ret, true);
|
106 |
return $badOut;
|
107 |
}
|
108 |
}}
|
inc-cl/su.php
CHANGED
@@ -15,7 +15,10 @@ if (!class_exists("nxs_snapClassSU")) { class nxs_snapClassSU {
|
|
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;"> <img id="<?php echo $ntInfo['code'].$indx;?>LoadingImg" style="display: none;" src='<?php echo $nxs_plurl; ?>img/ajax-loader-sm.gif' />
|
18 |
-
<input value="
|
|
|
|
|
|
|
19 |
<?php if (isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);"><?php echo "*[".(substr_count($pbo['catSelEd'], ",")+1)."]*" ?></span><?php } ?>
|
20 |
<?php if (isset($pbo['rpstOn']) && (int)$pbo['rpstOn'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popReActive');" onmouseover="nxs_showPopUpInfo('popReActive', event);"><?php echo "*[R]*" ?></span><?php } ?>
|
21 |
<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>
|
@@ -128,7 +131,7 @@ if (!class_exists("nxs_snapClassSU")) { class nxs_snapClassSU {
|
|
128 |
if (isset($pval['delayDays'])) $options[$ii]['nDays'] = trim($pval['delayDays']);
|
129 |
if (isset($pval['delayHrs'])) $options[$ii]['nHrs'] = trim($pval['delayHrs']); if (isset($pval['delayMin'])) $options[$ii]['nMin'] = trim($pval['delayMin']);
|
130 |
if (isset($pval['qTLng'])) $options[$ii]['qTLng'] = trim($pval['qTLng']);
|
131 |
-
} elseif ((
|
132 |
} return $options;
|
133 |
}
|
134 |
//#### Show Post->Edit Meta Box Settings
|
@@ -251,7 +254,8 @@ if (!function_exists("nxs_doPublishToSU")) { //## Second Function to Post to SU
|
|
251 |
if ($postID=='0') prr($ret); nxs_addToLogN('E', 'Error', $logNT, '-=ERROR=- '.print_r($ret, true), $extInfo);
|
252 |
} else { // ## All Good - log it.
|
253 |
if ($postID=='0') { nxs_addToLogN('S', 'Test', $logNT, 'OK - TEST Message Posted '); echo _e('OK - Message Posted, please see your '.$logNT.' Page. ', 'nxs_snap'); }
|
254 |
-
else { nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPosted'=>'1', 'pgID'=>$ret['postID'], 'postURL'=>$ret['postURL'], 'pDate'=>date('Y-m-d H:i:s')));
|
|
|
255 |
} //prr($ret);
|
256 |
//## Return Result
|
257 |
if ($ret['isPosted']=='1') return 200; else return print_r($ret, true);
|
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;"> <img id="<?php echo $ntInfo['code'].$indx;?>LoadingImg" style="display: none;" src='<?php echo $nxs_plurl; ?>img/ajax-loader-sm.gif' />
|
18 |
+
<input value="0" name="<?php echo $ntInfo['lcode']; ?>[<?php echo $indx; ?>][apDo<?php echo $ntInfo['code']; ?>]" type="hidden" />
|
19 |
+
<?php if ((int)$pbo['do'.$ntInfo['code']] == 1 && isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <input type="radio" id="rbtn<?php echo $ntInfo['lcode'].$indx; ?>" checked="checked" onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);" /> <?php } else { ?>
|
20 |
+
<input value="1" name="<?php echo $ntInfo['lcode']; ?>[<?php echo $indx; ?>][apDo<?php echo $ntInfo['code']; ?>]" type="checkbox" <?php if ((int)$pbo['do'.$ntInfo['code']] == 1 && $pbo['catSel']!='1') echo "checked"; ?> />
|
21 |
+
<?php } ?>
|
22 |
<?php if (isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);"><?php echo "*[".(substr_count($pbo['catSelEd'], ",")+1)."]*" ?></span><?php } ?>
|
23 |
<?php if (isset($pbo['rpstOn']) && (int)$pbo['rpstOn'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popReActive');" onmouseover="nxs_showPopUpInfo('popReActive', event);"><?php echo "*[R]*" ?></span><?php } ?>
|
24 |
<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>
|
131 |
if (isset($pval['delayDays'])) $options[$ii]['nDays'] = trim($pval['delayDays']);
|
132 |
if (isset($pval['delayHrs'])) $options[$ii]['nHrs'] = trim($pval['delayHrs']); if (isset($pval['delayMin'])) $options[$ii]['nMin'] = trim($pval['delayMin']);
|
133 |
if (isset($pval['qTLng'])) $options[$ii]['qTLng'] = trim($pval['qTLng']);
|
134 |
+
} elseif ( count($pval)==1 ) if (isset($pval['apDo'.$code])) $options[$ii]['do'.$code] = $pval['apDo'.$code]; else $options[$ii]['do'.$code] = 0;
|
135 |
} return $options;
|
136 |
}
|
137 |
//#### Show Post->Edit Meta Box Settings
|
254 |
if ($postID=='0') prr($ret); nxs_addToLogN('E', 'Error', $logNT, '-=ERROR=- '.print_r($ret, true), $extInfo);
|
255 |
} else { // ## All Good - log it.
|
256 |
if ($postID=='0') { nxs_addToLogN('S', 'Test', $logNT, 'OK - TEST Message Posted '); echo _e('OK - Message Posted, please see your '.$logNT.' Page. ', 'nxs_snap'); }
|
257 |
+
else { nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPosted'=>'1', 'pgID'=>$ret['postID'], 'postURL'=>$ret['postURL'], 'pDate'=>date('Y-m-d H:i:s')));
|
258 |
+
$extInfo .= ' | <a href="'.$ret['postURL'].'" target="_blank">Post Link</a>'; nxs_addToLogN('S', 'Posted', $logNT, 'OK - Message Posted ', $extInfo); }
|
259 |
} //prr($ret);
|
260 |
//## Return Result
|
261 |
if ($ret['isPosted']=='1') return 200; else return print_r($ret, true);
|
inc-cl/tr.api.php
CHANGED
@@ -14,10 +14,12 @@ if (!class_exists("nxs_class_SNAP_TR")) { class nxs_class_SNAP_TR {
|
|
14 |
function doPostToNT($options, $message){ $badOut = array('pgID'=>'', 'isPosted'=>0, 'pDate'=>date('Y-m-d H:i:s'), 'Error'=>'');
|
15 |
//## Check settings
|
16 |
if (!is_array($options)) { $badOut['Error'] = 'No Options'; return $badOut; }
|
17 |
-
if (!isset($options['trConsKey']) || trim($options['trConsSec'])=='') { $badOut['Error'] = 'Not Configured'; return $badOut; }
|
|
|
|
|
18 |
//## Format
|
19 |
-
$msg =
|
20 |
-
|
21 |
|
22 |
//## Post
|
23 |
require_once('apis/trOAuth.php'); $consumer_key = $options['trConsKey']; $consumer_secret = $options['trConsSec'];
|
@@ -25,12 +27,12 @@ if (!class_exists("nxs_class_SNAP_TR")) { class nxs_class_SNAP_TR {
|
|
25 |
|
26 |
$postArr = array('tags'=>$message['tags'], 'date'=>$message['postDate']);
|
27 |
if (isset($message['imageURL'])) $imgURL = trim(nxs_getImgfrOpt($message['imageURL'], $options['imgSize'])); else $imgURL = '';
|
28 |
-
|
29 |
-
if ($options['
|
30 |
if (!isset($options['cImgURL']) || $options['cImgURL']=='' || $options['cImgURL']=='R' ) $postArr['link'] = $message['url'];
|
31 |
elseif ($options['cImgURL']=='S' ) { $postArr['link'] = $message['url']; $postArr['link'] = nxs_mkShortURL($postArr['link']);}
|
32 |
-
} elseif($options['
|
33 |
-
} elseif($options['
|
34 |
$embedTxt = '<iframe width="560" height="315" src="http://www.youtube.com/embed/'.$message['videoURL'].'" frameborder="0" allowfullscreen></iframe>';
|
35 |
$postArr['embed'] = $embedTxt;
|
36 |
} else { $postArr['title'] = $msgT; $postArr['type'] = 'text'; $postArr['source'] = $message['url']; $postArr['body'] = $msg; }
|
14 |
function doPostToNT($options, $message){ $badOut = array('pgID'=>'', 'isPosted'=>0, 'pDate'=>date('Y-m-d H:i:s'), 'Error'=>'');
|
15 |
//## Check settings
|
16 |
if (!is_array($options)) { $badOut['Error'] = 'No Options'; return $badOut; }
|
17 |
+
if (!isset($options['trConsKey']) || trim($options['trConsSec'])=='' || empty($options['trAccessTocken'])) { $badOut['Error'] = 'Not Configured'; return $badOut; }
|
18 |
+
if (!isset($options['postType']) && isset($options['trPostType'])) $options['postType'] = $options['trPostType']; //## Compatibility with v <3.2
|
19 |
+
if (empty($options['imgSize'])) $options['imgSize'] = ''; if (empty($message['postDate'])) $message['postDate'] = '';
|
20 |
//## Format
|
21 |
+
if (!empty($message['pText'])) $msg = $message['pText']; else $msg = nxs_doFormatMsg($options['trMsgFormat'], $message);
|
22 |
+
if (!empty($message['pTitle'])) $msgT = $message['pTitle']; else $msgT = nxs_doFormatMsg($options['trMsgTFormat'], $message);
|
23 |
|
24 |
//## Post
|
25 |
require_once('apis/trOAuth.php'); $consumer_key = $options['trConsKey']; $consumer_secret = $options['trConsSec'];
|
27 |
|
28 |
$postArr = array('tags'=>$message['tags'], 'date'=>$message['postDate']);
|
29 |
if (isset($message['imageURL'])) $imgURL = trim(nxs_getImgfrOpt($message['imageURL'], $options['imgSize'])); else $imgURL = '';
|
30 |
+
// postType
|
31 |
+
if ($options['postType']=='I') { $postArr['type'] = 'photo'; $postArr['caption'] = $msg; $postArr['source'] = $imgURL;
|
32 |
if (!isset($options['cImgURL']) || $options['cImgURL']=='' || $options['cImgURL']=='R' ) $postArr['link'] = $message['url'];
|
33 |
elseif ($options['cImgURL']=='S' ) { $postArr['link'] = $message['url']; $postArr['link'] = nxs_mkShortURL($postArr['link']);}
|
34 |
+
} elseif($options['postType']=='U') { $postArr['type'] = 'audio'; $postArr['caption'] = $msg; $postArr['external_url'] = $aUrl;
|
35 |
+
} elseif($options['postType']=='V') { $postArr['type'] = 'video'; $postArr['caption'] = $msg;
|
36 |
$embedTxt = '<iframe width="560" height="315" src="http://www.youtube.com/embed/'.$message['videoURL'].'" frameborder="0" allowfullscreen></iframe>';
|
37 |
$postArr['embed'] = $embedTxt;
|
38 |
} else { $postArr['title'] = $msgT; $postArr['type'] = 'text'; $postArr['source'] = $message['url']; $postArr['body'] = $msg; }
|
inc-cl/tr.php
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
//## NextScripts Facebook Connection Class
|
3 |
$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_snapSetPgURL, $nxs_plurl; $ntInfo =
|
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_snapSetPgURL."&auth=tra&acc=".$_GET['acc'];
|
@@ -44,7 +44,10 @@ if (!class_exists("nxs_snapClassTR")) { class nxs_snapClassTR {
|
|
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;"> <img id="<?php echo $ntInfo['code'].$indx;?>LoadingImg" style="display: none;" src='<?php echo $nxs_plurl; ?>img/ajax-loader-sm.gif' />
|
47 |
-
<input value="
|
|
|
|
|
|
|
48 |
<?php if (isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);"><?php echo "*[".(substr_count($pbo['catSelEd'], ",")+1)."]*" ?></span><?php } ?>
|
49 |
<?php if (isset($pbo['rpstOn']) && (int)$pbo['rpstOn'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popReActive');" onmouseover="nxs_showPopUpInfo('popReActive', event);"><?php echo "*[R]*" ?></span><?php } ?>
|
50 |
<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>
|
@@ -167,8 +170,8 @@ if (!class_exists("nxs_snapClassTR")) { class nxs_snapClassTR {
|
|
167 |
|
168 |
}
|
169 |
//#### Set Unit Settings from POST
|
170 |
-
function setNTSettings($post, $options){
|
171 |
-
foreach ($post as $ii => $pval){
|
172 |
if (isset($pval['apTRConsKey']) && $pval['apTRConsSec']!='') { if (!isset($options[$ii])) $options[$ii] = array();
|
173 |
|
174 |
if (isset($pval['apTRURL'])) { $options[$ii]['trURL'] = trim($pval['apTRURL']); if ( substr($options[$ii]['trURL'], 0, 4)!='http' ) $options[$ii]['trURL'] = 'http://'.$options[$ii]['trURL'];
|
@@ -197,7 +200,7 @@ if (!class_exists("nxs_snapClassTR")) { class nxs_snapClassTR {
|
|
197 |
if (isset($pval['delayDays'])) $options[$ii]['nDays'] = trim($pval['delayDays']);
|
198 |
if (isset($pval['delayHrs'])) $options[$ii]['nHrs'] = trim($pval['delayHrs']); if (isset($pval['delayMin'])) $options[$ii]['nMin'] = trim($pval['delayMin']);
|
199 |
if (isset($pval['qTLng'])) $options[$ii]['qTLng'] = trim($pval['qTLng']);
|
200 |
-
} elseif ((
|
201 |
} return $options;
|
202 |
}
|
203 |
//#### Show Post->Edit Meta Box Settings
|
2 |
//## NextScripts Facebook Connection Class
|
3 |
$nxs_snapAvNts[] = array('code'=>'TR', 'lcode'=>'tr', 'name'=>'Tumblr');
|
4 |
|
5 |
+
if (!class_exists("nxs_snapClassTR")) { class nxs_snapClassTR { var $ntInfo = array('code'=>'TR', 'lcode'=>'tr', 'name'=>'Tumblr', 'defNName'=>'', 'tstReq' => true);
|
6 |
//#### Show Common Settings
|
7 |
+
function showGenNTSettings($ntOpts){ global $nxs_snapSetPgURL, $nxs_plurl; $ntInfo = $this->ntInfo;
|
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_snapSetPgURL."&auth=tra&acc=".$_GET['acc'];
|
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;"> <img id="<?php echo $ntInfo['code'].$indx;?>LoadingImg" style="display: none;" src='<?php echo $nxs_plurl; ?>img/ajax-loader-sm.gif' />
|
47 |
+
<input value="0" name="<?php echo $ntInfo['lcode']; ?>[<?php echo $indx; ?>][apDo<?php echo $ntInfo['code']; ?>]" type="hidden" />
|
48 |
+
<?php if ((int)$pbo['do'.$ntInfo['code']] == 1 && isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <input type="radio" id="rbtn<?php echo $ntInfo['lcode'].$indx; ?>" checked="checked" onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);" /> <?php } else { ?>
|
49 |
+
<input value="1" name="<?php echo $ntInfo['lcode']; ?>[<?php echo $indx; ?>][apDo<?php echo $ntInfo['code']; ?>]" type="checkbox" <?php if ((int)$pbo['do'.$ntInfo['code']] == 1 && $pbo['catSel']!='1') echo "checked"; ?> />
|
50 |
+
<?php } ?>
|
51 |
<?php if (isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);"><?php echo "*[".(substr_count($pbo['catSelEd'], ",")+1)."]*" ?></span><?php } ?>
|
52 |
<?php if (isset($pbo['rpstOn']) && (int)$pbo['rpstOn'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popReActive');" onmouseover="nxs_showPopUpInfo('popReActive', event);"><?php echo "*[R]*" ?></span><?php } ?>
|
53 |
<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>
|
170 |
|
171 |
}
|
172 |
//#### Set Unit Settings from POST
|
173 |
+
function setNTSettings($post, $options){ $code = $this->ntInfo['code'];
|
174 |
+
foreach ($post as $ii => $pval){
|
175 |
if (isset($pval['apTRConsKey']) && $pval['apTRConsSec']!='') { if (!isset($options[$ii])) $options[$ii] = array();
|
176 |
|
177 |
if (isset($pval['apTRURL'])) { $options[$ii]['trURL'] = trim($pval['apTRURL']); if ( substr($options[$ii]['trURL'], 0, 4)!='http' ) $options[$ii]['trURL'] = 'http://'.$options[$ii]['trURL'];
|
200 |
if (isset($pval['delayDays'])) $options[$ii]['nDays'] = trim($pval['delayDays']);
|
201 |
if (isset($pval['delayHrs'])) $options[$ii]['nHrs'] = trim($pval['delayHrs']); if (isset($pval['delayMin'])) $options[$ii]['nMin'] = trim($pval['delayMin']);
|
202 |
if (isset($pval['qTLng'])) $options[$ii]['qTLng'] = trim($pval['qTLng']);
|
203 |
+
} elseif ( count($pval)==1 ) if (isset($pval['apDo'.$code])) $options[$ii]['do'.$code] = $pval['apDo'.$code]; else $options[$ii]['do'.$code] = 0;
|
204 |
} return $options;
|
205 |
}
|
206 |
//#### Show Post->Edit Meta Box Settings
|
inc-cl/tw.api.php
CHANGED
@@ -12,14 +12,18 @@ if (!class_exists("nxs_class_SNAP_TW")) { class nxs_class_SNAP_TW {
|
|
12 |
return $out;
|
13 |
}
|
14 |
function doPostToNT($options, $message){ global $nxs_urlLen; $badOut = array('pgID'=>'', 'isPosted'=>0, 'pDate'=>date('Y-m-d H:i:s'), 'Error'=>'');
|
|
|
|
|
15 |
//## Check settings
|
16 |
if (!is_array($options)) { $badOut['Error'] = 'No Options'; return $badOut; }
|
17 |
if (!isset($options['twAccToken']) || trim($options['twAccToken'])=='') { $badOut['Error'] = 'No Auth Token Found'; return $badOut; }
|
|
|
18 |
//## Old Settings Fix
|
19 |
if ($options['attchImg']=='1') $options['attchImg'] = 'large'; if ($options['attchImg']=='0') $options['attchImg'] = false;
|
20 |
if (isset($message['img']) && !is_array($message['img']) ) $img = trim($message['img']); else $img = '';
|
21 |
//## Format Post
|
22 |
-
|
|
|
23 |
if (empty($imgURL) && $img=='') $options['attchImg'] = false;
|
24 |
//## Make Post
|
25 |
//$msg = $message['message']; $imgURL = trim($message['imageURL']); $img = trim($message['img']); $nxs_urlLen = $message['urlLength'];
|
12 |
return $out;
|
13 |
}
|
14 |
function doPostToNT($options, $message){ global $nxs_urlLen; $badOut = array('pgID'=>'', 'isPosted'=>0, 'pDate'=>date('Y-m-d H:i:s'), 'Error'=>'');
|
15 |
+
if (!function_exists('nxs_remote_get') && function_exists('wp_remote_get')) { function nxs_remote_get($url){return wp_remote_get($url);} }
|
16 |
+
if (!function_exists('is_nxs_error') && function_exists('is_wp_error')) { function is_nxs_error($a){return is_wp_error($a);} }
|
17 |
//## Check settings
|
18 |
if (!is_array($options)) { $badOut['Error'] = 'No Options'; return $badOut; }
|
19 |
if (!isset($options['twAccToken']) || trim($options['twAccToken'])=='') { $badOut['Error'] = 'No Auth Token Found'; return $badOut; }
|
20 |
+
if (empty($options['imgSize'])) $options['imgSize'] = '';
|
21 |
//## Old Settings Fix
|
22 |
if ($options['attchImg']=='1') $options['attchImg'] = 'large'; if ($options['attchImg']=='0') $options['attchImg'] = false;
|
23 |
if (isset($message['img']) && !is_array($message['img']) ) $img = trim($message['img']); else $img = '';
|
24 |
//## Format Post
|
25 |
+
if (!empty($message['pText'])) $msg = $message['pText']; else $msg = nxs_doFormatMsg($options['twMsgFormat'], $message);
|
26 |
+
if ($options['attchImg']!=false) { if (isset($message['imageURL'])) $imgURL = trim(nxs_getImgfrOpt($message['imageURL'], $options['imgSize'])); else $imgURL = ''; }
|
27 |
if (empty($imgURL) && $img=='') $options['attchImg'] = false;
|
28 |
//## Make Post
|
29 |
//$msg = $message['message']; $imgURL = trim($message['imageURL']); $img = trim($message['img']); $nxs_urlLen = $message['urlLength'];
|
inc-cl/tw.php
CHANGED
@@ -15,7 +15,10 @@ if (!class_exists("nxs_snapClassTW")) { class nxs_snapClassTW {
|
|
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;"> <img id="<?php echo $ntInfo['code'].$indx;?>LoadingImg" style="display: none;" src='<?php echo $nxs_plurl; ?>img/ajax-loader-sm.gif' />
|
18 |
-
<input value="
|
|
|
|
|
|
|
19 |
<?php if (isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);"><?php echo "*[".(substr_count($pbo['catSelEd'], ",")+1)."]*" ?></span><?php } ?>
|
20 |
<?php if (isset($pbo['rpstOn']) && (int)$pbo['rpstOn'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popReActive');" onmouseover="nxs_showPopUpInfo('popReActive', event);"><?php echo "*[R]*" ?></span><?php } ?>
|
21 |
<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>
|
@@ -124,7 +127,7 @@ if (!class_exists("nxs_snapClassTW")) { class nxs_snapClassTW {
|
|
124 |
if (isset($pval['attchImg'])) $options[$ii]['attchImg'] = $pval['attchImg']; else $options[$ii]['attchImg'] = 0;
|
125 |
if (isset($pval['delayHrs'])) $options[$ii]['nHrs'] = trim($pval['delayHrs']); if (isset($pval['delayMin'])) $options[$ii]['nMin'] = trim($pval['delayMin']); if (isset($pval['delayDays'])) $options[$ii]['nDays'] = trim($pval['delayDays']);
|
126 |
if (isset($pval['qTLng'])) $options[$ii]['qTLng'] = trim($pval['qTLng']);
|
127 |
-
} elseif ((
|
128 |
} return $options;
|
129 |
}
|
130 |
//#### Show Post->Edit Meta Box Settings
|
@@ -250,7 +253,6 @@ if (!function_exists("nxs_doPublishToTW")) { //## Second Function to Post to TW
|
|
250 |
}
|
251 |
}
|
252 |
$blogTitle = htmlspecialchars_decode(get_bloginfo('name'), ENT_QUOTES); if ($blogTitle=='') $blogTitle = home_url(); $uln = 0; $extInfo = ' | PostID: '.$postID;
|
253 |
-
|
254 |
if ($options['attchImg']=='1') { if (trim($options['imgToUse'])!='') $imgURL = $options['imgToUse']; else $imgURL = nxs_getPostImage($postID); if (preg_match("/noImg.\.png/i", $imgURL)) $imgURL = '';
|
255 |
if(trim($imgURL)=='') $options['attchImg'] = 0; else { $imgURL = str_replace(' ', '%20', $imgURL);
|
256 |
if( ini_get('allow_url_fopen') ) { if (@getimagesize($imgURL)!==false) { $img = wp_remote_get($imgURL);
|
@@ -316,15 +318,19 @@ if (!function_exists("nxs_doPublishToTW")) { //## Second Function to Post to TW
|
|
316 |
$siteTitle = htmlspecialchars_decode(get_bloginfo('name'), ENT_QUOTES); $siteTitle = nsTrnc($siteTitle, $twLim); $twMsgFormat = str_ireplace("%SITENAME%", $siteTitle, $twMsgFormat); $twLim = $twLim - nxs_strLen($siteTitle);
|
317 |
}
|
318 |
if (stripos($twMsgFormat, '%TEXT%')!==false) {
|
319 |
-
$pText = nsTrnc(strip_tags(strip_shortcodes($pText)),
|
320 |
$pText = nsTrnc($pText, $twLim); $twMsgFormat = str_ireplace("%TEXT%", $pText, $twMsgFormat); $twLim = $twLim - nxs_strLen($pText);
|
321 |
}
|
322 |
if (stripos($twMsgFormat, '%EXCERPT%')!==false) {
|
323 |
-
$pText = nsTrnc(strip_tags(strip_shortcodes($pText)),
|
324 |
$pText = nsTrnc($pText, $twLim); $twMsgFormat = str_ireplace("%EXCERPT%", $pText, $twMsgFormat); $twLim = $twLim - nxs_strLen($pText);
|
325 |
}
|
|
|
|
|
|
|
|
|
326 |
if (stripos($twMsgFormat, '%RAWEXCERPT%')!==false) {
|
327 |
-
$exrText = nsTrnc(strip_tags(strip_shortcodes($exrText)),
|
328 |
$exrText = nsTrnc($exrText, $twLim); $twMsgFormat = str_ireplace("%RAWEXCERPT%", $exrText, $twMsgFormat); $twLim = $twLim - nxs_strLen($exrText);
|
329 |
}
|
330 |
if (stripos($twMsgFormat, '%FULLTEXT%')!==false) {
|
@@ -340,7 +346,6 @@ if (!function_exists("nxs_doPublishToTW")) { //## Second Function to Post to TW
|
|
340 |
$msg = str_replace('&#8220;', '"', $msg); $msg = str_replace('“', '"', $msg); $msg = str_replace('#8220;', '"', $msg); $msg = str_replace('#8220', "'", $msg);
|
341 |
$msg = str_replace('&#8221;', '"', $msg); $msg = str_replace('”', '"', $msg); $msg = str_replace('#8221;', '"', $msg); $msg = str_replace('#8221', "'", $msg);
|
342 |
$message = array('message'=>$msg, 'img'=>$img, 'urlLength'=>$nxs_urlLen); $options['twMsgFormat'] = $msg;
|
343 |
-
|
344 |
//## Actual Post
|
345 |
$ntToPost = new nxs_class_SNAP_TW(); $ret = $ntToPost->doPostToNT($options, $message);
|
346 |
//## Process Results
|
@@ -348,7 +353,8 @@ if (!function_exists("nxs_doPublishToTW")) { //## Second Function to Post to TW
|
|
348 |
if ($postID=='0') prr($ret); nxs_addToLogN('E', 'Error', $logNT, '-=ERROR=- '.print_r($ret, true), $extInfo);
|
349 |
} else { // ## All Good - log it.
|
350 |
if ($postID=='0') { nxs_addToLogN('S', 'Test', $logNT, 'OK - TEST Message Posted '); echo _e('OK - Message Posted, please see your '.$logNT.' Page. ', 'nxs_snap'); }
|
351 |
-
else { nxs_addToRI($postID); nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPosted'=>'1', 'pgID'=>$ret['postID'], 'pDate'=>date('Y-m-d H:i:s')));
|
|
|
352 |
}
|
353 |
//## Return Result
|
354 |
if ($ret['isPosted']=='1') return 200; else return print_r($ret, true);
|
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;"> <img id="<?php echo $ntInfo['code'].$indx;?>LoadingImg" style="display: none;" src='<?php echo $nxs_plurl; ?>img/ajax-loader-sm.gif' />
|
18 |
+
<input value="0" name="<?php echo $ntInfo['lcode']; ?>[<?php echo $indx; ?>][apDo<?php echo $ntInfo['code']; ?>]" type="hidden" />
|
19 |
+
<?php if ((int)$pbo['do'.$ntInfo['code']] == 1 && isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <input type="radio" id="rbtn<?php echo $ntInfo['lcode'].$indx; ?>" checked="checked" onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);" /> <?php } else { ?>
|
20 |
+
<input value="1" name="<?php echo $ntInfo['lcode']; ?>[<?php echo $indx; ?>][apDo<?php echo $ntInfo['code']; ?>]" type="checkbox" <?php if ((int)$pbo['do'.$ntInfo['code']] == 1 && $pbo['catSel']!='1') echo "checked"; ?> />
|
21 |
+
<?php } ?>
|
22 |
<?php if (isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);"><?php echo "*[".(substr_count($pbo['catSelEd'], ",")+1)."]*" ?></span><?php } ?>
|
23 |
<?php if (isset($pbo['rpstOn']) && (int)$pbo['rpstOn'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popReActive');" onmouseover="nxs_showPopUpInfo('popReActive', event);"><?php echo "*[R]*" ?></span><?php } ?>
|
24 |
<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>
|
127 |
if (isset($pval['attchImg'])) $options[$ii]['attchImg'] = $pval['attchImg']; else $options[$ii]['attchImg'] = 0;
|
128 |
if (isset($pval['delayHrs'])) $options[$ii]['nHrs'] = trim($pval['delayHrs']); if (isset($pval['delayMin'])) $options[$ii]['nMin'] = trim($pval['delayMin']); if (isset($pval['delayDays'])) $options[$ii]['nDays'] = trim($pval['delayDays']);
|
129 |
if (isset($pval['qTLng'])) $options[$ii]['qTLng'] = trim($pval['qTLng']);
|
130 |
+
} elseif ( count($pval)==1 ) if (isset($pval['apDo'.$code])) $options[$ii]['do'.$code] = $pval['apDo'.$code]; else $options[$ii]['do'.$code] = 0;
|
131 |
} return $options;
|
132 |
}
|
133 |
//#### Show Post->Edit Meta Box Settings
|
253 |
}
|
254 |
}
|
255 |
$blogTitle = htmlspecialchars_decode(get_bloginfo('name'), ENT_QUOTES); if ($blogTitle=='') $blogTitle = home_url(); $uln = 0; $extInfo = ' | PostID: '.$postID;
|
|
|
256 |
if ($options['attchImg']=='1') { if (trim($options['imgToUse'])!='') $imgURL = $options['imgToUse']; else $imgURL = nxs_getPostImage($postID); if (preg_match("/noImg.\.png/i", $imgURL)) $imgURL = '';
|
257 |
if(trim($imgURL)=='') $options['attchImg'] = 0; else { $imgURL = str_replace(' ', '%20', $imgURL);
|
258 |
if( ini_get('allow_url_fopen') ) { if (@getimagesize($imgURL)!==false) { $img = wp_remote_get($imgURL);
|
318 |
$siteTitle = htmlspecialchars_decode(get_bloginfo('name'), ENT_QUOTES); $siteTitle = nsTrnc($siteTitle, $twLim); $twMsgFormat = str_ireplace("%SITENAME%", $siteTitle, $twMsgFormat); $twLim = $twLim - nxs_strLen($siteTitle);
|
319 |
}
|
320 |
if (stripos($twMsgFormat, '%TEXT%')!==false) {
|
321 |
+
$pText = nsTrnc(strip_tags(strip_shortcodes($pText)), 140, " ", "...");
|
322 |
$pText = nsTrnc($pText, $twLim); $twMsgFormat = str_ireplace("%TEXT%", $pText, $twMsgFormat); $twLim = $twLim - nxs_strLen($pText);
|
323 |
}
|
324 |
if (stripos($twMsgFormat, '%EXCERPT%')!==false) {
|
325 |
+
$pText = nsTrnc(strip_tags(strip_shortcodes($pText)), 140, " ", "...");
|
326 |
$pText = nsTrnc($pText, $twLim); $twMsgFormat = str_ireplace("%EXCERPT%", $pText, $twMsgFormat); $twLim = $twLim - nxs_strLen($pText);
|
327 |
}
|
328 |
+
if (stripos($twMsgFormat, '%ANNOUNCE%')!==false) {
|
329 |
+
$pText = nsTrnc(strip_tags(strip_shortcodes($pText)), 140, " ", "...");
|
330 |
+
$pText = nsTrnc($pText, $twLim); $twMsgFormat = str_ireplace("%ANNOUNCE%", $pText, $twMsgFormat); $twLim = $twLim - nxs_strLen($pText);
|
331 |
+
}
|
332 |
if (stripos($twMsgFormat, '%RAWEXCERPT%')!==false) {
|
333 |
+
$exrText = nsTrnc(strip_tags(strip_shortcodes($exrText)), 140, " ", "...");
|
334 |
$exrText = nsTrnc($exrText, $twLim); $twMsgFormat = str_ireplace("%RAWEXCERPT%", $exrText, $twMsgFormat); $twLim = $twLim - nxs_strLen($exrText);
|
335 |
}
|
336 |
if (stripos($twMsgFormat, '%FULLTEXT%')!==false) {
|
346 |
$msg = str_replace('&#8220;', '"', $msg); $msg = str_replace('“', '"', $msg); $msg = str_replace('#8220;', '"', $msg); $msg = str_replace('#8220', "'", $msg);
|
347 |
$msg = str_replace('&#8221;', '"', $msg); $msg = str_replace('”', '"', $msg); $msg = str_replace('#8221;', '"', $msg); $msg = str_replace('#8221', "'", $msg);
|
348 |
$message = array('message'=>$msg, 'img'=>$img, 'urlLength'=>$nxs_urlLen); $options['twMsgFormat'] = $msg;
|
|
|
349 |
//## Actual Post
|
350 |
$ntToPost = new nxs_class_SNAP_TW(); $ret = $ntToPost->doPostToNT($options, $message);
|
351 |
//## Process Results
|
353 |
if ($postID=='0') prr($ret); nxs_addToLogN('E', 'Error', $logNT, '-=ERROR=- '.print_r($ret, true), $extInfo);
|
354 |
} else { // ## All Good - log it.
|
355 |
if ($postID=='0') { nxs_addToLogN('S', 'Test', $logNT, 'OK - TEST Message Posted '); echo _e('OK - Message Posted, please see your '.$logNT.' Page. ', 'nxs_snap'); }
|
356 |
+
else { nxs_addToRI($postID); nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPosted'=>'1', 'pgID'=>$ret['postID'], 'pDate'=>date('Y-m-d H:i:s')));
|
357 |
+
$extInfo .= ' | <a href="'.$ret['postURL'].'" target="_blank">Post Link</a>'; nxs_addToLogN('S', 'Posted', $logNT, 'OK - Message Posted ', $extInfo); }
|
358 |
}
|
359 |
//## Return Result
|
360 |
if ($ret['isPosted']=='1') return 200; else return print_r($ret, true);
|
inc-cl/vb.api.php
CHANGED
@@ -89,7 +89,8 @@ if (!class_exists("nxs_class_SNAP_VB")) { class nxs_class_SNAP_VB {
|
|
89 |
if (!isset($options['vbUName']) || trim($options['vbPass'])=='') { $badOut['Error'] = 'Not Configured'; return $badOut; }
|
90 |
$pass = (substr($options['vbPass'], 0, 5)=='n5g9a'?nsx_doDecode(substr($options['vbPass'], 5)):$options['vbPass']);
|
91 |
//## Format
|
92 |
-
$msg =
|
|
|
93 |
$urlToGo = (!empty($message['url']))?$message['url']:'';
|
94 |
//## Post
|
95 |
if (isset($options['vbSvC'])) $nxs_vbCkArray = maybe_unserialize( $options['vbSvC']); $loginError = true;
|
89 |
if (!isset($options['vbUName']) || trim($options['vbPass'])=='') { $badOut['Error'] = 'Not Configured'; return $badOut; }
|
90 |
$pass = (substr($options['vbPass'], 0, 5)=='n5g9a'?nsx_doDecode(substr($options['vbPass'], 5)):$options['vbPass']);
|
91 |
//## Format
|
92 |
+
if (!empty($message['pText'])) $msg = $message['pText']; else $msg = nxs_doFormatMsg($options['vbMsgFormat'], $message);
|
93 |
+
if (!empty($message['pTitle'])) $msgT = $message['pTitle']; else $msgT = nxs_doFormatMsg($options['vbMsgTFormat'], $message);
|
94 |
$urlToGo = (!empty($message['url']))?$message['url']:'';
|
95 |
//## Post
|
96 |
if (isset($options['vbSvC'])) $nxs_vbCkArray = maybe_unserialize( $options['vbSvC']); $loginError = true;
|
inc-cl/vb.php
CHANGED
@@ -15,7 +15,10 @@ if (!class_exists("nxs_snapClassVB")) { class nxs_snapClassVB {
|
|
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;"> <img id="<?php echo $ntInfo['code'].$indx;?>LoadingImg" style="display: none;" src='<?php echo $nxs_plurl; ?>img/ajax-loader-sm.gif' />
|
18 |
-
<input value="
|
|
|
|
|
|
|
19 |
<?php if (isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);"><?php echo "*[".(substr_count($pbo['catSelEd'], ",")+1)."]*" ?></span><?php } ?>
|
20 |
<?php if (isset($pbo['rpstOn']) && (int)$pbo['rpstOn'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popReActive');" onmouseover="nxs_showPopUpInfo('popReActive', event);"><?php echo "*[R]*" ?></span><?php } ?>
|
21 |
<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>
|
@@ -124,7 +127,7 @@ if (!class_exists("nxs_snapClassVB")) { class nxs_snapClassVB {
|
|
124 |
if (isset($pval['delayDays'])) $options[$ii]['nDays'] = trim($pval['delayDays']);
|
125 |
if (isset($pval['delayHrs'])) $options[$ii]['nHrs'] = trim($pval['delayHrs']); if (isset($pval['delayMin'])) $options[$ii]['nMin'] = trim($pval['delayMin']);
|
126 |
if (isset($pval['qTLng'])) $options[$ii]['qTLng'] = trim($pval['qTLng']);
|
127 |
-
} elseif ((
|
128 |
} return $options;
|
129 |
}
|
130 |
//#### Show Post->Edit Meta Box Settings
|
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;"> <img id="<?php echo $ntInfo['code'].$indx;?>LoadingImg" style="display: none;" src='<?php echo $nxs_plurl; ?>img/ajax-loader-sm.gif' />
|
18 |
+
<input value="0" name="<?php echo $ntInfo['lcode']; ?>[<?php echo $indx; ?>][apDo<?php echo $ntInfo['code']; ?>]" type="hidden" />
|
19 |
+
<?php if ((int)$pbo['do'.$ntInfo['code']] == 1 && isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <input type="radio" id="rbtn<?php echo $ntInfo['lcode'].$indx; ?>" checked="checked" onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);" /> <?php } else { ?>
|
20 |
+
<input value="1" name="<?php echo $ntInfo['lcode']; ?>[<?php echo $indx; ?>][apDo<?php echo $ntInfo['code']; ?>]" type="checkbox" <?php if ((int)$pbo['do'.$ntInfo['code']] == 1 && $pbo['catSel']!='1') echo "checked"; ?> />
|
21 |
+
<?php } ?>
|
22 |
<?php if (isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);"><?php echo "*[".(substr_count($pbo['catSelEd'], ",")+1)."]*" ?></span><?php } ?>
|
23 |
<?php if (isset($pbo['rpstOn']) && (int)$pbo['rpstOn'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popReActive');" onmouseover="nxs_showPopUpInfo('popReActive', event);"><?php echo "*[R]*" ?></span><?php } ?>
|
24 |
<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>
|
127 |
if (isset($pval['delayDays'])) $options[$ii]['nDays'] = trim($pval['delayDays']);
|
128 |
if (isset($pval['delayHrs'])) $options[$ii]['nHrs'] = trim($pval['delayHrs']); if (isset($pval['delayMin'])) $options[$ii]['nMin'] = trim($pval['delayMin']);
|
129 |
if (isset($pval['qTLng'])) $options[$ii]['qTLng'] = trim($pval['qTLng']);
|
130 |
+
} elseif ( count($pval)==1 ) if (isset($pval['apDo'.$code])) $options[$ii]['do'.$code] = $pval['apDo'.$code]; else $options[$ii]['do'.$code] = 0;
|
131 |
} return $options;
|
132 |
}
|
133 |
//#### Show Post->Edit Meta Box Settings
|
inc-cl/vk.api.php
CHANGED
@@ -39,10 +39,11 @@ if (!class_exists("nxs_class_SNAP_VK")) { class nxs_class_SNAP_VK {
|
|
39 |
function doPostToNT($options, $message){ $badOut = array('pgID'=>'', 'isPosted'=>0, 'pDate'=>date('Y-m-d H:i:s'), 'Error'=>''); global $nxs_vkCkArray;
|
40 |
//## Check settings
|
41 |
if (!is_array($options)) { $badOut['Error'] = 'No Options'; return $badOut; }
|
|
|
42 |
if ((!isset($options['uName']) || trim($options['uPass'])=='') && (!isset($options['vkAppAuthToken']) || trim($options['vkAppAuthToken'])=='')) { $badOut['Error'] = 'Not Configured'; return $badOut; }
|
43 |
$pass = (substr($options['uPass'], 0, 5)=='n5g9a'?nsx_doDecode(substr($options['uPass'], 5)):$options['uPass']);
|
44 |
//## Format
|
45 |
-
$msg = nxs_doFormatMsg($options['msgFrmt'], $message); $urlToGo = (!empty($message['url']))?$message['url']:'';
|
46 |
|
47 |
$postType = $options['postType']; //$link = urlencode($link); $desc = urlencode(substr($msg, 0, 500));
|
48 |
|
39 |
function doPostToNT($options, $message){ $badOut = array('pgID'=>'', 'isPosted'=>0, 'pDate'=>date('Y-m-d H:i:s'), 'Error'=>''); global $nxs_vkCkArray;
|
40 |
//## Check settings
|
41 |
if (!is_array($options)) { $badOut['Error'] = 'No Options'; return $badOut; }
|
42 |
+
if (empty($options['imgSize'])) $options['imgSize'] = '';
|
43 |
if ((!isset($options['uName']) || trim($options['uPass'])=='') && (!isset($options['vkAppAuthToken']) || trim($options['vkAppAuthToken'])=='')) { $badOut['Error'] = 'Not Configured'; return $badOut; }
|
44 |
$pass = (substr($options['uPass'], 0, 5)=='n5g9a'?nsx_doDecode(substr($options['uPass'], 5)):$options['uPass']);
|
45 |
//## Format
|
46 |
+
if (!empty($message['pText'])) $msg = $message['pText']; else $msg = nxs_doFormatMsg($options['msgFrmt'], $message); $urlToGo = (!empty($message['url']))?$message['url']:'';
|
47 |
|
48 |
$postType = $options['postType']; //$link = urlencode($link); $desc = urlencode(substr($msg, 0, 500));
|
49 |
|
inc-cl/vk.php
CHANGED
@@ -15,7 +15,10 @@ if (!class_exists("nxs_snapClassVK")) { class nxs_snapClassVK {
|
|
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;"> <img id="<?php echo $ntInfo['code'].$indx;?>LoadingImg" style="display: none;" src='<?php echo $nxs_plurl; ?>img/ajax-loader-sm.gif' />
|
18 |
-
<input value="
|
|
|
|
|
|
|
19 |
<?php if (isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);"><?php echo "*[".(substr_count($pbo['catSelEd'], ",")+1)."]*" ?></span><?php } ?>
|
20 |
<?php if (isset($pbo['rpstOn']) && (int)$pbo['rpstOn'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popReActive');" onmouseover="nxs_showPopUpInfo('popReActive', event);"><?php echo "*[R]*" ?></span><?php } ?>
|
21 |
<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>
|
@@ -201,7 +204,7 @@ if (!class_exists("nxs_snapClassVK")) { class nxs_snapClassVK {
|
|
201 |
$options[$ii]['vkPgID'] = $vkPgID; //echo $vkPgID;
|
202 |
if (strpos($options[$ii]['url'], '?')!==false) $options[$ii]['url'] = substr($options[$ii]['url'], 0, strpos($options[$ii]['url'], '?'));// prr($pval); prr($options[$ii]); // die();
|
203 |
}
|
204 |
-
} elseif ((
|
205 |
} return $options;
|
206 |
}
|
207 |
//#### Show Post->Edit Meta Box Settings
|
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;"> <img id="<?php echo $ntInfo['code'].$indx;?>LoadingImg" style="display: none;" src='<?php echo $nxs_plurl; ?>img/ajax-loader-sm.gif' />
|
18 |
+
<input value="0" name="<?php echo $ntInfo['lcode']; ?>[<?php echo $indx; ?>][apDo<?php echo $ntInfo['code']; ?>]" type="hidden" />
|
19 |
+
<?php if ((int)$pbo['do'.$ntInfo['code']] == 1 && isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <input type="radio" id="rbtn<?php echo $ntInfo['lcode'].$indx; ?>" checked="checked" onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);" /> <?php } else { ?>
|
20 |
+
<input value="1" name="<?php echo $ntInfo['lcode']; ?>[<?php echo $indx; ?>][apDo<?php echo $ntInfo['code']; ?>]" type="checkbox" <?php if ((int)$pbo['do'.$ntInfo['code']] == 1 && $pbo['catSel']!='1') echo "checked"; ?> />
|
21 |
+
<?php } ?>
|
22 |
<?php if (isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);"><?php echo "*[".(substr_count($pbo['catSelEd'], ",")+1)."]*" ?></span><?php } ?>
|
23 |
<?php if (isset($pbo['rpstOn']) && (int)$pbo['rpstOn'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popReActive');" onmouseover="nxs_showPopUpInfo('popReActive', event);"><?php echo "*[R]*" ?></span><?php } ?>
|
24 |
<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>
|
204 |
$options[$ii]['vkPgID'] = $vkPgID; //echo $vkPgID;
|
205 |
if (strpos($options[$ii]['url'], '?')!==false) $options[$ii]['url'] = substr($options[$ii]['url'], 0, strpos($options[$ii]['url'], '?'));// prr($pval); prr($options[$ii]); // die();
|
206 |
}
|
207 |
+
} elseif ( count($pval)==1 ) if (isset($pval['apDo'.$code])) $options[$ii]['do'.$code] = $pval['apDo'.$code]; else $options[$ii]['do'.$code] = 0;
|
208 |
} return $options;
|
209 |
}
|
210 |
//#### Show Post->Edit Meta Box Settings
|
inc-cl/wp.api.php
CHANGED
@@ -23,8 +23,10 @@ if (!class_exists("nxs_class_SNAP_WP")) { class nxs_class_SNAP_WP {
|
|
23 |
if (!is_array($options)) { $badOut['Error'] = 'No Options'; return $badOut; }
|
24 |
if (!isset($options['wpUName']) || trim($options['wpPass'])=='') { $badOut['Error'] = 'Not Configured'; return $badOut; }
|
25 |
$pass = substr($options['wpPass'], 0, 5)=='n5g9a'?nsx_doDecode(substr($options['wpPass'], 5)):$options['wpPass'];
|
|
|
26 |
//## Format
|
27 |
-
$msg =
|
|
|
28 |
if (isset($message['imageURL'])) $imgURL = trim(nxs_getImgfrOpt($message['imageURL'], $options['imgSize'])); else $imgURL = '';
|
29 |
$link = urlencode($message['url']); $ext = substr($msg, 0, 1000);
|
30 |
//## Fix missing xmlrpc.php
|
23 |
if (!is_array($options)) { $badOut['Error'] = 'No Options'; return $badOut; }
|
24 |
if (!isset($options['wpUName']) || trim($options['wpPass'])=='') { $badOut['Error'] = 'Not Configured'; return $badOut; }
|
25 |
$pass = substr($options['wpPass'], 0, 5)=='n5g9a'?nsx_doDecode(substr($options['wpPass'], 5)):$options['wpPass'];
|
26 |
+
if (empty($options['imgSize'])) $options['imgSize'] = '';
|
27 |
//## Format
|
28 |
+
if (!empty($message['pText'])) $msg = $message['pText']; else $msg = nxs_doFormatMsg($options['wpMsgFormat'], $message);
|
29 |
+
if (!empty($message['pTitle'])) $msgT = $message['pTitle']; else $msgT = nxs_doFormatMsg($options['wpMsgTFormat'], $message);
|
30 |
if (isset($message['imageURL'])) $imgURL = trim(nxs_getImgfrOpt($message['imageURL'], $options['imgSize'])); else $imgURL = '';
|
31 |
$link = urlencode($message['url']); $ext = substr($msg, 0, 1000);
|
32 |
//## Fix missing xmlrpc.php
|
inc-cl/wp.php
CHANGED
@@ -15,7 +15,10 @@ if (!class_exists("nxs_snapClassWP")) { class nxs_snapClassWP {
|
|
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;"> <img id="<?php echo $ntInfo['code'].$indx;?>LoadingImg" style="display: none;" src='<?php echo $nxs_plurl; ?>img/ajax-loader-sm.gif' />
|
18 |
-
<input value="
|
|
|
|
|
|
|
19 |
<?php if (isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);"><?php echo "*[".(substr_count($pbo['catSelEd'], ",")+1)."]*" ?></span><?php } ?>
|
20 |
<?php if (isset($pbo['rpstOn']) && (int)$pbo['rpstOn'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popReActive');" onmouseover="nxs_showPopUpInfo('popReActive', event);"><?php echo "*[R]*" ?></span><?php } ?>
|
21 |
<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>
|
@@ -119,7 +122,7 @@ if (!class_exists("nxs_snapClassWP")) { class nxs_snapClassWP {
|
|
119 |
if (isset($pval['delayDays'])) $options[$ii]['nDays'] = trim($pval['delayDays']);
|
120 |
if (isset($pval['delayHrs'])) $options[$ii]['nHrs'] = trim($pval['delayHrs']); if (isset($pval['delayMin'])) $options[$ii]['nMin'] = trim($pval['delayMin']);
|
121 |
if (isset($pval['qTLng'])) $options[$ii]['qTLng'] = trim($pval['qTLng']);
|
122 |
-
} elseif ((
|
123 |
} return $options;
|
124 |
}
|
125 |
//#### Show Post->Edit Meta Box Settings
|
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;"> <img id="<?php echo $ntInfo['code'].$indx;?>LoadingImg" style="display: none;" src='<?php echo $nxs_plurl; ?>img/ajax-loader-sm.gif' />
|
18 |
+
<input value="0" name="<?php echo $ntInfo['lcode']; ?>[<?php echo $indx; ?>][apDo<?php echo $ntInfo['code']; ?>]" type="hidden" />
|
19 |
+
<?php if ((int)$pbo['do'.$ntInfo['code']] == 1 && isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <input type="radio" id="rbtn<?php echo $ntInfo['lcode'].$indx; ?>" checked="checked" onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);" /> <?php } else { ?>
|
20 |
+
<input value="1" name="<?php echo $ntInfo['lcode']; ?>[<?php echo $indx; ?>][apDo<?php echo $ntInfo['code']; ?>]" type="checkbox" <?php if ((int)$pbo['do'.$ntInfo['code']] == 1 && $pbo['catSel']!='1') echo "checked"; ?> />
|
21 |
+
<?php } ?>
|
22 |
<?php if (isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);"><?php echo "*[".(substr_count($pbo['catSelEd'], ",")+1)."]*" ?></span><?php } ?>
|
23 |
<?php if (isset($pbo['rpstOn']) && (int)$pbo['rpstOn'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popReActive');" onmouseover="nxs_showPopUpInfo('popReActive', event);"><?php echo "*[R]*" ?></span><?php } ?>
|
24 |
<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>
|
122 |
if (isset($pval['delayDays'])) $options[$ii]['nDays'] = trim($pval['delayDays']);
|
123 |
if (isset($pval['delayHrs'])) $options[$ii]['nHrs'] = trim($pval['delayHrs']); if (isset($pval['delayMin'])) $options[$ii]['nMin'] = trim($pval['delayMin']);
|
124 |
if (isset($pval['qTLng'])) $options[$ii]['qTLng'] = trim($pval['qTLng']);
|
125 |
+
} elseif ( count($pval)==1 ) if (isset($pval['apDo'.$code])) $options[$ii]['do'.$code] = $pval['apDo'.$code]; else $options[$ii]['do'.$code] = 0;
|
126 |
} return $options;
|
127 |
}
|
128 |
//#### Show Post->Edit Meta Box Settings
|
inc-cl/yt.api.php
CHANGED
@@ -17,7 +17,7 @@ if (!class_exists("nxs_class_SNAP_YT")) { class nxs_class_SNAP_YT {
|
|
17 |
if (!isset($options['ytUName']) || trim($options['ytPass'])=='') { $badOut['Error'] = 'Not Configured'; return $badOut; }
|
18 |
$pass = substr($options['ytPass'], 0, 5)=='n5g9a'?nsx_doDecode(substr($options['ytPass'], 5)):$options['ytPass'];
|
19 |
//## Format
|
20 |
-
$msg = nxs_doFormatMsg($options['ytMsgFormat'], $message);
|
21 |
|
22 |
$loginError = doConnectToGooglePlus2($options['ytUName'], $pass, 'YT');
|
23 |
if ($loginError!==false) {if ($postID=='0') echo $loginError; nxs_addToLogN('E', 'Error', $logNT, '-=ERROR=- '.print_r($loginError, true)." - BAD USER/PASS", $extInfo); return "BAD USER/PASS";}
|
17 |
if (!isset($options['ytUName']) || trim($options['ytPass'])=='') { $badOut['Error'] = 'Not Configured'; return $badOut; }
|
18 |
$pass = substr($options['ytPass'], 0, 5)=='n5g9a'?nsx_doDecode(substr($options['ytPass'], 5)):$options['ytPass'];
|
19 |
//## Format
|
20 |
+
if (!empty($message['pText'])) $msg = $message['pText']; else $msg = nxs_doFormatMsg($options['ytMsgFormat'], $message);
|
21 |
|
22 |
$loginError = doConnectToGooglePlus2($options['ytUName'], $pass, 'YT');
|
23 |
if ($loginError!==false) {if ($postID=='0') echo $loginError; nxs_addToLogN('E', 'Error', $logNT, '-=ERROR=- '.print_r($loginError, true)." - BAD USER/PASS", $extInfo); return "BAD USER/PASS";}
|
inc-cl/yt.php
CHANGED
@@ -16,7 +16,10 @@ if (!class_exists("nxs_snapClassYT")) { class nxs_snapClassYT {
|
|
16 |
<?php if(!function_exists('doPostToGooglePlus')) {?> YouTube doesn't have a built-in API for automated posts yet. The current <a href="http://developers.google.com/+/api/">YouTube 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 YouTube.
|
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;"> <img id="<?php echo $ntInfo['code'].$indx;?>LoadingImg" style="display: none;" src='<?php echo $nxs_plurl; ?>img/ajax-loader-sm.gif' />
|
19 |
-
<input value="
|
|
|
|
|
|
|
20 |
<?php if (isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);"><?php echo "*[".(substr_count($pbo['catSelEd'], ",")+1)."]*" ?></span><?php } ?>
|
21 |
<?php if (isset($pbo['rpstOn']) && (int)$pbo['rpstOn'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popReActive');" onmouseover="nxs_showPopUpInfo('popReActive', event);"><?php echo "*[R]*" ?></span><?php } ?>
|
22 |
<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>
|
@@ -113,7 +116,7 @@ if (!class_exists("nxs_snapClassYT")) { class nxs_snapClassYT {
|
|
113 |
if (isset($pval['delayDays'])) $options[$ii]['nDays'] = trim($pval['delayDays']);
|
114 |
if (isset($pval['delayHrs'])) $options[$ii]['nHrs'] = trim($pval['delayHrs']); if (isset($pval['delayMin'])) $options[$ii]['nMin'] = trim($pval['delayMin']);
|
115 |
if (isset($pval['qTLng'])) $options[$ii]['qTLng'] = trim($pval['qTLng']);
|
116 |
-
} elseif ((
|
117 |
} return $options;
|
118 |
}
|
119 |
//#### Show Post->Edit Meta Box Settings
|
16 |
<?php if(!function_exists('doPostToGooglePlus')) {?> YouTube doesn't have a built-in API for automated posts yet. The current <a href="http://developers.google.com/+/api/">YouTube 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 YouTube.
|
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;"> <img id="<?php echo $ntInfo['code'].$indx;?>LoadingImg" style="display: none;" src='<?php echo $nxs_plurl; ?>img/ajax-loader-sm.gif' />
|
19 |
+
<input value="0" name="<?php echo $ntInfo['lcode']; ?>[<?php echo $indx; ?>][apDo<?php echo $ntInfo['code']; ?>]" type="hidden" />
|
20 |
+
<?php if ((int)$pbo['do'.$ntInfo['code']] == 1 && isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <input type="radio" id="rbtn<?php echo $ntInfo['lcode'].$indx; ?>" checked="checked" onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);" /> <?php } else { ?>
|
21 |
+
<input value="1" name="<?php echo $ntInfo['lcode']; ?>[<?php echo $indx; ?>][apDo<?php echo $ntInfo['code']; ?>]" type="checkbox" <?php if ((int)$pbo['do'.$ntInfo['code']] == 1 && $pbo['catSel']!='1') echo "checked"; ?> />
|
22 |
+
<?php } ?>
|
23 |
<?php if (isset($pbo['catSel']) && (int)$pbo['catSel'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popOnlyCat');" onmouseover="nxs_showPopUpInfo('popOnlyCat', event);"><?php echo "*[".(substr_count($pbo['catSelEd'], ",")+1)."]*" ?></span><?php } ?>
|
24 |
<?php if (isset($pbo['rpstOn']) && (int)$pbo['rpstOn'] == 1) { ?> <span onmouseout="nxs_hidePopUpInfo('popReActive');" onmouseover="nxs_showPopUpInfo('popReActive', event);"><?php echo "*[R]*" ?></span><?php } ?>
|
25 |
<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>
|
116 |
if (isset($pval['delayDays'])) $options[$ii]['nDays'] = trim($pval['delayDays']);
|
117 |
if (isset($pval['delayHrs'])) $options[$ii]['nHrs'] = trim($pval['delayHrs']); if (isset($pval['delayMin'])) $options[$ii]['nMin'] = trim($pval['delayMin']);
|
118 |
if (isset($pval['qTLng'])) $options[$ii]['qTLng'] = trim($pval['qTLng']);
|
119 |
+
} elseif ( count($pval)==1 ) if (isset($pval['apDo'.$code])) $options[$ii]['do'.$code] = $pval['apDo'.$code]; else $options[$ii]['do'.$code] = 0;
|
120 |
} return $options;
|
121 |
}
|
122 |
//#### Show Post->Edit Meta Box Settings
|
inc/nxs_functions_adv.php
CHANGED
@@ -3,6 +3,7 @@
|
|
3 |
if (!function_exists("nsFormatMessage")) { function nsFormatMessage($msg, $postID, $addURLParams='', $lng=''){ global $ShownAds, $plgn_NS_SNAutoPoster, $nxs_urlLen; $post = get_post($postID); $options = $plgn_NS_SNAutoPoster->nxs_options;
|
4 |
if (!empty($options['nxsHTSpace'])) $htS = $options['nxsHTSpace']; else $htS = '';
|
5 |
// if ($addURLParams=='' && $options['addURLParams']!='') $addURLParams = $options['addURLParams'];
|
|
|
6 |
$msg = stripcslashes($msg); if (isset($ShownAds)) $ShownAdsL = $ShownAds; // $msg = htmlspecialchars(stripcslashes($msg));
|
7 |
$msg = nxs_doSpin($msg);
|
8 |
if (preg_match('%URL%', $msg)) { $url = get_permalink($postID); if($addURLParams!='') $url .= (strpos($url,'?')!==false?'&':'?').$addURLParams; $nxs_urlLen = nxs_strLen($url); $msg = str_ireplace("%URL%", $url, $msg);}
|
@@ -19,27 +20,20 @@ if (!function_exists("nsFormatMessage")) { function nsFormatMessage($msg, $postI
|
|
19 |
$postContent = strip_tags(strip_shortcodes(str_ireplace('<!--more-->', '#####!--more--!#####', str_ireplace("<!--more-->", '<!--more-->', $postContent))));
|
20 |
if (stripos($postContent, '#####!--more--!#####')!==false) { $postContentEx = explode('#####!--more--!#####',$postContent); $postContent = $postContentEx[0]; }
|
21 |
else $postContent = nsTrnc($postContent, $options['anounTagLimit']); $msg = str_ireplace("%ANNOUNCE%", $postContent, $msg);
|
22 |
-
}
|
23 |
-
if (preg_match('%TEXT%', $msg)) {
|
24 |
-
if ($post->post_excerpt!="") $excerpt = apply_filters('the_content', nxs_doQTrans($post->post_excerpt, $lng)); else $excerpt= apply_filters('the_content', nxs_doQTrans($post->post_content, $lng));
|
25 |
-
$excerpt = nsTrnc(strip_tags(strip_shortcodes($excerpt)), 300, " ", "..."); $msg = str_ireplace("%TEXT%", $excerpt, $msg);
|
26 |
-
}
|
27 |
if (preg_match('%EXCERPT%', $msg)) {
|
28 |
-
if ($post->post_excerpt!="") $excerpt = apply_filters('the_content', nxs_doQTrans($post->post_excerpt, $lng))
|
29 |
-
$excerpt
|
30 |
-
|
31 |
-
|
32 |
-
if ($post->post_excerpt!="") $excerpt = nxs_doQTrans($post->post_excerpt, $lng); else $excerpt= nxs_doQTrans($post->post_content, $lng);
|
33 |
-
$excerpt = nsTrnc(strip_tags(strip_shortcodes($excerpt)), 300, " ", "..."); $msg = str_ireplace("%RAWEXTEXT%", $excerpt, $msg);
|
34 |
-
}
|
35 |
if (preg_match('%RAWEXCERPT%', $msg)) {
|
36 |
-
if ($post->post_excerpt!="") $excerpt = nxs_doQTrans($post->post_excerpt, $lng); else $excerpt= nxs_doQTrans($post->post_content, $lng);
|
37 |
-
|
38 |
}
|
39 |
if (preg_match('%RAWEXCERPTHTML%', $msg)) {
|
40 |
if ($post->post_excerpt!="") $excerpt = strip_shortcodes(nxs_doQTrans($post->post_excerpt, $lng)); else $excerpt= nsTrnc(strip_tags(strip_shortcodes(nxs_doQTrans($post->post_content, $lng))), 300, " ", "...");
|
41 |
$msg = str_ireplace("%RAWEXCERPTHTML%", $excerpt, $msg);
|
42 |
-
|
43 |
if (preg_match('%TAGS%', $msg)) { $t = wp_get_object_terms($postID, 'product_tag'); if ( empty($t) || is_wp_error($pt) || !is_array($t) ) $t = wp_get_post_tags($postID);
|
44 |
$tggs = array(); foreach ($t as $tagA) {$tggs[] = $tagA->name;} $tags = implode(', ',$tggs); $msg = str_ireplace("%TAGS%", $tags, $msg);
|
45 |
}
|
@@ -108,4 +102,15 @@ if (!function_exists("nxsCheckSSLCurl")){function nxsCheckSSLCurl($url){
|
|
108 |
$content = curl_exec($ch); $err = curl_errno($ch); $errmsg = curl_error($ch); if ($err!=0) return array('errNo'=>$err, 'errMsg'=>$errmsg); else return false;
|
109 |
}}
|
110 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
?>
|
3 |
if (!function_exists("nsFormatMessage")) { function nsFormatMessage($msg, $postID, $addURLParams='', $lng=''){ global $ShownAds, $plgn_NS_SNAutoPoster, $nxs_urlLen; $post = get_post($postID); $options = $plgn_NS_SNAutoPoster->nxs_options;
|
4 |
if (!empty($options['nxsHTSpace'])) $htS = $options['nxsHTSpace']; else $htS = '';
|
5 |
// if ($addURLParams=='' && $options['addURLParams']!='') $addURLParams = $options['addURLParams'];
|
6 |
+
$msg = str_replace('%TEXT%','%EXCERPT%',$msg); $msg = str_replace('%RAWEXTEXT%','%RAWEXCERPT%',$msg);
|
7 |
$msg = stripcslashes($msg); if (isset($ShownAds)) $ShownAdsL = $ShownAds; // $msg = htmlspecialchars(stripcslashes($msg));
|
8 |
$msg = nxs_doSpin($msg);
|
9 |
if (preg_match('%URL%', $msg)) { $url = get_permalink($postID); if($addURLParams!='') $url .= (strpos($url,'?')!==false?'&':'?').$addURLParams; $nxs_urlLen = nxs_strLen($url); $msg = str_ireplace("%URL%", $url, $msg);}
|
20 |
$postContent = strip_tags(strip_shortcodes(str_ireplace('<!--more-->', '#####!--more--!#####', str_ireplace("<!--more-->", '<!--more-->', $postContent))));
|
21 |
if (stripos($postContent, '#####!--more--!#####')!==false) { $postContentEx = explode('#####!--more--!#####',$postContent); $postContent = $postContentEx[0]; }
|
22 |
else $postContent = nsTrnc($postContent, $options['anounTagLimit']); $msg = str_ireplace("%ANNOUNCE%", $postContent, $msg);
|
23 |
+
}
|
|
|
|
|
|
|
|
|
24 |
if (preg_match('%EXCERPT%', $msg)) {
|
25 |
+
if ($post->post_excerpt!="") $excerpt = strip_tags(strip_shortcodes(apply_filters('the_content', nxs_doQTrans($post->post_excerpt, $lng))));
|
26 |
+
else $excerpt= nsTrnc(strip_tags(strip_shortcodes(apply_filters('the_content', nxs_doQTrans($post->post_content, $lng)))), 300, " ", "...");
|
27 |
+
$msg = str_ireplace("%EXCERPT%", $excerpt, $msg);
|
28 |
+
}
|
|
|
|
|
|
|
29 |
if (preg_match('%RAWEXCERPT%', $msg)) {
|
30 |
+
if ($post->post_excerpt!="") $excerpt = strip_tags(strip_shortcodes(nxs_doQTrans($post->post_excerpt, $lng))); else $excerpt= nsTrnc(strip_tags(strip_shortcodes(nxs_doQTrans($post->post_content, $lng))), 300, " ", "...");
|
31 |
+
$msg = str_ireplace("%RAWEXCERPT%", $excerpt, $msg);
|
32 |
}
|
33 |
if (preg_match('%RAWEXCERPTHTML%', $msg)) {
|
34 |
if ($post->post_excerpt!="") $excerpt = strip_shortcodes(nxs_doQTrans($post->post_excerpt, $lng)); else $excerpt= nsTrnc(strip_tags(strip_shortcodes(nxs_doQTrans($post->post_content, $lng))), 300, " ", "...");
|
35 |
$msg = str_ireplace("%RAWEXCERPTHTML%", $excerpt, $msg);
|
36 |
+
}
|
37 |
if (preg_match('%TAGS%', $msg)) { $t = wp_get_object_terms($postID, 'product_tag'); if ( empty($t) || is_wp_error($pt) || !is_array($t) ) $t = wp_get_post_tags($postID);
|
38 |
$tggs = array(); foreach ($t as $tagA) {$tggs[] = $tagA->name;} $tags = implode(', ',$tggs); $msg = str_ireplace("%TAGS%", $tags, $msg);
|
39 |
}
|
102 |
$content = curl_exec($ch); $err = curl_errno($ch); $errmsg = curl_error($ch); if ($err!=0) return array('errNo'=>$err, 'errMsg'=>$errmsg); else return false;
|
103 |
}}
|
104 |
|
105 |
+
function toolbar_link_to_mypage( $wp_admin_bar ) {
|
106 |
+
$args = array(
|
107 |
+
'id' => 'snap-post',
|
108 |
+
'title' => '<span style="font-weight:bold; color:#2ecc2e;">{SNAP} </span> New Post to Social Networks',
|
109 |
+
'parent' => 'new-content',
|
110 |
+
'href' => '#',
|
111 |
+
'meta' => array( 'class' => 'my-toolbar-page', 'onclick' => 'nxs_showNewPostFrom();return false;' )
|
112 |
+
);
|
113 |
+
$wp_admin_bar->add_node( $args );
|
114 |
+
}
|
115 |
+
|
116 |
?>
|
inc/nxs_snap_class.php
CHANGED
@@ -109,7 +109,7 @@ define('WP_ALLOW_MULTISITE', true);<br/>to<br/>define('WP_ALLOW_MULTISITE', fals
|
|
109 |
if (get_magic_quotes_gpc() || $_POST['nxs_mqTest']=="\'") {array_walk_recursive($_POST, 'nsx_stripSlashes');} array_walk_recursive($_POST, 'nsx_fixSlashes');
|
110 |
//## Load Networks Settings update_NS_SNAutoPoster_settings
|
111 |
$acctsInfoPost = $_POST['nxsMainFromElementAccts']; unset($_POST['nxsMainFromElementAccts']); $acctsInfo = array();
|
112 |
-
$acctsInfo = NXS_parseQueryStr($acctsInfoPost);
|
113 |
|
114 |
foreach ($nxs_snapAvNts as $avNt) if (isset($acctsInfo[$avNt['lcode']])) { $clName = 'nxs_snapClass'.$avNt['code']; if (!isset($options[$avNt['lcode']])) $options[$avNt['lcode']] = array();
|
115 |
$ntClInst = new $clName(); $ntOpt = $ntClInst->setNTSettings($acctsInfo[$avNt['lcode']], $options[$avNt['lcode']]); $options[$avNt['lcode']] = $ntOpt;
|
@@ -160,8 +160,8 @@ define('WP_ALLOW_MULTISITE', true);<br/>to<br/>define('WP_ALLOW_MULTISITE', fals
|
|
160 |
if (isset($_POST['riActive'])) $options['riActive'] = 1; else $options['riActive'] = 0;
|
161 |
if (isset($_POST['riHowManyPostsToTrack'])) $options['riHowManyPostsToTrack'] = $_POST['riHowManyPostsToTrack'];
|
162 |
|
163 |
-
if (isset($_POST['useUnProc'])) $options['useUnProc'] = $_POST['useUnProc']; else $options['useUnProc'] = 0;
|
164 |
-
if (
|
165 |
if (isset($_POST['post_category'])) { $pk = $_POST['post_category']; if (!is_array($pk)) { $pk = urldecode($pk); parse_str($pk); }
|
166 |
$cIds = get_all_category_ids(); if(is_array($pk) && $cIds) $options['exclCats'] = serialize(array_diff($cIds, $pk)); else $options['exclCats'] = '';
|
167 |
} //prr($options['exclCats']);
|
@@ -224,6 +224,8 @@ if ( is_array($category_ids) && is_array($pk) && count($category_ids) == count($
|
|
224 |
<?php if ((function_exists("nxs_showPRXTab")) && (int)$options['showPrxTab'] == 1) { ?> <li><a href="#nsx_tab5">Proxies</a></li> <?php } ?>
|
225 |
<li><a href="#nsx_tab3">Log/History</a></li>
|
226 |
<li><a href="#nsx_tab4">Help/Support</a></li>
|
|
|
|
|
227 |
</ul>
|
228 |
|
229 |
<div class="nsx_tab_container">
|
@@ -245,7 +247,7 @@ if ( is_array($category_ids) && is_array($pk) && count($category_ids) == count($
|
|
245 |
|
246 |
</div>
|
247 |
|
248 |
-
<div class="popShAtt" id="popOnlyCat"><?php _e('Only selected categories will be autoposted to this account', 'nxs_snap'); ?></div>
|
249 |
<div class="popShAtt" id="popReActive"><?php _e('Reposter is activated for this account', 'nxs_snap'); ?></div>
|
250 |
|
251 |
<div id="showCatSel" style="display: none;background-color: #fff; width: 300px; padding: 25px;"><span class="nxspButton bClose"><span>X</span></span><?php _e('Select Categories', 'nxs_snap'); ?>:
|
@@ -290,7 +292,7 @@ if ( is_array($category_ids) && is_array($pk) && count($category_ids) == count($
|
|
290 |
<form method="post" id="nsStFormMisc" action="<?php echo $nxs_snapThisPageUrl?>"> <input type="hidden" name="nxsMainFromElementAccts" id="nxsMainFromElementAccts" value="" />
|
291 |
<input type="hidden" name="nxsMainFromSupportFld" id="nxsMainFromSupportFld" value="1" />
|
292 |
<!-- ##################### OTHER #####################-->
|
293 |
-
|
294 |
<!-- How to make auto-posts? -->
|
295 |
<div class="nxs_box"> <div class="nxs_box_header"><h3><?php _e('How to make auto-posts?', 'nxs_snap') ?> <-- (<a id="showShAttIS" onmouseover="showPopShAtt('IS', event);" onmouseout="hidePopShAtt('IS');" onclick="return false;" class="underdash" href="#"><?php _e('What\'s the difference?', 'nxs_snap') ?></a>)</h3></div>
|
296 |
<div class="popShAtt" id="popShAttIS">
|
@@ -731,6 +733,8 @@ Please see #4 and #5 for Twitter:<br/>
|
|
731 |
4. Click "Settings" tab. Scroll to the "Application type", change Access level from "Read Only" to <b>"Read and Write"</b>. Click "Update this Twitter application settings".<br/>
|
732 |
5. Come back to "Details" tab. Scroll to the "Your access token" and click "Create my access token" button. Refresh page and notice "Access token" and "Access token secret". Make sure you have <b>"Read and Write"</b> access level.<br/>
|
733 |
</div> </div>
|
|
|
|
|
734 |
</div>
|
735 |
<div class="popShAtt" id="popShAttRPST1"><div class="nxs_tls_sbInfo2"><?php _e('Set random delays around your interval time, to make your posts appear more human', 'nxs_snap'); ?></div></div>
|
736 |
<form method="post" enctype="multipart/form-data" id="nsStFormUpl" action="<?php echo $nxs_snapThisPageUrl?>">
|
@@ -847,7 +851,7 @@ Please see #4 and #5 for Twitter:<br/>
|
|
847 |
<div class="inside"><div id="postftfp">
|
848 |
|
849 |
|
850 |
-
<input value="1" type="hidden" name="snapEdIT" />
|
851 |
<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>
|
852 |
<?php if($post->post_status != "publish" ) { ?>
|
853 |
<div style="float: right;"> <input type="hidden" id="nxsLockIt" value="0" />
|
@@ -890,8 +894,8 @@ Please see #4 and #5 for Twitter:<br/>
|
|
890 |
|
891 |
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' );
|
892 |
|
893 |
-
$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);
|
894 |
-
if ((isset($options['nxsCPTSeld'])) && $options['nxsCPTSeld']!='') $nxsCPTSeld = unserialize($options['nxsCPTSeld']); else $nxsCPTSeld = array_keys($post_types);
|
895 |
foreach ($post_types as $cptID=>$cptName) if (in_array($cptID, $nxsCPTSeld)){
|
896 |
add_meta_box( 'NS_SNAP_AddPostMetaTags', __('NextScripts: Social Networks Auto Poster - Post Options', 'nxs_snap'), array($this, 'NS_SNAP_AddPostMetaTags'), $cptID );
|
897 |
}
|
109 |
if (get_magic_quotes_gpc() || $_POST['nxs_mqTest']=="\'") {array_walk_recursive($_POST, 'nsx_stripSlashes');} array_walk_recursive($_POST, 'nsx_fixSlashes');
|
110 |
//## Load Networks Settings update_NS_SNAutoPoster_settings
|
111 |
$acctsInfoPost = $_POST['nxsMainFromElementAccts']; unset($_POST['nxsMainFromElementAccts']); $acctsInfo = array();
|
112 |
+
$acctsInfo = NXS_parseQueryStr($acctsInfoPost); // prr($acctsInfo);
|
113 |
|
114 |
foreach ($nxs_snapAvNts as $avNt) if (isset($acctsInfo[$avNt['lcode']])) { $clName = 'nxs_snapClass'.$avNt['code']; if (!isset($options[$avNt['lcode']])) $options[$avNt['lcode']] = array();
|
115 |
$ntClInst = new $clName(); $ntOpt = $ntClInst->setNTSettings($acctsInfo[$avNt['lcode']], $options[$avNt['lcode']]); $options[$avNt['lcode']] = $ntOpt;
|
160 |
if (isset($_POST['riActive'])) $options['riActive'] = 1; else $options['riActive'] = 0;
|
161 |
if (isset($_POST['riHowManyPostsToTrack'])) $options['riHowManyPostsToTrack'] = $_POST['riHowManyPostsToTrack'];
|
162 |
|
163 |
+
if (isset($_POST['useUnProc'])) $options['useUnProc'] = $_POST['useUnProc']; else $options['useUnProc'] = 0;
|
164 |
+
if (!empty($_POST['nxsCPTSeld']) && is_array($_POST['nxsCPTSeld'])) $cpTypes = $_POST['nxsCPTSeld']; else $cpTypes = array(); $options['nxsCPTSeld'] = serialize($cpTypes);
|
165 |
if (isset($_POST['post_category'])) { $pk = $_POST['post_category']; if (!is_array($pk)) { $pk = urldecode($pk); parse_str($pk); }
|
166 |
$cIds = get_all_category_ids(); if(is_array($pk) && $cIds) $options['exclCats'] = serialize(array_diff($cIds, $pk)); else $options['exclCats'] = '';
|
167 |
} //prr($options['exclCats']);
|
224 |
<?php if ((function_exists("nxs_showPRXTab")) && (int)$options['showPrxTab'] == 1) { ?> <li><a href="#nsx_tab5">Proxies</a></li> <?php } ?>
|
225 |
<li><a href="#nsx_tab3">Log/History</a></li>
|
226 |
<li><a href="#nsx_tab4">Help/Support</a></li>
|
227 |
+
<li><a class="ab-item" href="#nsx_tab5"><span style="font-weight:bold; font-size: 16px; color:#2ecc2e;">⇒</span> New Post to Social Networks</a></li>
|
228 |
+
|
229 |
</ul>
|
230 |
|
231 |
<div class="nsx_tab_container">
|
247 |
|
248 |
</div>
|
249 |
|
250 |
+
<div class="popShAtt" id="popOnlyCat"><?php _e('Filters are "ON". Only selected categories/tags will be autoposted to this account. Click "Show Settings->Advanced" to change', 'nxs_snap'); ?></div>
|
251 |
<div class="popShAtt" id="popReActive"><?php _e('Reposter is activated for this account', 'nxs_snap'); ?></div>
|
252 |
|
253 |
<div id="showCatSel" style="display: none;background-color: #fff; width: 300px; padding: 25px;"><span class="nxspButton bClose"><span>X</span></span><?php _e('Select Categories', 'nxs_snap'); ?>:
|
292 |
<form method="post" id="nsStFormMisc" action="<?php echo $nxs_snapThisPageUrl?>"> <input type="hidden" name="nxsMainFromElementAccts" id="nxsMainFromElementAccts" value="" />
|
293 |
<input type="hidden" name="nxsMainFromSupportFld" id="nxsMainFromSupportFld" value="1" />
|
294 |
<!-- ##################### OTHER #####################-->
|
295 |
+
|
296 |
<!-- How to make auto-posts? -->
|
297 |
<div class="nxs_box"> <div class="nxs_box_header"><h3><?php _e('How to make auto-posts?', 'nxs_snap') ?> <-- (<a id="showShAttIS" onmouseover="showPopShAtt('IS', event);" onmouseout="hidePopShAtt('IS');" onclick="return false;" class="underdash" href="#"><?php _e('What\'s the difference?', 'nxs_snap') ?></a>)</h3></div>
|
298 |
<div class="popShAtt" id="popShAttIS">
|
733 |
4. Click "Settings" tab. Scroll to the "Application type", change Access level from "Read Only" to <b>"Read and Write"</b>. Click "Update this Twitter application settings".<br/>
|
734 |
5. Come back to "Details" tab. Scroll to the "Your access token" and click "Create my access token" button. Refresh page and notice "Access token" and "Access token secret". Make sure you have <b>"Read and Write"</b> access level.<br/>
|
735 |
</div> </div>
|
736 |
+
|
737 |
+
<div id="nsx_tab5" class="nsx_tab_content"><?php nxs_showNewPostForm($options); ?> </div>
|
738 |
</div>
|
739 |
<div class="popShAtt" id="popShAttRPST1"><div class="nxs_tls_sbInfo2"><?php _e('Set random delays around your interval time, to make your posts appear more human', 'nxs_snap'); ?></div></div>
|
740 |
<form method="post" enctype="multipart/form-data" id="nsStFormUpl" action="<?php echo $nxs_snapThisPageUrl?>">
|
851 |
<div class="inside"><div id="postftfp">
|
852 |
|
853 |
|
854 |
+
<input value="1" type="hidden" name="snapEdIT" />
|
855 |
<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>
|
856 |
<?php if($post->post_status != "publish" ) { ?>
|
857 |
<div style="float: right;"> <input type="hidden" id="nxsLockIt" value="0" />
|
894 |
|
895 |
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' );
|
896 |
|
897 |
+
$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);
|
898 |
+
if ((isset($options['nxsCPTSeld'])) && $options['nxsCPTSeld']!='') $nxsCPTSeld = unserialize($options['nxsCPTSeld']); else $nxsCPTSeld = array_keys($post_types); // prr($nxsCPTSeld); prr($post_types);
|
899 |
foreach ($post_types as $cptID=>$cptName) if (in_array($cptID, $nxsCPTSeld)){
|
900 |
add_meta_box( 'NS_SNAP_AddPostMetaTags', __('NextScripts: Social Networks Auto Poster - Post Options', 'nxs_snap'), array($this, 'NS_SNAP_AddPostMetaTags'), $cptID );
|
901 |
}
|
js/js.js
CHANGED
@@ -3,7 +3,9 @@ jQuery(document).ready(function() {
|
|
3 |
jQuery(window).load(function(){
|
4 |
jQuery('input:-webkit-autofill').each(function(){ var text =jQuery(this).val(); var name = jQuery(this).attr('name'); jQuery(this).after(this.outerHTML).remove(); jQuery('input[name=' + name + ']').val(text);});
|
5 |
});
|
6 |
-
}
|
|
|
|
|
7 |
//## Submit Serialized Form - avoid Max.Vars limit.
|
8 |
jQuery('#nsStFormMisc').submit(function() { var dataA = jQuery('#nsStForm').serialize(); jQuery('#nxsMainFromElementAccts').val(dataA); });
|
9 |
jQuery('#nsStForm').submit(function() { jQuery('#nsStFormMisc').submit(); return false; });
|
@@ -28,38 +30,48 @@ jQuery(document).ready(function() {
|
|
28 |
});
|
29 |
})(jQuery);
|
30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
//## Functions
|
32 |
function nxs_doResetPostSettings(pid){
|
33 |
-
jQuery.post(ajaxurl,{action: 'nxs_delPostSettings', pid: pid, _wpnonce: jQuery('input#nxsSsPageWPN_wpnonce').val()
|
34 |
}
|
35 |
function nxs_expSettings(){
|
36 |
jQuery.generateFile({ filename: 'nx-snap-settings.txt', content: jQuery('input#nxsSsPageWPN_wpnonce').val(), script: 'admin-ajax.php'});
|
37 |
}
|
38 |
// AJAX Functions
|
39 |
function getBoards(u,p,ii){ jQuery("#pnLoadingImg"+ii).show();
|
40 |
-
jQuery.post(ajaxurl,{u:u,p:p,ii:ii, nxs_mqTest:"'", action: 'getBoards', id: 0, _wpnonce: jQuery('input#nxsSsPageWPN_wpnonce').val()
|
41 |
jQuery("select#apPNBoard"+ii).html(j); jQuery("#pnLoadingImg"+ii).hide();
|
42 |
}, "html")
|
43 |
}
|
44 |
function getGPCats(u,p,ii,c){ jQuery("#gpLoadingImg"+ii).show();
|
45 |
-
jQuery.post(ajaxurl,{u:u,p:p,c:c,ii:ii, nxs_mqTest:"'", action: 'getGPCats', id: 0, _wpnonce: jQuery('input#nxsSsPageWPN_wpnonce').val()
|
46 |
jQuery("select#apGPCCats"+ii).html(j); jQuery("#gpLoadingImg"+ii).hide();
|
47 |
}, "html")
|
48 |
}
|
49 |
function getWLBoards(u,p,ii){ jQuery("#wlLoadingImg"+ii).show();
|
50 |
-
jQuery.post(ajaxurl,{u:u,p:p,ii:ii, nxs_mqTest:"'", action: 'getWLBoards', id: 0, _wpnonce: jQuery('input#nxsSsPageWPN_wpnonce').val()
|
51 |
jQuery("select#apWLBoard"+ii).html(j); jQuery("#wlLoadingImg"+ii).hide();
|
52 |
}, "html")
|
53 |
}
|
54 |
function nxs_getBrdsOrCats(u,p,ty,ii,fName){ jQuery("#"+ty+"LoadingImg"+ii).show();
|
55 |
-
jQuery.post(ajaxurl,{u:u,p:p,ii:ii,ty:ty, nxs_mqTest:"'", action: 'nxs_getBrdsOrCats', id: 0, _wpnonce: jQuery('input#nxsSsPageWPN_wpnonce').val()
|
56 |
jQuery("select#"+fName+ii).html(j); jQuery("#"+ty+"LoadingImg"+ii).hide();
|
57 |
}, "html")
|
58 |
}
|
59 |
|
60 |
|
61 |
function nxs_setRpstAll(t,ed,ii){ jQuery("#nxsLoadingImg"+t+ii).show(); var lpid = jQuery('#'+t+ii+'SetLPID').val();
|
62 |
-
jQuery.post(ajaxurl,{t:t,ed:ed,ii:ii, nxs_mqTest:"'", action: 'SetRpstAll', id: 0, lpid:lpid, _wpnonce: jQuery('input#nxsSsPageWPN_wpnonce').val()
|
63 |
alert('OK. Done.'); jQuery("#nxsLoadingImg"+t+ii).hide();
|
64 |
}, "html")
|
65 |
}
|
@@ -105,12 +117,13 @@ function doShowHideBlocks2(blID){ if (jQuery('#apDoS'+blID).val()=='0') { jQuery
|
|
105 |
|
106 |
function doGetHideNTBlock(bl,ii){ if (jQuery('#apDoS'+bl+ii).length<1 || jQuery('#apDoS'+bl+ii).val()=='0') {
|
107 |
if (jQuery('#do'+bl+ii+'Div').length<1) { jQuery("#"+bl+ii+"LoadingImg").show();
|
108 |
-
jQuery.post(ajaxurl,{nxsact:'getNTset',nt:bl,ii:ii,action:'nxs_snap_aj', _wpnonce: jQuery('input#nxsSsPageWPN_wpnonce').val()
|
109 |
//## check is filters were reset
|
110 |
-
var filtersReset = jQuery('#catSelA'+bl+ii).length && jQuery('#catSelA'+bl+ii).val() == 'X'; if (filtersReset) jQuery('#catSelA'+bl+ii).remove();
|
111 |
//## Show data
|
112 |
-
jQuery('#nxsNTSetDiv'+bl+ii).html(j); nxs_doTabsInd('#nxsNTSetDiv'+bl+ii); jQuery("#"+bl+ii+"LoadingImg").hide(); jQuery('#do'+bl+ii+'Div').show(); jQuery('#do'+bl+ii+'AG').text('[Hide Settings]'); jQuery('#apDoS'+bl+ii).val('1');
|
113 |
-
if (
|
|
|
114 |
}, "html")
|
115 |
} else { jQuery('#do'+bl+ii+'Div').show(); jQuery('#do'+bl+ii+'AG').text('[Hide Settings]'); jQuery('#apDoS'+bl+ii).val('1'); }
|
116 |
} else { jQuery('#do'+bl+ii+'Div').hide(); jQuery('#do'+bl+ii+'AG').text('[Show Settings]'); jQuery('#apDoS'+bl+ii).val('0'); }
|
@@ -149,22 +162,22 @@ function mxs_showFrmtInfo(hid){
|
|
149 |
jQuery('#'+hid+'Hint').show(); jQuery('#'+hid+'HintInfo').html('Hide format info');
|
150 |
}
|
151 |
function nxs_clLog(){
|
152 |
-
jQuery.post(ajaxurl,{action: 'nxs_clLgo', id: 0, _wpnonce: jQuery('input#nxsSsPageWPN_wpnonce').val()
|
153 |
jQuery("#nxslogDiv").html('');
|
154 |
}, "html")
|
155 |
}
|
156 |
function nxs_rfLog(){
|
157 |
-
jQuery.post(ajaxurl,{action: 'nxs_rfLgo', id: 0, _wpnonce: jQuery('input#nxsSsPageWPN_wpnonce').val()
|
158 |
jQuery("#nxslogDiv").html(j);
|
159 |
}, "html")
|
160 |
}
|
161 |
function nxs_prxTest(){ jQuery('#nxs_pchAjax').show();
|
162 |
-
jQuery.post(ajaxurl,{action: 'nxs_prxTest', id: 0, _wpnonce: jQuery('input#nxsSsPageWPN_wpnonce').val()
|
163 |
jQuery('#nxs_pchAjax').hide(); jQuery("#prxList").html(j);
|
164 |
}, "html")
|
165 |
}
|
166 |
function nxs_prxGet(){ jQuery('#nxs_pchAjax').show();
|
167 |
-
jQuery.post(ajaxurl,{action: 'nxs_prxGet', id: 0, _wpnonce: jQuery('input#nxsSsPageWPN_wpnonce').val()
|
168 |
jQuery('#nxs_pchAjax').hide(); jQuery("#prxList").html(j);
|
169 |
}, "html")
|
170 |
}
|
@@ -177,7 +190,7 @@ function nxsTRURLVal(ii){ var val = jQuery('#apTRURL'+ii).val(); var srch = val.
|
|
177 |
}
|
178 |
|
179 |
function nxs_hideTip(id){
|
180 |
-
jQuery.post(ajaxurl,{action: 'nxs_hideTip', id: id, _wpnonce: jQuery('input#nxsSsPageWPN_wpnonce').val()
|
181 |
jQuery('#'+id).hide();
|
182 |
}, "html")
|
183 |
}
|
@@ -200,5 +213,7 @@ function nxs_hideTip(id){
|
|
200 |
};
|
201 |
})(jQuery);
|
202 |
|
203 |
-
|
204 |
-
|
|
|
|
3 |
jQuery(window).load(function(){
|
4 |
jQuery('input:-webkit-autofill').each(function(){ var text =jQuery(this).val(); var name = jQuery(this).attr('name'); jQuery(this).after(this.outerHTML).remove(); jQuery('input[name=' + name + ']').val(text);});
|
5 |
});
|
6 |
+
}
|
7 |
+
//jQuery( "input[onchange^='nxs_doShowWarning']" ).prop("indeterminate", true).css( "-webkit-appearance", "checkbox" );
|
8 |
+
//jQuery( "input[onchange^='nxs_doShowWarning']" ).prop("indeterminate", true).css("background", "#D0D0D0").css("border-color", "#999");
|
9 |
//## Submit Serialized Form - avoid Max.Vars limit.
|
10 |
jQuery('#nsStFormMisc').submit(function() { var dataA = jQuery('#nsStForm').serialize(); jQuery('#nxsMainFromElementAccts').val(dataA); });
|
11 |
jQuery('#nsStForm').submit(function() { jQuery('#nsStFormMisc').submit(); return false; });
|
30 |
});
|
31 |
})(jQuery);
|
32 |
|
33 |
+
function nxs_showNewPostFrom() { jQuery('#nxs_popupDiv').bPopup({ modalClose: false, speed: 450, transition: 'slideDown', contentContainer:'#nxs_popupDivCont', loadUrl: 'admin-ajax.php', 'loadData': { "action": "nxs_snap_aj", "nxsact":"getNewPostDlg", "_wpnonce":jQuery('input#nxsSsPageWPN_wpnonce').val() }, loadCallback: function(){ jQuery("#nxsNPLoader").hide(); }, onClose: function(){ jQuery("#nxsNPLoader").show(); }, opacity: 0.6, follow: [false, false]}); }
|
34 |
+
|
35 |
+
function nxs_doNP(){ jQuery("#nxsNPLoaderPost").show(); var mNts = []; jQuery('input[name=nxsNPNts]:checked').each(function(i){ mNts[i] = jQuery(this).val(); });
|
36 |
+
jQuery.post(ajaxurl,{action: 'nxs_snap_aj',"nxsact":"doNewPost", mText: jQuery('#nxsNPText').val(), mTitle: jQuery('#nxsNPTitle').val(), mType: jQuery('input[name=nxsNPType]:checked').val(), mLink: jQuery('#nxsNPLink').val(), mImg: jQuery('#nxsNPImg').val(), mNts: mNts, nxs_mqTest:"'", _wpnonce: jQuery('#nxsSsPageWPN_wpnonce').val()}, function(j){ jQuery("#nxsNPResult").html(j); jQuery("#nxsNPLoaderPost").hide(); jQuery("#nxsNPCloseBt").val('Close'); }, "html")
|
37 |
+
}
|
38 |
+
|
39 |
+
function nxs_updtRdBtn(idd){
|
40 |
+
jQuery('#rbtn'+idd).attr('type', 'checkbox'); //alert('rbtn'+idd);
|
41 |
+
}
|
42 |
+
|
43 |
//## Functions
|
44 |
function nxs_doResetPostSettings(pid){
|
45 |
+
jQuery.post(ajaxurl,{action: 'nxs_delPostSettings', pid: pid, _wpnonce: jQuery('input#nxsSsPageWPN_wpnonce').val()}, function(j){ location.reload(); }, "html")
|
46 |
}
|
47 |
function nxs_expSettings(){
|
48 |
jQuery.generateFile({ filename: 'nx-snap-settings.txt', content: jQuery('input#nxsSsPageWPN_wpnonce').val(), script: 'admin-ajax.php'});
|
49 |
}
|
50 |
// AJAX Functions
|
51 |
function getBoards(u,p,ii){ jQuery("#pnLoadingImg"+ii).show();
|
52 |
+
jQuery.post(ajaxurl,{u:u,p:p,ii:ii, nxs_mqTest:"'", action: 'getBoards', id: 0, _wpnonce: jQuery('input#nxsSsPageWPN_wpnonce').val()}, function(j){ var options = '';
|
53 |
jQuery("select#apPNBoard"+ii).html(j); jQuery("#pnLoadingImg"+ii).hide();
|
54 |
}, "html")
|
55 |
}
|
56 |
function getGPCats(u,p,ii,c){ jQuery("#gpLoadingImg"+ii).show();
|
57 |
+
jQuery.post(ajaxurl,{u:u,p:p,c:c,ii:ii, nxs_mqTest:"'", action: 'getGPCats', id: 0, _wpnonce: jQuery('input#nxsSsPageWPN_wpnonce').val()}, function(j){ var options = '';
|
58 |
jQuery("select#apGPCCats"+ii).html(j); jQuery("#gpLoadingImg"+ii).hide();
|
59 |
}, "html")
|
60 |
}
|
61 |
function getWLBoards(u,p,ii){ jQuery("#wlLoadingImg"+ii).show();
|
62 |
+
jQuery.post(ajaxurl,{u:u,p:p,ii:ii, nxs_mqTest:"'", action: 'getWLBoards', id: 0, _wpnonce: jQuery('input#nxsSsPageWPN_wpnonce').val()}, function(j){ var options = '';
|
63 |
jQuery("select#apWLBoard"+ii).html(j); jQuery("#wlLoadingImg"+ii).hide();
|
64 |
}, "html")
|
65 |
}
|
66 |
function nxs_getBrdsOrCats(u,p,ty,ii,fName){ jQuery("#"+ty+"LoadingImg"+ii).show();
|
67 |
+
jQuery.post(ajaxurl,{u:u,p:p,ii:ii,ty:ty, nxs_mqTest:"'", action: 'nxs_getBrdsOrCats', id: 0, _wpnonce: jQuery('input#nxsSsPageWPN_wpnonce').val()}, function(j){ var options = '';
|
68 |
jQuery("select#"+fName+ii).html(j); jQuery("#"+ty+"LoadingImg"+ii).hide();
|
69 |
}, "html")
|
70 |
}
|
71 |
|
72 |
|
73 |
function nxs_setRpstAll(t,ed,ii){ jQuery("#nxsLoadingImg"+t+ii).show(); var lpid = jQuery('#'+t+ii+'SetLPID').val();
|
74 |
+
jQuery.post(ajaxurl,{t:t,ed:ed,ii:ii, nxs_mqTest:"'", action: 'SetRpstAll', id: 0, lpid:lpid, _wpnonce: jQuery('input#nxsSsPageWPN_wpnonce').val()}, function(j){ var options = '';
|
75 |
alert('OK. Done.'); jQuery("#nxsLoadingImg"+t+ii).hide();
|
76 |
}, "html")
|
77 |
}
|
117 |
|
118 |
function doGetHideNTBlock(bl,ii){ if (jQuery('#apDoS'+bl+ii).length<1 || jQuery('#apDoS'+bl+ii).val()=='0') {
|
119 |
if (jQuery('#do'+bl+ii+'Div').length<1) { jQuery("#"+bl+ii+"LoadingImg").show();
|
120 |
+
jQuery.post(ajaxurl,{nxsact:'getNTset',nt:bl,ii:ii,action:'nxs_snap_aj', _wpnonce: jQuery('input#nxsSsPageWPN_wpnonce').val()}, function(j){ var options = '';
|
121 |
//## check is filters were reset
|
122 |
+
//var filtersReset = jQuery('#catSelA'+bl+ii).length && jQuery('#catSelA'+bl+ii).val() == 'X'; if (filtersReset) jQuery('#catSelA'+bl+ii).remove();
|
123 |
//## Show data
|
124 |
+
jQuery('#nxsNTSetDiv'+bl+ii).html(j); nxs_doTabsInd('#nxsNTSetDiv'+bl+ii); jQuery("#"+bl+ii+"LoadingImg").hide(); jQuery('#do'+bl+ii+'Div').show(); jQuery('#do'+bl+ii+'AG').text('[Hide Settings]'); jQuery('#apDoS'+bl+ii).val('1');
|
125 |
+
if (jQuery('#rbtn'+bl.toLowerCase()+ii).attr('type') != 'checkbox') jQuery('#rbtn'+bl.toLowerCase()+ii).attr('type', 'checkbox');
|
126 |
+
// if (filtersReset) jQuery('#catSelA'+bl+ii).prop('checked', true);
|
127 |
}, "html")
|
128 |
} else { jQuery('#do'+bl+ii+'Div').show(); jQuery('#do'+bl+ii+'AG').text('[Hide Settings]'); jQuery('#apDoS'+bl+ii).val('1'); }
|
129 |
} else { jQuery('#do'+bl+ii+'Div').hide(); jQuery('#do'+bl+ii+'AG').text('[Show Settings]'); jQuery('#apDoS'+bl+ii).val('0'); }
|
162 |
jQuery('#'+hid+'Hint').show(); jQuery('#'+hid+'HintInfo').html('Hide format info');
|
163 |
}
|
164 |
function nxs_clLog(){
|
165 |
+
jQuery.post(ajaxurl,{action: 'nxs_clLgo', id: 0, _wpnonce: jQuery('input#nxsSsPageWPN_wpnonce').val()}, function(j){ var options = '';
|
166 |
jQuery("#nxslogDiv").html('');
|
167 |
}, "html")
|
168 |
}
|
169 |
function nxs_rfLog(){
|
170 |
+
jQuery.post(ajaxurl,{action: 'nxs_rfLgo', id: 0, _wpnonce: jQuery('input#nxsSsPageWPN_wpnonce').val()}, function(j){ var options = '';
|
171 |
jQuery("#nxslogDiv").html(j);
|
172 |
}, "html")
|
173 |
}
|
174 |
function nxs_prxTest(){ jQuery('#nxs_pchAjax').show();
|
175 |
+
jQuery.post(ajaxurl,{action: 'nxs_prxTest', id: 0, _wpnonce: jQuery('input#nxsSsPageWPN_wpnonce').val()}, function(j){ var options = '';
|
176 |
jQuery('#nxs_pchAjax').hide(); jQuery("#prxList").html(j);
|
177 |
}, "html")
|
178 |
}
|
179 |
function nxs_prxGet(){ jQuery('#nxs_pchAjax').show();
|
180 |
+
jQuery.post(ajaxurl,{action: 'nxs_prxGet', id: 0, _wpnonce: jQuery('input#nxsSsPageWPN_wpnonce').val()}, function(j){ var options = '';
|
181 |
jQuery('#nxs_pchAjax').hide(); jQuery("#prxList").html(j);
|
182 |
}, "html")
|
183 |
}
|
190 |
}
|
191 |
|
192 |
function nxs_hideTip(id){
|
193 |
+
jQuery.post(ajaxurl,{action: 'nxs_hideTip', id: id, _wpnonce: jQuery('input#nxsSsPageWPN_wpnonce').val()}, function(j){ var options = '';
|
194 |
jQuery('#'+id).hide();
|
195 |
}, "html")
|
196 |
}
|
213 |
};
|
214 |
})(jQuery);
|
215 |
|
216 |
+
/*================================================================================
|
217 |
+
* @name: bPopup - if you can't get it up, use bPopup * @author: (c)Bjoern Klinggaard (twitter@bklinggaard) * @version: 0.9.4.min
|
218 |
+
================================================================================*/
|
219 |
+
(function(b){b.fn.bPopup=function(z,F){function K(){a.contentContainer=b(a.contentContainer||c);switch(a.content){case "iframe":var h=b('<iframe class="b-iframe" '+a.iframeAttr+"></iframe>");h.appendTo(a.contentContainer);r=c.outerHeight(!0);s=c.outerWidth(!0);A();h.attr("src",a.loadUrl);k(a.loadCallback);break;case "image":A();b("<img />").load(function(){k(a.loadCallback);G(b(this))}).attr("src",a.loadUrl).hide().appendTo(a.contentContainer);break;default:A(),b('<div class="b-ajax-wrapper"></div>').load(a.loadUrl,a.loadData,function(){k(a.loadCallback);G(b(this))}).hide().appendTo(a.contentContainer)}}function A(){a.modal&&b('<div class="b-modal '+e+'"></div>').css({backgroundColor:a.modalColor,position:"fixed",top:0,right:0,bottom:0,left:0,opacity:0,zIndex:a.zIndex+t}).appendTo(a.appendTo).fadeTo(a.speed,a.opacity);D();c.data("bPopup",a).data("id",e).css({left:"slideIn"==a.transition||"slideBack"==a.transition?"slideBack"==a.transition?g.scrollLeft()+u:-1*(v+s):l(!(!a.follow[0]&&m||f)),position:a.positionStyle||"absolute",top:"slideDown"==a.transition||"slideUp"==a.transition?"slideUp"==a.transition?g.scrollTop()+w:x+-1*r:n(!(!a.follow[1]&&p||f)),"z-index":a.zIndex+t+1}).each(function(){a.appending&&b(this).appendTo(a.appendTo)});H(!0)}function q(){a.modal&&b(".b-modal."+c.data("id")).fadeTo(a.speed,0,function(){b(this).remove()});a.scrollBar||b("html").css("overflow","auto");b(".b-modal."+e).unbind("click");g.unbind("keydown."+e);d.unbind("."+e).data("bPopup",0<d.data("bPopup")-1?d.data("bPopup")-1:null);c.undelegate(".bClose, ."+a.closeClass,"click."+e,q).data("bPopup",null);H();return!1}function G(h){var b=h.width(),e=h.height(),d={};a.contentContainer.css({height:e,width:b});e>=c.height()&&(d.height=c.height());b>=c.width()&&(d.width=c.width());r=c.outerHeight(!0);s=c.outerWidth(!0);D();a.contentContainer.css({height:"auto",width:"auto"});d.left=l(!(!a.follow[0]&&m||f));d.top=n(!(!a.follow[1]&&p||f));c.animate(d,250,function(){h.show();B=E()})}function L(){d.data("bPopup",t);c.delegate(".bClose, ."+a.closeClass,"click."+e,q);a.modalClose&&b(".b-modal."+e).css("cursor","pointer").bind("click",q);M||!a.follow[0]&&!a.follow[1]||d.bind("scroll."+e,function(){B&&c.dequeue().animate({left:a.follow[0]?l(!f):"auto",top:a.follow[1]?n(!f):"auto"},a.followSpeed,a.followEasing)}).bind("resize."+e,function(){w=y.innerHeight||d.height();u=y.innerWidth||d.width();if(B=E())clearTimeout(I),I=setTimeout(function(){D();c.dequeue().each(function(){f?b(this).css({left:v,top:x}):b(this).animate({left:a.follow[0]?l(!0):"auto",top:a.follow[1]?n(!0):"auto"},a.followSpeed,a.followEasing)})},50)});a.escClose&&g.bind("keydown."+e,function(a){27==a.which&&q()})}function H(b){function d(e){c.css({display:"block",opacity:1}).animate(e,a.speed,a.easing,function(){J(b)})}switch(b?a.transition:a.transitionClose||a.transition){case "slideIn":d({left:b?l(!(!a.follow[0]&&m||f)):g.scrollLeft()-(s||c.outerWidth(!0))-C});break;case "slideBack":d({left:b?l(!(!a.follow[0]&&m||f)):g.scrollLeft()+u+C});break;case "slideDown":d({top:b?n(!(!a.follow[1]&&p||f)):g.scrollTop()-(r||c.outerHeight(!0))-C});break;case "slideUp":d({top:b?n(!(!a.follow[1]&&p||f)):g.scrollTop()+w+C});break;default:c.stop().fadeTo(a.speed,b?1:0,function(){J(b)})}}function J(b){b?(L(),k(F),a.autoClose&&setTimeout(q,a.autoClose)):(c.hide(),k(a.onClose),a.loadUrl&&(a.contentContainer.empty(),c.css({height:"auto",width:"auto"})))}function l(a){return a?v+g.scrollLeft():v}function n(a){return a?x+g.scrollTop():x}function k(a){b.isFunction(a)&&a.call(c)}function D(){x=p?a.position[1]:Math.max(0,(w-c.outerHeight(!0))/2-a.amsl);v=m?a.position[0]:(u-c.outerWidth(!0))/2;B=E()}function E(){return w>c.outerHeight(!0)&&u>c.outerWidth(!0)}b.isFunction(z)&&(F=z,z=null);var a=b.extend({},b.fn.bPopup.defaults,z);a.scrollBar||b("html").css("overflow","hidden");var c=this,g=b(document),y=window,d=b(y),w=y.innerHeight||d.height(),u=y.innerWidth||d.width(),M=/OS 6(_\d)+/i.test(navigator.userAgent),C=200,t=0,e,B,p,m,f,x,v,r,s,I;c.close=function(){a=this.data("bPopup");e="__b-popup"+d.data("bPopup")+"__";q()};return c.each(function(){b(this).data("bPopup")||(k(a.onOpen),t=(d.data("bPopup")||0)+1,e="__b-popup"+t+"__",p="auto"!==a.position[1],m="auto"!==a.position[0],f="fixed"===a.positionStyle,r=c.outerHeight(!0),s=c.outerWidth(!0),a.loadUrl?K():A())})};b.fn.bPopup.defaults={amsl:50,appending:!0,appendTo:"body",autoClose:!1,closeClass:"b-close",content:"ajax",contentContainer:!1,easing:"swing",escClose:!0,follow:[!0,!0],followEasing:"swing",followSpeed:500,iframeAttr:'scrolling="no" frameborder="0"',loadCallback:!1,loadData:!1,loadUrl:!1,modal:!0,modalClose:!0,modalColor:"#000",onClose:!1,onOpen:!1,opacity:0.7,position:["auto","auto"],positionStyle:"absolute",scrollBar:!0,speed:250,transition:"fadeIn",transitionClose:!1,zIndex:999997}})(jQuery);
|
nxs_functions.php
CHANGED
@@ -101,8 +101,8 @@ if (!function_exists('nxs_getPostImage')){ function nxs_getPostImage($postID, $s
|
|
101 |
}
|
102 |
if ($imgURL!='' && $options['imgNoCheck']!='1' && nxs_chckRmImage($imgURL)==false) $imgURL = ''; if ($imgURL!='') return $imgURL;
|
103 |
//## Featured Image
|
104 |
-
if ($imgURL=='') { if ((int)$postID>0 && function_exists("get_post_thumbnail_id") )
|
105 |
-
if ((trim($imgURL)!='') && substr($imgURL, 0, 4)!='http') $imgURL = site_url($imgURL);
|
106 |
}}
|
107 |
if ($imgURL!='' && $options['imgNoCheck']!='1' && nxs_chckRmImage($imgURL)==false) $imgURL = ''; if ($imgURL!='') return $imgURL;
|
108 |
//## plugin/categories-images
|
@@ -268,7 +268,7 @@ if (!function_exists("nxs_jsPostToSNAP2")){ function nxs_jsPostToSNAP2() { glob
|
|
268 |
window.location = "https://www.facebook.com/dialog/oauth?client_id="+fbAppID+"&client_secret="+fbAppSec+"&scope=publish_stream,offline_access,read_stream,manage_pages&redirect_uri=<?php echo $nxs_snapThisPageUrl;?>";
|
269 |
});
|
270 |
}
|
271 |
-
function doLic(){ var lk = jQuery('#eLic').val(); jQuery.post(ajaxurl,{lk:lk, action: 'nxsDoLic', id: 0, _wpnonce: jQuery('input#doLic_wpnonce').val()
|
272 |
if (jQuery.trim(j)=='OK') window.location = "<?php echo $nxs_snapThisPageUrl; ?>"; else alert('<?php _e('Wrong key, please contact support', 'nxs_snap'); ?>');
|
273 |
}, "html")
|
274 |
}
|
@@ -355,9 +355,6 @@ if (!function_exists("nxs_jsPostToSNAP2")){ function nxs_jsPostToSNAP2() { glob
|
|
355 |
background:-moz-linear-gradient( center top, #77a809 5%, #89c403 100% );
|
356 |
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#77a809', endColorstr='#89c403');
|
357 |
}.NXSButton:active {color:#ffffff; position:relative; top:1px;}.NXSButton:focus {color:#ffffff; position:relative; top:1px;} .nsBigText{font-size: 14px; color: #585858; font-weight: bold; display: inline;}
|
358 |
-
.nxspButton:hover { background-color: #1E1E1E;}
|
359 |
-
.nxspButton { background-color: #2B91AF; color: #FFFFFF; cursor: pointer; display: inline-block; text-align: center; text-decoration: none; border-radius: 6px 6px 6px 6px; box-shadow: none; font: bold 131% sans-serif; padding: 0 6px 2px; position: absolute; right: -7px; top: -7px;}
|
360 |
-
#nxs_spPopup, #showLicForm{ min-height: 250px; background-color: #FFFFFF; border-radius: 5px 5px 5px 5px; box-shadow: 0 0 3px 2px #999999; color: #111111; display: none; min-width: 850px; padding: 25px;}
|
361 |
#nxs_ntType {width: 150px;}
|
362 |
#nsx_addNT {width: 600px;}
|
363 |
.nxsInfoMsg{ margin: 1px auto; padding: 3px 10px 3px 5px; border: 1px solid #ffea90; background-color: #fdfae4; display: inline; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; }
|
@@ -384,7 +381,7 @@ html ul.nsx_tabs li.active, html ul.nsx_tabs li.active a:hover { background: #f
|
|
384 |
.nxs_tls_lbl{width:100%;padding-top:7px;padding-bottom:1px;}
|
385 |
.nxsInstrSpan{ font-size: 11px; }
|
386 |
|
387 |
-
|
388 |
.subDiv{margin-left: 15px;}
|
389 |
.nxs_hili {color:#008000;}
|
390 |
.clNewNTSets{width: 800px;}
|
@@ -766,6 +763,8 @@ function nxs_adjRpst($optionsii, $pval){ if (empty($optionsii['rpstDays'])) $op
|
|
766 |
|
767 |
if (isset($pval['nxsCPTSeld'])) $optionsii['nxsCPTSeld'] = serialize($pval['nxsCPTSeld']);
|
768 |
|
|
|
|
|
769 |
if (isset($pval['tagsSel'])) { $optionsii['tagsSel'] = trim($pval['tagsSel']); $tagsSelX = array(); $tggsSel = explode(',', $optionsii['tagsSel']);
|
770 |
foreach ($tggsSel as $tggg){ $tggg = trim($tggg); $tagsSelX[] = $tggg;
|
771 |
if (stripos($tggg, '|')!==false) { $tgArr = explode('|', $tggg); $taxonomy = $tgArr[0]; $tgggT = $tgArr[1]; } else { $taxonomy = 'post_tag'; $tgggT = $tggg; }
|
@@ -783,7 +782,9 @@ function nxs_adjRpst($optionsii, $pval){ if (empty($optionsii['rpstDays'])) $op
|
|
783 |
|
784 |
function nxs_showCatTagsCTFilters($nt, $ii, $options){ global $nxs_snapAvNts, $nxs_plurl;
|
785 |
if (!isset($options['tagsSel'])) $options['tagsSel'] = ''; if (!isset($options['custTaxSel'])) $options['custTaxSel'] = '';
|
786 |
-
?> <div class="nxs_tls_cpt"
|
|
|
|
|
787 |
<div class="nxs_tls_bd">
|
788 |
<div style="width:100%;"><strong><?php _e('Categories', 'nxs_snap'); ?>:</strong>
|
789 |
<input value="0" id="catSelA<?php echo strtoupper($nt); ?><?php echo $ii; ?>" type="radio" name="<?php echo $nt; ?>[<?php echo $ii; ?>][catSel]" <?php if ((int)$options['catSel'] != 1) echo "checked"; ?> /> <?php _e('All', 'nxs_snap'); ?>
|
@@ -823,7 +824,8 @@ function nxs_showRepostSettings($nt, $ii, $options){ global $nxs_snapAvNts, $nxs
|
|
823 |
<input value="1" id="riOC<?php echo $ii; ?>" <?php if (isset($options['rpstOnlyPUP']) && trim($options['rpstOnlyPUP'])=='1') echo "checked"; ?> type="checkbox" name="<?php echo $nt; ?>[<?php echo $ii; ?>][rpstOnlyPUP]"/>
|
824 |
<b><?php _e('Repost ONLY previously unautoposted posts', 'nxs_snap'); ?></b>
|
825 |
<br/>
|
826 |
-
<?php $args=array('public'=>true, '_builtin'=>false); $output = 'names'; $operator = 'and'; $post_types = array();
|
|
|
827 |
if (!empty($post_types) && is_array($post_types)) { ?>
|
828 |
<b><?php _e('Repost: (Choose Posts, Pages, Custom Post Types)', 'nxs_snap'); ?></b>
|
829 |
<?php $post_typesIncl = array('post'=>'post', 'page'=>'page'); $post_types = array_merge($post_typesIncl, $post_types); if ($options['nxsCPTSeld']=='a:1:{i:0;s:1:"0";}') $options['nxsCPTSeld'] = '';
|
@@ -956,7 +958,7 @@ function nxs_rePoster(){ global $nxs_snapAvNts,$plgn_NS_SNAutoPoster, $nxs_rpst_
|
|
956 |
$ntClInst = new $clName(); $ntOpts['ii'] = $ii; $ntOpts['pType'] = 'aj'; $ntOptsPost = $ntClInst->adjMetaOpt($ntOpts, $po[$ii]);
|
957 |
if ($options['extDebug']=='1') $extInfo .= "<br/><br/>NT OPTS: ".print_r($ntOptsPost, true); if ($options['extDebug']=='1') $extInfo .= "ARGS: <br/><br/>".print_r($args, true);
|
958 |
$result = $pFuncName($rpstLastPostID, $ntOptsPost); //if ($result == 200) die("Successfully sent your post to App.Net."); else die($result);
|
959 |
-
nxs_addToLogN('S', 'RE-
|
960 |
}
|
961 |
}
|
962 |
if (!isset($ntOpts['rpstLastShTime']) || (int)$ntOpts['rpstLastShTime']==0 ) { $hasChanged = true; $ntOpts['rpstLastShTime'] = $currTime; $ntOpts['rpstNxTime'] = $lastTime + $rpstEvrySec + rand(0-$rndSec, $rndSec); }
|
@@ -971,7 +973,7 @@ function nxs_chckBrwsr() { $isOK = false;
|
|
971 |
if (preg_match('/MSIE/i',$_SERVER['HTTP_USER_AGENT'])) $isOK = true; if (preg_match('/Internet Explorer/i',$_SERVER['HTTP_USER_AGENT'])) $isOK = true;
|
972 |
if (preg_match('/Firefox/i',$_SERVER['HTTP_USER_AGENT'])) $isOK = true; if (preg_match('/Opera/i',$_SERVER['HTTP_USER_AGENT'])) $isOK = true;
|
973 |
if (preg_match('/Chrome/i',$_SERVER['HTTP_USER_AGENT'])) $isOK = true; if (preg_match('/Safari/i',$_SERVER['HTTP_USER_AGENT'])) $isOK = true;
|
974 |
-
if (preg_match('/(up.browser|up.link|mmp|symbian|smartphone|midp|wap|phone)/i', strtolower($_SERVER['HTTP_USER_AGENT'])) || (strpos(strtolower($_SERVER['HTTP_ACCEPT']),'application/vnd.wap.xhtml+xml')>0) or ((isset($_SERVER['HTTP_X_WAP_PROFILE']) or isset($_SERVER['HTTP_PROFILE'])))) $isOK = false;
|
975 |
return $isOK;
|
976 |
}
|
977 |
|
@@ -988,7 +990,7 @@ if (!function_exists("nxs_psCron")) { function nxs_psCron() { if (stripos($_SERV
|
|
988 |
delete_post_meta(); add_post_meta($toPush['args'][0], 'snap_mp_'.$toPush['func'], (time()+300));
|
989 |
*/
|
990 |
delete_option("NSX_LastTChecked"); add_option("NSX_LastTChecked", time());
|
991 |
-
$cron_url = site_url('wp-cron.php?doing_wp_cron=0'); ?><script type="text/javascript" > jQuery(document).ready(function($) { jQuery.get('<?php echo $cron_url; ?>'); }); </script><?php die();
|
992 |
return true;
|
993 |
}}
|
994 |
|
101 |
}
|
102 |
if ($imgURL!='' && $options['imgNoCheck']!='1' && nxs_chckRmImage($imgURL)==false) $imgURL = ''; if ($imgURL!='') return $imgURL;
|
103 |
//## Featured Image
|
104 |
+
if ($imgURL=='') { if ((int)$postID>0 && function_exists("get_post_thumbnail_id") && function_exists('has_post_thumbnail') && has_post_thumbnail($postID) ){
|
105 |
+
$imgURL = wp_get_attachment_image_src(get_post_thumbnail_id($postID), $size); $imgURL = $imgURL[0]; if ((trim($imgURL)!='') && substr($imgURL, 0, 4)!='http') $imgURL = site_url($imgURL);
|
106 |
}}
|
107 |
if ($imgURL!='' && $options['imgNoCheck']!='1' && nxs_chckRmImage($imgURL)==false) $imgURL = ''; if ($imgURL!='') return $imgURL;
|
108 |
//## plugin/categories-images
|
268 |
window.location = "https://www.facebook.com/dialog/oauth?client_id="+fbAppID+"&client_secret="+fbAppSec+"&scope=publish_stream,offline_access,read_stream,manage_pages&redirect_uri=<?php echo $nxs_snapThisPageUrl;?>";
|
269 |
});
|
270 |
}
|
271 |
+
function doLic(){ var lk = jQuery('#eLic').val(); jQuery.post(ajaxurl,{lk:lk, action: 'nxsDoLic', id: 0, _wpnonce: jQuery('input#doLic_wpnonce').val()}, function(j){
|
272 |
if (jQuery.trim(j)=='OK') window.location = "<?php echo $nxs_snapThisPageUrl; ?>"; else alert('<?php _e('Wrong key, please contact support', 'nxs_snap'); ?>');
|
273 |
}, "html")
|
274 |
}
|
355 |
background:-moz-linear-gradient( center top, #77a809 5%, #89c403 100% );
|
356 |
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#77a809', endColorstr='#89c403');
|
357 |
}.NXSButton:active {color:#ffffff; position:relative; top:1px;}.NXSButton:focus {color:#ffffff; position:relative; top:1px;} .nsBigText{font-size: 14px; color: #585858; font-weight: bold; display: inline;}
|
|
|
|
|
|
|
358 |
#nxs_ntType {width: 150px;}
|
359 |
#nsx_addNT {width: 600px;}
|
360 |
.nxsInfoMsg{ margin: 1px auto; padding: 3px 10px 3px 5px; border: 1px solid #ffea90; background-color: #fdfae4; display: inline; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; }
|
381 |
.nxs_tls_lbl{width:100%;padding-top:7px;padding-bottom:1px;}
|
382 |
.nxsInstrSpan{ font-size: 11px; }
|
383 |
|
384 |
+
|
385 |
.subDiv{margin-left: 15px;}
|
386 |
.nxs_hili {color:#008000;}
|
387 |
.clNewNTSets{width: 800px;}
|
763 |
|
764 |
if (isset($pval['nxsCPTSeld'])) $optionsii['nxsCPTSeld'] = serialize($pval['nxsCPTSeld']);
|
765 |
|
766 |
+
if (isset($pval['fltrsOn'])) $optionsii['fltrsOn'] = trim($pval['fltrsOn']); else $optionsii['fltrsOn'] = 0;
|
767 |
+
|
768 |
if (isset($pval['tagsSel'])) { $optionsii['tagsSel'] = trim($pval['tagsSel']); $tagsSelX = array(); $tggsSel = explode(',', $optionsii['tagsSel']);
|
769 |
foreach ($tggsSel as $tggg){ $tggg = trim($tggg); $tagsSelX[] = $tggg;
|
770 |
if (stripos($tggg, '|')!==false) { $tgArr = explode('|', $tggg); $taxonomy = $tgArr[0]; $tgggT = $tgArr[1]; } else { $taxonomy = 'post_tag'; $tgggT = $tggg; }
|
782 |
|
783 |
function nxs_showCatTagsCTFilters($nt, $ii, $options){ global $nxs_snapAvNts, $nxs_plurl;
|
784 |
if (!isset($options['tagsSel'])) $options['tagsSel'] = ''; if (!isset($options['custTaxSel'])) $options['custTaxSel'] = '';
|
785 |
+
?> <div class="nxs_tls_cpt">
|
786 |
+
|
787 |
+
<?php _e('Filter Autoposting by', 'nxs_snap'); ?></div>
|
788 |
<div class="nxs_tls_bd">
|
789 |
<div style="width:100%;"><strong><?php _e('Categories', 'nxs_snap'); ?>:</strong>
|
790 |
<input value="0" id="catSelA<?php echo strtoupper($nt); ?><?php echo $ii; ?>" type="radio" name="<?php echo $nt; ?>[<?php echo $ii; ?>][catSel]" <?php if ((int)$options['catSel'] != 1) echo "checked"; ?> /> <?php _e('All', 'nxs_snap'); ?>
|
824 |
<input value="1" id="riOC<?php echo $ii; ?>" <?php if (isset($options['rpstOnlyPUP']) && trim($options['rpstOnlyPUP'])=='1') echo "checked"; ?> type="checkbox" name="<?php echo $nt; ?>[<?php echo $ii; ?>][rpstOnlyPUP]"/>
|
825 |
<b><?php _e('Repost ONLY previously unautoposted posts', 'nxs_snap'); ?></b>
|
826 |
<br/>
|
827 |
+
<?php $args=array('public'=>true, '_builtin'=>false); $output = 'names'; $operator = 'and'; $post_types = array();
|
828 |
+
if (function_exists('get_post_types')) $post_types=get_post_types($args, $output, $operator);
|
829 |
if (!empty($post_types) && is_array($post_types)) { ?>
|
830 |
<b><?php _e('Repost: (Choose Posts, Pages, Custom Post Types)', 'nxs_snap'); ?></b>
|
831 |
<?php $post_typesIncl = array('post'=>'post', 'page'=>'page'); $post_types = array_merge($post_typesIncl, $post_types); if ($options['nxsCPTSeld']=='a:1:{i:0;s:1:"0";}') $options['nxsCPTSeld'] = '';
|
958 |
$ntClInst = new $clName(); $ntOpts['ii'] = $ii; $ntOpts['pType'] = 'aj'; $ntOptsPost = $ntClInst->adjMetaOpt($ntOpts, $po[$ii]);
|
959 |
if ($options['extDebug']=='1') $extInfo .= "<br/><br/>NT OPTS: ".print_r($ntOptsPost, true); if ($options['extDebug']=='1') $extInfo .= "ARGS: <br/><br/>".print_r($args, true);
|
960 |
$result = $pFuncName($rpstLastPostID, $ntOptsPost); //if ($result == 200) die("Successfully sent your post to App.Net."); else die($result);
|
961 |
+
nxs_addToLogN('S', 'RE-Posting', $logNT, 'OK | '.$times.' | Previous Time:'.date_i18n('Y-m-d H:i:s', $lastTime).'| Next Shedulled Time - '.date_i18n('Y-m-d H:i:s', $ntOpts['rpstNxTime']).")<br/>", $extInfo);
|
962 |
}
|
963 |
}
|
964 |
if (!isset($ntOpts['rpstLastShTime']) || (int)$ntOpts['rpstLastShTime']==0 ) { $hasChanged = true; $ntOpts['rpstLastShTime'] = $currTime; $ntOpts['rpstNxTime'] = $lastTime + $rpstEvrySec + rand(0-$rndSec, $rndSec); }
|
973 |
if (preg_match('/MSIE/i',$_SERVER['HTTP_USER_AGENT'])) $isOK = true; if (preg_match('/Internet Explorer/i',$_SERVER['HTTP_USER_AGENT'])) $isOK = true;
|
974 |
if (preg_match('/Firefox/i',$_SERVER['HTTP_USER_AGENT'])) $isOK = true; if (preg_match('/Opera/i',$_SERVER['HTTP_USER_AGENT'])) $isOK = true;
|
975 |
if (preg_match('/Chrome/i',$_SERVER['HTTP_USER_AGENT'])) $isOK = true; if (preg_match('/Safari/i',$_SERVER['HTTP_USER_AGENT'])) $isOK = true;
|
976 |
+
if (preg_match('/(up.browser|up.link|mmp|symbian|smartphone|midp|wap|phone)/i', strtolower($_SERVER['HTTP_USER_AGENT'])) || (!empty($_SERVER['HTTP_ACCEPT']) && strpos(strtolower($_SERVER['HTTP_ACCEPT']),'application/vnd.wap.xhtml+xml')>0) or ((isset($_SERVER['HTTP_X_WAP_PROFILE']) or isset($_SERVER['HTTP_PROFILE'])))) $isOK = false;
|
977 |
return $isOK;
|
978 |
}
|
979 |
|
990 |
delete_post_meta(); add_post_meta($toPush['args'][0], 'snap_mp_'.$toPush['func'], (time()+300));
|
991 |
*/
|
992 |
delete_option("NSX_LastTChecked"); add_option("NSX_LastTChecked", time());
|
993 |
+
$cron_url = site_url('wp-cron.php?doing_wp_cron=0'); ?><script type="text/javascript" > jQuery(document).ready(function($) { jQuery.get('<?php echo $cron_url; ?>'); }); </script><?php // die();
|
994 |
return true;
|
995 |
}}
|
996 |
|
readme.txt
CHANGED
@@ -2,20 +2,20 @@
|
|
2 |
|
3 |
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, reddit, reddit.com, plugin, links, Post, posts, api, automatic, seo, integration, bookmark, FriendFeed, bookmarks, admin, images, image, social, sharing, share, repost, re-post, wordpress.com, StumbleUpon, Diigo, vBulletin, Plurk, forums, vKontakte, open graph, LiveJournal, YouTube
|
6 |
Requires at least: 3.1
|
7 |
-
Tested up to: 3.8.
|
8 |
-
Stable tag: 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, FriendFeed, DreamWidth, Delicious, Diigo, Instapaper, Stumbleupon, LinkedIn, Pinterest, Plurk, VKontakte(VK.com), YouTube, 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 3.0** - Auto-repost existing posts, autoposting query, select what image to use for autopost, "Custom URLs" for posts, New networks: App.net, Reddit and deviantart.com
|
18 |
|
|
|
|
|
19 |
* *Version 2.7* - YouTube Support, FriendFeed support, Auto-import comments from Facebook and Twitter as Wordpress Commnets, goo.gl and YOURLS support, ability to spin message text
|
20 |
* *Version 2.6* - Better Interface, DreamWidth support, Instapaper support, ability to auto-import comments from social networks
|
21 |
* *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.
|
@@ -30,6 +30,7 @@ Automatically re-publishes blogposts to Facebook, Twitter, Google+, Pinterest, L
|
|
30 |
* **Deviantart.com** - Autopost to your blog. HTML is supported.
|
31 |
* **Diigo** - Auto-submit bookmark to your account.
|
32 |
* **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.
|
|
|
33 |
* **FriendFeed** - Autopost to your account. Ability to attach Image to posts.
|
34 |
* **Instapaper** - Auto-submit bookmark to your account.
|
35 |
* **Google+** (*with third party API library*) - Autopost to your profile, business page or community. Ability to attach your blogpost to Google+ post. Ability to make "Image" posts.
|
@@ -37,6 +38,7 @@ Automatically re-publishes blogposts to Facebook, Twitter, Google+, Pinterest, L
|
|
37 |
* **LiveJournal** - Auto-submit your blogpost to LiveJournal blog or community. "LiveJournal Engine" based website DreamWidth.org is also supported.
|
38 |
* **Pinterest** (*with third party API library*) - Pin your blogpost's featured image to your Pinterest board.
|
39 |
* **Reddit** (*with third party API library*) - post to your subreddits.
|
|
|
40 |
* **Stumbleupon** - Auto-submit bookmark to your account.
|
41 |
* **Tumblr** - Autopost to your account. Ability to attach your blogpost to Tumblr post. HTML is supported.
|
42 |
* **Twitter** - Autopost to your account. Ability to attach Image to tweets.
|
@@ -151,13 +153,48 @@ Please see more <a href="http://www.nextscripts.com/faq/">Frequently asked quest
|
|
151 |
|
152 |
== Changelog ==
|
153 |
|
154 |
-
= 3.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
155 |
|
156 |
* [Critical] Bug Fix - [ERROR] (#100) actions should be a JSON-encoded dictionary with 'name' and 'link' keys
|
157 |
* Improvement/Bug Fix - Plugin will import all comments from Facebook posts, not just the first 100.
|
158 |
* Bug Fix - Plugin were re-posting the same "Sticky" post in some configurations.
|
159 |
|
160 |
-
= 3.1.1 [01/14/
|
161 |
|
162 |
* Improvement/Bug Fix - Update for Jan 14 Twitter API change - requirement for ONLY secured SSL connections
|
163 |
* Improvement/Bug Fix - Better compatibility with some WP Admin themes - like fixed missing "Update Settings" button
|
2 |
|
3 |
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+, Flickr, twitter, google plus, pinterest, tumblr, blogger, blogspot, blogpost, linkedin, delicious, delicious.com, reddit, reddit.com, plugin, links, Post, posts, api, automatic, seo, scoop.it, integration, bookmark, FriendFeed, bookmarks, admin, images, image, social, sharing, share, repost, re-post, wordpress.com, StumbleUpon, Diigo, vBulletin, Plurk, forums, vKontakte, open graph, LiveJournal, YouTube
|
6 |
Requires at least: 3.1
|
7 |
+
Tested up to: 3.8.1
|
8 |
+
Stable tag: 3.2.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, Flickr, LiveJournal, FriendFeed, DreamWidth, Delicious, Diigo, Instapaper, Stumbleupon, LinkedIn, Pinterest, Plurk, VKontakte(VK.com), YouTube, App.net, Scoop.It, 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 3.2** - Post to all social accounts without creating a Wordpress Post. New networks - Flickr and Scoop.It.
|
18 |
+
* *Version 3.0* - Auto-repost existing posts, autoposting query, select what image to use for autopost, "Custom URLs" for posts, New networks: App.net, Reddit and deviantart.com
|
19 |
* *Version 2.7* - YouTube Support, FriendFeed support, Auto-import comments from Facebook and Twitter as Wordpress Commnets, goo.gl and YOURLS support, ability to spin message text
|
20 |
* *Version 2.6* - Better Interface, DreamWidth support, Instapaper support, ability to auto-import comments from social networks
|
21 |
* *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.
|
30 |
* **Deviantart.com** - Autopost to your blog. HTML is supported.
|
31 |
* **Diigo** - Auto-submit bookmark to your account.
|
32 |
* **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.
|
33 |
+
* **Flickr** - Autopost images to your photostream and/or sets. Tags are supported.
|
34 |
* **FriendFeed** - Autopost to your account. Ability to attach Image to posts.
|
35 |
* **Instapaper** - Auto-submit bookmark to your account.
|
36 |
* **Google+** (*with third party API library*) - Autopost to your profile, business page or community. Ability to attach your blogpost to Google+ post. Ability to make "Image" posts.
|
38 |
* **LiveJournal** - Auto-submit your blogpost to LiveJournal blog or community. "LiveJournal Engine" based website DreamWidth.org is also supported.
|
39 |
* **Pinterest** (*with third party API library*) - Pin your blogpost's featured image to your Pinterest board.
|
40 |
* **Reddit** (*with third party API library*) - post to your subreddits.
|
41 |
+
* **Scoop.It** - Autopost to your "Topics". Ability to attach your blogpost to scoop. Ability to make "Image" posts.
|
42 |
* **Stumbleupon** - Auto-submit bookmark to your account.
|
43 |
* **Tumblr** - Autopost to your account. Ability to attach your blogpost to Tumblr post. HTML is supported.
|
44 |
* **Twitter** - Autopost to your account. Ability to attach Image to tweets.
|
153 |
|
154 |
== Changelog ==
|
155 |
|
156 |
+
= 3.2.3 [02/07/2014] =
|
157 |
+
|
158 |
+
* Improvement - More networks show the links to the created posts in the log.
|
159 |
+
* Bug Fix - Flickr was missing from the "add new network" list
|
160 |
+
* Bug Fix - Reddit failed to retrieve reddits with "Moderation" rights.
|
161 |
+
* Bug Fix - Fixed(removed) an ability for super admin to disable himself for WPMU installations.
|
162 |
+
* Bug Fix - Twitter - %ANOUNCE% tag was causing message to go over 140 characters.
|
163 |
+
|
164 |
+
= 3.2.2 [02/05/2014] =
|
165 |
+
|
166 |
+
* New - New network "Flickr". Post your images to your photostream and/or sets. Tags are supported.
|
167 |
+
* Improvement - Some networks show the links to the created posts in the log.
|
168 |
+
* Improvement/Bug Fix - Compatibility with plugins that hijack all requests with the word 'ajax'.
|
169 |
+
* Improvement/Bug Fix - Compatibility with custom "post transition" statuses.
|
170 |
+
* Bug Fix - Google+ - Fixed additional URL parameters.
|
171 |
+
* Bug Fix - "New Post to social networks" fixed problem with " become \"
|
172 |
+
* Bug Fix - "New Post to social networks" link is visible only to people who can use SNAP.
|
173 |
+
* Bug Fix - Broken tabs and "-1" messages on WPMU installations.
|
174 |
+
|
175 |
+
= 3.2.1 [01/30/2014] =
|
176 |
+
|
177 |
+
* [Critical] Bug Fix - Facebook module could overwrite post type to "Text Only" for existing posts.
|
178 |
+
* New - New Post to social networks without creating Wordpress post link is now in the top "New" menu.
|
179 |
+
* Bug Fix - fixed link [Enabled/Disabled for Repost according to Categories/Tags/Taxonomies filters] (yes, again)
|
180 |
+
|
181 |
+
= 3.2.0 [01/29/2014] =
|
182 |
+
|
183 |
+
* New - Post to social networks without creating Wordpress post.
|
184 |
+
* New - New network "Scoop.It". Make text posts, link posts, or image posts. Post with tags.
|
185 |
+
* New - New LinkedIn Showcase pages are supported. (Pro Only)
|
186 |
+
* Improvement/Bug Fix - New interface for checkboxes for networks with excluded categories.
|
187 |
+
* Improvement/Bug Fix - %EXCERPT% tags won't cut the actual excerpt to 300 characters anymore.
|
188 |
+
* Bug Fix - fized link [Enabled/Disabled for Repost according to Categories/Tags/Taxonomies filters]
|
189 |
+
* Bug Fix - Stability improvements to re-posting functionality.
|
190 |
+
|
191 |
+
= 3.1.2 [01/15/2014] =
|
192 |
|
193 |
* [Critical] Bug Fix - [ERROR] (#100) actions should be a JSON-encoded dictionary with 'name' and 'link' keys
|
194 |
* Improvement/Bug Fix - Plugin will import all comments from Facebook posts, not just the first 100.
|
195 |
* Bug Fix - Plugin were re-posting the same "Sticky" post in some configurations.
|
196 |
|
197 |
+
= 3.1.1 [01/14/2014] =
|
198 |
|
199 |
* Improvement/Bug Fix - Update for Jan 14 Twitter API change - requirement for ONLY secured SSL connections
|
200 |
* Improvement/Bug Fix - Better compatibility with some WP Admin themes - like fixed missing "Update Settings" button
|