Make WordPress Core


Ignore:
Timestamp:
07/18/2017 04:20:17 AM (7 years ago)
Author:
westonruter
Message:

Widgets: Discount shortcodes and leading/trailing line breaks for triggering Text widget legacy mode.

Since shortcode handling is just-in-time deferred to run after wpautop, there is no need to retain the presence of shortcodes to trigger legacy mode. Also updates Text widget legacy mode notice informing of Custom HTML widget.

Merges [41070] onto 4.8 branch.
Amends [41050].
Props westonruter, melchoyce.
Fixes #40951 for 4.8.1.

Location:
branches/4.8
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.8

  • branches/4.8/tests/phpunit/tests/widgets/text-widget.php

    r41053 r41071  
    267267
    268268        $instance = array_merge( $base_instance, array(
     269            'text' => "\nOne line",
     270            'filter' => false,
     271        ) );
     272        $this->assertFalse( $widget->is_legacy_instance( $instance ), 'Not legacy when there is leading whitespace.' );
     273
     274        $instance = array_merge( $base_instance, array(
     275            'text' => "\nOne line\n\n",
     276            'filter' => false,
     277        ) );
     278        $this->assertFalse( $widget->is_legacy_instance( $instance ), 'Not legacy when there is trailing whitespace.' );
     279
     280        $instance = array_merge( $base_instance, array(
    269281            'text' => "One\nTwo",
    270282            'filter' => false,
     
    295307        ) );
    296308        $this->assertTrue( $widget->is_legacy_instance( $instance ), 'Legacy when HTML comment is present.' );
    297 
    298         $instance = array_merge( $base_instance, array(
    299             'text' => 'Here is a [gallery]',
    300             'filter' => true,
    301         ) );
    302         $this->assertTrue( $widget->is_legacy_instance( $instance ), 'Legacy mode when a shortcode is present.' );
    303309
    304310        // Check text examples that will not migrate to TinyMCE.
Note: See TracChangeset for help on using the changeset viewer.