Make WordPress Core


Ignore:
Timestamp:
05/27/2015 10:20:48 PM (10 years ago)
Author:
wonderboymusic
Message:

Add missing doc blocks to theme.php.
Correct some @return values.

See #32444.

File:
1 edited

Legend:

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

    r32048 r32629  
    1414 *
    1515 * @since 3.4.0
     16 *
     17 * @global array $wp_theme_directories
     18 * @staticvar array $_themes
    1619 *
    1720 * @param array $args The search arguments. Optional.
     
    2326 * - blog_id     int    (Multisite) The blog ID used to calculate which themes are allowed. Defaults to 0,
    2427 *                      synonymous for the current blog.
    25  * @return Array of WP_Theme objects.
     28 * @return array Array of WP_Theme objects.
    2629 */
    2730function wp_get_themes( $args = array() ) {
     
    8588 * @since 3.4.0
    8689 *
     90 * @global array $wp_theme_directories
     91 *
    8792 * @param string $stylesheet Directory name for the theme. Optional. Defaults to current theme.
    8893 * @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).
    9095 * @return WP_Theme Theme object. Be sure to check the object's exists() method if you need to confirm the theme's existence.
    9196 */
     
    243248 *
    244249 * @since 2.1.0
     250 *
     251 * @global WP_Locale $wp_locale
    245252 *
    246253 * @return string
     
    339346 * @since 2.9.0
    340347 *
     348 * @global array $wp_theme_directories
     349 *
    341350 * @return array|string An array of theme roots keyed by template/stylesheet or a single theme root if all themes have the same root.
    342351 */
     
    359368 *
    360369 * @since 2.9.0
     370 *
     371 * @global array $wp_theme_directories
    361372 *
    362373 * @param string $directory Either the full filesystem path to a theme folder or a folder within WP_CONTENT_DIR
     
    392403 * @since 2.9.0
    393404 *
     405 * @global array $wp_theme_directories
     406 * @staticvar array $found_themes
     407 *
    394408 * @param bool $force Optional. Whether to force a new directory scan. Defaults to false.
    395  * @return array Valid themes found
     409 * @return array|false Valid themes found
    396410 */
    397411function search_theme_directories( $force = false ) {
     
    519533 * @since 1.5.0
    520534 *
     535 * @global array $wp_theme_directories
     536 *
    521537 * @param string $stylesheet_or_template The stylesheet or template name of the theme
    522538 * @return string Theme path.
     
    551567 * @since 1.5.0
    552568 *
     569 * @global array $wp_theme_directories
     570 *
    553571 * @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, preventing
    556  *  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.
    557575 * @return string Themes URI.
    558576 */
     
    598616 * @since 3.1.0
    599617 *
     618 * @global array $wp_theme_directories
     619 *
    600620 * @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.
    602623 * @return string Theme root
    603624 */
     
    757778 * @since 2.5.0
    758779 *
     780 * @global array                $wp_theme_directories
     781 * @global WP_Customize_Manager $wp_customize
     782 * @global array                $sidebars_widgets
     783 *
    759784 * @param string $stylesheet Stylesheet name
    760785 */
     
    872897 * @since 3.1.0
    873898 *
    874  * @return array|null Theme modifications.
     899 * @return array|void Theme modifications.
    875900 */
    876901function get_theme_mods() {
     
    885910            delete_option( "mods_$theme_name" );
    886911        }
    887     }
    888     return $mods;
     912        return $mods;
     913    }
    889914}
    890915
     
    899924 * @since 2.1.0
    900925 *
    901  * @param string $name Theme modification name.
     926 * @param string      $name    Theme modification name.
    902927 * @param bool|string $default
    903928 * @return string
     
    934959 * @since 2.1.0
    935960 *
    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.
    938963 */
    939964function set_theme_mod( $name, $value ) {
     
    968993 *
    969994 * @param string $name Theme modification name.
    970  * @return null
    971995 */
    972996function remove_theme_mod( $name ) {
     
    9781002    unset( $mods[ $name ] );
    9791003
    980     if ( empty( $mods ) )
    981         return remove_theme_mods();
    982 
     1004    if ( empty( $mods ) ) {
     1005        remove_theme_mods();
     1006        return;
     1007    }
    9831008    $theme = get_option( 'stylesheet' );
    9841009    update_option( "theme_mods_$theme", $mods );
     
    10321057
    10331058    $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;
    10351060}
    10361061
     
    10741099 * @access private
    10751100 *
    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 */
    10791106function _get_random_header_data() {
    10801107    static $_wp_random_header;
     
    11141141 * @return string Path to header image
    11151142 */
    1116 
    11171143function get_random_header_image() {
    11181144    $random_image = _get_random_header_data();
     
    11991225 *
    12001226 * @since 3.4.0
     1227 *
     1228 * @global array $_wp_default_headers
    12011229 *
    12021230 * @return object
     
    12411269 * @since 3.0.0
    12421270 *
     1271 * @global array $_wp_default_headers
     1272 *
    12431273 * @param array $headers Array of headers keyed by a string id. The ids point to arrays containing 'url', 'thumbnail_url', and 'description' keys.
    12441274 */
     
    12571287 * @see register_default_headers()
    12581288 * @since 3.0.0
     1289 *
     1290 * @global array $_wp_default_headers
    12591291 *
    12601292 * @param string|array $header The header string id (key of array) to remove, or an array thereof.
     
    13811413 * @since 3.0.0
    13821414 *
     1415 * @global array $editor_styles
     1416 *
    13831417 * @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'
    13851419 */
    13861420function add_editor_style( $stylesheet = 'editor-style.css' ) {
    1387 
    13881421    add_theme_support( 'editor-style' );
    13891422
     
    14061439 *
    14071440 * @since 3.1.0
     1441 *
     1442 * @global array $editor_styles
    14081443 *
    14091444 * @return bool True on success, false if there were no stylesheets to remove.
     
    14231458 * @since 4.0.0
    14241459 *
    1425  * @global $editor_styles Registered editor stylesheets
     1460 * @global array $editor_styles Registered editor stylesheets
    14261461 *
    14271462 * @return array If registered, a list of editor stylesheet URLs.
     
    14741509 *
    14751510 * @since 2.9.0
     1511 *
     1512 * @global array $_wp_theme_features
    14761513 *
    14771514 * @param string $feature The feature being added.
     
    16481685 * @since 3.4.0
    16491686 * @access private
     1687 *
     1688 * @global Custom_Image_Header $custom_image_header
     1689 * @global Custom_Background   $custom_background
    16501690 */
    16511691function _custom_header_background_just_in_time() {
     
    16841724 *
    16851725 * @since 3.1.0
     1726 *
     1727 * @global array $_wp_theme_features
    16861728 *
    16871729 * @param string $feature the feature to check
     
    17181760 * @see add_theme_support()
    17191761 * @param string $feature the feature being added
    1720  * @return null|bool Whether feature was removed.
     1762 * @return bool|void Whether feature was removed.
    17211763 */
    17221764function remove_theme_support( $feature ) {
     
    17331775 * @access private
    17341776 * @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 *
    17351782 * @param string $feature
    17361783 */
     
    17781825 *
    17791826 * @since 2.9.0
     1827 *
     1828 * @global array $_wp_theme_features
     1829 *
    17801830 * @param string $feature the feature being checked
    1781  * @return boolean
     1831 * @return bool
    17821832 */
    17831833function current_theme_supports( $feature ) {
     
    19321982 *
    19331983 * @since 3.4.0
     1984 *
     1985 * @global WP_Customize_Manager $wp_customize
    19341986 */
    19351987function _wp_customize_include() {
     
    19502002 */
    19512003function _wp_customize_loader_settings() {
    1952     global $wp_scripts;
    1953 
    19542004    $admin_origin = parse_url( admin_url() );
    19552005    $home_origin  = parse_url( home_url() );
     
    19732023    $script = 'var _wpCustomizeLoaderSettings = ' . wp_json_encode( $settings ) . ';';
    19742024
     2025    $wp_scripts = wp_scripts();
    19752026    $data = $wp_scripts->get_data( 'customize-loader', 'data' );
    19762027    if ( $data )
     
    19862037 *
    19872038 * @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
    19892041 */
    19902042function wp_customize_url( $stylesheet = null ) {
Note: See TracChangeset for help on using the changeset viewer.