Changeset 46395
- Timestamp:
- 10/05/2019 12:53:39 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/theme.php
r46394 r46395 935 935 936 936 if ( is_string( $default ) ) { 937 $default = sprintf( $default, get_template_directory_uri(), get_stylesheet_directory_uri() ); 937 // Only run the replacement if an sprintf() string format pattern was found. 938 if ( preg_match( '#(?<!%)%(?:\d+\$?)?s#', $default ) ) { 939 $default = sprintf( $default, get_template_directory_uri(), get_stylesheet_directory_uri() ); 940 } 938 941 } 939 942 -
trunk/tests/phpunit/tests/option/themeMods.php
r33812 r46395 33 33 } 34 34 35 /** 36 * @ticket 34290 37 * 38 * @dataProvider data_theme_mod_default_value_with_percent_symbols 39 */ 40 function test_theme_mod_default_value_with_percent_symbols( $default, $expected ) { 41 $this->assertEquals( $expected, get_theme_mod( 'test_name', $default ) ); 42 } 43 44 function data_theme_mod_default_value_with_percent_symbols() { 45 return array( 46 array( 47 '100%', 48 '100%', 49 ), 50 array( 51 '%s', 52 get_template_directory_uri(), 53 ), 54 array( 55 '%s%s', 56 get_template_directory_uri() . get_stylesheet_directory_uri(), 57 ), 58 array( 59 '%1$s%s', 60 get_template_directory_uri() . get_template_directory_uri(), 61 ), 62 array( 63 '%2$s%s', 64 get_stylesheet_directory_uri() . get_template_directory_uri(), 65 ), 66 array( 67 '%1$s%2$s', 68 get_template_directory_uri() . get_stylesheet_directory_uri(), 69 ), 70 array( 71 '%40s%40s', 72 get_template_directory_uri() . get_stylesheet_directory_uri(), 73 ), 74 array( 75 '%%1', 76 '%%1', 77 ), 78 array( 79 '%1%', 80 '%1%', 81 ), 82 array( 83 '1%%', 84 '1%%', 85 ), 86 array( 87 '%%s', 88 '%%s', 89 ), 90 array( 91 '%s%', 92 get_template_directory_uri(), 93 ), 94 array( 95 's%%', 96 's%%', 97 ), 98 ); 99 } 100 35 101 }
Note: See TracChangeset
for help on using the changeset viewer.