Remove AtomPub from core.

* Will be replaced with http://wordpress.org/extend/plugins/atom-publishing-protocol/.
 * Introduces an action, xmlrpc_rsd_apis, to add APIs to xmlrpc.php?rsd.
 * Introduces support for 'error' being 403 and 50x in class-wp.php.
 * Removes 'Remote Publishing' from Writing Settings (see [21804]). Keeps the remote_publishing settings section.

DB version is bumped to generate the new wp-app rewrite rule and remove the old enable_app option.

props wonderboymusic.
fixes #21509.



git-svn-id: http://core.svn.wordpress.org/trunk@21818 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2012-09-11 20:11:39 +00:00
parent 8404dac54c
commit 9d204841ee
14 changed files with 53 additions and 1586 deletions

View File

@ -444,7 +444,6 @@ function populate_options() {
// 2.6 // 2.6
'avatar_default' => 'mystery', 'avatar_default' => 'mystery',
'enable_app' => 0,
// 2.7 // 2.7
'large_size_w' => 1024, 'large_size_w' => 1024,
@ -542,7 +541,7 @@ function populate_options() {
'_wp_http_referer', 'Update', 'action', 'rich_editing', 'autosave_interval', 'deactivated_plugins', '_wp_http_referer', 'Update', 'action', 'rich_editing', 'autosave_interval', 'deactivated_plugins',
'can_compress_scripts', 'page_uris', 'update_core', 'update_plugins', 'update_themes', 'doing_cron', 'can_compress_scripts', 'page_uris', 'update_core', 'update_plugins', 'update_themes', 'doing_cron',
'random_seed', 'rss_excerpt_length', 'secret', 'use_linksupdate', 'default_comment_status_page', 'random_seed', 'rss_excerpt_length', 'secret', 'use_linksupdate', 'default_comment_status_page',
'wporg_popular_tags', 'what_to_show', 'rss_language', 'language', 'enable_xmlrpc', 'wporg_popular_tags', 'what_to_show', 'rss_language', 'language', 'enable_xmlrpc', 'enable_app',
); );
foreach ( $unusedoptions as $option ) foreach ( $unusedoptions as $option )
delete_option($option); delete_option($option);

View File

