Make WordPress Core


Ignore:
Timestamp:
06/10/2020 06:18:25 PM (6 years ago)
Author:
desrosj
Message:

General: Backport several commits for release.

  • Embeds: Ensure that the title attribute is set correctly on embeds.
  • Editor: Prevent HTML decoding on by setting the proper editor context.
  • Formatting: Ensure that wp_validate_redirect() sanitizes a wider variety of characters.
  • Themes: Ensure a broken theme name is returned properly.
  • Administration: Add a new filter to extend set-screen-option.

Merges [47947-47951] to the 5.1 branch.
Props xknown, sstoqnov, vortfu, SergeyBiryukov, whyisjake.

Location:
branches/5.1
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.1

  • branches/5.1/src/wp-admin/includes/misc.php

    r44789 r47963  
    640640                                break;
    641641                        default:
     642                                if ( '_page' === substr( $option, -5 ) || 'layout_columns' === $option ) {
     643                                        /**
     644                                         * Filters a screen option value before it is set.
     645                                         *
     646                                         * The filter can also be used to modify non-standard [items]_per_page
     647                                         * settings. See the parent function for a full list of standard options.
     648                                         *
     649                                         * Returning false to the filter will skip saving the current option.
     650                                         *
     651                                         * @since 2.8.0
     652                                         * @since 5.4.2 Only applied to options ending with '_page',
     653                                         *              or the 'layout_columns' option.
     654                                         *
     655                                         * @see set_screen_options()
     656                                         *
     657                                         * @param bool   $keep   Whether to save or skip saving the screen option value.
     658                                         *                       Default false.
     659                                         * @param string $option The option name.
     660                                         * @param int    $value  The number of rows to use.
     661                                         */
     662                                        $value = apply_filters( 'set-screen-option', false, $option, $value ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
     663                                }
     664
    642665                                /**
    643666                                 * Filters a screen option value before it is set.
    644667                                 *
    645                                  * The filter can also be used to modify non-standard [items]_per_page
    646                                  * settings. See the parent function for a full list of standard options.
     668                                 * The dynamic portion of the hook, `$option`, refers to the option name.
    647669                                 *
    648670                                 * Returning false to the filter will skip saving the current option.
    649671                                 *
    650                                  * @since 2.8.0
     672                                 * @since 5.4.2
    651673                                 *
    652674                                 * @see set_screen_options()
    653675                                 *
    654                                  * @param bool     $keep   Whether to save or skip saving the screen option value. Default false.
    655                                  * @param string   $option The option name.
    656                                  * @param int      $value  The number of rows to use.
     676                                 * @param bool   $keep   Whether to save or skip saving the screen option value.
     677                                 *                       Default false.
     678                                 * @param string $option The option name.
     679                                 * @param int    $value  The number of rows to use.
    657680                                 */
    658                                 $value = apply_filters( 'set-screen-option', false, $option, $value );
     681                                $value = apply_filters( "set_screen_option_{$option}", false, $option, $value );
    659682
    660683                                if ( false === $value ) {
Note: See TracChangeset for help on using the changeset viewer.