diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/network-publisher/networkpub.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/wp-content/plugins/network-publisher/networkpub.php Thu Mar 18 09:56:33 2010 +0000 @@ -0,0 +1,236 @@ +'API Key:', 'type'=>'text', 'default'=>''); +$networkpub_settings['id'] = array('label'=>'id', 'type'=>'text', 'default'=>''); +$options = get_option(WIDGET_NAME_INTERNAL); + +function networkpub_init() { + wp_enqueue_script('jquery'); + wp_register_script('networkpubjs', WP_PLUGIN_URL .'/network-publisher/networkpub.js'); + wp_enqueue_script('networkpubjs'); + wp_register_style('networkpubcss', WP_PLUGIN_URL . '/network-publisher/networkpub.css'); + wp_enqueue_style('networkpubcss'); + add_action('admin_menu', 'networkpub_pages'); + add_action('{$new_status}_{$post->post_type}', 'networkping'); + add_action('publish_post', 'networkping'); +} + +add_action('init', 'networkpub_init'); +add_action('init', 'networkpub_remove'); + +function networkping($id) { + if(!$id) { + return FALSE; + } + $options = get_option(WIDGET_NAME_INTERNAL); + $link = 'http://www.linksalpha.com/a/ping?id='.$options['id']; + require_once(ABSPATH.WPINC.'/class-snoopy.php'); + $snoop = new Snoopy; + $snoop->agent = WIDGET_NAME.' - '.get_option('siteurl'); + $response = ''; + if($snoop->fetchtext($link)){ + if (strpos($snoop->response_code, '200')) { + return TRUE; + } + } + return FALSE; +} + +function networkpub_pages() { + if ( function_exists('add_submenu_page') ) { + $page = add_submenu_page('plugins.php', WIDGET_NAME, WIDGET_NAME, 'manage_options', 'networkpub', 'networkpub_conf'); + } +} + +function networkpub_conf() { + global $networkpub_settings; + + if ( isset($_POST['submit']) ) { + if ( function_exists('current_user_can') && !current_user_can('manage_options') ) { + die(__('Cheatin’ uh?')); + } + $field_name = sprintf('%s_%s', WIDGET_PREFIX, 'api_key'); + $value = strip_tags(stripslashes($_POST[$field_name])); + if($value) { + $networkadd = networkpub_add($value); + } + } + $options = get_option(WIDGET_NAME_INTERNAL); + $html = '
| ';
+ $html .= ' Network Publisher makes it easy and painless to Publish your Blog Posts to Social Networks. All you need to do is connect to your Social Networks at LinksAlpha.com, grab API Key for each enabled Network and enter it below. Once setup, your Blog posts content appears on the social networks as soon as you hit the Publish button. ';
+ $html .= 'Click Here to get API Keys for your Social Networks. You can read more about this process at LinksAlpha.com. ';
+ $html .= 'Setup ';
+ $html .= ' ';
+ $html .= ' |
| ';
+ $html .= ' Currently Publishing ';
+ $html .= ''.networkpub_load().' ';
+ $html .= ' |
| API Key | Network | Option | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| '.$row->api_key.' | Twitter Account - '.$row->name.' | '; + break; + case 'fb_page': + $html .= ''.$row->api_key.' | Facebook Page - '.$row->name.' | '; + break; + case 'fb_wall': + $html .= ''.$row->api_key.' | '.$row->name.' | '; + break; + case 'myspace': + $html .= ''.$row->api_key.' | MySpace Account - '.$row->name.' | '; + break; + case 'linkedin': + $html .= ''.$row->api_key.' | LinkedIn Account - '.$row->name.' | '; + break; + case 'yammer': + $html .= ''.$row->api_key.' | Yammer Account - '.$row->name.' | '; + break; + } + $html .= 'Remove |