Make WordPress Core


Ignore:
Timestamp:
07/11/2017 12:53:33 AM (8 years ago)
Author:
SergeyBiryukov
Message:

Shortcodes: Allow using single quotes for empty value attributes.

Props enrico.sorcinelli.
Fixes #37304.

File:
1 edited

Legend:

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

    r40937 r41026  
    488488 */
    489489function get_shortcode_atts_regex() {
    490     return '/([\w-]+)\s*=\s*"([^"]*)"(?:\s|$)|([\w-]+)\s*=\s*\'([^\']*)\'(?:\s|$)|([\w-]+)\s*=\s*([^\s\'"]+)(?:\s|$)|"([^"]*)"(?:\s|$)|(\S+)(?:\s|$)/';
     490    return '/([\w-]+)\s*=\s*"([^"]*)"(?:\s|$)|([\w-]+)\s*=\s*\'([^\']*)\'(?:\s|$)|([\w-]+)\s*=\s*([^\s\'"]+)(?:\s|$)|"([^"]*)"(?:\s|$)|\'([^\']*)\'(?:\s|$)|(\S+)(?:\s|$)/';
    491491}
    492492
     
    520520            elseif (isset($m[7]) && strlen($m[7]))
    521521                $atts[] = stripcslashes($m[7]);
    522             elseif (isset($m[8]))
     522            elseif (isset($m[8]) && strlen($m[8]))
    523523                $atts[] = stripcslashes($m[8]);
     524            elseif (isset($m[9]))
     525                $atts[] = stripcslashes($m[9]);
    524526        }
    525527
Note: See TracChangeset for help on using the changeset viewer.