Changeset 32629 for trunk/src/wp-includes/theme.php
- Timestamp:
- 05/27/2015 10:20:48 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/theme.php
r32048 r32629 14 14 * 15 15 * @since 3.4.0 16 * 17 * @global array $wp_theme_directories 18 * @staticvar array $_themes 16 19 * 17 20 * @param array $args The search arguments. Optional. … … 23 26 * - blog_id int (Multisite) The blog ID used to calculate which themes are allowed. Defaults to 0, 24 27 * synonymous for the current blog. 25 * @return Array of WP_Theme objects.28 * @return array Array of WP_Theme objects. 26 29 */ 27 30 function wp_get_themes( $args = array() ) { … … 85 88 * @since 3.4.0 86 89 * 90 * @global array $wp_theme_directories 91 * 87 92 * @param string $stylesheet Directory name for the theme. Optional. Defaults to current theme. 88 93 * @param string $theme_root Absolute path of the theme root to look in. Optional. If not specified, get_raw_theme_root() 89 * is used to calculate the theme root for the $stylesheet provided (or current theme).94 * is used to calculate the theme root for the $stylesheet provided (or current theme). 90 95 * @return WP_Theme Theme object. Be sure to check the object's exists() method if you need to confirm the theme's existence. 91 96 */ … … 243 248 * 244 249 * @since 2.1.0 250 * 251 * @global WP_Locale $wp_locale 245 252 * 246 253 * @return string … … 339 346 * @since 2.9.0 340 347 * 348 * @global array $wp_theme_directories 349 * 341 350 * @return array|string An array of theme roots keyed by template/stylesheet or a single theme root if all themes have the same root. 342 351 */ … … 359 368 * 360 369 * @since 2.9.0 370 * 371 * @global array $wp_theme_directories 361 372 * 362 373 * @param string $directory Either the full filesystem path to a theme folder or a folder within WP_CONTENT_DIR … … 392 403 * @since 2.9.0 393 404 * 405 * @global array $wp_theme_directories 406 * @staticvar array $found_themes 407 * 394 408 * @param bool $force Optional. Whether to force a new directory scan. Defaults to false. 395 * @return array Valid themes found409 * @return array|false Valid themes found 396 410 */ 397 411 function search_theme_directories( $force = false ) { … … 519 533 * @since 1.5.0 520 534 * 535 * @global array $wp_theme_directories 536 * 521 537 * @param string $stylesheet_or_template The stylesheet or template name of the theme 522 538 * @return string Theme path. … … 551 567 * @since 1.5.0 552 568 * 569 * @global array $wp_theme_directories 570 * 553 571 * @param string $stylesheet_or_template Optional. The stylesheet or template name of the theme. 554 * Default is to leverage the main theme root.555 * @param string $theme_root Optional. The theme root for which calculations will be based, preventing556 * the need for a get_raw_theme_root() call.572 * Default is to leverage the main theme root. 573 * @param string $theme_root Optional. The theme root for which calculations will be based, preventing 574 * the need for a get_raw_theme_root() call. 557 575 * @return string Themes URI. 558 576 */ … … 598 616 * @since 3.1.0 599 617 * 618 * @global array $wp_theme_directories 619 * 600 620 * @param string $stylesheet_or_template The stylesheet or template name of the theme 601 * @param bool $skip_cache Optional. Whether to skip the cache. Defaults to false, meaning the cache is used. 621 * @param bool $skip_cache Optional. Whether to skip the cache. 622 * Defaults to false, meaning the cache is used. 602 623 * @return string Theme root 603 624 */ … … 757 778 * @since 2.5.0 758 779 * 780 * @global array $wp_theme_directories 781 * @global WP_Customize_Manager $wp_customize 782 * @global array $sidebars_widgets 783 * 759 784 * @param string $stylesheet Stylesheet name 760 785 */ … … 872 897 * @since 3.1.0 873 898 * 874 * @return array| nullTheme modifications.899 * @return array|void Theme modifications. 875 900 */ 876 901 function get_theme_mods() { … … 885 910 delete_option( "mods_$theme_name" ); 886 911 } 887 }888 return $mods;912 return $mods; 913 } 889 914 } 890 915 … … 899 924 * @since 2.1.0 900 925 * 901 * @param string $nameTheme modification name.926 * @param string $name Theme modification name. 902 927 * @param bool|string $default 903 928 * @return string … … 934 959 * @since 2.1.0 935 960 * 936 * @param string $name Theme modification name.937 * @param mixed $value theme modification value.961 * @param string $name Theme modification name. 962 * @param mixed $value Theme modification value. 938 963 */ 939 964 function set_theme_mod( $name, $value ) { … … 968 993 * 969 994 * @param string $name Theme modification name. 970 * @return null971 995 */ 972 996 function remove_theme_mod( $name ) { … … 978 1002 unset( $mods[ $name ] ); 979 1003 980 if ( empty( $mods ) ) 981 return remove_theme_mods(); 982 1004 if ( empty( $mods ) ) { 1005 remove_theme_mods(); 1006 return; 1007 } 983 1008 $theme = get_option( 'stylesheet' ); 984 1009 update_option( "theme_mods_$theme", $mods ); … … 1032 1057 1033 1058 $text_color = get_theme_mod( 'header_textcolor', get_theme_support( 'custom-header', 'default-text-color' ) ); 1034 return 'blank' != $text_color;1059 return 'blank' !== $text_color; 1035 1060 } 1036 1061 … … 1074 1099 * @access private 1075 1100 * 1076 * @return string Path to header image 1077 */ 1078 1101 * @global array $_wp_default_headers 1102 * @staticvar object $_wp_random_header 1103 * 1104 * @return object 1105 */ 1079 1106 function _get_random_header_data() { 1080 1107 static $_wp_random_header; … … 1114 1141 * @return string Path to header image 1115 1142 */ 1116 1117 1143 function get_random_header_image() { 1118 1144 $random_image = _get_random_header_data(); … … 1199 1225 * 1200 1226 * @since 3.4.0 1227 * 1228 * @global array $_wp_default_headers 1201 1229 * 1202 1230 * @return object … … 1241 1269 * @since 3.0.0 1242 1270 * 1271 * @global array $_wp_default_headers 1272 * 1243 1273 * @param array $headers Array of headers keyed by a string id. The ids point to arrays containing 'url', 'thumbnail_url', and 'description' keys. 1244 1274 */ … … 1257 1287 * @see register_default_headers() 1258 1288 * @since 3.0.0 1289 * 1290 * @global array $_wp_default_headers 1259 1291 * 1260 1292 * @param string|array $header The header string id (key of array) to remove, or an array thereof. … … 1381 1413 * @since 3.0.0 1382 1414 * 1415 * @global array $editor_styles 1416 * 1383 1417 * @param array|string $stylesheet Optional. Stylesheet name or array thereof, relative to theme root. 1384 * Defaults to 'editor-style.css'1418 * Defaults to 'editor-style.css' 1385 1419 */ 1386 1420 function add_editor_style( $stylesheet = 'editor-style.css' ) { 1387 1388 1421 add_theme_support( 'editor-style' ); 1389 1422 … … 1406 1439 * 1407 1440 * @since 3.1.0 1441 * 1442 * @global array $editor_styles 1408 1443 * 1409 1444 * @return bool True on success, false if there were no stylesheets to remove. … … 1423 1458 * @since 4.0.0 1424 1459 * 1425 * @global $editor_styles Registered editor stylesheets1460 * @global array $editor_styles Registered editor stylesheets 1426 1461 * 1427 1462 * @return array If registered, a list of editor stylesheet URLs. … … 1474 1509 * 1475 1510 * @since 2.9.0 1511 * 1512 * @global array $_wp_theme_features 1476 1513 * 1477 1514 * @param string $feature The feature being added. … … 1648 1685 * @since 3.4.0 1649 1686 * @access private 1687 * 1688 * @global Custom_Image_Header $custom_image_header 1689 * @global Custom_Background $custom_background 1650 1690 */ 1651 1691 function _custom_header_background_just_in_time() { … … 1684 1724 * 1685 1725 * @since 3.1.0 1726 * 1727 * @global array $_wp_theme_features 1686 1728 * 1687 1729 * @param string $feature the feature to check … … 1718 1760 * @see add_theme_support() 1719 1761 * @param string $feature the feature being added 1720 * @return null|boolWhether feature was removed.1762 * @return bool|void Whether feature was removed. 1721 1763 */ 1722 1764 function remove_theme_support( $feature ) { … … 1733 1775 * @access private 1734 1776 * @since 3.1.0 1777 * 1778 * @global array $_wp_theme_features 1779 * @global Custom_Image_Header $custom_image_header 1780 * @global Custom_Background $custom_background 1781 * 1735 1782 * @param string $feature 1736 1783 */ … … 1778 1825 * 1779 1826 * @since 2.9.0 1827 * 1828 * @global array $_wp_theme_features 1829 * 1780 1830 * @param string $feature the feature being checked 1781 * @return bool ean1831 * @return bool 1782 1832 */ 1783 1833 function current_theme_supports( $feature ) { … … 1932 1982 * 1933 1983 * @since 3.4.0 1984 * 1985 * @global WP_Customize_Manager $wp_customize 1934 1986 */ 1935 1987 function _wp_customize_include() { … … 1950 2002 */ 1951 2003 function _wp_customize_loader_settings() { 1952 global $wp_scripts;1953 1954 2004 $admin_origin = parse_url( admin_url() ); 1955 2005 $home_origin = parse_url( home_url() ); … … 1973 2023 $script = 'var _wpCustomizeLoaderSettings = ' . wp_json_encode( $settings ) . ';'; 1974 2024 2025 $wp_scripts = wp_scripts(); 1975 2026 $data = $wp_scripts->get_data( 'customize-loader', 'data' ); 1976 2027 if ( $data ) … … 1986 2037 * 1987 2038 * @param string $stylesheet Optional. Theme to customize. Defaults to current theme. 1988 * The theme's stylesheet will be urlencoded if necessary. 2039 * The theme's stylesheet will be urlencoded if necessary. 2040 * @return string 1989 2041 */ 1990 2042 function wp_customize_url( $stylesheet = null ) {
Note: See TracChangeset
for help on using the changeset viewer.