Make WordPress Core


Ignore:
Timestamp:
01/29/2020 12:43:23 AM (5 years ago)
Author:
SergeyBiryukov
Message:

Docs: Improve inline comments per the documentation standards.

Includes minor code layout fixes for better readability.

See #48303.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/shortcode.php

    r46586 r47122  
    294294        $this->assertEquals( '[baztag foo="bar"]the content[/baztag]', $out );
    295295
    296         // double escaped
     296        // Double escaped.
    297297        $out = do_shortcode( '[[[footag]]] [[[bartag foo="bar"]]]' );
    298298        $this->assertEquals( '[[footag]] [[bartag foo="bar"]]', $out );
     
    300300
    301301    function test_tag_not_escaped() {
    302         // these have square brackets on either end but aren't actually escaped
     302        // These have square brackets on either end but aren't actually escaped.
    303303        $out = do_shortcode( '[[footag] [bartag foo="bar"]]' );
    304304        $this->assertEquals( '[foo =  foo = bar]', $out );
     
    358358     */
    359359    function test_utf8_whitespace_1() {
    360         // NO-BREAK SPACE: U+00A0
     360        // NO-BREAK SPACE: U+00A0.
    361361        do_shortcode( "[test-shortcode-tag foo=\"bar\" \xC2\xA0baz=\"123\"]" );
    362362        $this->assertEquals(
     
    374374     */
    375375    function test_utf8_whitespace_2() {
    376         // ZERO WIDTH SPACE: U+200B
     376        // ZERO WIDTH SPACE: U+200B.
    377377        do_shortcode( "[test-shortcode-tag foo=\"bar\" \xE2\x80\x8Babc=\"def\"]" );
    378378        $this->assertEquals(
     
    390390     */
    391391    function test_shortcode_unautop() {
    392         // a blank line is added at the end, so test with it already there
     392        // A blank line is added at the end, so test with it already there.
    393393        $test_string = "[footag]\n";
    394394        $this->assertEquals( $test_string, shortcode_unautop( wpautop( $test_string ) ) );
     
    435435    }
    436436
    437     // Store passed in shortcode_atts_{$shortcode} args
     437    // Store passed in shortcode_atts_{$shortcode} args.
    438438    function _filter_atts( $out, $pairs, $atts ) {
    439439        $this->filter_atts_out   = $out;
     
    443443    }
    444444
    445     // Filter shortcode atts in various ways
     445    // Filter shortcode atts in various ways.
    446446    function _filter_atts2( $out, $pairs, $atts ) {
    447         // If foo attribute equals "foo1", change it to be default value
     447        // If foo attribute equals "foo1", change it to be default value.
    448448        if ( isset( $out['foo'] ) && 'foo1' === $out['foo'] ) {
    449449            $out['foo'] = $pairs['foo'];
    450450        }
    451451
    452         // If baz attribute is set, remove it
     452        // If baz attribute is set, remove it.
    453453        if ( isset( $out['baz'] ) ) {
    454454            unset( $out['baz'] );
     
    619619            ),
    620620            array(
    621                 '<div [gallery]>', // Shortcodes will never be stripped inside elements.
     621                '<div [gallery]>',   // Shortcodes will never be stripped inside elements.
    622622                '<div [gallery]>',
    623623            ),
     
    782782     */
    783783    public function test_pre_do_shortcode_tag() {
    784         // does nothing if no filters are set up
     784        // Does nothing if no filters are set up.
    785785        $str = 'pre_do_shortcode_tag';
    786786        add_shortcode( $str, array( $this, '_shortcode_pre_do_shortcode_tag' ) );
     
    788788        $this->assertSame( 'foo', $result_nofilter );
    789789
    790         // short-circuit with filter
     790        // Short-circuit with filter.
    791791        add_filter( 'pre_do_shortcode_tag', array( $this, '_filter_pre_do_shortcode_tag_bar' ) );
    792792        $result_filter = do_shortcode( "[{$str}]" );
    793793        $this->assertSame( 'bar', $result_filter );
    794794
    795         // respect priority
     795        // Respect priority.
    796796        add_filter( 'pre_do_shortcode_tag', array( $this, '_filter_pre_do_shortcode_tag_p11' ), 11 );
    797797        $result_priority = do_shortcode( "[{$str}]" );
    798798        $this->assertSame( 'p11', $result_priority );
    799799
    800         // pass arguments
     800        // Pass arguments.
    801801        $arr = array(
    802802            'return' => 'p11',
     
    852852     */
    853853    public function test_do_shortcode_tag_filter() {
    854         // does nothing if no filters are set up
     854        // Does nothing if no filters are set up.
    855855        $str = 'do_shortcode_tag';
    856856        add_shortcode( $str, array( $this, '_shortcode_do_shortcode_tag' ) );
     
    858858        $this->assertSame( 'foo', $result_nofilter );
    859859
    860         // modify output with filter
     860        // Modify output with filter.
    861861        add_filter( 'do_shortcode_tag', array( $this, '_filter_do_shortcode_tag_replace' ) );
    862862        $result_filter = do_shortcode( "[{$str}]" );
    863863        $this->assertSame( 'fee', $result_filter );
    864864
    865         // respect priority
     865        // Respect priority.
    866866        add_filter( 'do_shortcode_tag', array( $this, '_filter_do_shortcode_tag_generate' ), 11 );
    867867        $result_priority = do_shortcode( "[{$str}]" );
    868868        $this->assertSame( 'foobar', $result_priority );
    869869
    870         // pass arguments
     870        // Pass arguments.
    871871        $arr = array(
    872872            'return' => 'foobar',
Note: See TracChangeset for help on using the changeset viewer.