mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-02 00:00:15 +00:00
Coding Standards: Upgrade WPCS to 1.0.0
WPCS 1.0.0 includes a bunch of new auto-fixers, which drops the number of coding standards issues across WordPress significantly. Prior to running the auto-fixers, there were 15,312 issues detected. With this commit, we now drop to 4,769 issues. This change includes three notable additions: - Multiline function calls must now put each parameter on a new line. - Auto-formatting files is now part of the `grunt precommit` script. - Auto-fixable coding standards issues will now cause Travis failures. Fixes #44600. git-svn-id: https://develop.svn.wordpress.org/trunk@43571 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -445,7 +445,7 @@ function export_wp( $args = array() ) {
|
||||
<!-- 7. WordPress will then import each of the posts, pages, comments, categories, etc. -->
|
||||
<!-- contained in this file into your site. -->
|
||||
|
||||
<?php the_generator( 'export' ); ?>
|
||||
<?php the_generator( 'export' ); ?>
|
||||
<rss version="2.0"
|
||||
xmlns:excerpt="http://wordpress.org/export/<?php echo WXR_VERSION; ?>/excerpt/"
|
||||
xmlns:content="http://purl.org/rss/1.0/modules/content/"
|
||||
@@ -464,9 +464,9 @@ function export_wp( $args = array() ) {
|
||||
<wp:base_site_url><?php echo wxr_site_url(); ?></wp:base_site_url>
|
||||
<wp:base_blog_url><?php bloginfo_rss( 'url' ); ?></wp:base_blog_url>
|
||||
|
||||
<?php wxr_authors_list( $post_ids ); ?>
|
||||
<?php wxr_authors_list( $post_ids ); ?>
|
||||
|
||||
<?php foreach ( $cats as $c ) : ?>
|
||||
<?php foreach ( $cats as $c ) : ?>
|
||||
<wp:category>
|
||||
<wp:term_id><?php echo intval( $c->term_id ); ?></wp:term_id>
|
||||
<wp:category_nicename><?php echo wxr_cdata( $c->slug ); ?></wp:category_nicename>
|
||||
@@ -477,8 +477,8 @@ function export_wp( $args = array() ) {
|
||||
wxr_term_meta( $c );
|
||||
?>
|
||||
</wp:category>
|
||||
<?php endforeach; ?>
|
||||
<?php foreach ( $tags as $t ) : ?>
|
||||
<?php endforeach; ?>
|
||||
<?php foreach ( $tags as $t ) : ?>
|
||||
<wp:tag>
|
||||
<wp:term_id><?php echo intval( $t->term_id ); ?></wp:term_id>
|
||||
<wp:tag_slug><?php echo wxr_cdata( $t->slug ); ?></wp:tag_slug>
|
||||
@@ -488,8 +488,8 @@ function export_wp( $args = array() ) {
|
||||
wxr_term_meta( $t );
|
||||
?>
|
||||
</wp:tag>
|
||||
<?php endforeach; ?>
|
||||
<?php foreach ( $terms as $t ) : ?>
|
||||
<?php endforeach; ?>
|
||||
<?php foreach ( $terms as $t ) : ?>
|
||||
<wp:term>
|
||||
<wp:term_id><?php echo wxr_cdata( $t->term_id ); ?></wp:term_id>
|
||||
<wp:term_taxonomy><?php echo wxr_cdata( $t->taxonomy ); ?></wp:term_taxonomy>
|
||||
@@ -501,43 +501,43 @@ function export_wp( $args = array() ) {
|
||||
wxr_term_meta( $t );
|
||||
?>
|
||||
</wp:term>
|
||||
<?php endforeach; ?>
|
||||
<?php
|
||||
if ( 'all' == $args['content'] ) {
|
||||
wxr_nav_menu_terms();}
|
||||
?>
|
||||
<?php endforeach; ?>
|
||||
<?php
|
||||
if ( 'all' == $args['content'] ) {
|
||||
wxr_nav_menu_terms();}
|
||||
?>
|
||||
|
||||
<?php
|
||||
/** This action is documented in wp-includes/feed-rss2.php */
|
||||
do_action( 'rss2_head' );
|
||||
?>
|
||||
|
||||
<?php
|
||||
if ( $post_ids ) {
|
||||
/**
|
||||
* @global WP_Query $wp_query
|
||||
*/
|
||||
global $wp_query;
|
||||
<?php
|
||||
if ( $post_ids ) {
|
||||
/**
|
||||
* @global WP_Query $wp_query
|
||||
*/
|
||||
global $wp_query;
|
||||
|
||||
// Fake being in the loop.
|
||||
$wp_query->in_the_loop = true;
|
||||
// Fake being in the loop.
|
||||
$wp_query->in_the_loop = true;
|
||||
|
||||
// Fetch 20 posts at a time rather than loading the entire table into memory.
|
||||
while ( $next_posts = array_splice( $post_ids, 0, 20 ) ) {
|
||||
$where = 'WHERE ID IN (' . join( ',', $next_posts ) . ')';
|
||||
$posts = $wpdb->get_results( "SELECT * FROM {$wpdb->posts} $where" );
|
||||
// Fetch 20 posts at a time rather than loading the entire table into memory.
|
||||
while ( $next_posts = array_splice( $post_ids, 0, 20 ) ) {
|
||||
$where = 'WHERE ID IN (' . join( ',', $next_posts ) . ')';
|
||||
$posts = $wpdb->get_results( "SELECT * FROM {$wpdb->posts} $where" );
|
||||
|
||||
// Begin Loop.
|
||||
foreach ( $posts as $post ) {
|
||||
setup_postdata( $post );
|
||||
$is_sticky = is_sticky( $post->ID ) ? 1 : 0;
|
||||
?>
|
||||
// Begin Loop.
|
||||
foreach ( $posts as $post ) {
|
||||
setup_postdata( $post );
|
||||
$is_sticky = is_sticky( $post->ID ) ? 1 : 0;
|
||||
?>
|
||||
<item>
|
||||
<title>
|
||||
<?php
|
||||
/** This filter is documented in wp-includes/feed.php */
|
||||
echo apply_filters( 'the_title_rss', $post->post_title );
|
||||
?>
|
||||
<?php
|
||||
/** This filter is documented in wp-includes/feed.php */
|
||||
echo apply_filters( 'the_title_rss', $post->post_title );
|
||||
?>
|
||||
</title>
|
||||
<link><?php the_permalink_rss(); ?></link>
|
||||
<pubDate><?php echo mysql2date( 'D, d M Y H:i:s +0000', get_post_time( 'Y-m-d H:i:s', true ), false ); ?></pubDate>
|
||||
@@ -545,28 +545,28 @@ if ( $post_ids ) {
|
||||
<guid isPermaLink="false"><?php the_guid(); ?></guid>
|
||||
<description></description>
|
||||
<content:encoded>
|
||||
<?php
|
||||
/**
|
||||
* Filters the post content used for WXR exports.
|
||||
*
|
||||
* @since 2.5.0
|
||||
*
|
||||
* @param string $post_content Content of the current post.
|
||||
*/
|
||||
echo wxr_cdata( apply_filters( 'the_content_export', $post->post_content ) );
|
||||
?>
|
||||
<?php
|
||||
/**
|
||||
* Filters the post content used for WXR exports.
|
||||
*
|
||||
* @since 2.5.0
|
||||
*
|
||||
* @param string $post_content Content of the current post.
|
||||
*/
|
||||
echo wxr_cdata( apply_filters( 'the_content_export', $post->post_content ) );
|
||||
?>
|
||||
</content:encoded>
|
||||
<excerpt:encoded>
|
||||
<?php
|
||||
/**
|
||||
* Filters the post excerpt used for WXR exports.
|
||||
*
|
||||
* @since 2.6.0
|
||||
*
|
||||
* @param string $post_excerpt Excerpt for the current post.
|
||||
*/
|
||||
echo wxr_cdata( apply_filters( 'the_excerpt_export', $post->post_excerpt ) );
|
||||
?>
|
||||
<?php
|
||||
/**
|
||||
* Filters the post excerpt used for WXR exports.
|
||||
*
|
||||
* @since 2.6.0
|
||||
*
|
||||
* @param string $post_excerpt Excerpt for the current post.
|
||||
*/
|
||||
echo wxr_cdata( apply_filters( 'the_excerpt_export', $post->post_excerpt ) );
|
||||
?>
|
||||
</excerpt:encoded>
|
||||
<wp:post_id><?php echo intval( $post->ID ); ?></wp:post_id>
|
||||
<wp:post_date><?php echo wxr_cdata( $post->post_date ); ?></wp:post_date>
|
||||
@@ -580,40 +580,40 @@ if ( $post_ids ) {
|
||||
<wp:post_type><?php echo wxr_cdata( $post->post_type ); ?></wp:post_type>
|
||||
<wp:post_password><?php echo wxr_cdata( $post->post_password ); ?></wp:post_password>
|
||||
<wp:is_sticky><?php echo intval( $is_sticky ); ?></wp:is_sticky>
|
||||
<?php if ( $post->post_type == 'attachment' ) : ?>
|
||||
<?php if ( $post->post_type == 'attachment' ) : ?>
|
||||
<wp:attachment_url><?php echo wxr_cdata( wp_get_attachment_url( $post->ID ) ); ?></wp:attachment_url>
|
||||
<?php endif; ?>
|
||||
<?php wxr_post_taxonomy(); ?>
|
||||
<?php
|
||||
$postmeta = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->postmeta WHERE post_id = %d", $post->ID ) );
|
||||
foreach ( $postmeta as $meta ) :
|
||||
/**
|
||||
* Filters whether to selectively skip post meta used for WXR exports.
|
||||
*
|
||||
* Returning a truthy value to the filter will skip the current meta
|
||||
* object from being exported.
|
||||
*
|
||||
* @since 3.3.0
|
||||
*
|
||||
* @param bool $skip Whether to skip the current post meta. Default false.
|
||||
* @param string $meta_key Current meta key.
|
||||
* @param object $meta Current meta object.
|
||||
*/
|
||||
if ( apply_filters( 'wxr_export_skip_postmeta', false, $meta->meta_key, $meta ) ) {
|
||||
continue;
|
||||
}
|
||||
?>
|
||||
<?php wxr_post_taxonomy(); ?>
|
||||
<?php
|
||||
$postmeta = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->postmeta WHERE post_id = %d", $post->ID ) );
|
||||
foreach ( $postmeta as $meta ) :
|
||||
/**
|
||||
* Filters whether to selectively skip post meta used for WXR exports.
|
||||
*
|
||||
* Returning a truthy value to the filter will skip the current meta
|
||||
* object from being exported.
|
||||
*
|
||||
* @since 3.3.0
|
||||
*
|
||||
* @param bool $skip Whether to skip the current post meta. Default false.
|
||||
* @param string $meta_key Current meta key.
|
||||
* @param object $meta Current meta object.
|
||||
*/
|
||||
if ( apply_filters( 'wxr_export_skip_postmeta', false, $meta->meta_key, $meta ) ) {
|
||||
continue;
|
||||
}
|
||||
?>
|
||||
<wp:postmeta>
|
||||
<wp:meta_key><?php echo wxr_cdata( $meta->meta_key ); ?></wp:meta_key>
|
||||
<wp:meta_value><?php echo wxr_cdata( $meta->meta_value ); ?></wp:meta_value>
|
||||
</wp:postmeta>
|
||||
<?php
|
||||
endforeach;
|
||||
<?php
|
||||
endforeach;
|
||||
|
||||
$_comments = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved <> 'spam'", $post->ID ) );
|
||||
$comments = array_map( 'get_comment', $_comments );
|
||||
foreach ( $comments as $c ) :
|
||||
?>
|
||||
$_comments = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved <> 'spam'", $post->ID ) );
|
||||
$comments = array_map( 'get_comment', $_comments );
|
||||
foreach ( $comments as $c ) :
|
||||
?>
|
||||
<wp:comment>
|
||||
<wp:comment_id><?php echo intval( $c->comment_ID ); ?></wp:comment_id>
|
||||
<wp:comment_author><?php echo wxr_cdata( $c->comment_author ); ?></wp:comment_author>
|
||||
@@ -627,39 +627,39 @@ endforeach;
|
||||
<wp:comment_type><?php echo wxr_cdata( $c->comment_type ); ?></wp:comment_type>
|
||||
<wp:comment_parent><?php echo intval( $c->comment_parent ); ?></wp:comment_parent>
|
||||
<wp:comment_user_id><?php echo intval( $c->user_id ); ?></wp:comment_user_id>
|
||||
<?php
|
||||
$c_meta = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->commentmeta WHERE comment_id = %d", $c->comment_ID ) );
|
||||
foreach ( $c_meta as $meta ) :
|
||||
/**
|
||||
* Filters whether to selectively skip comment meta used for WXR exports.
|
||||
*
|
||||
* Returning a truthy value to the filter will skip the current meta
|
||||
* object from being exported.
|
||||
*
|
||||
* @since 4.0.0
|
||||
*
|
||||
* @param bool $skip Whether to skip the current comment meta. Default false.
|
||||
* @param string $meta_key Current meta key.
|
||||
* @param object $meta Current meta object.
|
||||
*/
|
||||
if ( apply_filters( 'wxr_export_skip_commentmeta', false, $meta->meta_key, $meta ) ) {
|
||||
continue;
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
$c_meta = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->commentmeta WHERE comment_id = %d", $c->comment_ID ) );
|
||||
foreach ( $c_meta as $meta ) :
|
||||
/**
|
||||
* Filters whether to selectively skip comment meta used for WXR exports.
|
||||
*
|
||||
* Returning a truthy value to the filter will skip the current meta
|
||||
* object from being exported.
|
||||
*
|
||||
* @since 4.0.0
|
||||
*
|
||||
* @param bool $skip Whether to skip the current comment meta. Default false.
|
||||
* @param string $meta_key Current meta key.
|
||||
* @param object $meta Current meta object.
|
||||
*/
|
||||
if ( apply_filters( 'wxr_export_skip_commentmeta', false, $meta->meta_key, $meta ) ) {
|
||||
continue;
|
||||
}
|
||||
?>
|
||||
<wp:commentmeta>
|
||||
<wp:meta_key><?php echo wxr_cdata( $meta->meta_key ); ?></wp:meta_key>
|
||||
<wp:meta_value><?php echo wxr_cdata( $meta->meta_value ); ?></wp:meta_value>
|
||||
</wp:commentmeta>
|
||||
<?php endforeach; ?>
|
||||
<?php endforeach; ?>
|
||||
</wp:comment>
|
||||
<?php endforeach; ?>
|
||||
<?php endforeach; ?>
|
||||
</item>
|
||||
<?php
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
?>
|
||||
</channel>
|
||||
</rss>
|
||||
<?php
|
||||
<?php
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user