1 <?php |
1 <?php |
2 /* |
2 /* |
3 Plugin Name: Network Publisher |
3 Plugin Name: Network Publisher |
4 Plugin URI: http://wordpress.org/extend/plugins/network-publisher/ |
4 Plugin URI: http://wordpress.org/extend/plugins/network-publisher/ |
5 Description: Automatically publish your blog posts to multiple Social Networks including Twitter, Facebook Profile, Facebook Pages, LinkedIn, MySpace, Yammer, Yahoo, Identi.ca, and <a href="http://www.linksalpha.com/networks" target="_blank">more</a>. Click <a href="http://help.linksalpha.com/networks/getting-started">here</a> for instructions. Email us at post@linksalpha.com if you have any queries. |
5 Description: Automatically publish your blog posts to multiple Social Networks including Twitter, Facebook Profile, Facebook Pages, LinkedIn, MySpace, Yammer, Yahoo, Identi.ca, and <a href="http://www.linksalpha.com/networks" target="_blank">more</a>. Click <a href="http://help.linksalpha.com/networks/getting-started">here</a> for instructions. Email us at post@linksalpha.com if you have any queries. |
6 Version: 5.6 |
6 Version: 5.7.1 |
7 Author: linksalpha |
7 Author: linksalpha |
8 Author URI: http://www.linksalpha.com |
8 Author URI: http://www.linksalpha.com |
9 */ |
9 */ |
10 |
10 |
11 /* |
11 /* |
39 define('NETWORKPUB_ERROR_INVALID_URL', 'invalid url'); |
39 define('NETWORKPUB_ERROR_INVALID_URL', 'invalid url'); |
40 define('NETWORKPUB_ERROR_INVALID_KEY', 'invalid key'); |
40 define('NETWORKPUB_ERROR_INVALID_KEY', 'invalid key'); |
41 define('NETWORKPUB_CURRENTLY_PUBLISHING', __('You are currently Publishing your Blog to')); |
41 define('NETWORKPUB_CURRENTLY_PUBLISHING', __('You are currently Publishing your Blog to')); |
42 define('NETWORKPUB_SOCIAL_NETWORKS', __('Social Networks')); |
42 define('NETWORKPUB_SOCIAL_NETWORKS', __('Social Networks')); |
43 define('NETWORKPUB_SOCIAL_NETWORK', __('Social Network')); |
43 define('NETWORKPUB_SOCIAL_NETWORK', __('Social Network')); |
44 define('NETWORKPUB_PLUGIN_VERSION', '5.6'); |
44 define('NETWORKPUB_PLUGIN_VERSION', '5.7.1'); |
45 |
45 |
46 $networkpub_settings['api_key'] = array('label' => 'API Key:', 'type' => 'text', 'default' => ''); |
46 $networkpub_settings['api_key'] = array('label' => 'API Key:', 'type' => 'text', 'default' => ''); |
47 $networkpub_settings['id'] = array('label' => 'id', 'type' => 'text', 'default' => ''); |
47 $networkpub_settings['id'] = array('label' => 'id', 'type' => 'text', 'default' => ''); |
48 $options = get_option(NETWORKPUB_WIDGET_NAME_INTERNAL); |
48 $options = get_option(NETWORKPUB_WIDGET_NAME_INTERNAL); |
49 |
49 |
50 /** |
50 /** |
51 * This is the intialization function |
51 * This is the intialization function |
52 */ |
52 */ |
53 |
|
54 function networkpub_init() { |
53 function networkpub_init() { |
55 networkpub_options(); |
54 networkpub_options(); |
56 //Following will run only if the user is admin of wordpress |
55 //Following will run only if the user is admin of wordpress |
57 if (is_admin()) { |
56 if (is_admin()) { |
58 //Enqueue css and js bundled with wordpress |
57 //Enqueue css and js bundled with wordpress |
98 add_action('save_post', 'networkpub_post_publish_status', 4, 2); |
97 add_action('save_post', 'networkpub_post_publish_status', 4, 2); |
99 add_action('save_post', 'networkpub_save_post_meta_box', 5, 2); |
98 add_action('save_post', 'networkpub_save_post_meta_box', 5, 2); |
100 add_action('wp_head', 'networkpub_add_metatags'); |
99 add_action('wp_head', 'networkpub_add_metatags'); |
101 add_filter('language_attributes', 'networkpub_html_schema'); |
100 add_filter('language_attributes', 'networkpub_html_schema'); |
102 |
101 |
|
102 |
103 function networkpub_options() { |
103 function networkpub_options() { |
104 $options = get_option(NETWORKPUB_WIDGET_NAME_INTERNAL); |
104 $options = get_option(NETWORKPUB_WIDGET_NAME_INTERNAL); |
105 if (!array_key_exists('networkpub_auth_error_show', $options)) { |
105 if (!array_key_exists('networkpub_auth_error_show', $options)) { |
106 $options['networkpub_auth_error_show'] = 1; |
106 $options['networkpub_auth_error_show'] = 1; |
107 } |
107 } |
138 if (!array_key_exists('networkpub_thumbnail_size', $options)) { |
138 if (!array_key_exists('networkpub_thumbnail_size', $options)) { |
139 $options['networkpub_thumbnail_size'] = 'medium'; |
139 $options['networkpub_thumbnail_size'] = 'medium'; |
140 } |
140 } |
141 if (!array_key_exists('networkpub_post_image_video', $options)) { |
141 if (!array_key_exists('networkpub_post_image_video', $options)) { |
142 $options['networkpub_post_image_video'] = 'image'; |
142 $options['networkpub_post_image_video'] = 'image'; |
|
143 } |
|
144 if (!array_key_exists('networkpub_install_extension_alert_show', $options)) { |
|
145 $options['networkpub_install_extension_alert_show'] = 1; |
143 } |
146 } |
144 update_option(NETWORKPUB_WIDGET_NAME_INTERNAL, $options); |
147 update_option(NETWORKPUB_WIDGET_NAME_INTERNAL, $options); |
145 } |
148 } |
146 |
149 |
147 function networkpub_actlinks($links) { |
150 function networkpub_actlinks($links) { |
180 } else { |
183 } else { |
181 $inputs_disabled = ''; |
184 $inputs_disabled = ''; |
182 } |
185 } |
183 //HTML |
186 //HTML |
184 $html = ''; |
187 $html = ''; |
|
188 //Extension download |
|
189 $networkpub_install_extension_alert_show = $options['networkpub_install_extension_alert_show']; |
|
190 if($networkpub_install_extension_alert_show) { |
|
191 global $is_gecko, $is_safari, $is_chrome; |
|
192 $html .= '<div style="display: none;" id="linksalpha_post_download_chrome" class="misc-pub-section networkpublisher_post_meta_box_first"><img src="//lh4.ggpht.com/RcHmTiAjiRPW5GSamTaet1etjiNYaeHVT2yOtEsJDEs9IRWTdt1P64zpDmh6XzAbN4HH9byl9YhgTK_NbcXq=s16" style="vertical-align: text-bottom" /> Install <a class="linksalpha_post_download_chrome_link" target="_blank" href="https://chrome.google.com/webstore/detail/ffifmkcjncgmnnmkedgkiabklmjdmpgi">Post extension for Chrome</a>.</div>'; |
|
193 $html .= '<div style="display: none;" id="linksalpha_post_download_firefox" class="misc-pub-section networkpublisher_post_meta_box_first"><img src="//lh5.ggpht.com/HE6TEsIgCGZgRKAZJ8SI1Yq7rGGxy5s_TQhleiphoEY2QFye1OlFRm8r_6JmGq4OUfHq07OE2dk6XeHWcYyU=s16" style="vertical-align: text-bottom" /> Install <a class="linksalpha_post_download_firefox_link" href="http://www.linksalpha.com/files/post.xpi">Post extension for Firefox</a>.</div>'; |
|
194 $html .= '<div style="display: none;" id="linksalpha_post_download_safari" class="misc-pub-section networkpublisher_post_meta_box_first"><img src="//lh6.ggpht.com/4FQoS1Pn8OQOlahH5ESbjJv8iuVPV2If34-fABfBWcrJLUja5wiyLgWAekHWEuk_WaZg_iU9bf4Jli07WDQrRQ=s16" style="vertical-align: text-bottom" /> Install <a class="linksalpha_post_download_safari_link" href="http://www.linksalpha.com/files/post.safariextz">Post extension for Safari</a>.</div>'; |
|
195 if($is_gecko) { |
|
196 $browser = 'firefox'; |
|
197 } elseif($is_chrome) { |
|
198 $browser = 'chrome'; |
|
199 } elseif($is_safari) { |
|
200 $browser = 'safari'; |
|
201 } else { |
|
202 $browser = ''; |
|
203 } |
|
204 $html .= '<input type="hidden" name="linksalpha_browser" id="linksalpha_browser" value="'.$browser.'" autocomplete="off" />'; |
|
205 } |
185 //Publish |
206 //Publish |
186 $curr_val_publish = get_post_meta($object->ID, '_networkpub_meta_publish', true); |
207 $curr_val_publish = get_post_meta($object->ID, '_networkpub_meta_publish', true); |
187 if ($curr_val_publish == '') { |
208 if ($curr_val_publish == '') { |
188 $curr_val_publish = 1; |
209 $curr_val_publish = 1; |
189 } |
210 } |
190 $html .= '<div class="misc-pub-section">'; |
211 $html .= '<div class="misc-pub-section networkpublisher_post_meta_box_first">'; |
191 $html_label = ' <label for="networkpub_meta_cb_publish">' . __('Publish this') . ' <i>' . $this_post_type .'</i>'. __(' to') . ' <a href="' . NETWORKPUB_PLUGIN_ADMIN_URL . '">' . __('configured Networks') . '</a></label>'; |
212 $html_label = ' <label for="networkpub_meta_cb_publish">' . __('Publish this') . ' <i>' . $this_post_type .'</i>'. __(' to') . ' <a href="' . NETWORKPUB_PLUGIN_ADMIN_URL . '">' . __('configured Networks') . '</a></label>'; |
192 $html_label_type_disabled = ' <label for="networkpub_meta_cb_publish" style="background-color:yellow;">' . __('Publishing of') . ' <i>' . $this_post_type .'</i>'. ' <a href="http://codex.wordpress.org/Post_Types" target="_blank">' . __('Post Type') . '</a>' . __(' to') . ' <a href="' . NETWORKPUB_PLUGIN_ADMIN_URL . '">' . __('configured Networks') . '</a>' . ' ' . __('has been disabled. ') . '<a href="' . NETWORKPUB_PLUGIN_ADMIN_URL . '#setting_networkpub_post_types">' . __('Click Here') . '</a>' . __(' to enable again.') . '</label>'; |
213 $html_label_type_disabled = ' <label for="networkpub_meta_cb_publish" style="background-color:yellow;">' . __('Publishing of') . ' <i>' . $this_post_type .'</i>'. ' <a href="http://codex.wordpress.org/Post_Types" target="_blank">' . __('Post Type') . '</a>' . __(' to') . ' <a href="' . NETWORKPUB_PLUGIN_ADMIN_URL . '">' . __('configured Networks') . '</a>' . ' ' . __('has been disabled. ') . '<a href="' . NETWORKPUB_PLUGIN_ADMIN_URL . '#setting_networkpub_post_types">' . __('Click Here') . '</a>' . __(' to enable again.') . '</label>'; |
193 if ($curr_val_publish) { |
214 if ($curr_val_publish) { |
194 if (array_key_exists('networkpub_post_types', $options)) { |
215 if (array_key_exists('networkpub_post_types', $options)) { |
195 if (in_array($this_post_type, explode(',', $options['networkpub_post_types']))) { |
216 if (in_array($this_post_type, explode(',', $options['networkpub_post_types']))) { |
216 //Message |
237 //Message |
217 $curr_val_message = get_post_meta($object->ID, 'networkpub_postmessage', true); |
238 $curr_val_message = get_post_meta($object->ID, 'networkpub_postmessage', true); |
218 $html .= '<div class="misc-pub-section">'; |
239 $html .= '<div class="misc-pub-section">'; |
219 $html .= '<div class="networkpublisher_post_meta_box_label_box"><label class="networkpublisher_post_meta_box_label" for="networkpub_postmessage"><a target="_blank" href="http://help.linksalpha.com/wordpress-plugin-network-publisher/message">'. __('Message').'</a>'.(' to be included in the post:') . '</label></div>'; |
240 $html .= '<div class="networkpublisher_post_meta_box_label_box"><label class="networkpublisher_post_meta_box_label" for="networkpub_postmessage"><a target="_blank" href="http://help.linksalpha.com/wordpress-plugin-network-publisher/message">'. __('Message').'</a>'.(' to be included in the post:') . '</label></div>'; |
220 $html .= '<textarea ' . $inputs_disabled . ' name="networkpub_postmessage" id="networkpub_postmessage">' . $curr_val_message . '</textarea>'; |
241 $html .= '<textarea ' . $inputs_disabled . ' name="networkpub_postmessage" id="networkpub_postmessage">' . $curr_val_message . '</textarea>'; |
|
242 $html .= '</div>'; |
|
243 //Summary |
|
244 $curr_val_summary = get_post_meta($object->ID, 'networkpub_postsummary', true); |
|
245 $html .= '<div class="misc-pub-section">'; |
|
246 $html .= '<div class="networkpublisher_post_meta_box_label_box"><label class="networkpublisher_post_meta_box_label" for="networkpub_postsummary"><a target="_blank" href="http://help.linksalpha.com/wordpress-plugin-network-publisher/summary">'. __('Summary').'</a>'.(' to be included in the post:') . '</label></div>'; |
|
247 $html .= '<textarea ' . $inputs_disabled . ' name="networkpub_postsummary" id="networkpub_postsummary">' . $curr_val_summary . '</textarea>'; |
221 $html .= '</div>'; |
248 $html .= '</div>'; |
222 //Twitter handle |
249 //Twitter handle |
223 $curr_val_twitterhandle = get_post_meta($object->ID, 'networkpub_twitterhandle', true); |
250 $curr_val_twitterhandle = get_post_meta($object->ID, 'networkpub_twitterhandle', true); |
224 $html .= '<div class="misc-pub-section">'; |
251 $html .= '<div class="misc-pub-section">'; |
225 $html .= '<div class="networkpublisher_post_meta_box_label_box"><label class="networkpublisher_post_meta_box_label" for="networkpub_twitterhandle">@<a target="_blank" href="http://help.linksalpha.com/wordpress-plugin-network-publisher/twitter-handle">' .__('Twitter handles').'</a>'.__(' to mention in the post:') . '</label></div>'; |
252 $html .= '<div class="networkpublisher_post_meta_box_label_box"><label class="networkpublisher_post_meta_box_label" for="networkpub_twitterhandle">@<a target="_blank" href="http://help.linksalpha.com/wordpress-plugin-network-publisher/twitter-handle">' .__('Twitter handles').'</a>'.__(' to mention in the post:') . '</label></div>'; |
276 if (in_array($networkpub_meta_published, array('failed', 'done'))) { |
303 if (in_array($networkpub_meta_published, array('failed', 'done'))) { |
277 $html .= '<div class="misc-pub-section">'; |
304 $html .= '<div class="misc-pub-section">'; |
278 } else { |
305 } else { |
279 $html .= '<div class="misc-pub-section" style="border-bottom:0px;padding-bottom:0px;">'; |
306 $html .= '<div class="misc-pub-section" style="border-bottom:0px;padding-bottom:0px;">'; |
280 } |
307 } |
281 $html .= '<div class="networkpublisher_post_meta_box">'; |
308 $html .= '<div class="networkpublisher_post_meta_box_label_box">'; |
282 if ($curr_val_content) { |
309 if ($curr_val_content) { |
283 $html .= '<input type="checkbox" name="networkpub_meta_cb_content" id="networkpub_meta_cb_content" checked ' . $inputs_disabled . ' />'; |
310 $html .= '<input type="checkbox" name="networkpub_meta_cb_content" id="networkpub_meta_cb_content" checked ' . $inputs_disabled . ' />'; |
284 } else { |
311 } else { |
285 $html .= '<input type="checkbox" name="networkpub_meta_cb_content" id="networkpub_meta_cb_content" ' . $inputs_disabled . ' />'; |
312 $html .= '<input type="checkbox" name="networkpub_meta_cb_content" id="networkpub_meta_cb_content" ' . $inputs_disabled . ' />'; |
286 } |
313 } |
287 $html .= ' <label for="networkpub_meta_cb_content">' . __('Use Excerpt for publishing to Networks') . '</label>'; |
314 $html .= ' <label for="networkpub_meta_cb_content">' . __('Use Excerpt for publishing to Networks') . '</label>'; |
288 $html .= '</div>'; |
315 $html .= '</div>'; |
289 $html .= '</div>'; |
316 $html .= '</div>'; |
290 //Content Sent successfully |
317 //Content Sent successfully |
291 if ($networkpub_meta_published == 'failed') { |
318 if ($networkpub_meta_published == 'failed') { |
292 $html .= '<div class="misc-pub-section" style="border-bottom:0px;padding-bottom:0px;">'; |
319 $html .= '<div class="misc-pub-section">'; |
293 $html .= '<div class="networkpublisher_post_meta_box" style="color:red;"><img src="' . NETWORKPUB_WP_PLUGIN_URL . 'alert.png" /> ' . __('Post to social networks failed.') . '</div>'; |
320 $html .= '<div class="networkpublisher_post_meta_box_label_box" style="color:red;"><img src="' . NETWORKPUB_WP_PLUGIN_URL . 'alert.png" /> ' . __('Post to social networks failed.') . '</div>'; |
294 $html .= '</div>'; |
321 $html .= '</div>'; |
295 } elseif ($networkpub_meta_published == 'done') { |
322 } elseif ($networkpub_meta_published == 'done') { |
|
323 $html .= '<div class="misc-pub-section">'; |
|
324 $html .= '<div class="networkpublisher_post_meta_box_label_box" style="color:green;"><input type="checkbox" checked disabled="disabled" /> <label for="networkpub_meta_cb_content">' . __('Data sent successfully.') . '</label></div>'; |
|
325 $html .= '</div>'; |
|
326 } |
|
327 if(in_array($networkpub_meta_published, array('failed', 'done'))) { |
296 $html .= '<div class="misc-pub-section" style="border-bottom:0px;padding-bottom:0px;">'; |
328 $html .= '<div class="misc-pub-section" style="border-bottom:0px;padding-bottom:0px;">'; |
297 $html .= '<div class="networkpublisher_post_meta_box" style="color:green;"><input type="checkbox" checked disabled="disabled" /> <label for="networkpub_meta_cb_content">' . __('Data sent successfully.') . '</label></div>'; |
329 $html .= '<input type="button" class="button-primary" id="networkpub_post_update" value="Post an Update">'; |
|
330 $post_data = networkpub_get_post_data_republish($object); |
|
331 $post_data_string = http_build_query($post_data); |
|
332 $html .= '<input type="hidden" id="networkpub_post_data" value="'.$post_data_string.'">'; |
298 $html .= '</div>'; |
333 $html .= '</div>'; |
299 } |
334 } |
300 //nonce |
335 //nonce |
301 $html .= '<input type="hidden" name="networkpub_meta_nonce" value="' . wp_create_nonce(plugin_basename(__FILE__)) . '" />'; |
336 $html .= '<input type="hidden" name="networkpub_meta_nonce" value="' . wp_create_nonce(plugin_basename(__FILE__)) . '" />'; |
302 //Return |
337 //Return |
323 if ($_POST['networkpub_postmessage']) { |
358 if ($_POST['networkpub_postmessage']) { |
324 $new_meta_value_postmessage = strip_tags($_POST['networkpub_postmessage']); |
359 $new_meta_value_postmessage = strip_tags($_POST['networkpub_postmessage']); |
325 } |
360 } |
326 } |
361 } |
327 update_post_meta($post_id, 'networkpub_postmessage', $new_meta_value_postmessage); |
362 update_post_meta($post_id, 'networkpub_postmessage', $new_meta_value_postmessage); |
|
363 #Summary |
|
364 $new_meta_value_postsummary = ''; |
|
365 if (!empty($_POST['networkpub_postsummary'])) { |
|
366 if ($_POST['networkpub_postsummary']) { |
|
367 $new_meta_value_postsummary = strip_tags($_POST['networkpub_postsummary']); |
|
368 } |
|
369 } |
|
370 update_post_meta($post_id, 'networkpub_postsummary', $new_meta_value_postsummary); |
328 #Twitter Handle |
371 #Twitter Handle |
329 $new_meta_value_twitterhandle = ''; |
372 $new_meta_value_twitterhandle = ''; |
330 if (!empty($_POST['networkpub_twitterhandle'])) { |
373 if (!empty($_POST['networkpub_twitterhandle'])) { |
331 if ($_POST['networkpub_twitterhandle']) { |
374 if ($_POST['networkpub_twitterhandle']) { |
332 $new_meta_value_twitterhandle = strip_tags($_POST['networkpub_twitterhandle']); |
375 $new_meta_value_twitterhandle = strip_tags($_POST['networkpub_twitterhandle']); |
381 if (empty($options['api_key'])) { |
424 if (empty($options['api_key'])) { |
382 if (!isset($_POST['submit'])) { |
425 if (!isset($_POST['submit'])) { |
383 echo ' |
426 echo ' |
384 <div class="updated fade" style="padding:10px;text-align:left"> |
427 <div class="updated fade" style="padding:10px;text-align:left"> |
385 <div style="font-weight:bold;"><a href="http://wordpress.org/extend/plugins/network-publisher/" target="_blank">' . NETWORKPUB_WIDGET_NAME . '</a> ' . __('plugin is almost ready.') . '</div> |
428 <div style="font-weight:bold;"><a href="http://wordpress.org/extend/plugins/network-publisher/" target="_blank">' . NETWORKPUB_WIDGET_NAME . '</a> ' . __('plugin is almost ready.') . '</div> |
386 <div>' . __('You must') . ' <a href="' . NETWORKPUB_PLUGIN_ADMIN_URL . '">' . __('enter API key') . '</a> ' . __(' on the settings page for plugin') . ' ' . NETWORKPUB_WIDGET_NAME . ' ' . __('for automatic posting of your blog articles to 20+ Social Networks including Twitter, Facebook Profile, Facebook Pages, LinkedIn, MySpace, Yammer, Yahoo, Identi.ca, and more to work') . '</div> |
429 <div>' . __('You must') . ' <a href="' . NETWORKPUB_PLUGIN_ADMIN_URL . '">' . __('enter API key') . '</a> ' . __(' on the settings page for plugin') . ' ' . NETWORKPUB_WIDGET_NAME . ' ' . __('for automatic posting of your blog articles to 20+ Social Networks including Twitter, Facebook Profile, Facebook Pages, LinkedIn, MySpace, Yammer, Yahoo, Identi.ca, and more.') . '</div> |
387 </div>'; |
430 </div>'; |
388 } |
431 } |
389 } |
432 } |
390 } |
433 } |
391 |
434 |
573 $days = floor($diff / (60 * 60 * 24)); |
616 $days = floor($diff / (60 * 60 * 24)); |
574 if ($days > 3) { |
617 if ($days > 3) { |
575 return; |
618 return; |
576 } |
619 } |
577 $post_message = get_post_meta($post_id, 'networkpub_postmessage', true); |
620 $post_message = get_post_meta($post_id, 'networkpub_postmessage', true); |
|
621 $post_summary = get_post_meta($post_id, 'networkpub_postsummary', true); |
578 $post_twitterhandle = get_post_meta($post_id, 'networkpub_twitterhandle', true); |
622 $post_twitterhandle = get_post_meta($post_id, 'networkpub_twitterhandle', true); |
579 $post_twitterhash = get_post_meta($post_id, 'networkpub_twitterhash', true); |
623 $post_twitterhash = get_post_meta($post_id, 'networkpub_twitterhash', true); |
580 $post_ogtypefacebook = get_post_meta($post_id, 'networkpub_ogtype_facebook', true); |
624 $post_ogtypefacebook = get_post_meta($post_id, 'networkpub_ogtype_facebook', true); |
581 $networkpub_meta_publish = get_post_meta($post_id, '_networkpub_meta_publish', true); |
625 $networkpub_meta_publish = get_post_meta($post_id, '_networkpub_meta_publish', true); |
582 $networkpub_post_image_video = get_post_meta($post_id, 'networkpub_post_image_video', true); |
626 $networkpub_post_image_video = get_post_meta($post_id, 'networkpub_post_image_video', true); |
633 'post_tags' => $post_tags, |
677 'post_tags' => $post_tags, |
634 'post_geotag' => $post_geotag, |
678 'post_geotag' => $post_geotag, |
635 'twitterhandle' => $post_twitterhandle, |
679 'twitterhandle' => $post_twitterhandle, |
636 'hashtag' => $post_twitterhash, |
680 'hashtag' => $post_twitterhash, |
637 'content_message' => $post_message, |
681 'content_message' => $post_message, |
|
682 'content_summary' => $post_summary, |
638 'post_image_video' => $networkpub_post_image_video, |
683 'post_image_video' => $networkpub_post_image_video, |
639 ); |
684 ); |
640 $post_image = networkpub_thumbnail_link($post_id, $post_data['post_content']); |
685 $post_image = networkpub_thumbnail_link($post_id, $post_data['post_content']); |
641 if ($post_image) { |
686 if ($post_image) { |
642 $params['post_image'] = $post_image; |
687 $params['post_image'] = $post_image; |
772 $networkpub_thumbnail_size = strip_tags($_POST['networkpub_thumbnail_size']); |
817 $networkpub_thumbnail_size = strip_tags($_POST['networkpub_thumbnail_size']); |
773 } else { |
818 } else { |
774 $networkpub_thumbnail_size = 'medium'; |
819 $networkpub_thumbnail_size = 'medium'; |
775 } |
820 } |
776 networkpub_update_option('networkpub_thumbnail_size', $networkpub_thumbnail_size); |
821 networkpub_update_option('networkpub_thumbnail_size', $networkpub_thumbnail_size); |
|
822 } elseif ($_POST['networkpub_form_type'] == 'networkpub_install_extension_alert_show') { |
|
823 if (array_key_exists('networkpub_install_extension_alert_show', $_POST)) { |
|
824 $networkpub_install_extension_alert_show = 1; |
|
825 } else { |
|
826 $networkpub_install_extension_alert_show = 0; |
|
827 } |
|
828 networkpub_update_option('networkpub_install_extension_alert_show', $networkpub_install_extension_alert_show); |
777 } |
829 } |
778 } |
830 } |
779 } |
831 } |
780 if (!empty($_GET['linksalpha_request_type'])) { |
832 if (!empty($_GET['linksalpha_request_type'])) { |
781 if ($_GET['linksalpha_request_type'] == 'get_posts') { |
833 if ($_GET['linksalpha_request_type'] == 'get_posts') { |
868 } |
920 } |
869 if (array_key_exists('networkpub_thumbnail_size', $options)) { |
921 if (array_key_exists('networkpub_thumbnail_size', $options)) { |
870 $networkpub_thumbnail_size = $options['networkpub_thumbnail_size']; |
922 $networkpub_thumbnail_size = $options['networkpub_thumbnail_size']; |
871 } else { |
923 } else { |
872 $networkpub_thumbnail_size = 'medium'; |
924 $networkpub_thumbnail_size = 'medium'; |
|
925 } |
|
926 if (array_key_exists('networkpub_install_extension_alert_show', $options)) { |
|
927 $networkpub_install_extension_alert_show = $options['networkpub_install_extension_alert_show']; |
|
928 if ($networkpub_install_extension_alert_show) { |
|
929 $networkpub_install_extension_alert_show = 'checked'; |
|
930 } else { |
|
931 $networkpub_install_extension_alert_show = ''; |
|
932 } |
|
933 } else { |
|
934 $networkpub_install_extension_alert_show = 'checked'; |
873 } |
935 } |
874 } else { |
936 } else { |
875 $networkpub_enable = 'checked'; |
937 $networkpub_enable = 'checked'; |
876 $networkpub_auth_error_show = 'checked'; |
938 $networkpub_auth_error_show = 'checked'; |
877 $networkpub_mixed_mode_alert_show = 'checked'; |
939 $networkpub_mixed_mode_alert_show = 'checked'; |
882 $networkpub_metatags_googleplus = 'checked'; |
944 $networkpub_metatags_googleplus = 'checked'; |
883 $networkpub_googleplus_page_type = 'Article'; |
945 $networkpub_googleplus_page_type = 'Article'; |
884 $networkpub_custom_field_image = ''; |
946 $networkpub_custom_field_image = ''; |
885 $networkpub_custom_field_image_url = ''; |
947 $networkpub_custom_field_image_url = ''; |
886 $networkpub_thumbnail_size = 'medium'; |
948 $networkpub_thumbnail_size = 'medium'; |
|
949 $networkpub_install_extension_alert_show = 'checked'; |
887 } |
950 } |
888 $fb_langs = networkpub_fb_langs(); |
951 $fb_langs = networkpub_fb_langs(); |
889 $fb_langs_options = ''; |
952 $fb_langs_options = ''; |
890 asort($fb_langs); |
953 asort($fb_langs); |
891 foreach ($fb_langs as $key => $val) { |
954 foreach ($fb_langs as $key => $val) { |
932 <div class="wrap"> |
995 <div class="wrap"> |
933 <div style="width:76%;float:left;"> |
996 <div style="width:76%;float:left;"> |
934 <div class="networkpublisher_share_box"> |
997 <div class="networkpublisher_share_box"> |
935 <table> |
998 <table> |
936 <tr> |
999 <tr> |
937 <td> |
1000 <td class="networkpublisher_share_box_left"> |
938 <a href="' . networkpub_postbox_url() . '">' . __('Postbox') . '</a> | ' . __('Share') . ' |
1001 <span>Install Browser Extension </span> |
|
1002 <span><img src="//lh4.ggpht.com/RcHmTiAjiRPW5GSamTaet1etjiNYaeHVT2yOtEsJDEs9IRWTdt1P64zpDmh6XzAbN4HH9byl9YhgTK_NbcXq=s16" style="vertical-align: text-bottom" /> <a target="_blank" href="https://chrome.google.com/webstore/detail/ffifmkcjncgmnnmkedgkiabklmjdmpgi">Chrome</a></span> |
|
1003 <span><img src="//lh5.ggpht.com/HE6TEsIgCGZgRKAZJ8SI1Yq7rGGxy5s_TQhleiphoEY2QFye1OlFRm8r_6JmGq4OUfHq07OE2dk6XeHWcYyU=s16" style="vertical-align: text-bottom" /> <a href="http://www.linksalpha.com/files/post.xpi">Firefox</a></span> |
|
1004 <span><img src="//lh6.ggpht.com/4FQoS1Pn8OQOlahH5ESbjJv8iuVPV2If34-fABfBWcrJLUja5wiyLgWAekHWEuk_WaZg_iU9bf4Jli07WDQrRQ=s16" style="vertical-align: text-bottom" /> <a href="http://www.linksalpha.com/files/post.safariextz">Safari</a></span> |
939 </td> |
1005 </td> |
940 <td> |
1006 <td class="networkpublisher_share_box_right"> |
941 <div class="linksalpha-email-button" id="linksalpha_tag_208867858" data-url="http://www.linksalpha.com" data-text="LinksAlpha - Making Social Media Easy!" data-desc="LinksAlpha provides quick and easy way for companies and users to connect and share on social web. Using LinksAlpha tools, you can integrate Social Media Buttons into your website, Publish your Website Content Automatically to Social Media Sites, and Track Social Media Profiles, all from one place." data-image="http://www.linksalpha.com/images/LALOGO_s175.png"></div> |
1007 <table> |
942 <script type="text/javascript" src="http://www.linksalpha.com/social/loader?tag_id=linksalpha_tag_208867858&fblikefont=arial&vkontakte=1&livejournal=1&twitter=1&xinglang=de&linkedin=1&tumblr=1&hyves=1&fblikelang=en_US&delicious=1&twitterw=110&gpluslang=en-US&gmail=1&weibo=1&posterous=1&xing=1&sonico=1&twitterlang=en&pinterest=1&myspace=1&msn=1&print=1&mailru=1&email=1&counters=googleplus%2Cfacebook%2Clinkedin%2Ctwitter&reddit=1&hotmail=1&netlog=1&twitterrelated=linksalpha&aolmail=1&link=http%3A%2F%2Fwww.linksalpha.com&diigo=1&evernote=1&digg=1&yahoomail=1&yammer=1&stumbleupon=1&instapaper=1&facebookw=90&googleplus=1&fblikeverb=like&fblikeref=linksalpha&halign=left&readitlater=1&v=2&facebook=1&button=googleplus%2Cfacebook%2Clinkedin%2Ctwitter&identica=1"></script> |
1008 <tr> |
|
1009 <td> |
|
1010 <span style="float:right"> |
|
1011 <div class="linksalpha-email-button" id="linksalpha_tag_208867858" data-url="http://www.linksalpha.com" data-text="LinksAlpha - Making Social Media Easy!" data-desc="LinksAlpha provides quick and easy way for companies and users to connect and share on social web. Using LinksAlpha tools, you can integrate Social Media Buttons into your website, Publish your Website Content Automatically to Social Media Sites, and Track Social Media Profiles, all from one place." data-image="http://www.linksalpha.com/images/LALOGO_s175.png"></div> |
|
1012 <script type="text/javascript" src="http://www.linksalpha.com/social/loader?tag_id=linksalpha_tag_208867858&fblikefont=arial&vkontakte=1&livejournal=1&twitter=1&xinglang=de&linkedin=1&tumblr=1&hyves=1&fblikelang=en_US&delicious=1&twitterw=110&gpluslang=en-US&gmail=1&weibo=1&posterous=1&xing=1&sonico=1&twitterlang=en&pinterest=1&myspace=1&msn=1&print=1&mailru=1&email=1&counters=googleplus%2Cfacebook%2Clinkedin%2Ctwitter&reddit=1&hotmail=1&netlog=1&twitterrelated=linksalpha&aolmail=1&link=http%3A%2F%2Fwww.linksalpha.com&diigo=1&evernote=1&digg=1&yahoomail=1&yammer=1&stumbleupon=1&instapaper=1&facebookw=90&googleplus=1&fblikeverb=like&fblikeref=linksalpha&halign=left&readitlater=1&v=2&facebook=1&button=googleplus%2Cfacebook%2Clinkedin%2Ctwitter&identica=1"></script> |
|
1013 </span> |
|
1014 <span>' . __('Share') . ' </span> |
|
1015 </td> |
|
1016 </tr> |
|
1017 </table> |
943 </td> |
1018 </td> |
944 </tr> |
1019 </tr> |
945 </table> |
1020 </table> |
946 </div> |
1021 </div> |
947 <div> |
1022 <div>'; |
948 <div class="networkpublisher_started"> |
1023 if (empty($options['api_key'])) { |
|
1024 $html .= '<div class="networkpublisher_started"> |
949 <div style="padding:0px 0px 5px 0px;"><strong>' . __('Network Publisher') . '</strong> ' . __('makes it easy to Publish your Blog Posts to Social Networks. To configure:') . '</div> |
1025 <div style="padding:0px 0px 5px 0px;"><strong>' . __('Network Publisher') . '</strong> ' . __('makes it easy to Publish your Blog Posts to Social Networks. To configure:') . '</div> |
950 <div><b>1.</b> ' . __('Connect to your Social Networks at') . ' <a target="_blank" href="http://www.linksalpha.com/networks">' . __('LinksAlpha.com') . '</a></div> |
1026 <div><b>1.</b> ' . __('Connect to your Social Networks at') . ' <a target="_blank" href="http://www.linksalpha.com/networks">' . __('LinksAlpha.com') . '</a></div> |
951 <div><b>2.</b> ' . __('Get your') . ' <a target="_blank" href="http://www.linksalpha.com/account/your_api_key">' . __('User API Key') . '</a> ' . __('or') . ' <a target="_blank" href="http://www.linksalpha.com/networks">' . __('Network API Key') . '</a> ' . __('and enter it below.') . '</div> |
1027 <div><b>2.</b> ' . __('Get your') . ' <a target="_blank" href="http://www.linksalpha.com/account/your_api_key">' . __('User API Key') . '</a> ' . __('or') . ' <a target="_blank" href="http://www.linksalpha.com/networks">' . __('Network API Key') . '</a> ' . __('and enter it below.') . '</div> |
952 <div style="padding:5px 0px 0px 0px;">' . __('Once setup, your Blog posts content appears on the social networks as soon as you hit the Publish button.') . '</div> |
1028 <div style="padding:5px 0px 0px 0px;">' . __('Once setup, your Blog posts content appears on the social networks as soon as you hit the Publish button.') . '</div> |
953 <div>' . __('You can') . ' <a href="http://help.linksalpha.com/networks/getting-started" target="_blank">' . __('read more about this process at LinksAlpha.com.') . '</a></div> |
1029 <div>' . __('You can') . ' <a href="http://help.linksalpha.com/networks/getting-started" target="_blank">' . __('read more about this process at LinksAlpha.com.') . '</a></div> |
954 </div> |
1030 </div>'; |
955 <div class="networkpublisher_header"> |
1031 } |
|
1032 $html .= '<div class="networkpublisher_header"> |
956 <strong>' . __('Setup') . '</strong> |
1033 <strong>' . __('Setup') . '</strong> |
957 </div> |
1034 </div> |
958 <div style="padding-left:0px;margin-bottom:40px;"> |
1035 <div style="padding-left:0px;margin-bottom:40px;"> |
959 <div class="networkpublisher_content_box"> |
1036 <div class="networkpublisher_content_box"> |
960 <form action="" method="post"> |
1037 <form action="" method="post"> |
1229 </form> |
1309 </form> |
1230 </div> |
1310 </div> |
1231 </div> |
1311 </div> |
1232 </div> |
1312 </div> |
1233 </a> |
1313 </a> |
|
1314 <div style="padding:40px 0px 0px 0px;"> |
|
1315 <div class="networkpublisher_header"> |
|
1316 <strong>' . __('Show/Hide message to Install Browser Extension') . '</strong> |
|
1317 </div> |
|
1318 <div class="networkpublisher_content_box"> |
|
1319 <div style="padding-bottom:10px;"> |
|
1320 <form action="" method="post"> |
|
1321 <div> |
|
1322 <input type="checkbox" id="networkpub_install_extension_alert_show" name="networkpub_install_extension_alert_show" ' . $networkpub_install_extension_alert_show . ' /><label for="networkpub_install_extension_alert_show"> ' . __('Check this box to show the message in Network Publisher widget to install browser extension from LinksAlpha.com.') . ' <a target="_blank" href="http://www.linksalpha.com/downloads">' . __('Click Here') . '</a> ' . __('to learn more.') . '</label> |
|
1323 </div> |
|
1324 <div style="padding-top:5px;"> |
|
1325 <input type="hidden" name="networkpub_form_type" value="networkpub_install_extension_alert_show" /> |
|
1326 <input type="submit" name="submit" class="button-primary" value="' . __('Update') . '" /> |
|
1327 </div> |
|
1328 </form> |
|
1329 </div> |
|
1330 </div> |
|
1331 </div> |
1234 <div style="font-size:13px;margin:40px 0px 0px 0px;"> |
1332 <div style="font-size:13px;margin:40px 0px 0px 0px;"> |
1235 <div class="networkpublisher_header"> |
1333 <div class="networkpublisher_header"> |
1236 <strong>' . __('Note') . '</strong> |
1334 <strong>' . __('Note') . '</strong> |
1237 </div> |
1335 </div> |
1238 <div class="networkpublisher_content_box"> |
1336 <div class="networkpublisher_content_box"> |
1241 </div> |
1339 </div> |
1242 </div> |
1340 </div> |
1243 </div> |
1341 </div> |
1244 </div> |
1342 </div> |
1245 <div style="vertical-align:top;padding-left:2%;text-align:right;width:20%;float:left;"> |
1343 <div style="vertical-align:top;padding-left:2%;text-align:right;width:20%;float:left;"> |
1246 <div style="margin-bottom:20px;width:150px;margin-top:10px;float:right;"> |
|
1247 <a href="' . networkpub_postbox_url() . '" style="text-decoration:none;"> |
|
1248 <div class="networkpublisher_button_yellow">' . __('View Postbox') . '</div> |
|
1249 </a> |
|
1250 </div> |
|
1251 <div class="networkpub_clear_both"></div> |
1344 <div class="networkpub_clear_both"></div> |
1252 <div class="networkpublisher_header_3" style="float:right;margin-right:-20px;">' . __('Supported Networks') . '</div> |
1345 <div class="networkpublisher_header_3" style="float:right;margin-right:-35px;">' . __('Supported Networks') . '</div> |
1253 <div class="networkpub_clear_both"></div> |
1346 <div class="networkpub_clear_both"></div> |
1254 <div class="networkpublisher_content_box_3" style="float:right;margin-right:-20px;"> |
1347 <div class="networkpublisher_content_box_3" style="float:right;margin-right:-35px;"> |
1255 ' . networkpub_supported_networks() . ' |
1348 ' . networkpub_supported_networks() . ' |
1256 </div> |
1349 </div> |
1257 <div class="networkpub_clear_both"></div> |
1350 <div class="networkpub_clear_both"></div> |
1258 </div> |
1351 </div> |
1259 </div>'; |
1352 </div>'; |
2199 update_post_meta($post_id, 'networkpub_video_source', $response->results->source); |
2291 update_post_meta($post_id, 'networkpub_video_source', $response->results->source); |
2200 update_post_meta($post_id, 'networkpub_video_picture', $response->results->picture); |
2292 update_post_meta($post_id, 'networkpub_video_picture', $response->results->picture); |
2201 return; |
2293 return; |
2202 } |
2294 } |
2203 |
2295 |
|
2296 function networkpub_get_post_data_republish($p) { |
|
2297 $post_data = array(); |
|
2298 $post_data['page_url'] = get_permalink($p); |
|
2299 if($p->post_title) { |
|
2300 $post_data['page_title'] = networkpub_prepare_text($p->post_title); |
|
2301 } |
|
2302 if($p->post_content) { |
|
2303 $post_data['page_text'] = networkpub_prepare_text($p->post_content); |
|
2304 } |
|
2305 $page_url_image = networkpub_thumbnail_link($p->ID, $p->post_content); |
|
2306 if($page_url_image) { |
|
2307 $post_data['page_url_image'] = $page_url_image; |
|
2308 } |
|
2309 return $post_data; |
|
2310 } |
|
2311 |
2204 register_deactivation_hook(__FILE__, 'networkpub_deactivate'); |
2312 register_deactivation_hook(__FILE__, 'networkpub_deactivate'); |
2205 ?> |
2313 ?> |