15 and (int)substr($url_host, 4, 2) < 32 ) or strpos($url_host, '10.') === 0 ) {
$errdesc = lacandsnw_error_msgs('localhost url');
echo $errdesc;
return FALSE;
}
$link = 'http://www.linksalpha.com/a/networkpubadd';
$params = array('url'=>urlencode($url), 'key'=>$api_key, 'plugin'=>'sd-nw');
$response_full = lacandsnw_networkpub_http_post($link,$params);
$response_code = $response_full[0];
if ($response_code != 200) {
$errdesc = lacandsnw_error_msgs($response_full[1]);
echo $errdesc;
return FALSE;
}
$response = lacandsnw_networkpub_json_decode($response_full[1]);
if ($response->errorCode > 0) {
$errdesc = lacandsnw_error_msgs($response->errorMessage);
echo $errdesc;
return FALSE;
}
$options = get_option(LAECHONW_WIDGET_NAME_INTERNAL);
if(empty($options['api_key'])) {
$options['api_key'] = $api_key;
} else {
$options_array = explode(',', $options['api_key']);
if(!in_array($api_key, $options_array)) {
$options['api_key'] = $options['api_key'].','.$api_key;
}
}
$options['lacandsnw_id'] = $response->results->id;
update_option(LAECHONW_WIDGET_NAME_INTERNAL, $options);
echo '
'.LACANDSNW_ERROR_LOADING_API_KEYS.'.
';
echo $html;
return;
}
if(count($response->results) == 1) {
$html = ''.LACANDSNW_CURRENTLY_PUBLISHING.' '.count($response->results).' '.LACANDSNW_SOCIAL_NETWORK.'
';
} else {
$html = ''.LACANDSNW_CURRENTLY_PUBLISHING.' '.count($response->results).' '.LACANDSNW_SOCIAL_NETWORKS.'
';
}
$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').'.
';
return $html;
break;
case 'localhost url':
$html = '
'.__('Website/Blog inaccessible').'
';
$html .= '
'.__('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').'.
';
return $html;
break;
case 'remote url error':
$html = '
'.__('Remote URL error').': '.$arr_errCodes[$errCodesCount-1];
if($errCodesCount == 3) {
$html .= '. '.__('Error Code').' ='.$arr_errCodes[$errCodesCount-2];
}
$html .= '
'.__('Description:').'
'.__('Please try again. Wait for sometime and 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').'.
'.__('If you still face issues then email us at').'
post@linksalpha.com '.__('with error description').'.
';
return $html;
break;
case 'feed parsing error':
$html = '
'.__('Feed parsing error').': '.$arr_errCodes[$errCodesCount-1];
if($errCodesCount == 3) {
$html .= '. '.__('Error Code').'= '.$arr_errCodes[$errCodesCount-2];
}
$html .= '
'.__('If it comes out to be correct, try again and email as at ').'
post@linksalpha.com '.__('with your blog URL and error description').'.
';
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').'.
'.__('If you still face issues then email us at ').'
post@linksalpha.com '.__('with error description').'
';
return $html;
break;
case 'invalid key':
$html = '
'.__('Invalid Key').': '.__('the key that you entered is incorrect. Please try again').'.
'.__('Or').',
'.__('Click here').' '.__('to enter your blog URL on LinksAlpha manually').'.
'.__('If you still face issues then email us at ').'
post@linksalpha.com '.__('with error description').'
';
return $html;
break;
case 'subscription upgrade required':
$html = '
';
return $html;
break;
default:
$html = '
'.__('Sorry we are undergoing maintenance at this time - this happens very rarely but is critical to ensure continued availability. We apologize for the inconvenience.').'
'.__('This can take upto 2 hours maximum. Please try again after sometime and it is guaranteed to work').'.
'.__('You can also email us at').'
post@linksalpha.com '.__('if issue persists. Thanks for your understanding').'
';
return $html;
break;
}
}
function lacandsnw_pushpresscheck() {
$active_plugins = get_option('active_plugins');
$pushpress_plugin = 'pushpress/pushpress.php';
$this_plugin_key = array_search($pushpress_plugin, $active_plugins);
if ($this_plugin_key) {
$options = get_option(LAECHONW_WIDGET_NAME_INTERNAL);
if(array_key_exists('lacandsnw_id', $options)) {
if($options['lacandsnw_id']) {
$link = 'http://www.linksalpha.com/a/pushpress';
$body = array('id'=>$options['lacandsnw_id']);
$response_full = lacandsnw_networkpub_http_post($link, $body);
$response_code = $response_full[0];
}
}
}
}
function lacandsnw_networkpubcheck() {
$active_plugins = get_option('active_plugins');
$pushpress_plugin = 'network-publisher/networkpub.php';
$this_plugin_key = array_search($pushpress_plugin, $active_plugins);
if ($this_plugin_key) {
return True;
}
return False;
}
function lacandsnw_postbox_url() {
if ( version_compare($wp_version, '3.0.0', '<') ) {
$admin_url = get_bloginfo('url').'/wp-admin/edit.php?page='.LACANDSNW_WIDGET_NAME_POSTBOX_INTERNAL;
} else {
$admin_url = get_admin_url().'/edit.php?page='.LACANDSNW_WIDGET_NAME_POSTBOX_INTERNAL;
}
return $admin_url;
}
function lacandsnw_postbox(){
$html = '
'.LAECHONW_WIDGET_NAME.' - '.LACANDSNW_WIDGET_NAME_POSTBOX.'
';
$html .= '
';
$html .= '
'.__('Share this Plugin').'
';
echo $html;
return;
}
?>