Make WordPress Core

Changeset 30540


Ignore:
Timestamp:
11/24/2014 05:29:43 AM (11 years ago)
Author:
DrewAPicture
Message:

Ensure inline code is markdown-escaped as such, HTML tags are removed from summaries, and that code snippets in descriptions are properly indented.

Affects DocBlocks for the following core elements in wp-includes/formatting.php:

  • Markdown-indent code snippets in the description for wptexturize()
  • Backtick-escape inline code in a parameter description for _wptexturize_pushpop_element()
  • Backtick-escape inline code in the description for shortcode_unautop()
  • Backtick-escape HTML tags in the description for convert_chars()
  • Markdown-indent a code snippet in the description for _split_str_by_whitespace()
  • Backtick-escape an <img> tag in the description for translate_smiley()
  • Add markdown formatting to the description for links_add_target()
  • Backtick-escape HTML tags in the description for wp_strip_all_tags()

Props rarst.
See #30473.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/formatting.php

    r30496 r30540  
    1212 *
    1313 * As an example,
    14  * <code>
    15  * 'cause today's effort makes it worth tomorrow's "holiday"...
    16  * </code>
     14 *
     15 *     'cause today's effort makes it worth tomorrow's "holiday" ...
     16 *
    1717 * Becomes:
    18  * <code>
    19  * &#8217;cause today&#8217;s effort makes it worth tomorrow&#8217;s &#8220;holiday&#8221;&#8230;
    20  * </code>
     18 *
     19 *     &#8217;cause today&#8217;s effort makes it worth tomorrow&#8217;s &#8220;holiday&#8221; &#8230;
     20 *
    2121 * Code within certain html blocks are skipped.
    2222 *
     
    313313 * @access private
    314314 *
    315  * @param string $text Text to check. Must be a tag like <html> or [shortcode].
     315 * @param string $text Text to check. Must be a tag like `<html>` or `[shortcode]`.
    316316 * @param array $stack List of open tag elements.
    317317 * @param array $disabled_elements The tag names to match against. Spaces are not allowed in tag names.
     
    481481 * Don't auto-p wrap shortcodes that stand alone
    482482 *
    483  * Ensures that shortcodes are not wrapped in <<p>>...<</p>>.
     483 * Ensures that shortcodes are not wrapped in `<p>...</p>`.
    484484 *
    485485 * @since 2.9.0
     
    13671367 * Converts a number of characters from a string.
    13681368 *
    1369  * Metadata tags <<title>> and <<category>> are removed, <<br>> and <<hr>> are
     1369 * Metadata tags `<title>` and `<category>` are removed, `<br>` and `<hr>` are
    13701370 * converted into correct XHTML and Unicode characters are converted to the
    13711371 * valid range.
     
    19361936 * Input string must have no null characters (or eventual transformations on output chunks must not care about null characters)
    19371937 *
    1938  * <code>
    1939  * _split_str_by_whitespace( "1234 67890 1234 67890a cd 1234   890 123456789 1234567890a    45678   1 3 5 7 90 ", 10 ) ==
    1940  * array (
    1941  *   0 => '1234 67890 ',  // 11 characters: Perfect split
    1942  *   1 => '1234 ',        //  5 characters: '1234 67890a' was too long
    1943  *   2 => '67890a cd ',   // 10 characters: '67890a cd 1234' was too long
    1944  *   3 => '1234   890 ',  // 11 characters: Perfect split
    1945  *   4 => '123456789 ',   // 10 characters: '123456789 1234567890a' was too long
    1946  *   5 => '1234567890a ', // 12 characters: Too long, but no inner whitespace on which to split
    1947  *   6 => '   45678   ',  // 11 characters: Perfect split
    1948  *   7 => '1 3 5 7 9',    //  9 characters: End of $string
    1949  * );
    1950  * </code>
     1938 *     _split_str_by_whitespace( "1234 67890 1234 67890a cd 1234   890 123456789 1234567890a    45678   1 3 5 7 90 ", 10 ) ==
     1939 *     array (
     1940 *         0 => '1234 67890 ',  // 11 characters: Perfect split
     1941 *         1 => '1234 ',        //  5 characters: '1234 67890a' was too long
     1942 *         2 => '67890a cd ',   // 10 characters: '67890a cd 1234' was too long
     1943 *         3 => '1234   890 ',  // 11 characters: Perfect split
     1944 *         4 => '123456789 ',   // 10 characters: '123456789 1234567890a' was too long
     1945 *         5 => '1234567890a ', // 12 characters: Too long, but no inner whitespace on which to split
     1946 *         6 => '   45678   ',  // 11 characters: Perfect split
     1947 *         7 => '1 3 5 7 9',    //  9 characters: End of $string
     1948 *     );
    19511949 *
    19521950 * @since 3.4.0
     
    20222020 * Callback handler for {@link convert_smilies()}.
    20232021 * Looks up one smiley code in the $wpsmiliestrans global array and returns an
    2024  * <img> string for that smiley.
     2022 * `<img>` string for that smiley.
    20252023 *
    20262024 * @global array $wpsmiliestrans
     
    37043702 * Adds a Target attribute to all links in passed content.
    37053703 *
    3706  * This function by default only applies to <a> tags, however this can be
     3704 * This function by default only applies to `<a>` tags, however this can be
    37073705 * modified by the 3rd param.
    37083706 *
    3709  * <b>NOTE:</b> Any current target attributed will be stripped and replaced.
     3707 * *NOTE:* Any current target attributed will be stripped and replaced.
    37103708 *
    37113709 * @since 2.7.0
     
    37583756 *
    37593757 * This differs from strip_tags() because it removes the contents of
    3760  * the <script> and <style> tags. E.g. strip_tags( '<script>something</script>' )
     3758 * the `<script>` and `<style>` tags. E.g. `strip_tags( '<script>something</script>' )`
    37613759 * will return 'something'. wp_strip_all_tags will return ''
    37623760 *
Note: See TracChangeset for help on using the changeset viewer.