@ -994,10 +994,6 @@ function upgrade_260() {
if ( $wp_current_db_version < 8000 ) if ( $wp_current_db_version < 8000 )
populate_roles_260(); populate_roles_260();
if ( $wp_current_db_version < 8201 ) {
update_option('enable_app', 1);
}
} }
/** /**

View File

@ -121,7 +121,10 @@ wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'default_link_category
</tr> </tr>
<?php endif; ?> <?php endif; ?>
<?php do_settings_fields('writing', 'default'); ?> <?php
do_settings_fields('writing', 'default');
do_settings_fields('writing', 'remote_publishing'); // A deprecated section.
?>
</table> </table>
<h3 class="title"><?php _e('Press This') ?></h3> <h3 class="title"><?php _e('Press This') ?></h3>
@ -168,20 +171,6 @@ wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'default_email_categor
</table> </table>
<?php } ?> <?php } ?>
<h3><?php _e('Remote Publishing') ?></h3>
<p><?php printf(__('To post to WordPress from a desktop blogging client or remote website that uses the Atom Publishing Protocol or one of the XML-RPC publishing interfaces you must enable them below.')) ?></p>
<table class="form-table">
<tr valign="top">
<th scope="row"><?php _e('Atom Publishing Protocol') ?></th>
<td><fieldset><legend class="screen-reader-text"><span><?php _e('Atom Publishing Protocol') ?></span></legend>
<label for="enable_app">
<input name="enable_app" type="checkbox" id="enable_app" value="1" <?php checked('1', get_option('enable_app')); ?> />
<?php _e('Enable the Atom Publishing Protocol.') ?></label><br />
</fieldset></td>
</tr>
<?php do_settings_fields('writing', 'remote_publishing'); ?>
</table>
<?php if ( apply_filters( 'enable_update_services_configuration', true ) ) { ?> <?php if ( apply_filters( 'enable_update_services_configuration', true ) ) { ?>
<h3><?php _e('Update Services') ?></h3> <h3><?php _e('Update Services') ?></h3>

View File

@ -64,7 +64,7 @@ $whitelist_options = array(
'media' => array( 'thumbnail_size_w', 'thumbnail_size_h', 'thumbnail_crop', 'medium_size_w', 'medium_size_h', 'large_size_w', 'large_size_h', 'image_default_size', 'image_default_align', 'image_default_link_type', 'embed_autourls', 'embed_size_w', 'embed_size_h' ), 'media' => array( 'thumbnail_size_w', 'thumbnail_size_h', 'thumbnail_crop', 'medium_size_w', 'medium_size_h', 'large_size_w', 'large_size_h', 'image_default_size', 'image_default_align', 'image_default_link_type', 'embed_autourls', 'embed_size_w', 'embed_size_h' ),
'privacy' => array( 'blog_public' ), 'privacy' => array( 'blog_public' ),
'reading' => array( 'posts_per_page', 'posts_per_rss', 'rss_use_excerpt', 'blog_charset', 'show_on_front', 'page_on_front', 'page_for_posts' ), 'reading' => array( 'posts_per_page', 'posts_per_rss', 'rss_use_excerpt', 'blog_charset', 'show_on_front', 'page_on_front', 'page_for_posts' ),
'writing' => array( 'default_post_edit_rows', 'use_smilies', 'default_category', 'default_email_category', 'use_balanceTags', 'default_link_category', 'default_post_format', 'enable_app' ), 'writing' => array( 'default_post_edit_rows', 'use_smilies', 'default_category', 'default_email_category', 'use_balanceTags', 'default_link_category', 'default_post_format' ),
'options' => array( '' ) ); 'options' => array( '' ) );
$mail_options = array('mailserver_url', 'mailserver_port', 'mailserver_login', 'mailserver_pass'); $mail_options = array('mailserver_url', 'mailserver_port', 'mailserver_login', 'mailserver_pass');

View File

@ -1,53 +0,0 @@
<?php
/**
* Atom Publishing Protocol support for WordPress
*
* @version 1.0.5-dc
*/
/**
* WordPress is handling an Atom Publishing Protocol request.
*
* @var bool
*/
define('APP_REQUEST', true);
/** Set up WordPress environment */
require_once('./wp-load.php');
/** Atom Publishing Protocol Class */
require_once(ABSPATH . WPINC . '/atomlib.php');
/** Atom Server **/
require_once(ABSPATH . WPINC . '/class-wp-atom-server.php');
/** Admin Image API for metadata updating */
require_once(ABSPATH . '/wp-admin/includes/image.php');
$_SERVER['PATH_INFO'] = preg_replace( '/.*\/wp-app\.php/', '', $_SERVER['REQUEST_URI'] );
// Allow for a plugin to insert a different class to handle requests.
$wp_atom_server_class = apply_filters('wp_atom_server_class', 'wp_atom_server');
$wp_atom_server = new $wp_atom_server_class;
// Handle the request
$wp_atom_server->handle_request();
exit;
/**
* Writes logging info to a file.
*
* @since 2.2.0
* @deprecated 3.4.0
* @deprecated Use error_log()
* @link http://www.php.net/manual/en/function.error-log.php
*
* @param string $label Type of logging
* @param string $msg Information describing logging reason.
*/
function log_app( $label, $msg ) {
_deprecated_function( __FUNCTION__, '3.4', 'error_log()' );
if ( ! empty( $GLOBALS['app_logging'] ) )
error_log( $label . ' - ' . $msg );
}

View File

