more. Click here for instructions. Email us at post@linksalpha.com if you have any queries.
Version: 4.8
Author: LinksAlpha
Author URI: http://www.linksalpha.com
*/
/*
Copyright (C) 2010 LinksAlpha.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
define('NETWORKPUB_WP_PLUGIN_URL', networkpub_get_plugin_dir());
define('NETWORKPUB_PLUGIN_ADMIN_URL', __("plugins.php?page=networkpub"));
define('NETWORKPUB_WIDGET_NAME', 'Network Publisher');
define('NETWORKPUB_WIDGET_NAME_INTERNAL', 'networkpub');
define('NETWORKPUB_WIDGET_NAME_POSTBOX', 'Postbox');
define('NETWORKPUB_WIDGET_NAME_POSTBOX_INTERNAL', 'networkpubpostbox');
define('NETWORKPUB_WIDGET_PREFIX', 'networkpub');
define('NETWORKPUB', __('Automatically publish your blog posts to 30+ Social Networks including Facebook, Twitter, LinkedIn, Yahoo, Yammer, MySpace, Identi.ca'));
define('NETWORKPUB_ERROR_INTERNAL', 'internal error');
define('NETWORKPUB_ERROR_INVALID_URL', 'invalid url');
define('NETWORKPUB_ERROR_INVALID_KEY', 'invalid key');
define('NETWORKPUB_CURRENTLY_PUBLISHING', __('You are currently Publishing your Blog to'));
define('NETWORKPUB_SOCIAL_NETWORKS', __('Social Networks'));
define('NETWORKPUB_SOCIAL_NETWORK', __('Social Network'));
define('NETWORKPUB_PLUGIN_VERSION', '4.8');
$networkpub_settings['api_key'] = array('label'=>'API Key:', 'type'=>'text', 'default'=>'');
$networkpub_settings['id'] = array('label'=>'id', 'type'=>'text', 'default'=>'');
$options = get_option(NETWORKPUB_WIDGET_NAME_INTERNAL);
function networkpub_init() {
if ( is_admin() ) {
wp_enqueue_style('thickbox');
wp_enqueue_script('jquery');
wp_enqueue_script('thickbox');
wp_register_script('networkpubjs', NETWORKPUB_WP_PLUGIN_URL .'networkpub.js');
wp_enqueue_script('networkpubjs');
wp_register_script('postmessagejs', NETWORKPUB_WP_PLUGIN_URL .'jquery.ba-postmessage.min.js');
wp_enqueue_script('postmessagejs');
wp_register_style('networkpubcss', NETWORKPUB_WP_PLUGIN_URL . 'networkpub.css');
wp_enqueue_style('networkpubcss');
add_action('admin_menu', 'networkpub_pages');
add_action('activate_{$plugin}', 'networkpub_pushpresscheck');
add_action("activated_plugin", "networkpub_pushpresscheck");
register_deactivation_hook( __FILE__, 'networkpub_deactivate' );
}
}
add_action('init', 'networkpub_init');
register_activation_hook( __FILE__, 'networkpub_activate' );
add_action('admin_notices', 'networkpub_warning');
add_action('init', 'networkpub_remove');
add_action('init', 'networkpub_get_posts');
add_action('xmlrpc_publish_post', 'networkpub_ping');
add_action('{$new_status}_{$post->post_type}', 'networkpub_ping');
add_action('publish_post', 'networkpub_ping');
add_action('future_to_publish', 'networkpub_ping');
add_action('transition_post_status','networkpub_ping_custom', 12, 3);
add_action('xmlrpc_publish_post', 'networkpub_post_xmlrpc');
add_action('{$new_status}_{$post->post_type}', 'networkpub_post');
add_action('publish_post', 'networkpub_post');
add_action('future_to_publish', 'networkpub_post');
add_action('transition_post_status','networkpub_post_custom', 12, 3);
add_action('{$new_status}_{$post->post_type}', 'networkpub_convert');
add_action('publish_post', 'networkpub_convert');
add_action('future_to_publish', 'networkpub_convert');
add_action('admin_menu', 'networkpub_create_post_meta_box' );
add_action('save_post', 'networkpub_save_post_meta_box', 5, 2 );
add_action('save_post', 'networkpub_post_publish_status', 4, 2 );
// Add a link to this plugin's settings page
function networkpub_actlinks( $links ) {
$settings_link = 'Settings';
array_unshift( $links, $settings_link );
return $links;
}
$plugin = plugin_basename(__FILE__);
add_filter("plugin_action_links_$plugin", 'networkpub_actlinks' );
function networkpub_create_post_meta_box() {
add_meta_box( 'networkpub_meta_box', 'Network Publisher', 'networkpub_post_meta_box', 'post', 'side', 'high' );
}
function networkpub_post_meta_box( $object, $box ) {
//Published State
$networkpub_meta_published = get_post_meta( $object->ID, '_networkpub_meta_published', true );
if(in_array($networkpub_meta_published, array('done','failed'))) {
$inputs_disabled = 'disabled="disabled"';
} else {
$inputs_disabled = '';
}
//Publish
$curr_val_publish = get_post_meta( $object->ID, '_networkpub_meta_publish', true );
if($curr_val_publish == '') {
$curr_val_publish = 1;
}
$html = '
".__('Network Publisher plugin is almost ready.')." ".
sprintf(__('You must enter API key (under Plugins->Network Publisher) for automatic posting of your blog articles to 30+ Social Networks including Twitter, Facebook Profile, Facebook Pages, LinkedIn, MySpace, Yammer, Yahoo, Identi.ca, etc. to work.'),
"plugins.php?page=networkpub")."
You should typically use this option when you are making mass updates to your posts to prevent them from getting published to the configured networks
Deactivating the plugin will not disable publishing. You need to use this checkbox to disable publishing
Note
If you decide to stop using this plugin permanently, please remove your blog URL from LinksAlpha Website Manager. Otherwise, your blog posts may continue to get posted even after you remove this plugin.
';
return $html;
break;
case 'invalid url':
$html = '
'.__('Your blog URL is invalid').':'.$arr_errCodes[$errCodesCount-1];
if($errCodesCount == 3) {
$html .= '. '.__('Error Code').' ='.$arr_errCodes[$errCodesCount-2];
}
$html .= '
'.__('You can also').' '.__('Click here').''.__(' to enter blog URL on LinksAlpha manually.
Also ensure that in ').''.__('Settings').'->'.__('General').'->"'.__('Blog address (URL)').'" '.__('the URL is filled-in correctly').'.
'.__('If you still face issues then email us at').' post@linksalpha.com '.__('with error description').'.
'.__('You are trying to use the plugin on ').'localhost '.__('or behind a').' '.__('firewall').', '.__('which is not supported. Please install the plugin on a Wordpress blog on a live server').'.
'.__('Description:').''.__('Please try again').'. '.__('Your site either did not respond (it is extremely slow) or it is not operational').'.
'.__('You can also').' '.__('Click here').' '.__('to enter blog URL on LinksAlpha manually').'.
'.__('Also ensure that in').' '.__('Settings').'->'.__('General').'->"'.__('Blog address (URL)').'" '.__('the URL is filled-in correctly').'.
';
return $html;
break;
case 'feed not found':
$html ='
'.__('We could not find feed URL for your blog').'.
'.__('Click here').' '.__('to enter feed URL on LinksAlpha manually').'.
'.__('Also ensure that in ').''.__('Settings').'->'.__('General').'->"'.__('Blog address (URL)').'" '.__('the URL is filled-in correctly').'.
'.__('Upgrade account').'. '.__('Please').' '.__('upgrade your subscription').' '.__('to continue using current number of networks and websites').'.
';
return $html;
break;
case 'multiple accounts':
$html = '
Account Error
'.__('The key that you entered is for a LinksAlpha account that is different from the currently used account for this website. You can use API key from only one account on this website. Please input a valid User or Network API key and try again').'.