Make WordPress Core


Ignore:
Timestamp:
07/18/2017 04:16:16 AM (5 years ago)
Author:
westonruter
Message:

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

Since plugin-added 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.

Amends [41050].
Props westonruter, melchoyce.
Fixes #40951 for trunk.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/widgets/text-widget.php

    r41050 r41070  
    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.