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.


Built from https://develop.svn.wordpress.org/trunk@43571


git-svn-id: http://core.svn.wordpress.org/trunk@43400 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Gary Pendergast 2018-08-17 01:51:36 +00:00
parent 8142df82bc
commit 56c162fbc9
359 changed files with 5715 additions and 4599 deletions

View File

@ -74,7 +74,8 @@ if ( get_option( 'db_upgraded' ) ) {
if ( $c <= 50 || ( $c > 50 && mt_rand( 0, (int) ( $c / 50 ) ) == 1 ) ) {
require_once( ABSPATH . WPINC . '/http.php' );
$response = wp_remote_get(
admin_url( 'upgrade.php?step=1' ), array(
admin_url( 'upgrade.php?step=1' ),
array(
'timeout' => 120,
'httpversion' => '1.1',
)

View File

@ -63,7 +63,8 @@ if ( isset( $_REQUEST['attachment_id'] ) && ( $id = intval( $_REQUEST['attachmen
case 2:
add_filter( 'attachment_fields_to_edit', 'media_single_attachment_fields_to_edit', 10, 2 );
echo get_media_item(
$id, array(
$id,
array(
'send' => false,
'delete' => true,
)

View File

@ -290,7 +290,8 @@ if ( $comment->comment_approved != '0' ) { // if not unapproved
array(
'trashed' => '1',
'ids' => $comment_id,
), $redir
),
$redir
);
break;
case 'untrashcomment':
@ -303,7 +304,8 @@ if ( $comment->comment_approved != '0' ) { // if not unapproved
array(
'spammed' => '1',
'ids' => $comment_id,
), $redir
),
$redir
);
break;
case 'unspamcomment':

View File

@ -581,7 +581,8 @@ if ( current_theme_supports( 'custom-background', 'default-color' ) ) {
/** This filter is documented in wp-admin/includes/media.php */
$sizes = array_keys(
apply_filters(
'image_size_names_choose', array(
'image_size_names_choose',
array(
'thumbnail' => __( 'Thumbnail' ),
'medium' => __( 'Medium' ),
'large' => __( 'Large' ),

View File

@ -607,7 +607,8 @@ class Custom_Image_Header {
'page' => 'custom-header',
'step' => 2,
'_wpnonce-custom-header-upload' => wp_create_nonce( 'custom-header-upload' ),
), admin_url( 'themes.php' )
),
admin_url( 'themes.php' )
)
);
?>

View File

@ -394,7 +394,8 @@ do_action( 'do_meta_boxes', $post_type, 'advanced', $post );
do_action( 'do_meta_boxes', $post_type, 'side', $post );
add_screen_option(
'layout_columns', array(
'layout_columns',
array(
'max' => 2,
'default' => 2,
)
@ -696,7 +697,9 @@ if ( post_type_supports( $post_type, 'editor' ) ) {
<?php
wp_editor(
$post->post_content, 'content', array(
$post->post_content,
'content',
array(
'_content_editor_dfw' => $_content_editor_dfw,
'drag_drop_upload' => true,
'tabfocus_elements' => 'content-html,save-post',

View File

@ -72,7 +72,9 @@ if ( 'approved' === wp_get_comment_status( $comment ) && $comment->comment_post_
echo '<label for="content" class="screen-reader-text">' . __( 'Comment' ) . '</label>';
$quicktags_settings = array( 'buttons' => 'strong,em,link,block,del,ins,img,ul,ol,li,code,close' );
wp_editor(
$comment->comment_content, 'content', array(
$comment->comment_content,
'content',
array(
'media_buttons' => false,
'tinymce' => false,
'quicktags' => $quicktags_settings,

View File

@ -51,7 +51,8 @@ do_action( 'do_meta_boxes', 'link', 'advanced', $link );
do_action( 'do_meta_boxes', 'link', 'side', $link );
add_screen_option(
'layout_columns', array(
'layout_columns',
array(
'max' => 2,
'default' => 2,
)

View File

@ -55,7 +55,8 @@ if ( 'post' != $post_type ) {
}
add_screen_option(
'per_page', array(
'per_page',
array(
'default' => 20,
'option' => 'edit_' . $tax->name . '_per_page',
)
@ -95,7 +96,8 @@ switch ( $wp_list_table->current_action() ) {
array(
'error' => true,
'message' => 4,
), $referer
),
$referer
);
}
@ -187,7 +189,8 @@ switch ( $wp_list_table->current_action() ) {
array(
'error' => true,
'message' => 5,
), $referer
),
$referer
);
}
break;

View File

@ -127,7 +127,8 @@ if ( $doaction ) {
'trashed' => $trashed,
'ids' => join( ',', $post_ids ),
'locked' => $locked,
), $sendback
),
$sendback
);
break;
case 'untrash':
@ -290,7 +291,8 @@ get_current_screen()->set_screen_reader_content(
);
add_screen_option(
'per_page', array(
'per_page',
array(
'default' => 20,
'option' => 'edit_' . $post_type . '_per_page',
)

View File

@ -144,7 +144,8 @@ function export_date_options( $post_type = 'post' ) {
FROM $wpdb->posts
WHERE post_type = %s AND post_status != 'auto-draft'
ORDER BY post_date DESC
", $post_type
",
$post_type
)
);
@ -280,7 +281,8 @@ foreach ( get_post_types(
array(
'_builtin' => false,
'can_export' => true,
), 'objects'
),
'objects'
) as $post_type ) :
?>
<p><label><input type="radio" name="content" value="<?php echo esc_attr( $post_type->name ); ?>" /> <?php echo esc_html( $post_type->label ); ?></label></p>

View File

@ -119,8 +119,10 @@ if ( empty( $importers ) ) {
'action' => 'activate',
'plugin' => $plugin_file,
'from' => 'import',
), admin_url( 'plugins.php' )
), 'activate-plugin_' . $plugin_file
),
admin_url( 'plugins.php' )
),
'activate-plugin_' . $plugin_file
);
$action = sprintf(
'<a href="%s" aria-label="%s">%s</a>',
@ -142,8 +144,10 @@ if ( empty( $importers ) ) {
'action' => 'install-plugin',
'plugin' => $plugin_slug,
'from' => 'import',
), self_admin_url( 'update.php' )
), 'install-plugin_' . $plugin_slug
),
self_admin_url( 'update.php' )
),
'install-plugin_' . $plugin_slug
);
$action = sprintf(
'<a href="%1$s" class="install-now" data-slug="%2$s" data-name="%3$s" aria-label="%4$s">%5$s</a>',
@ -166,7 +170,8 @@ if ( empty( $importers ) ) {
$url = add_query_arg(
array(
'import' => $importer_id,
), self_admin_url( 'admin.php' )
),
self_admin_url( 'admin.php' )
);
$action = sprintf(
'<a href="%1$s" aria-label="%2$s">%3$s</a>',
@ -188,7 +193,8 @@ if ( empty( $importers ) ) {
'TB_iframe' => 'true',
'width' => 600,
'height' => 550,
), network_admin_url( 'plugin-install.php' )
),
network_admin_url( 'plugin-install.php' )
);
$action .= sprintf(
' | <a href="%1$s" class="thickbox open-plugin-details-modal" aria-label="%2$s">%3$s</a>',

View File

@ -514,7 +514,8 @@ function _wp_ajax_add_hierarchical_term() {
ob_start();
wp_terms_checklist(
0, array(
0,
array(
'taxonomy' => $taxonomy->name,
'descendants_and_self' => $cat_id,
'selected_cats' => $checked_categories,
@ -547,7 +548,8 @@ function _wp_ajax_add_hierarchical_term() {
ob_start();
wp_terms_checklist(
0, array(
0,
array(
'taxonomy' => $taxonomy->name,
'descendants_and_self' => $term_id,
'selected_cats' => $checked_categories,
@ -998,7 +1000,8 @@ function wp_ajax_get_tagcloud() {
}
$tags = get_terms(
$taxonomy, array(
$taxonomy,
array(
'number' => 45,
'orderby' => 'count',
'order' => 'DESC',
@ -1020,7 +1023,8 @@ function wp_ajax_get_tagcloud() {
// We need raw tag names here, so don't filter the output
$return = wp_generate_tag_cloud(
$tags, array(
$tags,
array(
'filter' => 0,
'format' => 'list',
)
@ -1460,7 +1464,8 @@ function wp_ajax_add_meta() {
'meta_key' => $key,
'meta_value' => $value,
'meta_id' => $mid,
), $c
),
$c
),
'position' => 0,
'supplemental' => array( 'postid' => $meta->post_id ),
@ -1625,7 +1630,8 @@ function wp_ajax_menu_get_metabox() {
$item = apply_filters( 'nav_menu_meta_box_object', $menus_meta_box_object );
ob_start();
call_user_func_array(
$callback, array(
$callback,
array(
null,
array(
'id' => 'add-' . $item->name,
@ -3166,7 +3172,8 @@ function wp_ajax_query_themes() {
}
$args = wp_parse_args(
wp_unslash( $_REQUEST['request'] ), array(
wp_unslash( $_REQUEST['request'] ),
array(
'per_page' => 20,
'fields' => $theme_field_defaults,
)
@ -3196,7 +3203,8 @@ function wp_ajax_query_themes() {
array(
'theme' => $theme->slug,
'_wpnonce' => wp_create_nonce( 'install-theme_' . $theme->slug ),
), $update_php
),
$update_php
);
if ( current_user_can( 'switch_themes' ) ) {
@ -3206,7 +3214,8 @@ function wp_ajax_query_themes() {
'action' => 'enable',
'_wpnonce' => wp_create_nonce( 'enable-theme_' . $theme->slug ),
'theme' => $theme->slug,
), network_admin_url( 'themes.php' )
),
network_admin_url( 'themes.php' )
);
} else {
$theme->activate_url = add_query_arg(
@ -3214,7 +3223,8 @@ function wp_ajax_query_themes() {
'action' => 'activate',
'_wpnonce' => wp_create_nonce( 'switch-theme_' . $theme->slug ),
'stylesheet' => $theme->slug,
), admin_url( 'themes.php' )
),
admin_url( 'themes.php' )
);
}
}
@ -3223,7 +3233,8 @@ function wp_ajax_query_themes() {
$theme->customize_url = add_query_arg(
array(
'return' => urlencode( network_admin_url( 'theme-install.php', 'relative' ) ),
), wp_customize_url( $theme->slug )
),
wp_customize_url( $theme->slug )
);
}
@ -3666,7 +3677,8 @@ function wp_ajax_install_theme() {
include_once( ABSPATH . 'wp-admin/includes/theme.php' );
$api = themes_api(
'theme_information', array(
'theme_information',
array(
'slug' => $slug,
'fields' => array( 'sections' => false ),
)
@ -3719,7 +3731,8 @@ function wp_ajax_install_theme() {
'action' => 'enable',
'_wpnonce' => wp_create_nonce( 'enable-theme_' . $slug ),
'theme' => $slug,
), network_admin_url( 'themes.php' )
),
network_admin_url( 'themes.php' )
);
} else {
$status['activateUrl'] = add_query_arg(
@ -3727,7 +3740,8 @@ function wp_ajax_install_theme() {
'action' => 'activate',
'_wpnonce' => wp_create_nonce( 'switch-theme_' . $slug ),
'stylesheet' => $slug,
), admin_url( 'themes.php' )
),
admin_url( 'themes.php' )
);
}
}
@ -3736,7 +3750,8 @@ function wp_ajax_install_theme() {
$status['customizeUrl'] = add_query_arg(
array(
'return' => urlencode( network_admin_url( 'theme-install.php', 'relative' ) ),
), wp_customize_url( $slug )
),
wp_customize_url( $slug )
);
}
@ -3950,7 +3965,8 @@ function wp_ajax_install_plugin() {
include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' );
$api = plugins_api(
'plugin_information', array(
'plugin_information',
array(
'slug' => sanitize_key( wp_unslash( $_POST['slug'] ) ),
'fields' => array(
'sections' => false,
@ -4010,7 +4026,8 @@ function wp_ajax_install_plugin() {
'_wpnonce' => wp_create_nonce( 'activate-plugin_' . $install_status['file'] ),
'action' => 'activate',
'plugin' => $install_status['file'],
), $plugins_url
),
$plugins_url
);
}
@ -4220,7 +4237,8 @@ function wp_ajax_search_plugins() {
/** @var WP_Plugins_List_Table $wp_list_table */
$wp_list_table = _get_list_table(
'WP_Plugins_List_Table', array(
'WP_Plugins_List_Table',
array(
'screen' => get_current_screen(),
)
);
@ -4235,11 +4253,13 @@ function wp_ajax_search_plugins() {
// Set the correct requester, so pagination works.
$_SERVER['REQUEST_URI'] = add_query_arg(
array_diff_key(
$_POST, array(
$_POST,
array(
'_ajax_nonce' => null,
'action' => null,
)
), network_admin_url( 'plugins.php', 'relative' )
),
network_admin_url( 'plugins.php', 'relative' )
);
$GLOBALS['s'] = wp_unslash( $_POST['s'] );
@ -4269,7 +4289,8 @@ function wp_ajax_search_install_plugins() {
/** @var WP_Plugin_Install_List_Table $wp_list_table */
$wp_list_table = _get_list_table(
'WP_Plugin_Install_List_Table', array(
'WP_Plugin_Install_List_Table',
array(
'screen' => get_current_screen(),
)
);
@ -4284,11 +4305,13 @@ function wp_ajax_search_install_plugins() {
// Set the correct requester, so pagination works.
$_SERVER['REQUEST_URI'] = add_query_arg(
array_diff_key(
$_POST, array(
$_POST,
array(
'_ajax_nonce' => null,
'action' => null,
)
), network_admin_url( 'plugin-install.php', 'relative' )
),
network_admin_url( 'plugin-install.php', 'relative' )
);
$wp_list_table->prepare_items();

View File

@ -83,7 +83,8 @@ class Automatic_Upgrader_Skin extends WP_Upgrader_Skin {
// Only allow basic HTML in the messages, as it'll be used in emails/logs rather than direct browser output.
$string = wp_kses(
$string, array(
$string,
array(
'a' => array(
'href' => true,
),

View File

@ -180,7 +180,9 @@ class Core_Upgrader extends WP_Upgrader {
$original_result = $result;
$result = new WP_Error(
'rollback_was_required', $this->strings['rollback_was_required'], (object) array(
'rollback_was_required',
$this->strings['rollback_was_required'],
(object) array(
'update' => $original_result,
'rollback' => $rollback_result,
)
@ -189,10 +191,14 @@ class Core_Upgrader extends WP_Upgrader {
}
/** This action is documented in wp-admin/includes/class-wp-upgrader.php */
do_action( 'upgrader_process_complete', $this, array(
do_action(
'upgrader_process_complete',
$this,
array(
'action' => 'update',
'type' => 'core',
) );
)
);
// Clear the current updates
delete_site_transient( 'update_core' );

View File

@ -275,12 +275,16 @@ class Language_Pack_Upgrader extends WP_Upgrader {
remove_action( 'upgrader_process_complete', 'wp_update_themes' );
/** This action is documented in wp-admin/includes/class-wp-upgrader.php */
do_action( 'upgrader_process_complete', $this, array(
do_action(
'upgrader_process_complete',
$this,
array(
'action' => 'update',
'type' => 'translation',
'bulk' => true,
'translations' => $language_updates_results,
) );
)
);
// Re-add upgrade hooks.
add_action( 'upgrader_process_complete', array( 'Language_Pack_Upgrader', 'async_upgrade' ), 20 );
@ -337,7 +341,8 @@ class Language_Pack_Upgrader extends WP_Upgrader {
if ( ! $mo || ! $po ) {
return new WP_Error(
'incompatible_archive_pomo', $this->strings['incompatible_archive'],
'incompatible_archive_pomo',
$this->strings['incompatible_archive'],
/* translators: 1: .po, 2: .mo */
sprintf(
__( 'The language pack is missing either the %1$s or %2$s files.' ),

View File

@ -306,12 +306,16 @@ class Plugin_Upgrader extends WP_Upgrader {
wp_clean_plugins_cache( $parsed_args['clear_update_cache'] );
/** This action is documented in wp-admin/includes/class-wp-upgrader.php */
do_action( 'upgrader_process_complete', $this, array(
do_action(
'upgrader_process_complete',
$this,
array(
'action' => 'update',
'type' => 'plugin',
'bulk' => true,
'plugins' => $plugins,
) );
)
);
$this->skin->bulk_footer();

View File

@ -67,7 +67,8 @@ class Theme_Installer_Skin extends WP_Upgrader_Skin {
'action' => 'activate',
'template' => urlencode( $template ),
'stylesheet' => urlencode( $stylesheet ),
), admin_url( 'themes.php' )
),
admin_url( 'themes.php' )
);
$activate_link = wp_nonce_url( $activate_link, 'switch-theme_' . $stylesheet );

View File

@ -51,7 +51,8 @@ class Theme_Upgrader_Skin extends WP_Upgrader_Skin {
'action' => 'activate',
'template' => urlencode( $template ),
'stylesheet' => urlencode( $stylesheet ),
), admin_url( 'themes.php' )
),
admin_url( 'themes.php' )
);
$activate_link = wp_nonce_url( $activate_link, 'switch-theme_' . $stylesheet );

View File

@ -111,7 +111,8 @@ class Theme_Upgrader extends WP_Upgrader {
// We don't have the parent theme, let's install it.
$api = themes_api(
'theme_information', array(
'theme_information',
array(
'slug' => $theme_info->get( 'Template' ),
'fields' => array(
'sections' => false,
@ -418,7 +419,9 @@ class Theme_Upgrader extends WP_Upgrader {
/** This action is documented in wp-admin/includes/class-wp-upgrader.php */
do_action(
'upgrader_process_complete', $this, array(
'upgrader_process_complete',
$this,
array(
'action' => 'update',
'type' => 'theme',
'bulk' => true,
@ -468,7 +471,8 @@ class Theme_Upgrader extends WP_Upgrader {
// A proper archive should have a style.css file in the single subdirectory
if ( ! file_exists( $working_directory . 'style.css' ) ) {
return new WP_Error(
'incompatible_archive_theme_no_style', $this->strings['incompatible_archive'],
'incompatible_archive_theme_no_style',
$this->strings['incompatible_archive'],
/* translators: %s: style.css */
sprintf(
__( 'The theme is missing the %s stylesheet.' ),
@ -478,7 +482,8 @@ class Theme_Upgrader extends WP_Upgrader {
}
$info = get_file_data(
$working_directory . 'style.css', array(
$working_directory . 'style.css',
array(
'Name' => 'Theme Name',
'Template' => 'Template',
)
@ -486,7 +491,8 @@ class Theme_Upgrader extends WP_Upgrader {
if ( empty( $info['Name'] ) ) {
return new WP_Error(
'incompatible_archive_theme_no_name', $this->strings['incompatible_archive'],
'incompatible_archive_theme_no_name',
$this->strings['incompatible_archive'],
/* translators: %s: style.css */
sprintf(
__( 'The %s stylesheet doesn&#8217;t contain a valid theme header.' ),
@ -498,7 +504,8 @@ class Theme_Upgrader extends WP_Upgrader {
// If it's not a child theme, it must have at least an index.php to be legit.
if ( empty( $info['Template'] ) && ! file_exists( $working_directory . 'index.php' ) ) {
return new WP_Error(
'incompatible_archive_theme_no_index', $this->strings['incompatible_archive'],
'incompatible_archive_theme_no_index',
$this->strings['incompatible_archive'],
/* translators: %s: index.php */
sprintf(
__( 'The theme is missing the %s file.' ),

View File

@ -240,7 +240,8 @@ class Walker_Nav_Menu_Edit extends Walker_Nav_Menu {
array(
'edit-menu-item' => $item_id,
'cancel' => time(),
), admin_url( 'nav-menus.php' )
),
admin_url( 'nav-menus.php' )
)
);
?>

View File

@ -336,7 +336,8 @@ class WP_Automatic_Updater {
// Boom, This sites about to get a whole new splash of paint!
$upgrade_result = $upgrader->upgrade(
$upgrader_item, array(
$upgrader_item,
array(
'clear_update_cache' => false,
// Always use partial builds if possible for core updates.
'pre_check_md5' => false,
@ -574,7 +575,8 @@ class WP_Automatic_Updater {
}
update_site_option(
'auto_core_update_failed', array(
'auto_core_update_failed',
array(
'attempted' => $core_update->current,
'current' => $wp_version,
'error_code' => $error_code,
@ -600,7 +602,8 @@ class WP_Automatic_Updater {
*/
protected function send_email( $type, $core_update, $result = null ) {
update_site_option(
'auto_core_update_notified', array(
'auto_core_update_notified',
array(
'type' => $type,
'email' => get_site_option( 'admin_email' ),
'version' => $core_update->current,

View File

@ -158,7 +158,8 @@ class WP_Comments_List_Table extends WP_List_Table {
$total_comments = get_comments(
array_merge(
$args, array(
$args,
array(
'count' => true,
'offset' => 0,
'number' => 0,
@ -277,10 +278,12 @@ class WP_Comments_List_Table extends WP_List_Table {
if ( 'mine' === $status ) {
$current_user_id = get_current_user_id();
$num_comments->mine = get_comments( array(
$num_comments->mine = get_comments(
array(
'user_id' => $current_user_id,
'count' => true,
) );
)
);
$link = add_query_arg( 'user_id', $current_user_id, $link );
} else {
$link = remove_query_arg( 'user_id', $link );
@ -384,7 +387,8 @@ if ( 'top' === $which ) {
* @param string[] $comment_types An array of comment types. Accepts 'Comments', 'Pings'.
*/
$comment_types = apply_filters(
'admin_comment_types_dropdown', array(
'admin_comment_types_dropdown',
array(
'comment' => __( 'Comments' ),
'pings' => __( 'Pings' ),
)
@ -759,7 +763,8 @@ if ( ( 'spam' === $comment_status || 'trash' === $comment_status ) && current_us
array(
's' => $author_ip,
'mode' => 'detail',
), admin_url( 'edit-comments.php' )
),
admin_url( 'edit-comments.php' )
);
if ( 'spam' === $comment_status ) {
$author_ip_url = add_query_arg( 'comment_status', 'spam', $author_ip_url );

View File

@ -137,7 +137,8 @@ class WP_List_Table {
*/
public function __construct( $args = array() ) {
$args = wp_parse_args(
$args, array(
$args,
array(
'plural' => '',
'singular' => '',
'ajax' => false,
@ -274,7 +275,8 @@ class WP_List_Table {
*/
protected function set_pagination_args( $args ) {
$args = wp_parse_args(
$args, array(
$args,
array(
'total_items' => 0,
'total_pages' => 0,
'per_page' => 0,
@ -568,7 +570,8 @@ class WP_List_Table {
WHERE post_type = %s
$extra_checks
ORDER BY post_date DESC
", $post_type
",
$post_type
)
);
@ -677,7 +680,8 @@ foreach ( $this->modes as $mode => $title ) {
array(
'p' => $post_id,
'comment_status' => 'approved',
), admin_url( 'edit-comments.php' )
),
admin_url( 'edit-comments.php' )
)
),
$approved_comments_number,
@ -699,7 +703,8 @@ foreach ( $this->modes as $mode => $title ) {
array(
'p' => $post_id,
'comment_status' => 'moderated',
), admin_url( 'edit-comments.php' )
),
admin_url( 'edit-comments.php' )
)
),
$pending_comments_number,

View File

@ -505,7 +505,8 @@ if ( ! empty( $views ) ) {
'parent_post_id' => $post->post_parent,
'media[]' => $post->ID,
'_wpnonce' => wp_create_nonce( 'bulk-' . $this->_args['plural'] ),
), 'upload.php'
),
'upload.php'
);
printf(
'<br /><a href="%s" class="hide-if-no-js detach-from-parent" aria-label="%s">%s</a>',

View File

@ -176,7 +176,8 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
$total_sites = get_sites(
array_merge(
$args, array(
$args,
array(
'count' => true,
'offset' => 0,
'number' => 0,
@ -406,12 +407,14 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
public function column_users( $blog ) {
$user_count = wp_cache_get( $blog['blog_id'] . '_user_count', 'blog-details' );
if ( ! $user_count ) {
$blog_users = new WP_User_Query( array(
$blog_users = new WP_User_Query(
array(
'blog_id' => $blog['blog_id'],
'fields' => 'ID',
'number' => 1,
'count_total' => true,
) );
)
);
$user_count = $blog_users->get_total();
wp_cache_set( $blog['blog_id'] . '_user_count', $user_count, 'blog-details', 12 * HOUR_IN_SECONDS );
}

View File

@ -153,7 +153,9 @@ class WP_MS_Themes_List_Table extends WP_List_Table {
$total_this_page = $totals[ $status ];
wp_localize_script(
'updates', '_wpUpdatesItemCounts', array(
'updates',
'_wpUpdatesItemCounts',
array(
'themes' => $totals,
'totals' => wp_get_update_data(),
)
@ -423,7 +425,8 @@ class WP_MS_Themes_List_Table extends WP_List_Table {
'theme' => $theme_key,
'paged' => $page,
's' => $s,
), $url
),
$url
);
if ( $this->is_site_themes ) {
@ -448,7 +451,8 @@ class WP_MS_Themes_List_Table extends WP_List_Table {
'theme' => $theme_key,
'paged' => $page,
's' => $s,
), $url
),
$url
);
if ( $this->is_site_themes ) {
@ -475,7 +479,8 @@ class WP_MS_Themes_List_Table extends WP_List_Table {
'theme_status' => $context,
'paged' => $page,
's' => $s,
), 'themes.php'
),
'themes.php'
);
/* translators: %s: theme name */

View File

@ -256,7 +256,9 @@ class WP_Plugin_Install_List_Table extends WP_List_Table {
}
wp_localize_script(
'updates', '_wpUpdatesItemCounts', array(
'updates',
'_wpUpdatesItemCounts',
array(
'plugins' => $js_plugins,
'totals' => wp_get_update_data(),
)
@ -560,7 +562,8 @@ class WP_Plugin_Install_List_Table extends WP_List_Table {
'_wpnonce' => wp_create_nonce( 'activate-plugin_' . $status['file'] ),
'action' => 'activate',
'plugin' => $status['file'],
), network_admin_url( 'plugins.php' )
),
network_admin_url( 'plugins.php' )
);
if ( is_network_admin() ) {

View File

@ -256,7 +256,9 @@ class WP_Plugins_List_Table extends WP_List_Table {
}
wp_localize_script(
'updates', '_wpUpdatesItemCounts', array(
'updates',
'_wpUpdatesItemCounts',
array(
'plugins' => $js_plugins,
'totals' => wp_get_update_data(),
)

View File

@ -98,7 +98,9 @@ class WP_Posts_List_Table extends WP_List_Table {
WHERE post_type = %s
AND post_status NOT IN ( '" . implode( "','", $exclude_states ) . "' )
AND post_author = %d
", $post_type, get_current_user_id()
",
$post_type,
get_current_user_id()
)
)
);

View File

@ -968,7 +968,8 @@ if ( $this->show_screen_options() ) :
*/
public function render_screen_options( $options = array() ) {
$options = wp_parse_args(
$options, array(
$options,
array(
'wrap' => true,
)
);

View File

@ -212,7 +212,8 @@ class WP_Terms_List_Table extends WP_List_Table {
$taxonomy = $this->screen->taxonomy;
$args = wp_parse_args(
$this->callback_args, array(
$this->callback_args,
array(
'page' => 1,
'number' => 20,
'search' => '',

View File

@ -270,7 +270,8 @@ class WP_Theme_Install_List_Table extends WP_Themes_List_Table {
array(
'tab' => 'theme-information',
'theme' => $theme->slug,
), self_admin_url( 'theme-install.php' )
),
self_admin_url( 'theme-install.php' )
);
$actions = array();
@ -279,14 +280,16 @@ class WP_Theme_Install_List_Table extends WP_Themes_List_Table {
array(
'action' => 'install-theme',
'theme' => $theme->slug,
), self_admin_url( 'update.php' )
),
self_admin_url( 'update.php' )
);
$update_url = add_query_arg(
array(
'action' => 'upgrade-theme',
'theme' => $theme->slug,
), self_admin_url( 'update.php' )
),
self_admin_url( 'update.php' )
);
$status = $this->_get_theme_status( $theme );
@ -346,10 +349,12 @@ class WP_Theme_Install_List_Table extends WP_Themes_List_Table {
</a>
<h3><?php echo $name; ?></h3>
<div class="theme-author"><?php
<div class="theme-author">
<?php
/* translators: %s: theme author */
printf( __( 'By %s' ), $author );
?></div>
?>
</div>
<div class="action-links">
<ul>
@ -430,14 +435,16 @@ class WP_Theme_Install_List_Table extends WP_Themes_List_Table {
array(
'action' => 'install-theme',
'theme' => $theme->slug,
), self_admin_url( 'update.php' )
),
self_admin_url( 'update.php' )
);
$update_url = add_query_arg(
array(
'action' => 'upgrade-theme',
'theme' => $theme->slug,
), self_admin_url( 'update.php' )
),
self_admin_url( 'update.php' )
);
$status = $this->_get_theme_status( $theme );
@ -474,10 +481,12 @@ class WP_Theme_Install_List_Table extends WP_Themes_List_Table {
}
?>
<h3 class="theme-name"><?php echo $name; ?></h3>
<span class="theme-by"><?php
<span class="theme-by">
<?php
/* translators: %s: theme author */
printf( __( 'By %s' ), $author );
?></span>
?>
</span>
<?php if ( isset( $theme->screenshot_url ) ) : ?>
<img class="theme-screenshot" src="<?php echo esc_url( $theme->screenshot_url ); ?>" alt="" />
<?php endif; ?>

View File

@ -1049,7 +1049,9 @@ function wp_dashboard_trigger_widget_control( $widget_control_id = false ) {
if ( is_scalar( $widget_control_id ) && $widget_control_id && isset( $wp_dashboard_control_callbacks[ $widget_control_id ] ) && is_callable( $wp_dashboard_control_callbacks[ $widget_control_id ] ) ) {
call_user_func(
$wp_dashboard_control_callbacks[ $widget_control_id ], '', array(
$wp_dashboard_control_callbacks[ $widget_control_id ],
'',
array(
'id' => $widget_control_id,
'callback' => $wp_dashboard_control_callbacks[ $widget_control_id ],
)
@ -1760,7 +1762,8 @@ function wp_welcome_panel() {
if ( current_theme_supports( 'widgets' ) && current_theme_supports( 'menus' ) ) {
printf(
__( 'Manage <a href="%1$s">widgets</a> or <a href="%2$s">menus</a>' ),
admin_url( 'widgets.php' ), admin_url( 'nav-menus.php' )
admin_url( 'widgets.php' ),
admin_url( 'nav-menus.php' )
);
} elseif ( current_theme_supports( 'widgets' ) ) {
echo '<a href="' . admin_url( 'widgets.php' ) . '">' . __( 'Manage widgets' ) . '</a>';

View File

@ -890,11 +890,13 @@ function _wp_handle_upload( &$file, $overrides, $time, $action ) {
* @param string $context The type of upload action. Values include 'upload' or 'sideload'.
*/
return apply_filters(
'wp_handle_upload', array(
'wp_handle_upload',
array(
'file' => $new_file,
'url' => $url,
'type' => $type,
), 'wp_handle_sideload' === $action ? 'sideload' : 'upload'
),
'wp_handle_sideload' === $action ? 'sideload' : 'upload'
);
}
@ -982,7 +984,8 @@ function download_url( $url, $timeout = 300 ) {
}
$response = wp_safe_remote_get(
$url, array(
$url,
array(
'timeout' => $timeout,
'stream' => true,
'filename' => $tmpfname,
@ -1679,7 +1682,8 @@ function request_filesystem_credentials( $form_post, $type = '', $error = false,
}
$credentials = get_option(
'ftp_credentials', array(
'ftp_credentials',
array(
'hostname' => '',
'username' => '',
)
@ -1955,9 +1959,9 @@ function wp_privacy_generate_personal_data_export_group_html( $group_data ) {
$allowed_tags = array(
'a' => array(
'href' => array(),
'target' => array()
'target' => array(),
),
'br' => array()
'br' => array(),
);
$allowed_protocols = array( 'http', 'https' );
$group_html = '';
@ -2060,22 +2064,22 @@ function wp_privacy_generate_personal_data_export_file( $request_id ) {
fwrite( $file, "<head>\n" );
fwrite( $file, "<meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />\n" );
fwrite( $file, "<style type='text/css'>" );
fwrite( $file, "body { color: black; font-family: Arial, sans-serif; font-size: 11pt; margin: 15px auto; width: 860px; }" );
fwrite( $file, "table { background: #f0f0f0; border: 1px solid #ddd; margin-bottom: 20px; width: 100%; }" );
fwrite( $file, "th { padding: 5px; text-align: left; width: 20%; }" );
fwrite( $file, "td { padding: 5px; }" );
fwrite( $file, "tr:nth-child(odd) { background-color: #fafafa; }" );
fwrite( $file, "</style>" );
fwrite( $file, "<title>" );
fwrite( $file, 'body { color: black; font-family: Arial, sans-serif; font-size: 11pt; margin: 15px auto; width: 860px; }' );
fwrite( $file, 'table { background: #f0f0f0; border: 1px solid #ddd; margin-bottom: 20px; width: 100%; }' );
fwrite( $file, 'th { padding: 5px; text-align: left; width: 20%; }' );
fwrite( $file, 'td { padding: 5px; }' );
fwrite( $file, 'tr:nth-child(odd) { background-color: #fafafa; }' );
fwrite( $file, '</style>' );
fwrite( $file, '<title>' );
fwrite( $file, esc_html( $title ) );
fwrite( $file, "</title>" );
fwrite( $file, '</title>' );
fwrite( $file, "</head>\n" );
// Body.
fwrite( $file, "<body>\n" );
// Heading.
fwrite( $file, "<h1>" . esc_html__( 'Personal Data Export' ) . "</h1>" );
fwrite( $file, '<h1>' . esc_html__( 'Personal Data Export' ) . '</h1>' );
// And now, all the Groups.
$groups = get_post_meta( $request_id, '_export_data_grouped', true );

View File

@ -141,7 +141,8 @@ function wp_get_popular_importers() {
array(
'locale' => $locale,
'version' => $wp_version,
), 'http://api.wordpress.org/core/importers/1.1/'
),
'http://api.wordpress.org/core/importers/1.1/'
);
$options = array( 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url( '/' ) );

View File

@ -388,7 +388,8 @@ function media_handle_upload( $file_id, $post_id, $post_data = array(), $overrid
'post_title' => $title,
'post_content' => $content,
'post_excerpt' => $excerpt,
), $post_data
),
$post_data
);
// This should never be set as it would then overwrite an existing attachment.
@ -458,7 +459,8 @@ function media_handle_sideload( $file_array, $post_id, $desc = null, $post_data
'post_parent' => $post_id,
'post_title' => $title,
'post_content' => $content,
), $post_data
),
$post_data
);
// This should never be set as it would then overwrite an existing attachment.
@ -1069,7 +1071,8 @@ function image_size_input_fields( $post, $check = '' ) {
* include 'Thumbnail', 'Medium', 'Large', 'Full Size'.
*/
$size_names = apply_filters(
'image_size_names_choose', array(
'image_size_names_choose',
array(
'thumbnail' => __( 'Thumbnail' ),
'medium' => __( 'Medium' ),
'large' => __( 'Large' ),
@ -1781,9 +1784,15 @@ function get_compat_media_markup( $attachment_id, $args = null ) {
$form_fields = apply_filters( 'attachment_fields_to_edit', $form_fields, $post );
unset(
$form_fields['image-size'], $form_fields['align'], $form_fields['image_alt'],
$form_fields['post_title'], $form_fields['post_excerpt'], $form_fields['post_content'],
$form_fields['url'], $form_fields['menu_order'], $form_fields['image_url']
$form_fields['image-size'],
$form_fields['align'],
$form_fields['image_alt'],
$form_fields['post_title'],
$form_fields['post_excerpt'],
$form_fields['post_content'],
$form_fields['url'],
$form_fields['menu_order'],
$form_fields['image_url']
);
/** This filter is documented in wp-admin/includes/media.php */
@ -2400,7 +2409,11 @@ jQuery(function($){
<p class="ml-submit">
<?php
submit_button(
__( 'Save all changes' ), 'savebutton', 'save', false, array(
__( 'Save all changes' ),
'savebutton',
'save',
false,
array(
'id' => 'save-all',
'style' => 'display: none;',
)

View File

@ -579,7 +579,8 @@ function post_categories_meta_box( $post, $box ) {
<ul id="<?php echo $tax_name; ?>checklist" data-wp-lists="list:<?php echo $tax_name; ?>" class="categorychecklist form-no-clear">
<?php
wp_terms_checklist(
$post->ID, array(
$post->ID,
array(
'taxonomy' => $tax_name,
'popular_cats' => $popular_ids,
)

View File

@ -165,7 +165,8 @@ function insert_with_markers( $filename, $marker, $insertion ) {
// Generate the new file data
$new_file_data = implode(
"\n", array_merge(
"\n",
array_merge(
$pre_lines,
array( $start_marker ),
$insertion,
@ -855,7 +856,8 @@ function admin_color_scheme_picker( $user_id ) {
array(
'fresh' => '',
'light' => '',
), $_wp_admin_css_colors
),
$_wp_admin_css_colors
)
);
}
@ -1428,13 +1430,15 @@ final class WP_Privacy_Policy_Content {
?>
<div class="policy-text-updated notice notice-warning">
<p><?php
<p>
<?php
printf(
/* translators: %s: Privacy Policy Guide URL */
__( 'The suggested privacy policy text has changed. Please <a href="%s">review the guide</a> and update your privacy policy.' ),
esc_url( admin_url( 'tools.php?wp-privacy-policy-guide=1' ) )
);
?></p>
?>
</p>
</div>
<?php
}

View File

@ -1147,7 +1147,8 @@ function network_edit_site_nav( $args = array() ) {
* }
*/
$links = apply_filters(
'network_edit_site_nav_links', array(
'network_edit_site_nav_links',
array(
'site-info' => array(
'label' => __( 'Info' ),
'url' => 'site-info.php',
@ -1173,7 +1174,8 @@ function network_edit_site_nav( $args = array() ) {
// Parse arguments
$r = wp_parse_args(
$args, array(
$args,
array(
'blog_id' => isset( $_GET['blog_id'] ) ? (int) $_GET['blog_id'] : 0,
'links' => $links,
'selected' => 'site-info',

View File

@ -105,7 +105,8 @@ function _wp_ajax_menu_quick_search( $request = array() ) {
}
} elseif ( 'taxonomy' == $matches[1] ) {
$terms = get_terms(
$matches[2], array(
$matches[2],
array(
'name__like' => $query,
'number' => 10,
)
@ -149,7 +150,8 @@ function wp_nav_menu_setup() {
if ( false === get_user_option( 'managenav-menuscolumnshidden' ) ) {
$user = wp_get_current_user();
update_user_option(
$user->ID, 'managenav-menuscolumnshidden',
$user->ID,
'managenav-menuscolumnshidden',
array(
0 => 'link-target',
1 => 'css-classes',
@ -439,7 +441,8 @@ function wp_nav_menu_item_post_type_meta_box( $object, $box ) {
<ul id="<?php echo $post_type_name; ?>checklist-most-recent" class="categorychecklist form-no-clear">
<?php
$recent_args = array_merge(
$args, array(
$args,
array(
'orderby' => 'post_date',
'order' => 'DESC',
'posts_per_page' => 15,
@ -530,7 +533,8 @@ function wp_nav_menu_item_post_type_meta_box( $object, $box ) {
} else {
$_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? intval( $_nav_menu_placeholder ) - 1 : -1;
array_unshift(
$posts, (object) array(
$posts,
(object) array(
'front_or_home' => true,
'ID' => 0,
'object_id' => $_nav_menu_placeholder,
@ -551,7 +555,8 @@ function wp_nav_menu_item_post_type_meta_box( $object, $box ) {
if ( $post_type->has_archive ) {
$_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? intval( $_nav_menu_placeholder ) - 1 : -1;
array_unshift(
$posts, (object) array(
$posts,
(object) array(
'ID' => 0,
'object_id' => $_nav_menu_placeholder,
'object' => $post_type_name,
@ -677,8 +682,10 @@ function wp_nav_menu_item_taxonomy_meta_box( $object, $box ) {
$num_pages = ceil(
wp_count_terms(
$taxonomy_name, array_merge(
$args, array(
$taxonomy_name,
array_merge(
$args,
array(
'number' => '',
'offset' => '',
)
@ -763,7 +770,8 @@ function wp_nav_menu_item_taxonomy_meta_box( $object, $box ) {
<ul id="<?php echo $taxonomy_name; ?>checklist-pop" class="categorychecklist form-no-clear" >
<?php
$popular_terms = get_terms(
$taxonomy_name, array(
$taxonomy_name,
array(
'orderby' => 'count',
'order' => 'DESC',
'number' => 10,
@ -800,7 +808,8 @@ function wp_nav_menu_item_taxonomy_meta_box( $object, $box ) {
if ( isset( $_REQUEST[ 'quick-search-taxonomy-' . $taxonomy_name ] ) ) {
$searched = esc_attr( $_REQUEST[ 'quick-search-taxonomy-' . $taxonomy_name ] );
$search_results = get_terms(
$taxonomy_name, array(
$taxonomy_name,
array(
'name__like' => $searched,
'fields' => 'all',
'orderby' => 'count',
@ -1096,7 +1105,8 @@ function _wp_delete_orphaned_draft_menu_items() {
*/
function wp_nav_menu_update_menu_items( $nav_menu_selected_id, $nav_menu_selected_title ) {
$unsorted_menu_items = wp_get_nav_menu_items(
$nav_menu_selected_id, array(
$nav_menu_selected_id,
array(
'orderby' => 'ID',
'output' => ARRAY_A,
'output_key' => 'ID',

View File

@ -288,7 +288,8 @@ function install_dashboard() {
$tags[ $tag['name'] ] = (object) $data;
}
echo wp_generate_tag_cloud(
$tags, array(
$tags,
array(
'single_text' => __( '%s plugin' ),
'multiple_text' => __( '%s plugins' ),
)
@ -501,7 +502,8 @@ function install_plugin_information() {
}
$api = plugins_api(
'plugin_information', array(
'plugin_information',
array(
'slug' => wp_unslash( $_REQUEST['plugin'] ),
)
);

View File

@ -239,7 +239,8 @@ function edit_post( $post_data = null ) {
if ( post_type_supports( $ptype->name, 'revisions' ) ) {
$revisions = wp_get_post_revisions(
$post_ID, array(
$post_ID,
array(
'order' => 'ASC',
'posts_per_page' => 1,
)
@ -955,8 +956,10 @@ function has_meta( $postid ) {
$wpdb->prepare(
"SELECT meta_key, meta_value, meta_id, post_id
FROM $wpdb->postmeta WHERE post_id = %d
ORDER BY meta_key,meta_id", $postid
), ARRAY_A
ORDER BY meta_key,meta_id",
$postid
),
ARRAY_A
);
}
@ -2002,7 +2005,8 @@ function taxonomy_meta_box_sanitize_cb_input( $taxonomy, $terms ) {
}
$_term = get_terms(
$taxonomy, array(
$taxonomy,
array(
'name' => $term,
'fields' => 'ids',
'hide_empty' => false,

View File

@ -167,7 +167,8 @@ function wp_prepare_revisions_for_js( $post, $selected_revision_id, $from = null
$now_gmt = time();
$revisions = wp_get_post_revisions(
$post->ID, array(
$post->ID,
array(
'order' => 'ASC',
'check_enabled' => false,
)
@ -194,7 +195,9 @@ function wp_prepare_revisions_for_js( $post, $selected_revision_id, $from = null
$modified_gmt = strtotime( $revision->post_modified_gmt . ' +0000' );
if ( $can_restore ) {
$restore_link = str_replace(
'&amp;', '&', wp_nonce_url(
'&amp;',
'&',
wp_nonce_url(
add_query_arg(
array(
'revision' => $revision->ID,

View File

@ -1027,7 +1027,8 @@ function populate_network( $network_id = 1, $domain = '', $email = '', $site_nam
if ( 1 == $network_id ) {
$wpdb->insert(
$wpdb->site, array(
$wpdb->site,
array(
'domain' => $domain,
'path' => $path,
)
@ -1035,7 +1036,8 @@ function populate_network( $network_id = 1, $domain = '', $email = '', $site_nam
$network_id = $wpdb->insert_id;
} else {
$wpdb->insert(
$wpdb->site, array(
$wpdb->site,
array(
'domain' => $domain,
'path' => $path,
'id' => $network_id,
@ -1179,7 +1181,8 @@ We hope you enjoy your new site. Thanks!
$current_site->path = $path;
$current_site->site_name = ucfirst( $domain );
$wpdb->insert(
$wpdb->blogs, array(
$wpdb->blogs,
array(
'site_id' => $network_id,
'blog_id' => 1,
'domain' => $domain,
@ -1207,7 +1210,8 @@ We hope you enjoy your new site. Thanks!
$errstr = '';
$hostname = substr( md5( time() ), 0, 6 ) . '.' . $domain; // Very random hostname!
$page = wp_remote_get(
'http://' . $hostname, array(
'http://' . $hostname,
array(
'timeout' => 5,
'httpversion' => '1.1',
)

View File

@ -39,7 +39,8 @@ require_once( ABSPATH . 'wp-admin/includes/class-wp-internal-pointers.php' );
*/
function wp_category_checklist( $post_id = 0, $descendants_and_self = 0, $selected_cats = false, $popular_cats = false, $walker = null, $checked_ontop = true ) {
wp_terms_checklist(
$post_id, array(
$post_id,
array(
'taxonomy' => 'category',
'descendants_and_self' => $descendants_and_self,
'selected_cats' => $selected_cats,
@ -128,7 +129,8 @@ function wp_terms_checklist( $post_id = 0, $args = array() ) {
$args['popular_cats'] = $r['popular_cats'];
} else {
$args['popular_cats'] = get_terms(
$taxonomy, array(
$taxonomy,
array(
'fields' => 'ids',
'orderby' => 'count',
'order' => 'DESC',
@ -139,7 +141,8 @@ function wp_terms_checklist( $post_id = 0, $args = array() ) {
}
if ( $descendants_and_self ) {
$categories = (array) get_terms(
$taxonomy, array(
$taxonomy,
array(
'child_of' => $descendants_and_self,
'hierarchical' => 0,
'hide_empty' => 0,
@ -204,7 +207,8 @@ function wp_popular_terms_checklist( $taxonomy, $default = 0, $number = 10, $ech
}
$terms = get_terms(
$taxonomy, array(
$taxonomy,
array(
'orderby' => 'count',
'order' => 'DESC',
'number' => $number,
@ -262,7 +266,8 @@ function wp_link_category_checklist( $link_id = 0 ) {
}
$categories = get_terms(
'link_category', array(
'link_category',
array(
'orderby' => 'name',
'hide_empty' => 0,
)
@ -404,7 +409,9 @@ function wp_comment_reply( $position = 1, $checkbox = false, $mode = 'single', $
* @param array $args An array of default args.
*/
$content = apply_filters(
'wp_comment_reply', '', array(
'wp_comment_reply',
'',
array(
'position' => $position,
'checkbox' => $checkbox,
'mode' => $mode,
@ -443,7 +450,9 @@ function wp_comment_reply( $position = 1, $checkbox = false, $mode = 'single', $
<?php
$quicktags_settings = array( 'buttons' => 'strong,em,link,block,del,ins,img,ul,ol,li,code,close' );
wp_editor(
'', 'replycontent', array(
'',
'replycontent',
array(
'media_buttons' => false,
'tinymce' => false,
'quicktags' => $quicktags_settings,
@ -717,7 +726,11 @@ foreach ( $keys as $key ) {
<div class="submit">
<?php
submit_button(
__( 'Add Custom Field' ), '', 'addmeta', false, array(
__( 'Add Custom Field' ),
'',
'addmeta',
false,
array(
'id' => 'newmeta-submit',
'data-wp-lists' => 'add:the-list:newmeta',
)
@ -1317,7 +1330,8 @@ function add_settings_section( $id, $title, $callback, $page ) {
if ( 'misc' == $page ) {
_deprecated_argument(
__FUNCTION__, '3.0.0',
__FUNCTION__,
'3.0.0',
/* translators: %s: misc */
sprintf(
__( 'The "%s" options group has been removed. Use another settings group.' ),
@ -1329,7 +1343,8 @@ function add_settings_section( $id, $title, $callback, $page ) {
if ( 'privacy' == $page ) {
_deprecated_argument(
__FUNCTION__, '3.5.0',
__FUNCTION__,
'3.5.0',
/* translators: %s: privacy */
sprintf(
__( 'The "%s" options group has been removed. Use another settings group.' ),
@ -1386,7 +1401,8 @@ function add_settings_field( $id, $title, $callback, $page, $section = 'default'
if ( 'misc' == $page ) {
_deprecated_argument(
__FUNCTION__, '3.0.0',
__FUNCTION__,
'3.0.0',
/* translators: %s: misc */
sprintf(
__( 'The "%s" options group has been removed. Use another settings group.' ),
@ -1398,7 +1414,8 @@ function add_settings_field( $id, $title, $callback, $page, $section = 'default'
if ( 'privacy' == $page ) {
_deprecated_argument(
__FUNCTION__, '3.5.0',
__FUNCTION__,
'3.5.0',
/* translators: %s: privacy */
sprintf(
__( 'The "%s" options group has been removed. Use another settings group.' ),

View File

@ -183,7 +183,8 @@ function get_theme_update_available( $theme ) {
'TB_iframe' => 'true',
'width' => 1024,
'height' => 800,
), $update['url']
),
$update['url']
); //Theme browser inside WP? replace this, Also, theme preview JS will override this on the available list.
$update_url = wp_nonce_url( admin_url( 'update.php?action=upgrade-theme&amp;theme=' . urlencode( $stylesheet ) ), 'upgrade-theme_' . $stylesheet );

View File

@ -34,7 +34,8 @@ function get_core_updates( $options = array() ) {
array(
'available' => true,
'dismissed' => false,
), $options
),
$options
);
$dismissed = get_site_option( 'dismissed_update_core' );
@ -549,7 +550,8 @@ function wp_theme_update_row( $theme_key, $theme ) {
'TB_iframe' => 'true',
'width' => 1024,
'height' => 800,
), $current->response[ $theme_key ]['url']
),
$current->response[ $theme_key ]['url']
);
/** @var WP_MS_Themes_List_Table $wp_list_table */

View File

@ -147,7 +147,8 @@ if ( ! function_exists( 'wp_install_defaults' ) ) :
$cat_id = $wpdb->get_var( $wpdb->prepare( "SELECT cat_ID FROM {$wpdb->sitecategories} WHERE category_nicename = %s", $cat_slug ) );
if ( $cat_id == null ) {
$wpdb->insert(
$wpdb->sitecategories, array(
$wpdb->sitecategories,
array(
'cat_ID' => 0,
'cat_name' => $cat_name,
'category_nicename' => $cat_slug,
@ -162,7 +163,8 @@ if ( ! function_exists( 'wp_install_defaults' ) ) :
}
$wpdb->insert(
$wpdb->terms, array(
$wpdb->terms,
array(
'term_id' => $cat_id,
'name' => $cat_name,
'slug' => $cat_slug,
@ -170,7 +172,8 @@ if ( ! function_exists( 'wp_install_defaults' ) ) :
)
);
$wpdb->insert(
$wpdb->term_taxonomy, array(
$wpdb->term_taxonomy,
array(
'term_id' => $cat_id,
'taxonomy' => 'category',
'description' => '',
@ -206,7 +209,8 @@ if ( ! function_exists( 'wp_install_defaults' ) ) :
}
$wpdb->insert(
$wpdb->posts, array(
$wpdb->posts,
array(
'post_author' => $user_id,
'post_date' => $now,
'post_date_gmt' => $now_gmt,
@ -225,7 +229,8 @@ if ( ! function_exists( 'wp_install_defaults' ) ) :
)
);
$wpdb->insert(
$wpdb->term_relationships, array(
$wpdb->term_relationships,
array(
'term_taxonomy_id' => $cat_tt_id,
'object_id' => 1,
)
@ -248,7 +253,8 @@ To get started with moderating, editing, and deleting comments, please visit the
Commenter avatars come from <a href="https://gravatar.com">Gravatar</a>.'
);
$wpdb->insert(
$wpdb->comments, array(
$wpdb->comments,
array(
'comment_post_ID' => 1,
'comment_author' => $first_comment_author,
'comment_author_email' => $first_comment_email,
@ -275,12 +281,14 @@ Commenter avatars come from <a href="https://gravatar.com">Gravatar</a>.'
<blockquote>The XYZ Doohickey Company was founded in 1971, and has been providing quality doohickeys to the public ever since. Located in Gotham City, XYZ employs over 2,000 people and does all kinds of awesome things for the Gotham community.</blockquote>
As a new WordPress user, you should go to <a href=\"%s\">your dashboard</a> to delete this page and create new pages for your content. Have fun!"
), admin_url()
),
admin_url()
);
$first_post_guid = get_option( 'home' ) . '/?page_id=2';
$wpdb->insert(
$wpdb->posts, array(
$wpdb->posts,
array(
'post_author' => $user_id,
'post_date' => $now,
'post_date_gmt' => $now_gmt,
@ -300,7 +308,8 @@ As a new WordPress user, you should go to <a href=\"%s\">your dashboard</a> to d
)
);
$wpdb->insert(
$wpdb->postmeta, array(
$wpdb->postmeta,
array(
'post_id' => 2,
'meta_key' => '_wp_page_template',
'meta_value' => 'default',
@ -323,7 +332,8 @@ As a new WordPress user, you should go to <a href=\"%s\">your dashboard</a> to d
$privacy_policy_guid = get_option( 'home' ) . '/?page_id=3';
$wpdb->insert(
$wpdb->posts, array(
$wpdb->posts,
array(
'post_author' => $user_id,
'post_date' => $now,
'post_date_gmt' => $now_gmt,
@ -344,7 +354,8 @@ As a new WordPress user, you should go to <a href=\"%s\">your dashboard</a> to d
)
);
$wpdb->insert(
$wpdb->postmeta, array(
$wpdb->postmeta,
array(
'post_id' => 3,
'meta_key' => '_wp_page_template',
'meta_value' => 'default',
@ -355,13 +366,15 @@ As a new WordPress user, you should go to <a href=\"%s\">your dashboard</a> to d
// Set up default widgets for default theme.
update_option(
'widget_search', array(
'widget_search',
array(
2 => array( 'title' => '' ),
'_multiwidget' => 1,
)
);
update_option(
'widget_recent-posts', array(
'widget_recent-posts',
array(
2 => array(
'title' => '',
'number' => 5,
@ -370,7 +383,8 @@ As a new WordPress user, you should go to <a href=\"%s\">your dashboard</a> to d
)
);
update_option(
'widget_recent-comments', array(
'widget_recent-comments',
array(
2 => array(
'title' => '',
'number' => 5,
@ -379,7 +393,8 @@ As a new WordPress user, you should go to <a href=\"%s\">your dashboard</a> to d
)
);
update_option(
'widget_archives', array(
'widget_archives',
array(
2 => array(
'title' => '',
'count' => 0,
@ -389,7 +404,8 @@ As a new WordPress user, you should go to <a href=\"%s\">your dashboard</a> to d
)
);
update_option(
'widget_categories', array(
'widget_categories',
array(
2 => array(
'title' => '',
'count' => 0,
@ -400,13 +416,15 @@ As a new WordPress user, you should go to <a href=\"%s\">your dashboard</a> to d
)
);
update_option(
'widget_meta', array(
'widget_meta',
array(
2 => array( 'title' => '' ),
'_multiwidget' => 1,
)
);
update_option(
'sidebars_widgets', array(
'sidebars_widgets',
array(
'wp_inactive_widgets' => array(),
'sidebar-1' => array(
0 => 'search-2',
@ -442,7 +460,8 @@ As a new WordPress user, you should go to <a href=\"%s\">your dashboard</a> to d
// Delete any caps that snuck into the previously active blog. (Hardcoded to blog 1 for now.) TODO: Get previous_blog_id.
if ( ! is_super_admin( $user_id ) && $user_id != 1 ) {
$wpdb->delete(
$wpdb->usermeta, array(
$wpdb->usermeta,
array(
'user_id' => $user_id,
'meta_key' => $wpdb->base_prefix . '1_capabilities',
)
@ -564,7 +583,11 @@ We hope you enjoy your new site. Thanks!
--The WordPress Team
https://wordpress.org/
'
), $blog_url, $name, $password, $login_url
),
$blog_url,
$name,
$password,
$login_url
);
@wp_mail( $email, __( 'New WordPress Site' ), $message );
@ -832,7 +855,8 @@ function upgrade_100() {
$cat = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->post2cat WHERE post_id = %d AND category_id = %d", $post->ID, $post->post_category ) );
if ( ! $cat && 0 != $post->post_category ) { // If there's no result
$wpdb->insert(
$wpdb->post2cat, array(
$wpdb->post2cat,
array(
'post_id' => $post->ID,
'category_id' => $post->post_category,
)
@ -1116,7 +1140,8 @@ function upgrade_160() {
$objects = $wpdb->get_results( "SELECT ID, post_type FROM $wpdb->posts WHERE post_status = 'object'" );
foreach ( $objects as $object ) {
$wpdb->update(
$wpdb->posts, array(
$wpdb->posts,
array(
'post_status' => 'attachment',
'post_mime_type' => $object->post_type,
'post_type' => '',
@ -1234,7 +1259,11 @@ function upgrade_230() {
$wpdb->query(
$wpdb->prepare(
"INSERT INTO $wpdb->terms (term_id, name, slug, term_group) VALUES
(%d, %s, %s, %d)", $term_id, $name, $slug, $term_group
(%d, %s, %s, %d)",
$term_id,
$name,
$slug,
$term_group
)
);
@ -1288,7 +1317,8 @@ function upgrade_230() {
}
$wpdb->insert(
$wpdb->term_relationships, array(
$wpdb->term_relationships,
array(
'object_id' => $post_id,
'term_taxonomy_id' => $tt_id,
)
@ -1327,7 +1357,8 @@ function upgrade_230() {
$default_link_cat = $term_id;
$wpdb->insert(
$wpdb->term_taxonomy, array(
$wpdb->term_taxonomy,
array(
'term_id' => $term_id,
'taxonomy' => 'link_category',
'description' => '',
@ -1355,7 +1386,8 @@ function upgrade_230() {
}
$wpdb->insert(
$wpdb->term_relationships, array(
$wpdb->term_relationships,
array(
'object_id' => $link->link_id,
'term_taxonomy_id' => $tt_id,
)
@ -1376,7 +1408,8 @@ function upgrade_230() {
continue;
}
$wpdb->insert(
$wpdb->term_relationships, array(
$wpdb->term_relationships,
array(
'object_id' => $link_id,
'term_taxonomy_id' => $tt_id,
)

View File

@ -576,7 +576,10 @@ this email. This invitation will expire in a few days.
Please click the following link to activate your user account:
%%s'
), wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ), home_url(), wp_specialchars_decode( translate_user_role( $role['name'] ) )
),
wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ),
home_url(),
wp_specialchars_decode( translate_user_role( $role['name'] ) )
);
}
@ -627,10 +630,12 @@ function _wp_privacy_completed_request( $request_id ) {
update_post_meta( $request_id, '_wp_user_request_completed_timestamp', time() );
$request = wp_update_post( array(
$request = wp_update_post(
array(
'ID' => $request_id,
'post_status' => 'request-completed',
) );
)
);
return $request;
}
@ -755,7 +760,8 @@ function _wp_personal_data_cleanup_requests() {
/** This filter is documented in wp-includes/user.php */
$expires = (int) apply_filters( 'user_request_key_expiration', DAY_IN_SECONDS );
$requests_query = new WP_Query( array(
$requests_query = new WP_Query(
array(
'post_type' => 'user_request',
'posts_per_page' => -1,
'post_status' => 'request-pending',
@ -766,16 +772,19 @@ function _wp_personal_data_cleanup_requests() {
'before' => $expires . ' seconds ago',
),
),
) );
)
);
$request_ids = $requests_query->posts;
foreach ( $request_ids as $request_id ) {
wp_update_post( array(
wp_update_post(
array(
'ID' => $request_id,
'post_status' => 'request-failed',
'post_password' => '',
) );
)
);
}
}
@ -796,10 +805,12 @@ function _wp_personal_data_export_page() {
// "Borrow" xfn.js for now so we don't have to create new files.
wp_enqueue_script( 'xfn' );
$requests_table = new WP_Privacy_Data_Export_Requests_Table( array(
$requests_table = new WP_Privacy_Data_Export_Requests_Table(
array(
'plural' => 'privacy_requests',
'singular' => 'privacy_request',
) );
)
);
$requests_table->process_bulk_action();
$requests_table->prepare_items();
?>
@ -867,10 +878,12 @@ function _wp_personal_data_removal_page() {
// "Borrow" xfn.js for now so we don't have to create new files.
wp_enqueue_script( 'xfn' );
$requests_table = new WP_Privacy_Data_Removal_Requests_Table( array(
$requests_table = new WP_Privacy_Data_Removal_Requests_Table(
array(
'plural' => 'privacy_requests',
'singular' => 'privacy_request',
) );
)
);
$requests_table->process_bulk_action();
$requests_table->prepare_items();
@ -1502,10 +1515,18 @@ class WP_Privacy_Data_Export_Requests_Table extends WP_Privacy_Requests_Table {
submit_button( __( 'Retry' ), 'secondary', 'privacy_action_email_retry[' . $item->ID . ']', false );
break;
case 'request-completed':
echo '<a href="' . esc_url( wp_nonce_url( add_query_arg( array(
echo '<a href="' . esc_url(
wp_nonce_url(
add_query_arg(
array(
'action' => 'delete',
'request_id' => array( $item->ID ),
), admin_url( 'tools.php?page=export_personal_data' ) ), 'bulk-privacy_requests' ) ) . '" class="button">' . esc_html__( 'Remove request' ) . '</a>';
),
admin_url( 'tools.php?page=export_personal_data' )
),
'bulk-privacy_requests'
)
) . '" class="button">' . esc_html__( 'Remove request' ) . '</a>';
break;
}
}
@ -1616,10 +1637,18 @@ class WP_Privacy_Data_Removal_Requests_Table extends WP_Privacy_Requests_Table {
submit_button( __( 'Retry' ), 'secondary', 'privacy_action_email_retry[' . $item->ID . ']', false );
break;
case 'request-completed':
echo '<a href="' . esc_url( wp_nonce_url( add_query_arg( array(
echo '<a href="' . esc_url(
wp_nonce_url(
add_query_arg(
array(
'action' => 'delete',
'request_id' => array( $item->ID ),
), admin_url( 'tools.php?page=remove_personal_data' ) ), 'bulk-privacy_requests' ) ) . '" class="button">' . esc_html__( 'Remove request' ) . '</a>';
),
admin_url( 'tools.php?page=remove_personal_data' )
),
'bulk-privacy_requests'
)
) . '" class="button">' . esc_html__( 'Remove request' ) . '</a>';
break;
}
}

View File

@ -139,7 +139,8 @@ if ( current_user_can( 'upload_files' ) ) {
<div id="media-item-<?php echo $att_id; ?>" class="media-item">
<?php
echo get_media_item(
$att_id, array(
$att_id,
array(
'toggle' => false,
'send' => false,
'delete' => false,

View File

@ -611,7 +611,8 @@ require_once( ABSPATH . 'wp-admin/admin-header.php' );
array(
array( 'autofocus' => $focus ),
'return' => urlencode( remove_query_arg( wp_removable_query_args(), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ),
), admin_url( 'customize.php' )
),
admin_url( 'customize.php' )
)
),
__( 'Manage with Live Preview' )
@ -692,7 +693,8 @@ require_once( ABSPATH . 'wp-admin/admin-header.php' );
array(
'action' => 'edit',
'menu' => $menu_locations[ $_location ],
), admin_url( 'nav-menus.php' )
),
admin_url( 'nav-menus.php' )
)
);
?>
@ -710,7 +712,8 @@ require_once( ABSPATH . 'wp-admin/admin-header.php' );
'action' => 'edit',
'menu' => 0,
'use-location' => $_location,
), admin_url( 'nav-menus.php' )
),
admin_url( 'nav-menus.php' )
)
);
?>
@ -743,12 +746,14 @@ require_once( ABSPATH . 'wp-admin/admin-header.php' );
<span class="add-edit-menu-action">
<?php
printf(
__( 'Edit your menu below, or <a href="%s">create a new menu</a>. Don&#8217;t forget to save your changes!' ), esc_url(
__( 'Edit your menu below, or <a href="%s">create a new menu</a>. Don&#8217;t forget to save your changes!' ),
esc_url(
add_query_arg(
array(
'action' => 'edit',
'menu' => 0,
), admin_url( 'nav-menus.php' )
),
admin_url( 'nav-menus.php' )
)
)
);
@ -802,12 +807,14 @@ require_once( ABSPATH . 'wp-admin/admin-header.php' );
<span class="add-new-menu-action">
<?php
printf(
__( 'or <a href="%s">create a new menu</a>. Don&#8217;t forget to save your changes!' ), esc_url(
__( 'or <a href="%s">create a new menu</a>. Don&#8217;t forget to save your changes!' ),
esc_url(
add_query_arg(
array(
'action' => 'edit',
'menu' => 0,
), admin_url( 'nav-menus.php' )
),
admin_url( 'nav-menus.php' )
)
)
);
@ -973,8 +980,10 @@ require_once( ABSPATH . 'wp-admin/admin-header.php' );
array(
'action' => 'delete',
'menu' => $nav_menu_selected_id,
), admin_url( 'nav-menus.php' )
), 'delete-nav_menu-' . $nav_menu_selected_id
),
admin_url( 'nav-menus.php' )
),
'delete-nav_menu-' . $nav_menu_selected_id
)
);
?>

View File

@ -107,7 +107,8 @@ if ( isset( $_REQUEST['action'] ) && 'update-site' == $_REQUEST['action'] ) {
array(
'update' => 'updated',
'id' => $id,
), 'site-info.php'
),
'site-info.php'
)
);
exit;

View File

@ -173,7 +173,8 @@ Name: %3$s'
array(
'update' => 'added',
'id' => $id,
), 'site-new.php'
),
'site-new.php'
)
);
exit;
@ -212,13 +213,15 @@ if ( ! empty( $messages ) ) {
}
}
?>
<p><?php
<p>
<?php
printf(
/* translators: %s: asterisk to mark required form fields. */
__( 'Required fields are marked %s' ),
'<span class="required">*</span>'
);
?></p>
?>
</p>
<form method="post" action="<?php echo network_admin_url( 'site-new.php?action=add-site' ); ?>" novalidate="novalidate">
<?php wp_nonce_field( 'add-blog', '_wpnonce_add-blog' ); ?>
<table class="form-table">

View File

@ -65,7 +65,8 @@ if ( isset( $_REQUEST['action'] ) && 'update-site' == $_REQUEST['action'] && is_
array(
'update' => 'updated',
'id' => $id,
), 'site-settings.php'
),
'site-settings.php'
)
);
exit;

View File

@ -151,7 +151,8 @@ if ( $action ) {
array(
'id' => $id,
$action => $n,
), $referer
),
$referer
)
);
exit;

View File

@ -181,14 +181,16 @@ if ( $action ) {
foreach ( $themes as $theme ) {
$delete_result = delete_theme(
$theme, esc_url(
$theme,
esc_url(
add_query_arg(
array(
'verify-delete' => 1,
'action' => 'delete-selected',
'checked' => $_REQUEST['checked'],
'_wpnonce' => $_REQUEST['_wpnonce'],
), network_admin_url( 'themes.php' )
),
network_admin_url( 'themes.php' )
)
)
);
@ -201,7 +203,8 @@ if ( $action ) {
'deleted' => count( $themes ),
'paged' => $paged,
's' => $s,
), network_admin_url( 'themes.php' )
),
network_admin_url( 'themes.php' )
)
);
exit;

View File

@ -82,7 +82,8 @@ switch ( $action ) {
echo "<li>$siteurl</li>";
$response = wp_remote_get(
$upgrade_url, array(
$upgrade_url,
array(
'timeout' => 120,
'httpversion' => '1.1',
'sslverify' => false,

View File

@ -66,7 +66,8 @@ if ( isset( $_REQUEST['action'] ) && 'add-user' == $_REQUEST['action'] ) {
array(
'update' => 'added',
'user_id' => $user_id,
), 'user-new.php'
),
'user-new.php'
)
);
exit;

View File

@ -113,7 +113,8 @@ if ( isset( $_GET['action'] ) ) {
array(
'updated' => 'true',
'action' => $userfunction,
), wp_get_referer()
),
wp_get_referer()
)
);
} else {
@ -169,7 +170,8 @@ if ( isset( $_GET['action'] ) ) {
array(
'updated' => 'true',
'action' => $deletefunction,
), network_admin_url( 'users.php' )
),
network_admin_url( 'users.php' )
)
);
exit();

View File

@ -90,7 +90,8 @@ else :
<li><label for="page_on_front">
<?php
printf(
__( 'Homepage: %s' ), wp_dropdown_pages(
__( 'Homepage: %s' ),
wp_dropdown_pages(
array(
'name' => 'page_on_front',
'echo' => 0,
@ -105,7 +106,8 @@ else :
<li><label for="page_for_posts">
<?php
printf(
__( 'Posts page: %s' ), wp_dropdown_pages(
__( 'Posts page: %s' ),
wp_dropdown_pages(
array(
'name' => 'page_for_posts',
'echo' => 0,

View File

@ -261,7 +261,8 @@ if ( 'update' == $action ) {
foreach ( $options as $option ) {
if ( $unregistered ) {
_deprecated_argument(
'options.php', '2.7.0',
'options.php',
'2.7.0',
sprintf(
/* translators: %s: the option/setting */
__( 'The %s setting is unregistered. Unregistered settings are deprecated. See https://codex.wordpress.org/Settings_API' ),

View File

@ -492,7 +492,8 @@ if ( isset( $_GET['error'] ) ) :
'action' => 'error_scrape',
'plugin' => urlencode( $plugin ),
'_wpnonce' => urlencode( $_GET['_error_nonce'] ),
), admin_url( 'plugins.php' )
),
admin_url( 'plugins.php' )
);
?>
<iframe style="border:0" width="100%" height="70px" src="<?php echo esc_url( $iframe_url ); ?>"></iframe>

View File

@ -242,7 +242,8 @@ switch ( $action ) {
array(
'trashed' => 1,
'ids' => $post_id,
), $sendback
),
$sendback
)
);
exit();

View File

@ -33,8 +33,10 @@ function wp_load_press_this() {
'action' => 'activate',
'plugin' => $plugin_file,
'from' => 'press-this',
), admin_url( 'plugins.php' )
), 'activate-plugin_' . $plugin_file
),
admin_url( 'plugins.php' )
),
'activate-plugin_' . $plugin_file
);
$action = sprintf(
'<a href="%1$s" aria-label="%2$s">%2$s</a>',
@ -49,8 +51,10 @@ function wp_load_press_this() {
'action' => 'install-plugin',
'plugin' => $plugin_slug,
'from' => 'press-this',
), self_admin_url( 'update.php' )
), 'install-plugin_' . $plugin_slug
),
self_admin_url( 'update.php' )
),
'install-plugin_' . $plugin_slug
);
$action = sprintf(
'<a href="%1$s" class="install-now" data-slug="%2$s" data-name="%2$s" aria-label="%3$s">%3$s</a>',

View File

@ -195,16 +195,19 @@ require_once( ABSPATH . 'wp-admin/admin-header.php' );
</th>
<td>
<?php
$has_pages = (bool) get_posts( array(
$has_pages = (bool) get_posts(
array(
'post_type' => 'page',
'posts_per_page' => 1,
'post_status' => array(
'publish',
'draft',
),
) );
)
);
if ( $has_pages ) : ?>
if ( $has_pages ) :
?>
<form method="post" action="">
<label for="page_for_privacy_policy">
<?php _e( 'Select an existing page:' ); ?>

View File

@ -63,7 +63,8 @@ switch ( $action ) {
array(
'message' => 5,
'revision' => $revision->ID,
), get_edit_post_link( $post->ID, 'url' )
),
get_edit_post_link( $post->ID, 'url' )
);
break;
case 'view':

View File

@ -41,7 +41,9 @@ foreach ( $installed_themes as $k => $v ) {
}
wp_localize_script(
'theme', '_wpThemeSettings', array(
'theme',
'_wpThemeSettings',
array(
'themes' => false,
'settings' => array(
'isInstall' => true,

View File

@ -133,7 +133,9 @@ if ( current_user_can( 'switch_themes' ) ) {
wp_reset_vars( array( 'theme', 'search' ) );
wp_localize_script(
'theme', '_wpThemeSettings', array(
'theme',
'_wpThemeSettings',
array(
'themes' => $themes,
'settings' => array(
'canInstall' => ( ! is_multisite() && current_user_can( 'install_themes' ) ),
@ -367,7 +369,8 @@ $can_install = current_user_can( 'install_themes' );
array(
'action' => 'delete',
'stylesheet' => urlencode( $stylesheet ),
), admin_url( 'themes.php' )
),
admin_url( 'themes.php' )
);
$delete_url = wp_nonce_url( $delete_url, 'delete-theme_' . $stylesheet );
?>
@ -384,7 +387,8 @@ $can_install = current_user_can( 'install_themes' );
array(
'action' => 'install-theme',
'theme' => urlencode( $parent_theme_name ),
), admin_url( 'update.php' )
),
admin_url( 'update.php' )
);
$install_url = wp_nonce_url( $install_url, 'install-theme_' . $parent_theme_name );
?>
@ -533,7 +537,9 @@ wp_print_admin_notice_templates();
wp_print_update_row_templates();
wp_localize_script(
'updates', '_wpUpdatesItemCounts', array(
'updates',
'_wpUpdatesItemCounts',
array(
'totals' => wp_get_update_data(),
)
);

View File

@ -21,12 +21,14 @@ if ( $is_privacy_guide ) {
$title = __( 'Tools' );
get_current_screen()->add_help_tab( array(
get_current_screen()->add_help_tab(
array(
'id' => 'converter',
'title' => __( 'Categories and Tags Converter' ),
'content' => '<p>' . __( 'Categories have hierarchy, meaning that you can nest sub-categories. Tags do not have hierarchy and cannot be nested. Sometimes people start out using one on their posts, then later realize that the other would work better for their content.' ) . '</p>' .
'<p>' . __( 'The Categories and Tags Converter link on this screen will take you to the Import screen, where that Converter is one of the plugins you can install. Once that plugin is installed, the Activate Plugin &amp; Run Importer link will take you to a screen where you can choose to convert tags into categories or vice versa.' ) . '</p>',
) );
)
);
get_current_screen()->set_help_sidebar(
'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
@ -54,9 +56,10 @@ if ( $is_privacy_guide ) {
if ( current_user_can( 'import' ) ) :
$cats = get_taxonomy( 'category' );
$tags = get_taxonomy( 'post_tag' );
if ( current_user_can($cats->cap->manage_terms) || current_user_can($tags->cap->manage_terms) ) : ?>
if ( current_user_can( $cats->cap->manage_terms ) || current_user_can( $tags->cap->manage_terms ) ) :
?>
<div class="card">
<h2 class="title"><?php _e( 'Categories and Tags Converter' ) ?></h2>
<h2 class="title"><?php _e( 'Categories and Tags Converter' ); ?></h2>
<p><?php printf( __( 'If you want to convert your categories to tags (or vice versa), use the <a href="%s">Categories and Tags Converter</a> available from the Import screen.' ), 'import.php' ); ?></p>
</div>
<?php

View File

@ -514,7 +514,8 @@ if ( $reinstall ) {
$upgrader = new Core_Upgrader();
$result = $upgrader->upgrade(
$update, array(
$update,
array(
'allow_relaxed_file_ownership' => $allow_relaxed_file_ownership,
)
);
@ -668,7 +669,9 @@ if ( 'upgrade-core' == $action ) {
echo '</div>';
wp_localize_script(
'updates', '_wpUpdatesItemCounts', array(
'updates',
'_wpUpdatesItemCounts',
array(
'totals' => wp_get_update_data(),
)
);
@ -702,7 +705,9 @@ if ( 'upgrade-core' == $action ) {
}
wp_localize_script(
'updates', '_wpUpdatesItemCounts', array(
'updates',
'_wpUpdatesItemCounts',
array(
'totals' => wp_get_update_data(),
)
);
@ -738,7 +743,9 @@ if ( 'upgrade-core' == $action ) {
echo '</div>';
wp_localize_script(
'updates', '_wpUpdatesItemCounts', array(
'updates',
'_wpUpdatesItemCounts',
array(
'totals' => wp_get_update_data(),
)
);
@ -776,7 +783,9 @@ if ( 'upgrade-core' == $action ) {
<?php
wp_localize_script(
'updates', '_wpUpdatesItemCounts', array(
'updates',
'_wpUpdatesItemCounts',
array(
'totals' => wp_get_update_data(),
)
);
@ -803,7 +812,9 @@ if ( 'upgrade-core' == $action ) {
$result = $upgrader->bulk_upgrade();
wp_localize_script(
'updates', '_wpUpdatesItemCounts', array(
'updates',
'_wpUpdatesItemCounts',
array(
'totals' => wp_get_update_data(),
)
);

View File

@ -106,7 +106,8 @@ if ( isset( $_GET['action'] ) ) {
check_admin_referer( 'install-plugin_' . $plugin );
$api = plugins_api(
'plugin_information', array(
'plugin_information',
array(
'slug' => $plugin,
'fields' => array(
'sections' => false,
@ -225,7 +226,8 @@ if ( isset( $_GET['action'] ) ) {
check_admin_referer( 'install-theme_' . $theme );
$api = themes_api(
'theme_information', array(
'theme_information',
array(
'slug' => $theme,
'fields' => array(
'sections' => false,

View File

@ -40,7 +40,9 @@ if ( 'grid' === $mode ) {
}
wp_localize_script(
'media-grid', '_wpMediaGridSettings', array(
'media-grid',
'_wpMediaGridSettings',
array(
'adminUrl' => parse_url( self_admin_url(), PHP_URL_PATH ),
'queryVars' => (object) $vars,
)
@ -160,7 +162,8 @@ if ( $doaction ) {
array(
'trashed' => count( $post_ids ),
'ids' => join( ',', $post_ids ),
), $location
),
$location
);
break;
case 'untrash':

View File

@ -79,7 +79,8 @@ if ( isset( $_REQUEST['action'] ) && 'adduser' == $_REQUEST['action'] ) {
array(
'update' => 'addnoconfirmation',
'user_id' => $user_id,
), 'user-new.php'
),
'user-new.php'
);
} else {
$redirect = add_query_arg( array( 'update' => 'could_not_add' ), 'user-new.php' );
@ -87,7 +88,8 @@ if ( isset( $_REQUEST['action'] ) && 'adduser' == $_REQUEST['action'] ) {
} else {
$newuser_key = wp_generate_password( 20, false );
add_option(
'new_user_' . $newuser_key, array(
'new_user_' . $newuser_key,
array(
'user_id' => $user_id,
'email' => $user_details->user_email,
'role' => $_REQUEST['role'],
@ -176,7 +178,9 @@ Please click the following link to confirm the invite:
add_filter( 'wpmu_welcome_user_notification', '__return_false' ); // Disable welcome email
}
wpmu_signup_user(
$new_user_login, $new_user_email, array(
$new_user_login,
$new_user_email,
array(
'add_to_blog' => get_current_blog_id(),
'new_role' => $_REQUEST['role'],
)
@ -193,7 +197,8 @@ Please click the following link to confirm the invite:
array(
'update' => 'addnoconfirmation',
'user_id' => $new_user['user_id'],
), 'user-new.php'
),
'user-new.php'
);
}
} else {

View File

@ -206,7 +206,8 @@ switch ( $wp_list_table->current_action() ) {
array(
'delete_count' => $delete_count,
'update' => $update,
), $redirect
),
$redirect
);
wp_redirect( $redirect );
exit();
@ -476,7 +477,8 @@ foreach ( $userids as $id ) {
__( 'New user created. <a href="%s">Edit user</a>' ),
esc_url(
add_query_arg(
'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ),
'wp_http_referer',
urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ),
self_admin_url( 'user-edit.php?user_id=' . $user_id )
)
)

View File

@ -27,7 +27,9 @@ if ( is_wp_error( $comment ) ) {
$data = intval( $comment->get_error_data() );
if ( ! empty( $data ) ) {
wp_die(
'<p>' . $comment->get_error_message() . '</p>', __( 'Comment Submission Failure' ), array(
'<p>' . $comment->get_error_message() . '</p>',
__( 'Comment Submission Failure' ),
array(
'response' => $data,
'back_link' => true,
)

View File

@ -45,10 +45,12 @@ get_header(); ?>
/* translators: %1$s: smilie */
$archive_content = '<p>' . sprintf( __( 'Try looking in the monthly archives. %1$s', 'twentyeleven' ), convert_smilies( ':)' ) ) . '</p>';
the_widget(
'WP_Widget_Archives', array(
'WP_Widget_Archives',
array(
'count' => 0,
'dropdown' => 1,
), array( 'after_title' => '</h2>' . $archive_content )
),
array( 'after_title' => '</h2>' . $archive_content )
);
?>

View File

@ -33,7 +33,8 @@
<?php
printf(
_n( 'One thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', get_comments_number(), 'twentyeleven' ),
number_format_i18n( get_comments_number() ), '<span>' . get_the_title() . '</span>'
number_format_i18n( get_comments_number() ),
'<span>' . get_the_title() . '</span>'
);
?>
</h2>

View File

@ -107,7 +107,8 @@ if ( ! function_exists( 'twentyeleven_setup' ) ) :
// Add support for custom backgrounds.
add_theme_support(
'custom-background', array(
'custom-background',
array(
/*
* Let WordPress know what our default background color is.
* This is dependent on our current color scheme.
@ -685,7 +686,8 @@ if ( ! function_exists( 'twentyeleven_comment' ) ) :
<?php
comment_reply_link(
array_merge(
$args, array(
$args,
array(
'reply_text' => __( 'Reply <span>&darr;</span>', 'twentyeleven' ),
'depth' => $depth,
'max_depth' => $args['max_depth'],

View File

@ -523,14 +523,16 @@ function twentyeleven_customize_register( $wp_customize ) {
if ( isset( $wp_customize->selective_refresh ) ) {
$wp_customize->selective_refresh->add_partial(
'blogname', array(
'blogname',
array(
'selector' => '#site-title a',
'container_inclusive' => false,
'render_callback' => 'twentyeleven_customize_partial_blogname',
)
);
$wp_customize->selective_refresh->add_partial(
'blogdescription', array(
'blogdescription',
array(
'selector' => '#site-description',
'container_inclusive' => false,
'render_callback' => 'twentyeleven_customize_partial_blogdescription',
@ -542,7 +544,8 @@ function twentyeleven_customize_register( $wp_customize ) {
$defaults = twentyeleven_get_default_theme_options();
$wp_customize->add_setting(
'twentyeleven_theme_options[color_scheme]', array(
'twentyeleven_theme_options[color_scheme]',
array(
'default' => $defaults['color_scheme'],
'type' => 'option',
'capability' => 'edit_theme_options',
@ -556,7 +559,8 @@ function twentyeleven_customize_register( $wp_customize ) {
}
$wp_customize->add_control(
'twentyeleven_color_scheme', array(
'twentyeleven_color_scheme',
array(
'label' => __( 'Color Scheme', 'twentyeleven' ),
'section' => 'colors',
'settings' => 'twentyeleven_theme_options[color_scheme]',
@ -568,7 +572,8 @@ function twentyeleven_customize_register( $wp_customize ) {
// Link Color (added to Color Scheme section in Customizer)
$wp_customize->add_setting(
'twentyeleven_theme_options[link_color]', array(
'twentyeleven_theme_options[link_color]',
array(
'default' => twentyeleven_get_default_link_color( $options['color_scheme'] ),
'type' => 'option',
'sanitize_callback' => 'sanitize_hex_color',
@ -578,7 +583,9 @@ function twentyeleven_customize_register( $wp_customize ) {
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize, 'link_color', array(
$wp_customize,
'link_color',
array(
'label' => __( 'Link Color', 'twentyeleven' ),
'section' => 'colors',
'settings' => 'twentyeleven_theme_options[link_color]',
@ -588,14 +595,16 @@ function twentyeleven_customize_register( $wp_customize ) {
// Default Layout
$wp_customize->add_section(
'twentyeleven_layout', array(
'twentyeleven_layout',
array(
'title' => __( 'Layout', 'twentyeleven' ),
'priority' => 50,
)
);
$wp_customize->add_setting(
'twentyeleven_theme_options[theme_layout]', array(
'twentyeleven_theme_options[theme_layout]',
array(
'type' => 'option',
'default' => $defaults['theme_layout'],
'sanitize_callback' => 'sanitize_key',
@ -609,7 +618,8 @@ function twentyeleven_customize_register( $wp_customize ) {
}
$wp_customize->add_control(
'twentyeleven_theme_options[theme_layout]', array(
'twentyeleven_theme_options[theme_layout]',
array(
'section' => 'twentyeleven_layout',
'type' => 'radio',
'choices' => $choices,

View File

@ -19,7 +19,9 @@ class Twenty_Eleven_Ephemera_Widget extends WP_Widget {
*/
function __construct() {
parent::__construct(
'widget_twentyeleven_ephemera', __( 'Twenty Eleven Ephemera', 'twentyeleven' ), array(
'widget_twentyeleven_ephemera',
__( 'Twenty Eleven Ephemera', 'twentyeleven' ),
array(
'classname' => 'widget_twentyeleven_ephemera',
'description' => __( 'Use this widget to list your recent Aside, Status, Quote, and Link posts', 'twentyeleven' ),
'customize_selective_refresh' => true,

View File

@ -230,7 +230,9 @@ get_header(); ?>
<?php
the_widget(
'Twenty_Eleven_Ephemera_Widget', '', array(
'Twenty_Eleven_Ephemera_Widget',
'',
array(
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
)

View File

@ -93,7 +93,8 @@ if ( ! function_exists( 'twentyfifteen_setup' ) ) :
* to output valid HTML5.
*/
add_theme_support(
'html5', array(
'html5',
array(
'search-form',
'comment-form',
'comment-list',
@ -108,7 +109,8 @@ if ( ! function_exists( 'twentyfifteen_setup' ) ) :
* See: https://codex.wordpress.org/Post_Formats
*/
add_theme_support(
'post-formats', array(
'post-formats',
array(
'aside',
'image',
'video',
@ -127,7 +129,8 @@ if ( ! function_exists( 'twentyfifteen_setup' ) ) :
* @since Twenty Fifteen 1.5
*/
add_theme_support(
'custom-logo', array(
'custom-logo',
array(
'height' => 248,
'width' => 248,
'flex-height' => true,
@ -152,8 +155,10 @@ if ( ! function_exists( 'twentyfifteen_setup' ) ) :
* }
*/
add_theme_support(
'custom-background', apply_filters(
'twentyfifteen_custom_background_args', array(
'custom-background',
apply_filters(
'twentyfifteen_custom_background_args',
array(
'default-color' => $default_color,
'default-attachment' => 'fixed',
)
@ -252,7 +257,8 @@ if ( ! function_exists( 'twentyfifteen_fonts_url' ) ) :
array(
'family' => urlencode( implode( '|', $fonts ) ),
'subset' => urlencode( $subsets ),
), 'https://fonts.googleapis.com/css'
),
'https://fonts.googleapis.com/css'
);
}
@ -307,7 +313,9 @@ function twentyfifteen_scripts() {
wp_enqueue_script( 'twentyfifteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20150330', true );
wp_localize_script(
'twentyfifteen-script', 'screenReaderText', array(
'twentyfifteen-script',
'screenReaderText',
array(
'expand' => '<span class="screen-reader-text">' . __( 'expand child menu', 'twentyfifteen' ) . '</span>',
'collapse' => '<span class="screen-reader-text">' . __( 'collapse child menu', 'twentyfifteen' ) . '</span>',
)

View File

@ -45,7 +45,9 @@ function twentyfifteen_upgrade_notice() {
*/
function twentyfifteen_customize() {
wp_die(
sprintf( __( 'Twenty Fifteen requires at least WordPress version 4.1. You are running version %s. Please upgrade and try again.', 'twentyfifteen' ), $GLOBALS['wp_version'] ), '', array(
sprintf( __( 'Twenty Fifteen requires at least WordPress version 4.1. You are running version %s. Please upgrade and try again.', 'twentyfifteen' ), $GLOBALS['wp_version'] ),
'',
array(
'back_link' => true,
)
);

View File

@ -32,8 +32,10 @@ function twentyfifteen_custom_header_setup() {
* }
*/
add_theme_support(
'custom-header', apply_filters(
'twentyfifteen_custom_header_args', array(
'custom-header',
apply_filters(
'twentyfifteen_custom_header_args',
array(
'default-text-color' => $default_text_color,
'width' => 954,
'height' => 1300,

View File

@ -22,14 +22,16 @@ function twentyfifteen_customize_register( $wp_customize ) {
if ( isset( $wp_customize->selective_refresh ) ) {
$wp_customize->selective_refresh->add_partial(
'blogname', array(
'blogname',
array(
'selector' => '.site-title a',
'container_inclusive' => false,
'render_callback' => 'twentyfifteen_customize_partial_blogname',
)
);
$wp_customize->selective_refresh->add_partial(
'blogdescription', array(
'blogdescription',
array(
'selector' => '.site-description',
'container_inclusive' => false,
'render_callback' => 'twentyfifteen_customize_partial_blogdescription',
@ -39,7 +41,8 @@ function twentyfifteen_customize_register( $wp_customize ) {
// Add color scheme setting and control.
$wp_customize->add_setting(
'color_scheme', array(
'color_scheme',
array(
'default' => 'default',
'sanitize_callback' => 'twentyfifteen_sanitize_color_scheme',
'transport' => 'postMessage',
@ -47,7 +50,8 @@ function twentyfifteen_customize_register( $wp_customize ) {
);
$wp_customize->add_control(
'color_scheme', array(
'color_scheme',
array(
'label' => __( 'Base Color Scheme', 'twentyfifteen' ),
'section' => 'colors',
'type' => 'select',
@ -58,7 +62,8 @@ function twentyfifteen_customize_register( $wp_customize ) {
// Add custom header and sidebar text color setting and control.
$wp_customize->add_setting(
'sidebar_textcolor', array(
'sidebar_textcolor',
array(
'default' => $color_scheme[4],
'sanitize_callback' => 'sanitize_hex_color',
'transport' => 'postMessage',
@ -67,7 +72,9 @@ function twentyfifteen_customize_register( $wp_customize ) {
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize, 'sidebar_textcolor', array(
$wp_customize,
'sidebar_textcolor',
array(
'label' => __( 'Header and Sidebar Text Color', 'twentyfifteen' ),
'description' => __( 'Applied to the header on small screens and the sidebar on wide screens.', 'twentyfifteen' ),
'section' => 'colors',
@ -80,7 +87,8 @@ function twentyfifteen_customize_register( $wp_customize ) {
// Add custom header and sidebar background color setting and control.
$wp_customize->add_setting(
'header_background_color', array(
'header_background_color',
array(
'default' => $color_scheme[1],
'sanitize_callback' => 'sanitize_hex_color',
'transport' => 'postMessage',
@ -89,7 +97,9 @@ function twentyfifteen_customize_register( $wp_customize ) {
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize, 'header_background_color', array(
$wp_customize,
'header_background_color',
array(
'label' => __( 'Header and Sidebar Background Color', 'twentyfifteen' ),
'description' => __( 'Applied to the header on small screens and the sidebar on wide screens.', 'twentyfifteen' ),
'section' => 'colors',
@ -166,7 +176,8 @@ function twentyfifteen_get_color_schemes() {
* }
*/
return apply_filters(
'twentyfifteen_color_schemes', array(
'twentyfifteen_color_schemes',
array(
'default' => array(
'label' => __( 'Default', 'twentyfifteen' ),
'colors' => array(
@ -371,7 +382,8 @@ add_action( 'customize_preview_init', 'twentyfifteen_customize_preview_js' );
*/
function twentyfifteen_get_color_scheme_css( $colors ) {
$colors = wp_parse_args(
$colors, array(
$colors,
array(
'background_color' => '',
'header_background_color' => '',
'box_background_color' => '',

View File

@ -91,7 +91,8 @@ if ( ! function_exists( 'twentyfourteen_setup' ) ) :
* to output valid HTML5.
*/
add_theme_support(
'html5', array(
'html5',
array(
'search-form',
'comment-form',
'comment-list',
@ -105,7 +106,8 @@ if ( ! function_exists( 'twentyfourteen_setup' ) ) :
* See https://codex.wordpress.org/Post_Formats
*/
add_theme_support(
'post-formats', array(
'post-formats',
array(
'aside',
'image',
'video',
@ -118,8 +120,10 @@ if ( ! function_exists( 'twentyfourteen_setup' ) ) :
// This theme allows users to set a custom background.
add_theme_support(
'custom-background', apply_filters(
'twentyfourteen_custom_background_args', array(
'custom-background',
apply_filters(
'twentyfourteen_custom_background_args',
array(
'default-color' => 'f5f5f5',
)
)
@ -127,7 +131,8 @@ if ( ! function_exists( 'twentyfourteen_setup' ) ) :
// Add support for featured content.
add_theme_support(
'featured-content', array(
'featured-content',
array(
'featured_content_filter' => 'twentyfourteen_get_featured_posts',
'max_posts' => 6,
)
@ -286,7 +291,9 @@ function twentyfourteen_scripts() {
if ( is_front_page() && 'slider' == get_theme_mod( 'featured_content_layout' ) ) {
wp_enqueue_script( 'twentyfourteen-slider', get_template_directory_uri() . '/js/slider.js', array( 'jquery' ), '20131205', true );
wp_localize_script(
'twentyfourteen-slider', 'featuredSliderDefaults', array(
'twentyfourteen-slider',
'featuredSliderDefaults',
array(
'prevText' => __( 'Previous', 'twentyfourteen' ),
'nextText' => __( 'Next', 'twentyfourteen' ),
)

View File

@ -45,7 +45,9 @@ function twentyfourteen_upgrade_notice() {
*/
function twentyfourteen_customize() {
wp_die(
sprintf( __( 'Twenty Fourteen requires at least WordPress version 3.6. You are running version %s. Please upgrade and try again.', 'twentyfourteen' ), $GLOBALS['wp_version'] ), '', array(
sprintf( __( 'Twenty Fourteen requires at least WordPress version 3.6. You are running version %s. Please upgrade and try again.', 'twentyfourteen' ), $GLOBALS['wp_version'] ),
'',
array(
'back_link' => true,
)
);

View File

@ -36,8 +36,10 @@ function twentyfourteen_custom_header_setup() {
* }
*/
add_theme_support(
'custom-header', apply_filters(
'twentyfourteen_custom_header_args', array(
'custom-header',
apply_filters(
'twentyfourteen_custom_header_args',
array(
'default-text-color' => 'fff',
'width' => 1260,
'height' => 240,

View File

@ -22,14 +22,16 @@ function twentyfourteen_customize_register( $wp_customize ) {
if ( isset( $wp_customize->selective_refresh ) ) {
$wp_customize->selective_refresh->add_partial(
'blogname', array(
'blogname',
array(
'selector' => '.site-title a',
'container_inclusive' => false,
'render_callback' => 'twentyfourteen_customize_partial_blogname',
)
);
$wp_customize->selective_refresh->add_partial(
'blogdescription', array(
'blogdescription',
array(
'selector' => '.site-description',
'container_inclusive' => false,
'render_callback' => 'twentyfourteen_customize_partial_blogdescription',
@ -54,7 +56,8 @@ function twentyfourteen_customize_register( $wp_customize ) {
// Add the featured content section in case it's not already there.
$wp_customize->add_section(
'featured_content', array(
'featured_content',
array(
'title' => __( 'Featured Content', 'twentyfourteen' ),
'description' => sprintf(
__( 'Use a <a href="%1$s">tag</a> to feature your posts. If no posts match the tag, <a href="%2$s">sticky posts</a> will be displayed instead.', 'twentyfourteen' ),
@ -68,14 +71,16 @@ function twentyfourteen_customize_register( $wp_customize ) {
// Add the featured content layout setting and control.
$wp_customize->add_setting(
'featured_content_layout', array(
'featured_content_layout',
array(
'default' => 'grid',
'sanitize_callback' => 'twentyfourteen_sanitize_layout',
)
);
$wp_customize->add_control(
'featured_content_layout', array(
'featured_content_layout',
array(
'label' => __( 'Layout', 'twentyfourteen' ),
'section' => 'featured_content',
'type' => 'select',

View File

@ -376,7 +376,8 @@ class Featured_Content {
*/
public static function customize_register( $wp_customize ) {
$wp_customize->add_section(
'featured_content', array(
'featured_content',
array(
'title' => __( 'Featured Content', 'twentyfourteen' ),
'description' => sprintf(
__( 'Use a <a href="%1$s">tag</a> to feature your posts. If no posts match the tag, <a href="%2$s">sticky posts</a> will be displayed instead.', 'twentyfourteen' ),
@ -390,14 +391,16 @@ class Featured_Content {
// Add Featured Content settings.
$wp_customize->add_setting(
'featured-content[tag-name]', array(
'featured-content[tag-name]',
array(
'default' => _x( 'featured', 'featured content default tag slug', 'twentyfourteen' ),
'type' => 'option',
'sanitize_js_callback' => array( __CLASS__, 'delete_transient' ),
)
);
$wp_customize->add_setting(
'featured-content[hide-tag]', array(
'featured-content[hide-tag]',
array(
'default' => true,
'type' => 'option',
'sanitize_js_callback' => array( __CLASS__, 'delete_transient' ),
@ -406,14 +409,16 @@ class Featured_Content {
// Add Featured Content controls.
$wp_customize->add_control(
'featured-content[tag-name]', array(
'featured-content[tag-name]',
array(
'label' => __( 'Tag Name', 'twentyfourteen' ),
'section' => 'featured_content',
'priority' => 20,
)
);
$wp_customize->add_control(
'featured-content[hide-tag]', array(
'featured-content[hide-tag]',
array(
'label' => __( 'Don&rsquo;t display tag on front end.', 'twentyfourteen' ),
'section' => 'featured_content',
'type' => 'checkbox',

View File

@ -31,7 +31,9 @@ class Twenty_Fourteen_Ephemera_Widget extends WP_Widget {
*/
public function __construct() {
parent::__construct(
'widget_twentyfourteen_ephemera', __( 'Twenty Fourteen Ephemera', 'twentyfourteen' ), array(
'widget_twentyfourteen_ephemera',
__( 'Twenty Fourteen Ephemera', 'twentyfourteen' ),
array(
'classname' => 'widget_twentyfourteen_ephemera',
'description' => __( 'Use this widget to list your recent Aside, Quote, Video, Audio, Image, Gallery, and Link posts.', 'twentyfourteen' ),
'customize_selective_refresh' => true,

View File

@ -71,7 +71,8 @@ function twentyseventeen_setup() {
* to output valid HTML5.
*/
add_theme_support(
'html5', array(
'html5',
array(
'comment-form',
'comment-list',
'gallery',
@ -85,7 +86,8 @@ function twentyseventeen_setup() {
* See: https://codex.wordpress.org/Post_Formats
*/
add_theme_support(
'post-formats', array(
'post-formats',
array(
'aside',
'image',
'video',
@ -98,7 +100,8 @@ function twentyseventeen_setup() {
// Add theme support for Custom Logo.
add_theme_support(
'custom-logo', array(
'custom-logo',
array(
'width' => 250,
'height' => 250,
'flex-width' => true,

View File

@ -49,7 +49,9 @@ function twentyseventeen_upgrade_notice() {
*/
function twentyseventeen_customize() {
wp_die(
sprintf( __( 'Twenty Seventeen requires at least WordPress version 4.7. You are running version %s. Please upgrade and try again.', 'twentyseventeen' ), $GLOBALS['wp_version'] ), '', array(
sprintf( __( 'Twenty Seventeen requires at least WordPress version 4.7. You are running version %s. Please upgrade and try again.', 'twentyseventeen' ), $GLOBALS['wp_version'] ),
'',
array(
'back_link' => true,
)
);

View File

@ -34,8 +34,10 @@ function twentyseventeen_custom_header_setup() {
* }
*/
add_theme_support(
'custom-header', apply_filters(
'twentyseventeen_custom_header_args', array(
'custom-header',
apply_filters(
'twentyseventeen_custom_header_args',
array(
'default-image' => get_parent_theme_file_uri( '/assets/images/header.jpg' ),
'width' => 2000,
'height' => 1200,

View File

@ -18,13 +18,15 @@ function twentyseventeen_customize_register( $wp_customize ) {
$wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage';
$wp_customize->selective_refresh->add_partial(
'blogname', array(
'blogname',
array(
'selector' => '.site-title a',
'render_callback' => 'twentyseventeen_customize_partial_blogname',
)
);
$wp_customize->selective_refresh->add_partial(
'blogdescription', array(
'blogdescription',
array(
'selector' => '.site-description',
'render_callback' => 'twentyseventeen_customize_partial_blogdescription',
)
@ -34,7 +36,8 @@ function twentyseventeen_customize_register( $wp_customize ) {
* Custom colors.
*/
$wp_customize->add_setting(
'colorscheme', array(
'colorscheme',
array(
'default' => 'light',
'transport' => 'postMessage',
'sanitize_callback' => 'twentyseventeen_sanitize_colorscheme',
@ -42,7 +45,8 @@ function twentyseventeen_customize_register( $wp_customize ) {
);
$wp_customize->add_setting(
'colorscheme_hue', array(
'colorscheme_hue',
array(
'default' => 250,
'transport' => 'postMessage',
'sanitize_callback' => 'absint', // The hue is stored as a positive integer.
@ -50,7 +54,8 @@ function twentyseventeen_customize_register( $wp_customize ) {
);
$wp_customize->add_control(
'colorscheme', array(
'colorscheme',
array(
'type' => 'radio',
'label' => __( 'Color Scheme', 'twentyseventeen' ),
'choices' => array(
@ -65,7 +70,9 @@ function twentyseventeen_customize_register( $wp_customize ) {
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize, 'colorscheme_hue', array(
$wp_customize,
'colorscheme_hue',
array(
'mode' => 'hue',
'section' => 'colors',
'priority' => 6,
@ -77,14 +84,16 @@ function twentyseventeen_customize_register( $wp_customize ) {
* Theme options.
*/
$wp_customize->add_section(
'theme_options', array(
'theme_options',
array(
'title' => __( 'Theme Options', 'twentyseventeen' ),
'priority' => 130, // Before Additional CSS.
)
);
$wp_customize->add_setting(
'page_layout', array(
'page_layout',
array(
'default' => 'two-column',
'sanitize_callback' => 'twentyseventeen_sanitize_page_layout',
'transport' => 'postMessage',
@ -92,7 +101,8 @@ function twentyseventeen_customize_register( $wp_customize ) {
);
$wp_customize->add_control(
'page_layout', array(
'page_layout',
array(
'label' => __( 'Page Layout', 'twentyseventeen' ),
'section' => 'theme_options',
'type' => 'radio',
@ -117,7 +127,8 @@ function twentyseventeen_customize_register( $wp_customize ) {
// Create a setting and control for each of the sections available in the theme.
for ( $i = 1; $i < ( 1 + $num_sections ); $i++ ) {
$wp_customize->add_setting(
'panel_' . $i, array(
'panel_' . $i,
array(
'default' => false,
'sanitize_callback' => 'absint',
'transport' => 'postMessage',
@ -125,7 +136,8 @@ function twentyseventeen_customize_register( $wp_customize ) {
);
$wp_customize->add_control(
'panel_' . $i, array(
'panel_' . $i,
array(
/* translators: %d is the front page section number */
'label' => sprintf( __( 'Front Page Section %d Content', 'twentyseventeen' ), $i ),
'description' => ( 1 !== $i ? '' : __( 'Select pages to feature in each area from the dropdowns. Add an image to a section by setting a featured image in the page editor. Empty sections will not be displayed.', 'twentyseventeen' ) ),
@ -137,7 +149,8 @@ function twentyseventeen_customize_register( $wp_customize ) {
);
$wp_customize->selective_refresh->add_partial(
'panel_' . $i, array(
'panel_' . $i,
array(
'selector' => '#panel' . $i,
'render_callback' => 'twentyseventeen_front_page_section',
'container_inclusive' => true,

View File

@ -70,7 +70,8 @@ if ( ! function_exists( 'twentysixteen_setup' ) ) :
* @since Twenty Sixteen 1.2
*/
add_theme_support(
'custom-logo', array(
'custom-logo',
array(
'height' => 240,
'width' => 240,
'flex-height' => true,
@ -98,7 +99,8 @@ if ( ! function_exists( 'twentysixteen_setup' ) ) :
* to output valid HTML5.
*/
add_theme_support(
'html5', array(
'html5',
array(
'search-form',
'comment-form',
'comment-list',
@ -113,7 +115,8 @@ if ( ! function_exists( 'twentysixteen_setup' ) ) :
* See: https://codex.wordpress.org/Post_Formats
*/
add_theme_support(
'post-formats', array(
'post-formats',
array(
'aside',
'image',
'video',
@ -233,7 +236,8 @@ if ( ! function_exists( 'twentysixteen_fonts_url' ) ) :
array(
'family' => urlencode( implode( '|', $fonts ) ),
'subset' => urlencode( $subsets ),
), 'https://fonts.googleapis.com/css'
),
'https://fonts.googleapis.com/css'
);
}
@ -297,7 +301,9 @@ function twentysixteen_scripts() {
wp_enqueue_script( 'twentysixteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20160816', true );
wp_localize_script(
'twentysixteen-script', 'screenReaderText', array(
'twentysixteen-script',
'screenReaderText',
array(
'expand' => __( 'expand child menu', 'twentysixteen' ),
'collapse' => __( 'collapse child menu', 'twentysixteen' ),
)

View File

@ -51,7 +51,9 @@ function twentysixteen_upgrade_notice() {
*/
function twentysixteen_customize() {
wp_die(
sprintf( __( 'Twenty Sixteen requires at least WordPress version 4.4. You are running version %s. Please upgrade and try again.', 'twentysixteen' ), $GLOBALS['wp_version'] ), '', array(
sprintf( __( 'Twenty Sixteen requires at least WordPress version 4.4. You are running version %s. Please upgrade and try again.', 'twentysixteen' ), $GLOBALS['wp_version'] ),
'',
array(
'back_link' => true,
)
);

View File

@ -31,8 +31,10 @@ function twentysixteen_custom_header_and_background() {
* }
*/
add_theme_support(
'custom-background', apply_filters(
'twentysixteen_custom_background_args', array(
'custom-background',
apply_filters(
'twentysixteen_custom_background_args',
array(
'default-color' => $default_background_color,
)
)
@ -55,8 +57,10 @@ function twentysixteen_custom_header_and_background() {
* }
*/
add_theme_support(
'custom-header', apply_filters(
'twentysixteen_custom_header_args', array(
'custom-header',
apply_filters(
'twentysixteen_custom_header_args',
array(
'default-text-color' => $default_text_color,
'width' => 1200,
'height' => 280,
@ -116,14 +120,16 @@ function twentysixteen_customize_register( $wp_customize ) {
if ( isset( $wp_customize->selective_refresh ) ) {
$wp_customize->selective_refresh->add_partial(
'blogname', array(
'blogname',
array(
'selector' => '.site-title a',
'container_inclusive' => false,
'render_callback' => 'twentysixteen_customize_partial_blogname',
)
);
$wp_customize->selective_refresh->add_partial(
'blogdescription', array(
'blogdescription',
array(
'selector' => '.site-description',
'container_inclusive' => false,
'render_callback' => 'twentysixteen_customize_partial_blogdescription',
@ -133,7 +139,8 @@ function twentysixteen_customize_register( $wp_customize ) {
// Add color scheme setting and control.
$wp_customize->add_setting(
'color_scheme', array(
'color_scheme',
array(
'default' => 'default',
'sanitize_callback' => 'twentysixteen_sanitize_color_scheme',
'transport' => 'postMessage',
@ -141,7 +148,8 @@ function twentysixteen_customize_register( $wp_customize ) {
);
$wp_customize->add_control(
'color_scheme', array(
'color_scheme',
array(
'label' => __( 'Base Color Scheme', 'twentysixteen' ),
'section' => 'colors',
'type' => 'select',
@ -152,7 +160,8 @@ function twentysixteen_customize_register( $wp_customize ) {
// Add page background color setting and control.
$wp_customize->add_setting(
'page_background_color', array(
'page_background_color',
array(
'default' => $color_scheme[1],
'sanitize_callback' => 'sanitize_hex_color',
'transport' => 'postMessage',
@ -161,7 +170,9 @@ function twentysixteen_customize_register( $wp_customize ) {
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize, 'page_background_color', array(
$wp_customize,
'page_background_color',
array(
'label' => __( 'Page Background Color', 'twentysixteen' ),
'section' => 'colors',
)
@ -173,7 +184,8 @@ function twentysixteen_customize_register( $wp_customize ) {
// Add link color setting and control.
$wp_customize->add_setting(
'link_color', array(
'link_color',
array(
'default' => $color_scheme[2],
'sanitize_callback' => 'sanitize_hex_color',
'transport' => 'postMessage',
@ -182,7 +194,9 @@ function twentysixteen_customize_register( $wp_customize ) {
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize, 'link_color', array(
$wp_customize,
'link_color',
array(
'label' => __( 'Link Color', 'twentysixteen' ),
'section' => 'colors',
)
@ -191,7 +205,8 @@ function twentysixteen_customize_register( $wp_customize ) {
// Add main text color setting and control.
$wp_customize->add_setting(
'main_text_color', array(
'main_text_color',
array(
'default' => $color_scheme[3],
'sanitize_callback' => 'sanitize_hex_color',
'transport' => 'postMessage',
@ -200,7 +215,9 @@ function twentysixteen_customize_register( $wp_customize ) {
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize, 'main_text_color', array(
$wp_customize,
'main_text_color',
array(
'label' => __( 'Main Text Color', 'twentysixteen' ),
'section' => 'colors',
)
@ -209,7 +226,8 @@ function twentysixteen_customize_register( $wp_customize ) {
// Add secondary text color setting and control.
$wp_customize->add_setting(
'secondary_text_color', array(
'secondary_text_color',
array(
'default' => $color_scheme[4],
'sanitize_callback' => 'sanitize_hex_color',
'transport' => 'postMessage',
@ -218,7 +236,9 @@ function twentysixteen_customize_register( $wp_customize ) {
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize, 'secondary_text_color', array(
$wp_customize,
'secondary_text_color',
array(
'label' => __( 'Secondary Text Color', 'twentysixteen' ),
'section' => 'colors',
)
@ -289,7 +309,8 @@ function twentysixteen_get_color_schemes() {
* }
*/
return apply_filters(
'twentysixteen_color_schemes', array(
'twentysixteen_color_schemes',
array(
'default' => array(
'label' => __( 'Default', 'twentysixteen' ),
'colors' => array(
@ -488,7 +509,8 @@ add_action( 'customize_preview_init', 'twentysixteen_customize_preview_js' );
*/
function twentysixteen_get_color_scheme_css( $colors ) {
$colors = wp_parse_args(
$colors, array(
$colors,
array(
'background_color' => '',
'page_background_color' => '',
'link_color' => '',

View File

@ -36,7 +36,8 @@
<?php
printf(
_n( 'One Response to %2$s', '%1$s Responses to %2$s', get_comments_number(), 'twentyten' ),
number_format_i18n( get_comments_number() ), '<em>' . get_the_title() . '</em>'
number_format_i18n( get_comments_number() ),
'<em>' . get_the_title() . '</em>'
);
?>
</h3>

Some files were not shown because too many files have changed in this diff Show More