Changeset 55014
- Timestamp:
- 12/23/2022 11:36:13 AM (22 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/theme.php
r54891 r55014 992 992 * Retrieves theme modification value for the active theme. 993 993 * 994 * If the modification name does not exist and `$default ` is a string, then the994 * If the modification name does not exist and `$default_value` is a string, then the 995 995 * default will be passed through the {@link https://www.php.net/sprintf sprintf()} 996 996 * PHP function with the template directory URI as the first value and the … … 999 999 * @since 2.1.0 1000 1000 * 1001 * @param string $name Theme modification name.1002 * @param mixed $default Optional. Theme modification default value. Default false.1001 * @param string $name Theme modification name. 1002 * @param mixed $default_value Optional. Theme modification default value. Default false. 1003 1003 * @return mixed Theme modification value. 1004 1004 */ 1005 function get_theme_mod( $name, $default = false ) {1005 function get_theme_mod( $name, $default_value = false ) { 1006 1006 $mods = get_theme_mods(); 1007 1007 … … 1021 1021 } 1022 1022 1023 if ( is_string( $default ) ) {1023 if ( is_string( $default_value ) ) { 1024 1024 // Only run the replacement if an sprintf() string format pattern was found. 1025 if ( preg_match( '#(?<!%)%(?:\d+\$?)?s#', $default ) ) {1025 if ( preg_match( '#(?<!%)%(?:\d+\$?)?s#', $default_value ) ) { 1026 1026 // Remove a single trailing percent sign. 1027 $default = preg_replace( '#(?<!%)%$#', '', $default);1028 $default = sprintf( $default, get_template_directory_uri(), get_stylesheet_directory_uri() );1027 $default_value = preg_replace( '#(?<!%)%$#', '', $default_value ); 1028 $default_value = sprintf( $default_value, get_template_directory_uri(), get_stylesheet_directory_uri() ); 1029 1029 } 1030 1030 } 1031 1031 1032 1032 /** This filter is documented in wp-includes/theme.php */ 1033 return apply_filters( "theme_mod_{$name}", $default );1033 return apply_filters( "theme_mod_{$name}", $default_value ); 1034 1034 } 1035 1035 … … 3126 3126 * @param string $feature The feature being checked. See add_theme_support() for the list 3127 3127 * of possible values. 3128 * @param string $ includePath to the file.3128 * @param string $file Path to the file. 3129 3129 * @return bool True if the active theme supports the supplied feature, false otherwise. 3130 3130 */ 3131 function require_if_theme_supports( $feature, $ include ) {3131 function require_if_theme_supports( $feature, $file ) { 3132 3132 if ( current_theme_supports( $feature ) ) { 3133 require $ include;3133 require $file; 3134 3134 return true; 3135 3135 }
Note: See TracChangeset
for help on using the changeset viewer.