@ -730,7 +730,7 @@ function is_admin_bar_showing() {
global $show_admin_bar, $pagenow; global $show_admin_bar, $pagenow;
// For all these types of requests, we never want an admin bar. // For all these types of requests, we never want an admin bar.
if ( defined('XMLRPC_REQUEST') || defined('APP_REQUEST') || defined('DOING_AJAX') || defined('IFRAME_REQUEST') ) if ( defined('XMLRPC_REQUEST') || defined('DOING_AJAX') || defined('IFRAME_REQUEST') )
return false; return false;
// Integrated into the admin. // Integrated into the admin.

File diff suppressed because it is too large Load Diff

View File

@ -195,7 +195,7 @@ class WP {
$query = $rewrite['$']; $query = $rewrite['$'];
$matches = array(''); $matches = array('');
} }
} else if ( $req_uri != 'wp-app.php' ) { } else {
foreach ( (array) $rewrite as $match => $query ) { foreach ( (array) $rewrite as $match => $query ) {
// If the requesting file is the anchor of the match, prepend it to the path info. // If the requesting file is the anchor of the match, prepend it to the path info.
if ( ! empty($req_uri) && strpos($match, $req_uri) === 0 && $req_uri != $request ) if ( ! empty($req_uri) && strpos($match, $req_uri) === 0 && $req_uri != $request )
@ -229,16 +229,14 @@ class WP {
// Parse the query. // Parse the query.
parse_str($query, $perma_query_vars); parse_str($query, $perma_query_vars);
// If we're processing a 404 request, clear the error var // If we're processing a 404 request, clear the error var since we found something.
// since we found something. if ( '404' == $error )
unset( $_GET['error'] ); unset( $error, $_GET['error'] );
unset( $error );
} }
// If req_uri is empty or if it is a request for ourself, unset error. // If req_uri is empty or if it is a request for ourself, unset error.
if ( empty($request) || $req_uri == $self || strpos($_SERVER['PHP_SELF'], 'wp-admin/') !== false ) { if ( empty($request) || $req_uri == $self || strpos($_SERVER['PHP_SELF'], 'wp-admin/') !== false ) {
unset( $_GET['error'] ); unset( $error, $_GET['error'] );
unset( $error );
if ( isset($perma_query_vars) && strpos($_SERVER['PHP_SELF'], 'wp-admin/') !== false ) if ( isset($perma_query_vars) && strpos($_SERVER['PHP_SELF'], 'wp-admin/') !== false )
unset( $perma_query_vars ); unset( $perma_query_vars );
@ -325,11 +323,15 @@ class WP {
if ( is_user_logged_in() ) if ( is_user_logged_in() )
$headers = array_merge($headers, wp_get_nocache_headers()); $headers = array_merge($headers, wp_get_nocache_headers());
if ( !empty($this->query_vars['error']) && '404' == $this->query_vars['error'] ) { if ( ! empty( $this->query_vars['error'] ) ) {
$status = 404; $status = (int) $this->query_vars['error'];
if ( 404 === $status ) {
if ( ! is_user_logged_in() ) if ( ! is_user_logged_in() )
$headers = array_merge($headers, wp_get_nocache_headers()); $headers = array_merge($headers, wp_get_nocache_headers());
$headers['Content-Type'] = get_option('html_type') . '; charset=' . get_option('blog_charset'); $headers['Content-Type'] = get_option('html_type') . '; charset=' . get_option('blog_charset');
} elseif ( in_array( $status, array( 403, 500, 502, 503 ) ) ) {
$exit_required = true;
}
} else if ( empty($this->query_vars['feed']) ) { } else if ( empty($this->query_vars['feed']) ) {
$headers['Content-Type'] = get_option('html_type') . '; charset=' . get_option('blog_charset'); $headers['Content-Type'] = get_option('html_type') . '; charset=' . get_option('blog_charset');
} else { } else {

View File

@ -1910,8 +1910,6 @@ function wp_die( $message = '', $title = '', $args = array() ) {
$function = apply_filters( 'wp_die_ajax_handler', '_ajax_wp_die_handler' ); $function = apply_filters( 'wp_die_ajax_handler', '_ajax_wp_die_handler' );
elseif ( defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST ) elseif ( defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST )
$function = apply_filters( 'wp_die_xmlrpc_handler', '_xmlrpc_wp_die_handler' ); $function = apply_filters( 'wp_die_xmlrpc_handler', '_xmlrpc_wp_die_handler' );
elseif ( defined( 'APP_REQUEST' ) && APP_REQUEST )
$function = apply_filters( 'wp_die_app_handler', '_scalar_wp_die_handler' );
else else
$function = apply_filters( 'wp_die_handler', '_default_wp_die_handler' ); $function = apply_filters( 'wp_die_handler', '_default_wp_die_handler' );

View File

@ -168,3 +168,25 @@ function wp_login($username, $password, $deprecated = '') {
else : else :
_deprecated_function( 'wp_login', '2.5', 'wp_signon()' ); _deprecated_function( 'wp_login', '2.5', 'wp_signon()' );
endif; endif;
/**
* WordPress AtomPub API implementation.
*
* Originally stored in wp-app.php, and later wp-includes/class-wp-atom-server.php.
* It is kept here in case a plugin directly referred to the class.
*
* @since 2.2.0
* @deprecated 3.5.0
* @link http://wordpress.org/extend/plugins/atom-publishing-protocol/
*/
if ( ! class_exists( 'wp_atom_server' ) ) {
class wp_atom_server {
public function __call( $name, $arguments ) {
_deprecated_function( __CLASS__ . '::' . $name, '3.5', 'the Atom Publishing Platform plugin' );
}
public static function __callStatic( $name, $arguments ) {
_deprecated_function( __CLASS__ . '::' . $name, '3.5', 'the Atom Publishing Platform plugin' );
}
}
}

View File

@ -4670,9 +4670,8 @@ function _future_post_hook( $deprecated = '', $post ) {
* @since 2.3.0 * @since 2.3.0
* @access private * @access private
* @uses $wpdb * @uses $wpdb
* @uses XMLRPC_REQUEST and APP_REQUEST constants. * @uses XMLRPC_REQUEST constant.
* @uses do_action() Calls 'xmlprc_publish_post' on post ID if XMLRPC_REQUEST is defined. * @uses do_action() Calls 'xmlprc_publish_post' on post ID if XMLRPC_REQUEST is defined.
* @uses do_action() Calls 'app_publish_post' on post ID if APP_REQUEST is defined.
* *
* @param int $post_id The ID in the database table of the post being published * @param int $post_id The ID in the database table of the post being published
*/ */
@ -4681,8 +4680,6 @@ function _publish_post_hook($post_id) {
if ( defined('XMLRPC_REQUEST') ) if ( defined('XMLRPC_REQUEST') )
do_action('xmlrpc_publish_post', $post_id); do_action('xmlrpc_publish_post', $post_id);
if ( defined('APP_REQUEST') )
do_action('app_publish_post', $post_id);
if ( defined('WP_IMPORTING') ) if ( defined('WP_IMPORTING') )
return; return;

View File

@ -1525,8 +1525,11 @@ class WP_Rewrite {
$home_path = parse_url( home_url() ); $home_path = parse_url( home_url() );
$robots_rewrite = ( empty( $home_path['path'] ) || '/' == $home_path['path'] ) ? array( 'robots\.txt$' => $this->index . '?robots=1' ) : array(); $robots_rewrite = ( empty( $home_path['path'] ) || '/' == $home_path['path'] ) ? array( 'robots\.txt$' => $this->index . '?robots=1' ) : array();
// Old feed files // Old feed and service files
$old_feed_files = array( '.*wp-(atom|rdf|rss|rss2|feed|commentsrss2)\.php$' => $this->index . '?feed=old' ); $deprecated_files = array(
'.*wp-(atom|rdf|rss|rss2|feed|commentsrss2)\.php$' => $this->index . '?feed=old',
'.*wp-app\.php$' => $this->index . '?error=403',
);
// Registration rules // Registration rules
$registration_pages = array(); $registration_pages = array();
@ -1585,9 +1588,9 @@ class WP_Rewrite {
// Put them together. // Put them together.
if ( $this->use_verbose_page_rules ) if ( $this->use_verbose_page_rules )
$this->rules = array_merge($this->extra_rules_top, $robots_rewrite, $old_feed_files, $registration_pages, $root_rewrite, $comments_rewrite, $search_rewrite, $author_rewrite, $date_rewrite, $page_rewrite, $post_rewrite, $this->extra_rules); $this->rules = array_merge($this->extra_rules_top, $robots_rewrite, $deprecated_files, $old_service_files, $registration_pages, $root_rewrite, $comments_rewrite, $search_rewrite, $author_rewrite, $date_rewrite, $page_rewrite, $post_rewrite, $this->extra_rules);
else else
$this->rules = array_merge($this->extra_rules_top, $robots_rewrite, $old_feed_files, $registration_pages, $root_rewrite, $comments_rewrite, $search_rewrite, $author_rewrite, $date_rewrite, $post_rewrite, $page_rewrite, $this->extra_rules); $this->rules = array_merge($this->extra_rules_top, $robots_rewrite, $deprecated_files, $old_service_files, $registration_pages, $root_rewrite, $comments_rewrite, $search_rewrite, $author_rewrite, $date_rewrite, $post_rewrite, $page_rewrite, $this->extra_rules);
do_action_ref_array('generate_rewrite_rules', array(&$this)); do_action_ref_array('generate_rewrite_rules', array(&$this));
$this->rules = apply_filters('rewrite_rules_array', $this->rules); $this->rules = apply_filters('rewrite_rules_array', $this->rules);

View File

@ -11,7 +11,7 @@ $wp_version = '3.5-alpha-21751';
* *
* @global int $wp_db_version * @global int $wp_db_version
*/ */
$wp_db_version = 21811; $wp_db_version = 21818;
/** /**
* Holds the TinyMCE version * Holds the TinyMCE version

View File

@ -42,7 +42,7 @@ header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
<api name="Movable Type" blogID="1" preferred="false" apiLink="<?php echo site_url('xmlrpc.php', 'rpc') ?>" /> <api name="Movable Type" blogID="1" preferred="false" apiLink="<?php echo site_url('xmlrpc.php', 'rpc') ?>" />
<api name="MetaWeblog" blogID="1" preferred="false" apiLink="<?php echo site_url('xmlrpc.php', 'rpc') ?>" /> <api name="MetaWeblog" blogID="1" preferred="false" apiLink="<?php echo site_url('xmlrpc.php', 'rpc') ?>" />
<api name="Blogger" blogID="1" preferred="false" apiLink="<?php echo site_url('xmlrpc.php', 'rpc') ?>" /> <api name="Blogger" blogID="1" preferred="false" apiLink="<?php echo site_url('xmlrpc.php', 'rpc') ?>" />
<api name="Atom" blogID="" preferred="false" apiLink="<?php echo site_url('wp-app.php/service', 'rpc') ?>" /> <?php do_action( 'xmlrpc_rsd_apis' ); ?>
</apis> </apis>
</service> </service>
</rsd> </rsd>