Make WordPress Core


Ignore:
Timestamp:
11/24/2014 06:04:10 AM (10 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:

  • Markdown-indent a code snippet in the description for wp_salt()
  • Backtick-escape inline code in the return description for get_avatar()
  • Various markdown formatting in the description for add_filter()
  • Markdown-indent a code snippet in the description for apply_filters()
  • Backtick-escape inline code in the @see description for apply_filters_ref_array()
  • Backtick-escape inline code in the description for do_action()
  • Backtick-escape variables in the parameter and return descriptions for do_action_ref_array()
  • Various markdown formatting in the description for get_plugin_data()

Props rarst.
See #30473.

File:
1 edited

Legend:

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

    r30105 r30544  
    4646 *
    4747 * The following example shows how a callback function is bound to a filter hook.
    48  * Note that $example is passed to the callback, (maybe) modified, then returned:
    49  *
    50  * <code>
    51  * function example_callback( $example ) {
    52  *  // Maybe modify $example in some way
    53  *  return $example;
    54  * }
    55  * add_filter( 'example_filter', 'example_callback' );
    56  * </code>
     48 *
     49 * Note that `$example` is passed to the callback, (maybe) modified, then returned:
     50 *
     51 *     function example_callback( $example ) {
     52 *         // Maybe modify $example in some way.
     53 *         return $example;
     54 *     }
     55 *     add_filter( 'example_filter', 'example_callback' );
    5756 *
    5857 * Since WordPress 1.5.1, bound callbacks can take as many arguments as are
    59  * passed as parameters in the corresponding apply_filters() call. The $accepted_args
     58 * passed as parameters in the corresponding apply_filters() call. The `$accepted_args`
    6059 * parameter allows for calling functions only when the number of args match.
    6160 *
    62  * <strong>Note:</strong> the function will return true whether or not the callback
    63  * is valid. It is up to you to take care. This is done for optimization purposes,
     61 * *Note:* the function will return true whether or not the callback is valid.
     62 * It is up to you to take care. This is done for optimization purposes,
    6463 * so everything is as quick as possible.
    6564 *
     
    149148 *
    150149 * The function allows for additional arguments to be added and passed to hooks.
    151  * <code>
    152  * // Our filter callback function
    153  * function example_callback( $string, $arg1, $arg2 ) {
    154  *  // (maybe) modify $string
    155  *  return $string;
    156  * }
    157  * add_filter( 'example_filter', 'example_callback', 10, 3 );
    158  *
    159  * // Apply the filters by calling the 'example_callback' function we
    160  * // "hooked" to 'example_filter' using the add_filter() function above.
    161  * // - 'example_filter' is the filter hook $tag
    162  * // - 'filter me' is the value being filtered
    163  * // - $arg1 and $arg2 are the additional arguments passed to the callback.
    164  * $value = apply_filters( 'example_filter', 'filter me', $arg1, $arg2 );
    165  * </code>
     150 *
     151 *     // Our filter callback function
     152 *     function example_callback( $string, $arg1, $arg2 ) {
     153 *         // (maybe) modify $string
     154 *         return $string;
     155 *     }
     156 *     add_filter( 'example_filter', 'example_callback', 10, 3 );
     157 *
     158 *     /*
     159 *      * Apply the filters by calling the 'example_callback' function we
     160 *      * "hooked" to 'example_filter' using the add_filter() function above.
     161 *      * - 'example_filter' is the filter hook $tag
     162 *      * - 'filter me' is the value being filtered
     163 *      * - $arg1 and $arg2 are the additional arguments passed to the callback.
     164 *     $value = apply_filters( 'example_filter', 'filter me', $arg1, $arg2 );
    166165 *
    167166 * @since 0.71
     
    172171 *
    173172 * @param string $tag   The name of the filter hook.
    174  * @param mixed  $value The value on which the filters hooked to <tt>$tag</tt> are applied on.
    175  * @param mixed  $var   Additional variables passed to the functions hooked to <tt>$tag</tt>.
     173 * @param mixed  $value The value on which the filters hooked to `$tag` are applied on.
     174 * @param mixed  $var   Additional variables passed to the functions hooked to `$tag`.
    176175 * @return mixed The filtered value after all hooked functions are applied to it.
    177176 */
     
    225224 * Execute functions hooked on a specific filter hook, specifying arguments in an array.
    226225 *
     226 * @see 3.0.0
     227 *
    227228 * @see apply_filters() This function is identical, but the arguments passed to the
    228  * functions hooked to <tt>$tag</tt> are supplied using an array.
    229  *
    230  * @since 3.0.0
     229 * functions hooked to `$tag` are supplied using an array.
    231230 *
    232231 * @global array $wp_filter         Stores all of the filters
     
    435434 * Execute functions hooked on a specific action hook.
    436435 *
    437  * This function invokes all functions attached to action hook $tag. It is
     436 * This function invokes all functions attached to action hook `$tag`. It is
    438437 * possible to create new action hooks by simply calling this function,
    439  * specifying the name of the new hook using the <tt>$tag</tt> parameter.
     438 * specifying the name of the new hook using the `$tag` parameter.
    440439 *
    441440 * You can pass extra arguments to the hooks, much like you can with
    442  * apply_filters().
     441 * {@see apply_filters()}.
    443442 *
    444443 * @since 1.2.0
    445444 *
    446  * @see apply_filters() This function works similar with the exception that nothing
    447  *                      is returned and only the functions or methods are called.
    448445 * @global array $wp_filter  Stores all of the filters
    449446 * @global array $wp_actions Increments the amount of times action was triggered.
     
    534531 *
    535532 * @param string $tag  The name of the action to be executed.
    536  * @param array  $args The arguments supplied to the functions hooked to <tt>$tag</tt>
    537  * @return null Will return null if $tag does not exist in $wp_filter array
     533 * @param array  $args The arguments supplied to the functions hooked to `$tag`.
     534 * @return null Will return null if `$tag` does not exist in `$wp_filter` array.
    538535 */
    539536function do_action_ref_array($tag, $args) {
Note: See TracChangeset for help on using the changeset viewer.