[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-includes/ -> ms-blogs.php (summary)

Site/blog functions that work with the blogs table and related data.

File Size: 733 lines (22 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 21 functions

  wpmu_update_blogs_date()
  get_blogaddress_by_id()
  get_blogaddress_by_name()
  get_blogaddress_by_domain()
  get_id_from_blogname()
  get_blog_details()
  refresh_blog_details()
  update_blog_details()
  get_blog_option()
  add_blog_option()
  delete_blog_option()
  update_blog_option()
  switch_to_blog()
  restore_current_blog()
  is_archived()
  update_archived()
  update_blog_status()
  get_blog_status()
  get_last_updated()
  _update_blog_date_on_post_publish()
  _update_blog_date_on_post_delete()

Functions
Functions that are not part of a class:

wpmu_update_blogs_date()   X-Ref
Update the last_updated field for the current blog.


get_blogaddress_by_id( $blog_id )   X-Ref
Get a full blog URL, given a blog id.

param: int $blog_id Blog ID
return: string

get_blogaddress_by_name( $blogname )   X-Ref
Get a full blog URL, given a blog name.

param: string $blogname The (subdomain or directory) name
return: string

get_blogaddress_by_domain( $domain, $path )   X-Ref
Get a full blog URL, given a domain and a path.

param: string $domain
param: string $path
return: string

get_id_from_blogname( $name )   X-Ref
Given a blog's (subdomain or directory) name, retrieve it's id.

param: string $name
return: int A blog id

get_blog_details( $fields, $get_all = true )   X-Ref
Retrieve the details for a blog from the blogs table and blog options.

param: int|string|array $fields A blog ID, a blog name, or an array of fields to query against.
param: bool $get_all Whether to retrieve all details or only the details in the blogs table. Default is true.
return: object Blog details.

refresh_blog_details( $blog_id )   X-Ref
Clear the blog details cache.

param: int $blog_id Blog ID

update_blog_details( $blog_id, $details = array()   X-Ref
Update the details for a blog. Updates the blogs table for a given blog id.

param: int $blog_id Blog ID
param: array $details Array of details keyed by blogs table field names.
return: bool True if update succeeds, false otherwise.

get_blog_option( $blog_id, $setting, $default = false )   X-Ref
Retrieve option value based on setting name and blog_id.

If the option does not exist or does not have a value, then the return value
will be false. This is useful to check whether you need to install an option
and is commonly used during installation of plugin options and to test
whether upgrading is required.

There is a filter called 'blog_option_$option' with the $option being
replaced with the option name. The filter takes two parameters. $value and
$blog_id. It returns $value.
The 'option_$option' filter in get_option() is not called.

param: int $blog_id Optional. Blog ID, can be null to refer to the current blog.
param: string $setting Name of option to retrieve. Should already be SQL-escaped.
param: string $default (optional) Default value returned if option not found.
return: mixed Value set for the option.

add_blog_option( $id, $key, $value )   X-Ref
Add an option for a particular blog.

param: int $id The blog id
param: string $key The option key
param: mixed $value The option value
return: bool True on success, false on failure.

delete_blog_option( $id, $key )   X-Ref
Delete an option for a particular blog.

param: int $id The blog id
param: string $key The option key
return: bool True on success, false on failure.

update_blog_option( $id, $key, $value, $deprecated = null )   X-Ref
Update an option for a particular blog.

param: int $id The blog id
param: string $key The option key
param: mixed $value The option value
return: bool True on success, false on failrue.

switch_to_blog( $new_blog, $validate = false )   X-Ref
Switch the current blog.

This function is useful if you need to pull posts, or other information,
from other blogs. You can switch back afterwards using restore_current_blog().

Things that aren't switched:
- autoloaded options. See #14992
- plugins. See #14941

param: int $new_blog The id of the blog you want to switch to. Default: current blog
param: bool $validate Whether to check if $new_blog exists before proceeding
return: bool    True on success, False if the validation failed

restore_current_blog()   X-Ref
Restore the current blog, after calling switch_to_blog()

return: bool True on success, False if we're already on the current blog

is_archived( $id )   X-Ref
Check if a particular blog is archived.

param: int $id The blog id
return: string Whether the blog is archived or not

update_archived( $id, $archived )   X-Ref
Update the 'archived' status of a particular blog.

param: int $id The blog id
param: string $archived The new status
return: string $archived

update_blog_status( $blog_id, $pref, $value, $deprecated = null )   X-Ref
Update a blog details field.

param: int $blog_id BLog ID
param: string $pref A field name
param: string $value Value for $pref
return: string $value

get_blog_status( $id, $pref )   X-Ref
Get a blog details field.

param: int $id The blog id
param: string $pref A field name
return: bool $value

get_last_updated( $deprecated = '', $start = 0, $quantity = 40 )   X-Ref
Get a list of most recently updated blogs.

param: mixed $deprecated Not used
param: int $start The offset
param: int $quantity The maximum number of blogs to retrieve. Default is 40.
return: array The list of blogs

_update_blog_date_on_post_publish( $new_status, $old_status, $post )   X-Ref
Handler for updating the blog date when a post is published or an already published post is changed.

param: string $new_status The new post status
param: string $old_status The old post status
param: object $post Post object

_update_blog_date_on_post_delete( $post_id )   X-Ref
Handler for updating the blog date when a published post is deleted.

param: int $post_id Post ID



Generated: Fri May 25 03:56:23 2012 Hosted by follow the white rabbit.