Make WordPress Core

Changeset 15676 for trunk/wp-includes


Ignore:
Timestamp:
10/01/2010 01:32:31 AM (13 years ago)
Author:
scribu
Message:

Add inline documentation for ms-blogs.php. See #14953

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/ms-blogs.php

    r15482 r15676  
    66 * @package WordPress
    77 * @subpackage Multisite
    8  * @since 3.0.0
    9  */
    10 
    11 // @todo use update_blog_details
     8 * @since MU
     9 */
     10
     11/**
     12 * Update the last_updated field for the current blog.
     13 *
     14 * @since MU
     15 */
    1216function wpmu_update_blogs_date() {
    1317    global $wpdb;
    1418
     19    // TODO: use update_blog_details
     20
    1521    $wpdb->update( $wpdb->blogs, array('last_updated' => current_time('mysql', true)), array('blog_id' => $wpdb->blogid) );
    1622    refresh_blog_details( $wpdb->blogid );
     
    1925}
    2026
     27/**
     28 * Get a full blog URL, given a blog id.
     29 *
     30 * @since MU
     31 *
     32 * @param int $blog_id Blog ID
     33 * @return string
     34 */
    2135function get_blogaddress_by_id( $blog_id ) {
    2236    $bloginfo = get_blog_details( (int) $blog_id, false ); // only get bare details!
     
    2438}
    2539
     40/**
     41 * Get a full blog URL, given a blog name.
     42 *
     43 * @since MU
     44 *
     45 * @param string $blogname The (subdomain or directory) name
     46 * @return string
     47 */
    2648function get_blogaddress_by_name( $blogname ) {
    2749    global $current_site;
     
    3961}
    4062
    41 function get_blogaddress_by_domain( $domain, $path ){
     63/**
     64 * Get a full blog URL, given a domain and a path.
     65 *
     66 * @since MU
     67 *
     68 * @param string $domain
     69 * @param string $path
     70 * @return string
     71 */
     72function get_blogaddress_by_domain( $domain, $path ) {
    4273    if ( is_subdomain_install() ) {
    4374        $url = "http://".$domain.$path;
     
    5687}
    5788
     89/**
     90 * Given a blog's (subdomain or directory) name, retrieve it's id.
     91 *
     92 * @since MU
     93 *
     94 * @param string $name
     95 * @return int A blog id
     96 */
    5897function get_id_from_blogname( $name ) {
    5998    global $wpdb, $current_site;
     
    77116 * Retrieve the details for a blog from the blogs table and blog options.
    78117 *
    79  * @since 3.0.0
     118 * @since MU
     119 *
    80120 * @param int|string|array $fields A blog ID, a blog name, or an array of fields to query against.
    81121 * @param bool $get_all Whether to retrieve all details or only the details in the blogs table. Default is true.
     
    203243 * Clear the blog details cache.
    204244 *
    205  * @since 3.0.0
     245 * @since MU
    206246 *
    207247 * @param int $blog_id Blog ID
     
    221261 * Update the details for a blog. Updates the blogs table for a given blog id.
    222262 *
    223  * @since 3.0.0
     263 * @since MU
    224264 *
    225265 * @param int $blog_id Blog ID
     
    281321 * The 'option_$option' filter in get_option() is not called.
    282322 *
    283  * @since NA
    284  * @package WordPress MU
    285  * @subpackage Option
     323 * @since MU
    286324 * @uses apply_filters() Calls 'blog_option_$optionname' with the option name value.
    287325 *
    288326 * @param int $blog_id is the id of the blog.
    289  * @param string $setting Name of option to retrieve. Should already be SQL-escaped
     327 * @param string $setting Name of option to retrieve. Should already be SQL-escaped.
    290328 * @param string $default (optional) Default value returned if option not found.
    291329 * @return mixed Value set for the option.
     
    341379}
    342380
     381/**
     382 * Add an option for a particular blog.
     383 *
     384 * @since MU
     385 *
     386 * @param int $id The blog id
     387 * @param string $key The option key
     388 * @param mixed $value The option value
     389 */
    343390function add_blog_option( $id, $key, $value ) {
    344391    $id = (int) $id;
     
    350397}
    351398
     399/**
     400 * Delete an option for a particular blog.
     401 *
     402 * @since MU
     403 *
     404 * @param int $id The blog id
     405 * @param string $key The option key
     406 */
    352407function delete_blog_option( $id, $key ) {
    353408    $id = (int) $id;
     
    359414}
    360415
     416/**
     417 * Update an option for a particular blog.
     418 *
     419 * @since MU
     420 *
     421 * @param int $id The blog id
     422 * @param string $key The option key
     423 * @param mixed $value The option value
     424 * @param bool $refresh Wether to refresh blog details or not
     425 */
    361426function update_blog_option( $id, $key, $value, $refresh = true ) {
    362427    $id = (int) $id;
     
    371436}
    372437
     438/**
     439 * Switch the current blog.
     440 *
     441 * This function is useful if you need to pull posts, or other information,
     442 * from other blogs. You can switch back afterwards using restore_current_blog().
     443 *
     444 * Things that aren't switched:
     445 *  - autoloaded options. See #14992
     446 *  - plugins. See #14941
     447 *
     448 * @see restore_current_blog()
     449 * @since MU
     450 *
     451 * @param int $new_blog The id of the blog you want to switch to. Default: current blog
     452 * @param bool $validate Wether to check if $new_blog exists before proceeding
     453 * @return bool True on success, False if the validation failed
     454 */
    373455function switch_to_blog( $new_blog, $validate = false ) {
    374456    global $wpdb, $table_prefix, $blog_id, $switched, $switched_stack, $wp_roles, $wp_object_cache;
     
    433515}
    434516
     517/**
     518 * Restore the current blog, after calling switch_to_blog()
     519 *
     520 * @see switch_to_blog()
     521 * @since MU
     522 *
     523 * @return bool True on success, False if we're already on the current blog
     524 */
    435525function restore_current_blog() {
    436526    global $table_prefix, $wpdb, $blog_id, $switched, $switched_stack, $wp_roles, $wp_object_cache;
     
    491581}
    492582
     583/**
     584 * Check if a particular blog is archived.
     585 *
     586 * @since MU
     587 *
     588 * @param int $id The blog id
     589 * @return string Wether the blog is archived or not
     590 */
    493591function is_archived( $id ) {
    494592    return get_blog_status($id, 'archived');
    495593}
    496594
     595/**
     596 * Update the 'archived' status of a particular blog.
     597 *
     598 * @since MU
     599 *
     600 * @param int $id The blog id
     601 * @param string $archived The new status
     602 * @return string $archived
     603 */
    497604function update_archived( $id, $archived ) {
    498605    update_blog_status($id, 'archived', $archived);
     
    503610 * Update a blog details field.
    504611 *
    505  * @since 3.0.0
     612 * @since MU
    506613 *
    507614 * @param int $blog_id BLog ID
     
    509616 * @param string $value Value for $pref
    510617 * @param bool $refresh Whether to refresh the blog details cache. Default is true.
     618 * @return string $value
    511619 */
    512620function update_blog_status( $blog_id, $pref, $value, $refresh = true ) {
     
    531639}
    532640
     641/**
     642 * Get a blog details field.
     643 *
     644 * @since MU
     645 *
     646 * @param int $id The blog id
     647 * @param string $pref A field name
     648 * @return bool $value
     649 */
    533650function get_blog_status( $id, $pref ) {
    534651    global $wpdb;
     
    541658}
    542659
     660/**
     661 * Get a list of most recently updated blogs.
     662 *
     663 * @since MU
     664 *
     665 * @param $deprecated Not used
     666 * @param int $start The offset
     667 * @param int $quantity The maximum number of blogs to retrieve. Default is 40.
     668 * @return array The list of blogs
     669 */
    543670function get_last_updated( $deprecated = '', $start = 0, $quantity = 40 ) {
    544671    global $wpdb;
Note: See TracChangeset for help on using the changeset viewer.