[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/src/bp-core/ -> bp-core-wpabstraction.php (summary)

WordPress Abstraction. The functions within this file will detect the version of WordPress you are running and will alter the environment so BuddyPress can run regardless.

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

Defines 21 functions

  bp_get_major_wp_version()
  get_blog_option()
  add_blog_option()
  update_blog_option()
  delete_blog_option()
  switch_to_blog()
  restore_current_blog()
  get_blogs_of_user()
  update_blog_status()
  is_subdomain_install()
  bp_core_get_status_sql()
  mb_strlen()
  mb_strpos()
  mb_strrpos()
  bp_insert_site_hook()
  bp_catch_site_data()
  bp_insert_site()
  bp_delete_site_hook()
  bp_delete_site_no_tables_drop()
  bp_delete_site()
  wp_parse_list()

Functions
Functions that are not part of a class:

bp_get_major_wp_version()   X-Ref
Parse the WordPress core version number into the major release.

since: 1.5.2
return: double $wp_version

get_blog_option( $blog_id, $option_name, $default = false )   X-Ref
Retrieve blog option.

since: 1.0.0
return: mixed
param: int    $blog_id     Blog ID to fetch for. Not used.
param: string $option_name Option name to fetch.
param: bool   $default     Whether or not default.

add_blog_option( $blog_id, $option_name, $option_value )   X-Ref
Add blog option.

since: 1.2.0
return: mixed
param: int    $blog_id      Blog ID to add for. Not used.
param: string $option_name  Option name to add.
param: mixed  $option_value Option value to add.

update_blog_option( $blog_id, $option_name, $value )   X-Ref
Update blog option.

since: 1.2.0
return: mixed
param: int    $blog_id     Blog ID to update for. Not used.
param: string $option_name Option name to update.
param: mixed  $value       Option value to update.

delete_blog_option( $blog_id, $option_name )   X-Ref
Delete blog option.

since: 1.5.0
return: mixed
param: int    $blog_id     Blog ID to delete for. Not used.
param: string $option_name Option name to delete.

switch_to_blog( $new_blog, $deprecated = null )   X-Ref
Switch to specified blog.

since: 1.2.0
return: int
param: mixed $new_blog   New blog to switch to. Not used.
param: null  $deprecated Whether or not deprecated. Not used.

restore_current_blog()   X-Ref
Restore current blog.

since: 1.2.0
return: int

get_blogs_of_user( $user_id, $all = false )   X-Ref
Retrive blogs associated with user.

since: 1.2.0
return: bool
param: int  $user_id ID of the user. Not used.
param: bool $all     Whether or not to return all. Not used.

update_blog_status( $blog_id, $pref, $value, $deprecated = null )   X-Ref
Whether or not to update blog status.

since: 1.2.0
return: bool
param: int    $blog_id    Blog to update status for. Not used.
param: mixed  $pref       Preference. Not used.
param: string $value      Value. Not used.
param: null   $deprecated Whether or not deprecated. Not used.

is_subdomain_install()   X-Ref
Whether or not if subdomain install.

since: 1.2.5.1
return: bool

bp_core_get_status_sql( $prefix = false )   X-Ref
Get SQL chunk for filtering spam users from member queries.

return: string SQL chunk.
param: string|bool $prefix Global table prefix.

mb_strlen( $str, $enc = '' )   X-Ref
Fallback implementation of mb_strlen(), hardcoded to UTF-8.

return: int String length.
param: string $str String to be measured.
param: string $enc Optional. Encoding type. Ignored.

mb_strpos( $haystack, $needle, $offset = 0, $encoding = '' )   X-Ref
Fallback implementation of mb_strpos(), hardcoded to UTF-8.

return: int|false Position of needle in haystack if found, else false.
param: string $haystack String to search in.
param: string $needle String to search for.
param: int    $offset Optional. Start position for the search. Default: 0.
param: string $encoding Optional. Encoding type. Ignored.

mb_strrpos( $haystack, $needle, $offset = 0, $encoding = '' )   X-Ref
Fallback implementation of mb_strrpos(), hardcoded to UTF-8.

return: string|false Position of last needle in haystack if found, else false.
param: string $haystack String to search in.
param: string $needle String to search for.
param: int    $offset Optional. Start position for the search. Default: 0.
param: string $encoding Optional. Encoding type. Ignored.

bp_insert_site_hook()   X-Ref
Returns the name of the hook to use once a WordPress Site is inserted into the Database.

WordPress 5.1.0 deprecated the `wpmu_new_blog` action. As BuddyPress is supporting WordPress back
to 4.9.0, this function makes sure we are using the new hook `wp_initialize_site` when the current
WordPress version is upper or equal to 5.1.0 and that we keep on using `wpmu_new_blog` for earlier
versions of WordPress.

since: 6.0.0
return: string The name of the hook to use.

bp_catch_site_data( $errors = null, $data = array()   X-Ref
Catch the new site data for a later use.

since: 6.0.0

bp_insert_site( $site, $args_or_user_id = null, $domain = '', $path = '', $network_id = 0, $meta = array()   X-Ref
Fires a BuddyPress hook when a new WordPress site is inserted into the database.

This hook makes sure BuddyPress is back compatible with WordPress versions < 5.1.0.

since: 6.0.0
param: int|WP_Site $site            The Site ID or the WP Site object.
param: int|array   $args_or_user_id An array of Site arguments or the User ID.
param: string      $domain          Site domain.
param: string      $path            Site path.
param: int         $network_id      Network ID. Only relevant on multi-network installations.
param: array       $meta            Meta data. Used to set initial site options.

bp_delete_site_hook()   X-Ref
Returns the name of the hook to use once a WordPress Site is deleted.

WordPress 5.1.0 deprecated the `delete_blog` action. As BuddyPress is supporting WordPress back
to 4.9.0, this function makes sure we are using the new hook `wp_validate_site_deletion` when the
current WordPress version is upper or equal to 5.1.0 and that we keep on using `delete_blog` for
earlier versions of WordPress.

since: 6.0.0
return: string The name of the hook to use.

bp_delete_site_no_tables_drop( $site )   X-Ref
Makes sure the `bp_delete_site` hook is fired if site's deletion
was performed without dropping tables.

since: 6.0.0
param: WP_Site $site The site object.

bp_delete_site( $site_id_or_error, $drop_or_site = false )   X-Ref
Fires a BuddyPress hook when a new WordPress site is deleted.

This hook makes sure BuddyPress is back compatible with WordPress versions < 5.1.0.

since: 6.0.0
param: int|WP_Error $site_id_or_error A WP Error object or the site ID.
param: bool|WP_Site $drop_or_site     A WP Site object or a boolean to inform whether site's table should be dropped.

wp_parse_list( $list )   X-Ref
Cleans up an array, comma- or space-separated list of scalar values.

As BuddyPress supports older WordPress versions than 5.1 (4.9 & 5.0),
the BP REST API needs this function to be available.

since: 7.0.0
return: array Sanitized array of values.
param: array|string $list List of values.



Generated: Fri Sep 18 01:01:33 2020 Cross-referenced by PHPXref 0.7.1