Make WordPress Core

Changeset 46751


Ignore:
Timestamp:
11/20/2019 08:29:36 AM (5 years ago)
Author:
SergeyBiryukov
Message:

Docs: Clarify that WP_Theme::get(), ::display(), and several related methods treat the Tags theme header as an array.

Props david.binda.
Fixes #48005.

File:
1 edited

Legend:

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

    r46696 r46751  
    735735     *
    736736     * @param string $header Theme header. Name, Description, Author, Version, ThemeURI, AuthorURI, Status, Tags.
    737      * @return string|false String on success, false on failure.
     737     * @return string|array|false String or array (for Tags header) on success, false on failure.
    738738     */
    739739    public function get( $header ) {
     
    774774     * @param bool $markup Optional. Whether to mark up the header. Defaults to true.
    775775     * @param bool $translate Optional. Whether to translate the header. Defaults to true.
    776      * @return string|false Processed header, false on failure.
     776     * @return string|array|false Processed header. An array for Tags if `$markup` is false, string otherwise.
     777     *                            False on failure.
    777778     */
    778779    public function display( $header, $markup = true, $translate = true ) {
     
    806807     *
    807808     * @param string $header Theme header. Name, Description, Author, Version, ThemeURI, AuthorURI, Status, Tags.
    808      * @param string $value Value to sanitize.
    809      * @return mixed
     809     * @param string $value  Value to sanitize.
     810     * @return string|array An array for Tags header, string otherwise.
    810811     */
    811812    private function sanitize_header( $header, $value ) {
     
    825826                    'strong'  => true,
    826827                );
    827                 $value              = wp_kses( $value, $header_tags );
     828
     829                $value = wp_kses( $value, $header_tags );
    828830                break;
    829831            case 'Author':
     
    841843                    'strong'  => true,
    842844                );
    843                 $value                     = wp_kses( $value, $header_tags_with_a );
     845
     846                $value = wp_kses( $value, $header_tags_with_a );
    844847                break;
    845848            case 'ThemeURI':
     
    865868     * @staticvar string $comma
    866869     *
    867      * @param string $header Theme header. Name, Description, Author, Version, ThemeURI, AuthorURI, Status, Tags.
    868      * @param string $value Value to mark up.
    869      * @param string $translate Whether the header has been translated.
     870     * @param string       $header    Theme header. Name, Description, Author, Version, ThemeURI, AuthorURI, Status, Tags.
     871     * @param string|array $value     Value to mark up. An array for Tags header, string otherwise.
     872     * @param string       $translate Whether the header has been translated.
    870873     * @return string Value, marked up.
    871874     */
     
    911914     * @staticvar array $tags_list
    912915     *
    913      * @param string $header Theme header. Name, Description, Author, Version, ThemeURI, AuthorURI, Status, Tags.
    914      * @param string $value Value to translate.
    915      * @return string Translated value.
     916     * @param string       $header Theme header. Name, Description, Author, Version, ThemeURI, AuthorURI, Status, Tags.
     917     * @param string|array $value  Value to translate. An array for Tags header, string otherwise.
     918     * @return string|array Translated value. An array for Tags header, string otherwise.
    916919     */
    917920    private function translate_header( $header, $value ) {
Note: See TracChangeset for help on using the changeset viewer.