Skip to content

Commit 2f7a23a

Browse files
Code Quality: Unwrap sprintf() with one argument.
This removes unnecessary uses of the `sprintf()` function when localizing or outputting static strings. These changes simplify the code and improve readability without affecting functionality. Props Soean. See #64898. git-svn-id: https://develop.svn.wordpress.org/trunk@62167 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 86e4699 commit 2f7a23a

3 files changed

Lines changed: 3 additions & 5 deletions

File tree

src/wp-admin/plugin-editor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@
164164
);
165165
wp_enqueue_script( 'wp-theme-plugin-editor' );
166166
wp_add_inline_script( 'wp-theme-plugin-editor', sprintf( 'jQuery( function( $ ) { wp.themePluginEditor.init( $( "#template" ), %s ); } )', wp_json_encode( $settings, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ) ) );
167-
wp_add_inline_script( 'wp-theme-plugin-editor', sprintf( 'wp.themePluginEditor.themeOrPlugin = "plugin";' ) );
167+
wp_add_inline_script( 'wp-theme-plugin-editor', 'wp.themePluginEditor.themeOrPlugin = "plugin";' );
168168

169169
require_once ABSPATH . 'wp-admin/admin-header.php';
170170

src/wp-includes/class-wp-customize-widgets.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -775,9 +775,7 @@ public function enqueue_scripts() {
775775

776776
if ( 1 === $registered_sidebar_count ) {
777777
$no_areas_shown_message = html_entity_decode(
778-
sprintf(
779-
__( 'Your theme has 1 widget area, but this particular page does not display it.' )
780-
),
778+
__( 'Your theme has 1 widget area, but this particular page does not display it.' ),
781779
ENT_QUOTES,
782780
get_bloginfo( 'charset' )
783781
);

src/wp-includes/class-wp-xmlrpc-server.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ public function login(
296296
$password
297297
) {
298298
if ( ! $this->is_enabled ) {
299-
$this->error = new IXR_Error( 405, sprintf( __( 'XML-RPC services are disabled on this site.' ) ) );
299+
$this->error = new IXR_Error( 405, __( 'XML-RPC services are disabled on this site.' ) );
300300
return false;
301301
}
302302

0 commit comments

Comments
 (0)