WordPress同步插件的主程序,入口文件。 action){add_meta_box('wp2wp_view','WP2WPQAQ-synchronize','wp2wp_view','post','side','high');add_action('admin_enqueue_scripts','wp2wp_active_style');}}// Create a template...function wp2wp
action){
add_meta_box('wp2wp_view','WP2WPQAQ-synchronize','wp2wp_view','post','side','high');
add_action('admin_enqueue_scripts','wp2wp_active_style');
}
}
// Create a template...
function wp2wp_view(){
?>
', 'wp2wpqaq');?>
query( 'wp.getOptions', array( 0, $options['user'], $options['pass'], array( 'software_name', 'software_version', 'so_api' ) ) );
$xmlrpcResponse = $xmlrpc->getResponse();
if ( null == $xmlrpcResponse ) {
if ( -32300 == $xmlrpc->getErrorCode() ) {
$options['authenticated'] = false;
$newOptions['group'][$groupId]['servers'][$serverKey]['api'] = 'API Unavailable';
} else {
$options['authenticated'] = false;
$options['api'] = 'Unknown';
}
}else{
if ( isset( $xmlrpcResponse['faultString'] ) ) {
$options['authenticated'] = false;
$options['api'] = __( trim( $xmlrpcResponse['faultString'], ' .' ), 'WP2WPQAQ' );
}else{
$options['authenticated'] = true;
if ( isset( $xmlrpcResponse['so_api'] ) ) {
$options['api'] = sprintf( __( 'WP2WPQAQ Synchronize API v%s', 'WP2WPQAQ' ), $xmlrpcResponse['so_api']['value'] );
} else {
$options['api'] = $xmlrpcResponse['software_name']['value'].' '.$xmlrpcResponse['software_version']['value'];
}
}
}
}
}
}
return $options;
}
// Settings link on plugins page...
function wp2wp_settings_link( $links, $file ) {
if ( plugin_basename( __FILE__ ) == $file ) {
array_push( $links, ''.__( 'Settings', 'wp2wpqaq' ).'' );
}
return $links;
}
}