wp/wp-includes/widgets/class-wp-widget-text.php
changeset 16 a86126ab1dd4
parent 9 177826044cd9
child 18 be944660c56a
--- a/wp/wp-includes/widgets/class-wp-widget-text.php	Tue Oct 22 16:11:46 2019 +0200
+++ b/wp/wp-includes/widgets/class-wp-widget-text.php	Tue Dec 15 13:49:49 2020 +0100
@@ -61,10 +61,12 @@
 			add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_preview_scripts' ) );
 		}
 
-		// Note that the widgets component in the customizer will also do the 'admin_print_scripts-widgets.php' action in WP_Customize_Widgets::print_scripts().
+		// Note that the widgets component in the customizer will also do
+		// the 'admin_print_scripts-widgets.php' action in WP_Customize_Widgets::print_scripts().
 		add_action( 'admin_print_scripts-widgets.php', array( $this, 'enqueue_admin_scripts' ) );
 
-		// Note that the widgets component in the customizer will also do the 'admin_footer-widgets.php' action in WP_Customize_Widgets::print_footer_scripts().
+		// Note that the widgets component in the customizer will also do
+		// the 'admin_footer-widgets.php' action in WP_Customize_Widgets::print_footer_scripts().
 		add_action( 'admin_footer-widgets.php', array( 'WP_Widget_Text', 'render_control_template_scripts' ) );
 	}
 
@@ -121,8 +123,9 @@
 
 		$doc = new DOMDocument();
 
-		// Suppress warnings generated by loadHTML
+		// Suppress warnings generated by loadHTML.
 		$errors = libxml_use_internal_errors( true );
+		// phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged
 		@$doc->loadHTML(
 			sprintf(
 				'<!DOCTYPE html><html><head><meta charset="%s"></head><body>%s</body></html>',
@@ -212,7 +215,7 @@
 	 *
 	 * @since 2.8.0
 	 *
-	 * @global WP_Post $post
+	 * @global WP_Post $post Global post object.
 	 *
 	 * @param array $args     Display arguments including 'before_title', 'after_title',
 	 *                        'before_widget', and 'after_widget'.
@@ -343,6 +346,7 @@
 	 * @since 4.9.0
 	 *
 	 * @see WP_Widget_Media_Video::inject_video_max_width_style()
+	 *
 	 * @param array $matches Pattern matches from preg_replace_callback.
 	 * @return string HTML Output.
 	 */
@@ -371,7 +375,7 @@
 				'title'  => '',
 				'text'   => '',
 				'filter' => false, // For back-compat.
-				'visual' => null, // Must be explicitly defined.
+				'visual' => null,  // Must be explicitly defined.
 			)
 		);
 
@@ -416,7 +420,7 @@
 	 * @since 4.9.3
 	 */
 	public function enqueue_preview_scripts() {
-		require_once dirname( dirname( __FILE__ ) ) . '/media.php';
+		require_once dirname( __DIR__ ) . '/media.php';
 
 		wp_playlist_scripts( 'audio' );
 		wp_playlist_scripts( 'video' );
@@ -440,11 +444,11 @@
 	 * @since 2.8.0
 	 * @since 4.8.0 Form only contains hidden inputs which are synced with JS template.
 	 * @since 4.8.1 Restored original form to be displayed when in legacy mode.
+	 *
 	 * @see WP_Widget_Text::render_control_template_scripts()
 	 * @see _WP_Editors::editor()
 	 *
 	 * @param array $instance Current settings.
-	 * @return void
 	 */
 	public function form( $instance ) {
 		$instance = wp_parse_args(