Changeset 46128
- Timestamp:
- 09/15/2019 11:05:31 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/formatting.php
r46105 r46128 4837 4837 * @return string The formatted string. 4838 4838 */ 4839 function wp_sprintf( $pattern ) { 4840 $args = func_get_args(); 4839 function wp_sprintf( $pattern, ...$args ) { 4841 4840 $len = strlen( $pattern ); 4842 4841 $start = 0; … … 4868 4867 // Find numbered arguments or take the next one in order 4869 4868 if ( preg_match( '/^%(\d+)\$/', $fragment, $matches ) ) { 4870 $arg = isset( $args[ $matches[1] ] ) ? $args[ $matches[1] ] : ''; 4869 $index = $matches[1] - 1; // 0-based array vs 1-based sprintf arguments. 4870 $arg = isset( $args[ $index ] ) ? $args[ $index ] : ''; 4871 4871 $fragment = str_replace( "%{$matches[1]}$", '%', $fragment ); 4872 4872 } else { 4873 $arg = isset( $args[ $arg_index ] ) ? $args[ $arg_index ] : ''; 4873 4874 ++$arg_index; 4874 $arg = isset( $args[ $arg_index ] ) ? $args[ $arg_index ] : '';4875 4875 } 4876 4876
Note: See TracChangeset
for help on using the changeset viewer.