class-wp-widget-text.php 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570
  1. <?php
  2. /**
  3. * Widget API: WP_Widget_Text class
  4. *
  5. * @package WordPress
  6. * @subpackage Widgets
  7. * @since 4.4.0
  8. */
  9. /**
  10. * Core class used to implement a Text widget.
  11. *
  12. * @since 2.8.0
  13. *
  14. * @see WP_Widget
  15. */
  16. class WP_Widget_Text extends WP_Widget {
  17. /**
  18. * Whether or not the widget has been registered yet.
  19. *
  20. * @since 4.8.1
  21. * @var bool
  22. */
  23. protected $registered = false;
  24. /**
  25. * Sets up a new Text widget instance.
  26. *
  27. * @since 2.8.0
  28. */
  29. public function __construct() {
  30. $widget_ops = array(
  31. 'classname' => 'widget_text',
  32. 'description' => __( 'Arbitrary text.' ),
  33. 'customize_selective_refresh' => true,
  34. 'show_instance_in_rest' => true,
  35. );
  36. $control_ops = array(
  37. 'width' => 400,
  38. 'height' => 350,
  39. );
  40. parent::__construct( 'text', __( 'Text' ), $widget_ops, $control_ops );
  41. }
  42. /**
  43. * Add hooks for enqueueing assets when registering all widget instances of this widget class.
  44. *
  45. * @param int $number Optional. The unique order number of this widget instance
  46. * compared to other instances of the same class. Default -1.
  47. */
  48. public function _register_one( $number = -1 ) {
  49. parent::_register_one( $number );
  50. if ( $this->registered ) {
  51. return;
  52. }
  53. $this->registered = true;
  54. wp_add_inline_script( 'text-widgets', sprintf( 'wp.textWidgets.idBases.push( %s );', wp_json_encode( $this->id_base ) ) );
  55. if ( $this->is_preview() ) {
  56. add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_preview_scripts' ) );
  57. }
  58. // Note that the widgets component in the customizer will also do
  59. // the 'admin_print_scripts-widgets.php' action in WP_Customize_Widgets::print_scripts().
  60. add_action( 'admin_print_scripts-widgets.php', array( $this, 'enqueue_admin_scripts' ) );
  61. // Note that the widgets component in the customizer will also do
  62. // the 'admin_footer-widgets.php' action in WP_Customize_Widgets::print_footer_scripts().
  63. add_action( 'admin_footer-widgets.php', array( 'WP_Widget_Text', 'render_control_template_scripts' ) );
  64. }
  65. /**
  66. * Determines whether a given instance is legacy and should bypass using TinyMCE.
  67. *
  68. * @since 4.8.1
  69. *
  70. * @param array $instance {
  71. * Instance data.
  72. *
  73. * @type string $text Content.
  74. * @type bool|string $filter Whether autop or content filters should apply.
  75. * @type bool $legacy Whether widget is in legacy mode.
  76. * }
  77. * @return bool Whether Text widget instance contains legacy data.
  78. */
  79. public function is_legacy_instance( $instance ) {
  80. // Legacy mode when not in visual mode.
  81. if ( isset( $instance['visual'] ) ) {
  82. return ! $instance['visual'];
  83. }
  84. // Or, the widget has been added/updated in 4.8.0 then filter prop is 'content' and it is no longer legacy.
  85. if ( isset( $instance['filter'] ) && 'content' === $instance['filter'] ) {
  86. return false;
  87. }
  88. // If the text is empty, then nothing is preventing migration to TinyMCE.
  89. if ( empty( $instance['text'] ) ) {
  90. return false;
  91. }
  92. $wpautop = ! empty( $instance['filter'] );
  93. $has_line_breaks = ( false !== strpos( trim( $instance['text'] ), "\n" ) );
  94. // If auto-paragraphs are not enabled and there are line breaks, then ensure legacy mode.
  95. if ( ! $wpautop && $has_line_breaks ) {
  96. return true;
  97. }
  98. // If an HTML comment is present, assume legacy mode.
  99. if ( false !== strpos( $instance['text'], '<!--' ) ) {
  100. return true;
  101. }
  102. // In the rare case that DOMDocument is not available we cannot reliably sniff content and so we assume legacy.
  103. if ( ! class_exists( 'DOMDocument' ) ) {
  104. // @codeCoverageIgnoreStart
  105. return true;
  106. // @codeCoverageIgnoreEnd
  107. }
  108. $doc = new DOMDocument();
  109. // Suppress warnings generated by loadHTML.
  110. $errors = libxml_use_internal_errors( true );
  111. // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged
  112. @$doc->loadHTML(
  113. sprintf(
  114. '<!DOCTYPE html><html><head><meta charset="%s"></head><body>%s</body></html>',
  115. esc_attr( get_bloginfo( 'charset' ) ),
  116. $instance['text']
  117. )
  118. );
  119. libxml_use_internal_errors( $errors );
  120. $body = $doc->getElementsByTagName( 'body' )->item( 0 );
  121. // See $allowedposttags.
  122. $safe_elements_attributes = array(
  123. 'strong' => array(),
  124. 'em' => array(),
  125. 'b' => array(),
  126. 'i' => array(),
  127. 'u' => array(),
  128. 's' => array(),
  129. 'ul' => array(),
  130. 'ol' => array(),
  131. 'li' => array(),
  132. 'hr' => array(),
  133. 'abbr' => array(),
  134. 'acronym' => array(),
  135. 'code' => array(),
  136. 'dfn' => array(),
  137. 'a' => array(
  138. 'href' => true,
  139. ),
  140. 'img' => array(
  141. 'src' => true,
  142. 'alt' => true,
  143. ),
  144. );
  145. $safe_empty_elements = array( 'img', 'hr', 'iframe' );
  146. foreach ( $body->getElementsByTagName( '*' ) as $element ) {
  147. /** @var DOMElement $element */
  148. $tag_name = strtolower( $element->nodeName );
  149. // If the element is not safe, then the instance is legacy.
  150. if ( ! isset( $safe_elements_attributes[ $tag_name ] ) ) {
  151. return true;
  152. }
  153. // If the element is not safely empty and it has empty contents, then legacy mode.
  154. if ( ! in_array( $tag_name, $safe_empty_elements, true ) && '' === trim( $element->textContent ) ) {
  155. return true;
  156. }
  157. // If an attribute is not recognized as safe, then the instance is legacy.
  158. foreach ( $element->attributes as $attribute ) {
  159. /** @var DOMAttr $attribute */
  160. $attribute_name = strtolower( $attribute->nodeName );
  161. if ( ! isset( $safe_elements_attributes[ $tag_name ][ $attribute_name ] ) ) {
  162. return true;
  163. }
  164. }
  165. }
  166. // Otherwise, the text contains no elements/attributes that TinyMCE could drop, and therefore the widget does not need legacy mode.
  167. return false;
  168. }
  169. /**
  170. * Filters gallery shortcode attributes.
  171. *
  172. * Prevents all of a site's attachments from being shown in a gallery displayed on a
  173. * non-singular template where a $post context is not available.
  174. *
  175. * @since 4.9.0
  176. *
  177. * @param array $attrs Attributes.
  178. * @return array Attributes.
  179. */
  180. public function _filter_gallery_shortcode_attrs( $attrs ) {
  181. if ( ! is_singular() && empty( $attrs['id'] ) && empty( $attrs['include'] ) ) {
  182. $attrs['id'] = -1;
  183. }
  184. return $attrs;
  185. }
  186. /**
  187. * Outputs the content for the current Text widget instance.
  188. *
  189. * @since 2.8.0
  190. *
  191. * @global WP_Post $post Global post object.
  192. *
  193. * @param array $args Display arguments including 'before_title', 'after_title',
  194. * 'before_widget', and 'after_widget'.
  195. * @param array $instance Settings for the current Text widget instance.
  196. */
  197. public function widget( $args, $instance ) {
  198. global $post;
  199. $title = ! empty( $instance['title'] ) ? $instance['title'] : '';
  200. /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
  201. $title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
  202. $text = ! empty( $instance['text'] ) ? $instance['text'] : '';
  203. $is_visual_text_widget = ( ! empty( $instance['visual'] ) && ! empty( $instance['filter'] ) );
  204. // In 4.8.0 only, visual Text widgets get filter=content, without visual prop; upgrade instance props just-in-time.
  205. if ( ! $is_visual_text_widget ) {
  206. $is_visual_text_widget = ( isset( $instance['filter'] ) && 'content' === $instance['filter'] );
  207. }
  208. if ( $is_visual_text_widget ) {
  209. $instance['filter'] = true;
  210. $instance['visual'] = true;
  211. }
  212. /*
  213. * Suspend legacy plugin-supplied do_shortcode() for 'widget_text' filter for the visual Text widget to prevent
  214. * shortcodes being processed twice. Now do_shortcode() is added to the 'widget_text_content' filter in core itself
  215. * and it applies after wpautop() to prevent corrupting HTML output added by the shortcode. When do_shortcode() is
  216. * added to 'widget_text_content' then do_shortcode() will be manually called when in legacy mode as well.
  217. */
  218. $widget_text_do_shortcode_priority = has_filter( 'widget_text', 'do_shortcode' );
  219. $should_suspend_legacy_shortcode_support = ( $is_visual_text_widget && false !== $widget_text_do_shortcode_priority );
  220. if ( $should_suspend_legacy_shortcode_support ) {
  221. remove_filter( 'widget_text', 'do_shortcode', $widget_text_do_shortcode_priority );
  222. }
  223. // Override global $post so filters (and shortcodes) apply in a consistent context.
  224. $original_post = $post;
  225. if ( is_singular() ) {
  226. // Make sure post is always the queried object on singular queries (not from another sub-query that failed to clean up the global $post).
  227. $post = get_queried_object();
  228. } else {
  229. // Nullify the $post global during widget rendering to prevent shortcodes from running with the unexpected context on archive queries.
  230. $post = null;
  231. }
  232. // Prevent dumping out all attachments from the media library.
  233. add_filter( 'shortcode_atts_gallery', array( $this, '_filter_gallery_shortcode_attrs' ) );
  234. /**
  235. * Filters the content of the Text widget.
  236. *
  237. * @since 2.3.0
  238. * @since 4.4.0 Added the `$widget` parameter.
  239. * @since 4.8.1 The `$widget` param may now be a `WP_Widget_Custom_HTML` object in addition to a `WP_Widget_Text` object.
  240. *
  241. * @param string $text The widget content.
  242. * @param array $instance Array of settings for the current widget.
  243. * @param WP_Widget_Text|WP_Widget_Custom_HTML $widget Current text or HTML widget instance.
  244. */
  245. $text = apply_filters( 'widget_text', $text, $instance, $this );
  246. if ( $is_visual_text_widget ) {
  247. /**
  248. * Filters the content of the Text widget to apply changes expected from the visual (TinyMCE) editor.
  249. *
  250. * By default a subset of the_content filters are applied, including wpautop and wptexturize.
  251. *
  252. * @since 4.8.0
  253. *
  254. * @param string $text The widget content.
  255. * @param array $instance Array of settings for the current widget.
  256. * @param WP_Widget_Text $widget Current Text widget instance.
  257. */
  258. $text = apply_filters( 'widget_text_content', $text, $instance, $this );
  259. } else {
  260. // Now in legacy mode, add paragraphs and line breaks when checkbox is checked.
  261. if ( ! empty( $instance['filter'] ) ) {
  262. $text = wpautop( $text );
  263. }
  264. /*
  265. * Manually do shortcodes on the content when the core-added filter is present. It is added by default
  266. * in core by adding do_shortcode() to the 'widget_text_content' filter to apply after wpautop().
  267. * Since the legacy Text widget runs wpautop() after 'widget_text' filters are applied, the widget in
  268. * legacy mode here manually applies do_shortcode() on the content unless the default
  269. * core filter for 'widget_text_content' has been removed, or if do_shortcode() has already
  270. * been applied via a plugin adding do_shortcode() to 'widget_text' filters.
  271. */
  272. if ( has_filter( 'widget_text_content', 'do_shortcode' ) && ! $widget_text_do_shortcode_priority ) {
  273. if ( ! empty( $instance['filter'] ) ) {
  274. $text = shortcode_unautop( $text );
  275. }
  276. $text = do_shortcode( $text );
  277. }
  278. }
  279. // Restore post global.
  280. $post = $original_post;
  281. remove_filter( 'shortcode_atts_gallery', array( $this, '_filter_gallery_shortcode_attrs' ) );
  282. // Undo suspension of legacy plugin-supplied shortcode handling.
  283. if ( $should_suspend_legacy_shortcode_support ) {
  284. add_filter( 'widget_text', 'do_shortcode', $widget_text_do_shortcode_priority );
  285. }
  286. echo $args['before_widget'];
  287. if ( ! empty( $title ) ) {
  288. echo $args['before_title'] . $title . $args['after_title'];
  289. }
  290. $text = preg_replace_callback( '#<(video|iframe|object|embed)\s[^>]*>#i', array( $this, 'inject_video_max_width_style' ), $text );
  291. // Adds 'noopener' relationship, without duplicating values, to all HTML A elements that have a target.
  292. $text = wp_targeted_link_rel( $text );
  293. ?>
  294. <div class="textwidget"><?php echo $text; ?></div>
  295. <?php
  296. echo $args['after_widget'];
  297. }
  298. /**
  299. * Inject max-width and remove height for videos too constrained to fit inside sidebars on frontend.
  300. *
  301. * @since 4.9.0
  302. *
  303. * @see WP_Widget_Media_Video::inject_video_max_width_style()
  304. *
  305. * @param array $matches Pattern matches from preg_replace_callback.
  306. * @return string HTML Output.
  307. */
  308. public function inject_video_max_width_style( $matches ) {
  309. $html = $matches[0];
  310. $html = preg_replace( '/\sheight="\d+"/', '', $html );
  311. $html = preg_replace( '/\swidth="\d+"/', '', $html );
  312. $html = preg_replace( '/(?<=width:)\s*\d+px(?=;?)/', '100%', $html );
  313. return $html;
  314. }
  315. /**
  316. * Handles updating settings for the current Text widget instance.
  317. *
  318. * @since 2.8.0
  319. *
  320. * @param array $new_instance New settings for this instance as input by the user via
  321. * WP_Widget::form().
  322. * @param array $old_instance Old settings for this instance.
  323. * @return array Settings to save or bool false to cancel saving.
  324. */
  325. public function update( $new_instance, $old_instance ) {
  326. $new_instance = wp_parse_args(
  327. $new_instance,
  328. array(
  329. 'title' => '',
  330. 'text' => '',
  331. 'filter' => false, // For back-compat.
  332. 'visual' => null, // Must be explicitly defined.
  333. )
  334. );
  335. $instance = $old_instance;
  336. $instance['title'] = sanitize_text_field( $new_instance['title'] );
  337. if ( current_user_can( 'unfiltered_html' ) ) {
  338. $instance['text'] = $new_instance['text'];
  339. } else {
  340. $instance['text'] = wp_kses_post( $new_instance['text'] );
  341. }
  342. $instance['filter'] = ! empty( $new_instance['filter'] );
  343. // Upgrade 4.8.0 format.
  344. if ( isset( $old_instance['filter'] ) && 'content' === $old_instance['filter'] ) {
  345. $instance['visual'] = true;
  346. }
  347. if ( 'content' === $new_instance['filter'] ) {
  348. $instance['visual'] = true;
  349. }
  350. if ( isset( $new_instance['visual'] ) ) {
  351. $instance['visual'] = ! empty( $new_instance['visual'] );
  352. }
  353. // Filter is always true in visual mode.
  354. if ( ! empty( $instance['visual'] ) ) {
  355. $instance['filter'] = true;
  356. }
  357. return $instance;
  358. }
  359. /**
  360. * Enqueue preview scripts.
  361. *
  362. * These scripts normally are enqueued just-in-time when a playlist shortcode is used.
  363. * However, in the customizer, a playlist shortcode may be used in a text widget and
  364. * dynamically added via selective refresh, so it is important to unconditionally enqueue them.
  365. *
  366. * @since 4.9.3
  367. */
  368. public function enqueue_preview_scripts() {
  369. require_once dirname( __DIR__ ) . '/media.php';
  370. wp_playlist_scripts( 'audio' );
  371. wp_playlist_scripts( 'video' );
  372. }
  373. /**
  374. * Loads the required scripts and styles for the widget control.
  375. *
  376. * @since 4.8.0
  377. */
  378. public function enqueue_admin_scripts() {
  379. wp_enqueue_editor();
  380. wp_enqueue_media();
  381. wp_enqueue_script( 'text-widgets' );
  382. wp_add_inline_script( 'text-widgets', 'wp.textWidgets.init();', 'after' );
  383. }
  384. /**
  385. * Outputs the Text widget settings form.
  386. *
  387. * @since 2.8.0
  388. * @since 4.8.0 Form only contains hidden inputs which are synced with JS template.
  389. * @since 4.8.1 Restored original form to be displayed when in legacy mode.
  390. *
  391. * @see WP_Widget_Text::render_control_template_scripts()
  392. * @see _WP_Editors::editor()
  393. *
  394. * @param array $instance Current settings.
  395. */
  396. public function form( $instance ) {
  397. $instance = wp_parse_args(
  398. (array) $instance,
  399. array(
  400. 'title' => '',
  401. 'text' => '',
  402. )
  403. );
  404. ?>
  405. <?php if ( ! $this->is_legacy_instance( $instance ) ) : ?>
  406. <?php
  407. if ( user_can_richedit() ) {
  408. add_filter( 'the_editor_content', 'format_for_editor', 10, 2 );
  409. $default_editor = 'tinymce';
  410. } else {
  411. $default_editor = 'html';
  412. }
  413. /** This filter is documented in wp-includes/class-wp-editor.php */
  414. $text = apply_filters( 'the_editor_content', $instance['text'], $default_editor );
  415. // Reset filter addition.
  416. if ( user_can_richedit() ) {
  417. remove_filter( 'the_editor_content', 'format_for_editor' );
  418. }
  419. // Prevent premature closing of textarea in case format_for_editor() didn't apply or the_editor_content filter did a wrong thing.
  420. $escaped_text = preg_replace( '#</textarea#i', '&lt;/textarea', $text );
  421. ?>
  422. <input id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" class="title sync-input" type="hidden" value="<?php echo esc_attr( $instance['title'] ); ?>">
  423. <textarea id="<?php echo $this->get_field_id( 'text' ); ?>" name="<?php echo $this->get_field_name( 'text' ); ?>" class="text sync-input" hidden><?php echo $escaped_text; ?></textarea>
  424. <input id="<?php echo $this->get_field_id( 'filter' ); ?>" name="<?php echo $this->get_field_name( 'filter' ); ?>" class="filter sync-input" type="hidden" value="on">
  425. <input id="<?php echo $this->get_field_id( 'visual' ); ?>" name="<?php echo $this->get_field_name( 'visual' ); ?>" class="visual sync-input" type="hidden" value="on">
  426. <?php else : ?>
  427. <input id="<?php echo $this->get_field_id( 'visual' ); ?>" name="<?php echo $this->get_field_name( 'visual' ); ?>" class="visual" type="hidden" value="">
  428. <p>
  429. <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label>
  430. <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" />
  431. </p>
  432. <div class="notice inline notice-info notice-alt">
  433. <?php if ( ! isset( $instance['visual'] ) ) : ?>
  434. <p><?php _e( 'This widget may contain code that may work better in the &#8220;Custom HTML&#8221; widget. How about trying that widget instead?' ); ?></p>
  435. <?php else : ?>
  436. <p><?php _e( 'This widget may have contained code that may work better in the &#8220;Custom HTML&#8221; widget. If you have not yet, how about trying that widget instead?' ); ?></p>
  437. <?php endif; ?>
  438. </div>
  439. <p>
  440. <label for="<?php echo $this->get_field_id( 'text' ); ?>"><?php _e( 'Content:' ); ?></label>
  441. <textarea class="widefat" rows="16" cols="20" id="<?php echo $this->get_field_id( 'text' ); ?>" name="<?php echo $this->get_field_name( 'text' ); ?>"><?php echo esc_textarea( $instance['text'] ); ?></textarea>
  442. </p>
  443. <p>
  444. <input id="<?php echo $this->get_field_id( 'filter' ); ?>" name="<?php echo $this->get_field_name( 'filter' ); ?>" type="checkbox"<?php checked( ! empty( $instance['filter'] ) ); ?> />&nbsp;<label for="<?php echo $this->get_field_id( 'filter' ); ?>"><?php _e( 'Automatically add paragraphs' ); ?></label>
  445. </p>
  446. <?php
  447. endif;
  448. }
  449. /**
  450. * Render form template scripts.
  451. *
  452. * @since 4.8.0
  453. * @since 4.9.0 The method is now static.
  454. */
  455. public static function render_control_template_scripts() {
  456. $dismissed_pointers = explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) );
  457. ?>
  458. <script type="text/html" id="tmpl-widget-text-control-fields">
  459. <# var elementIdPrefix = 'el' + String( Math.random() ).replace( /\D/g, '' ) + '_' #>
  460. <p>
  461. <label for="{{ elementIdPrefix }}title"><?php esc_html_e( 'Title:' ); ?></label>
  462. <input id="{{ elementIdPrefix }}title" type="text" class="widefat title">
  463. </p>
  464. <?php if ( ! in_array( 'text_widget_custom_html', $dismissed_pointers, true ) ) : ?>
  465. <div hidden class="wp-pointer custom-html-widget-pointer wp-pointer-top">
  466. <div class="wp-pointer-content">
  467. <h3><?php _e( 'New Custom HTML Widget' ); ?></h3>
  468. <?php if ( is_customize_preview() ) : ?>
  469. <p><?php _e( 'Did you know there is a &#8220;Custom HTML&#8221; widget now? You can find it by pressing the &#8220;<a class="add-widget" href="#">Add a Widget</a>&#8221; button and searching for &#8220;HTML&#8221;. Check it out to add some custom code to your site!' ); ?></p>
  470. <?php else : ?>
  471. <p><?php _e( 'Did you know there is a &#8220;Custom HTML&#8221; widget now? You can find it by scanning the list of available widgets on this screen. Check it out to add some custom code to your site!' ); ?></p>
  472. <?php endif; ?>
  473. <div class="wp-pointer-buttons">
  474. <a class="close" href="#"><?php _e( 'Dismiss' ); ?></a>
  475. </div>
  476. </div>
  477. <div class="wp-pointer-arrow">
  478. <div class="wp-pointer-arrow-inner"></div>
  479. </div>
  480. </div>
  481. <?php endif; ?>
  482. <?php if ( ! in_array( 'text_widget_paste_html', $dismissed_pointers, true ) ) : ?>
  483. <div hidden class="wp-pointer paste-html-pointer wp-pointer-top">
  484. <div class="wp-pointer-content">
  485. <h3><?php _e( 'Did you just paste HTML?' ); ?></h3>
  486. <p><?php _e( 'Hey there, looks like you just pasted HTML into the &#8220;Visual&#8221; tab of the Text widget. You may want to paste your code into the &#8220;Text&#8221; tab instead. Alternately, try out the new &#8220;Custom HTML&#8221; widget!' ); ?></p>
  487. <div class="wp-pointer-buttons">
  488. <a class="close" href="#"><?php _e( 'Dismiss' ); ?></a>
  489. </div>
  490. </div>
  491. <div class="wp-pointer-arrow">
  492. <div class="wp-pointer-arrow-inner"></div>
  493. </div>
  494. </div>
  495. <?php endif; ?>
  496. <p>
  497. <label for="{{ elementIdPrefix }}text" class="screen-reader-text"><?php esc_html_e( 'Content:' ); ?></label>
  498. <textarea id="{{ elementIdPrefix }}text" class="widefat text wp-editor-area" style="height: 200px" rows="16" cols="20"></textarea>
  499. </p>
  500. </script>
  501. <?php
  502. }
  503. }