mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
Docs: Promote many bool types to true or false where only that value is used.
See #51800 git-svn-id: https://develop.svn.wordpress.org/trunk@49927 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -29,7 +29,7 @@ class WP_Community_Events {
|
||||
*
|
||||
* @since 4.8.0
|
||||
*
|
||||
* @var bool|array
|
||||
* @var false|array
|
||||
*/
|
||||
protected $user_location = false;
|
||||
|
||||
@@ -306,7 +306,7 @@ class WP_Community_Events {
|
||||
* @since 4.8.0
|
||||
*
|
||||
* @param array $location Should contain 'latitude' and 'longitude' indexes.
|
||||
* @return bool|string false on failure, or a string on success.
|
||||
* @return false|string false on failure, or a string on success.
|
||||
*/
|
||||
protected function get_events_transient_key( $location ) {
|
||||
$key = false;
|
||||
@@ -325,8 +325,8 @@ class WP_Community_Events {
|
||||
*
|
||||
* @since 4.8.0
|
||||
*
|
||||
* @param array $events Response body from the API request.
|
||||
* @param int|bool $expiration Optional. Amount of time to cache the events. Defaults to false.
|
||||
* @param array $events Response body from the API request.
|
||||
* @param int|false $expiration Optional. Amount of time to cache the events. Defaults to false.
|
||||
* @return bool true if events were cached; false if not.
|
||||
*/
|
||||
protected function cache_events( $events, $expiration = false ) {
|
||||
|
||||
@@ -128,7 +128,7 @@ class WP_Site_Health_Auto_Updates {
|
||||
*
|
||||
* @since 5.3.0
|
||||
*
|
||||
* @return array|bool The test results. False if auto-updates are enabled.
|
||||
* @return array|false The test results. False if auto-updates are enabled.
|
||||
*/
|
||||
public function test_wp_automatic_updates_disabled() {
|
||||
if ( ! class_exists( 'WP_Automatic_Updater' ) ) {
|
||||
@@ -152,7 +152,7 @@ class WP_Site_Health_Auto_Updates {
|
||||
*
|
||||
* @since 5.2.0
|
||||
*
|
||||
* @return array|bool The test results. False if the auto-updates failed.
|
||||
* @return array|false The test results. False if the auto-updates failed.
|
||||
*/
|
||||
function test_if_failed_update() {
|
||||
$failed = get_site_option( 'auto_core_update_failed' );
|
||||
@@ -302,7 +302,7 @@ class WP_Site_Health_Auto_Updates {
|
||||
*
|
||||
* @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass.
|
||||
*
|
||||
* @return array|bool The test results. False if they're not writeable.
|
||||
* @return array|false The test results. False if they're not writeable.
|
||||
*/
|
||||
function test_all_files_writable() {
|
||||
global $wp_filesystem;
|
||||
@@ -387,7 +387,7 @@ class WP_Site_Health_Auto_Updates {
|
||||
*
|
||||
* @since 5.2.0
|
||||
*
|
||||
* @return array|bool The test results. False if it isn't a development version.
|
||||
* @return array|false The test results. False if it isn't a development version.
|
||||
*/
|
||||
function test_accepts_dev_updates() {
|
||||
require ABSPATH . WPINC . '/version.php'; // $wp_version; // x.y.z
|
||||
|
||||
@@ -1680,7 +1680,7 @@ function dashboard_browser_nag_class( $classes ) {
|
||||
*
|
||||
* @since 3.2.0
|
||||
*
|
||||
* @return array|bool Array of browser data on success, false on failure.
|
||||
* @return array|false Array of browser data on success, false on failure.
|
||||
*/
|
||||
function wp_check_browser_version() {
|
||||
if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) {
|
||||
|
||||
@@ -247,7 +247,7 @@ function get_author_user_ids() {
|
||||
* @global wpdb $wpdb WordPress database abstraction object.
|
||||
*
|
||||
* @param int $user_id User ID.
|
||||
* @return array|bool List of editable authors. False if no editable users.
|
||||
* @return array|false List of editable authors. False if no editable users.
|
||||
*/
|
||||
function get_editable_authors( $user_id ) {
|
||||
_deprecated_function( __FUNCTION__, '3.1.0', 'get_users()' );
|
||||
|
||||
@@ -130,7 +130,7 @@ function get_home_path() {
|
||||
* @param string $folder Optional. Full path to folder. Default empty.
|
||||
* @param int $levels Optional. Levels of folders to follow, Default 100 (PHP Loop limit).
|
||||
* @param string[] $exclusions Optional. List of folders and files to skip.
|
||||
* @return bool|string[] False on failure, else array of files.
|
||||
* @return false|string[] False on failure, else array of files.
|
||||
*/
|
||||
function list_files( $folder = '', $levels = 100, $exclusions = array() ) {
|
||||
if ( empty( $folder ) ) {
|
||||
@@ -998,11 +998,11 @@ function _wp_handle_upload( &$file, $overrides, $time, $action ) {
|
||||
*
|
||||
* @see _wp_handle_upload()
|
||||
*
|
||||
* @param array $file Reference to a single element of `$_FILES`.
|
||||
* Call the function once for each uploaded file.
|
||||
* @param array|bool $overrides Optional. An associative array of names => values
|
||||
* to override default variables. Default false.
|
||||
* @param string $time Optional. Time formatted in 'yyyy/mm'. Default null.
|
||||
* @param array $file Reference to a single element of `$_FILES`.
|
||||
* Call the function once for each uploaded file.
|
||||
* @param array|false $overrides Optional. An associative array of names => values
|
||||
* to override default variables. Default false.
|
||||
* @param string $time Optional. Time formatted in 'yyyy/mm'. Default null.
|
||||
* @return array On success, returns an associative array of file attributes.
|
||||
* On failure, returns `$overrides['upload_error_handler']( &$file, $message )`
|
||||
* or `array( 'error' => $message )`.
|
||||
@@ -1029,11 +1029,11 @@ function wp_handle_upload( &$file, $overrides = false, $time = null ) {
|
||||
*
|
||||
* @see _wp_handle_upload()
|
||||
*
|
||||
* @param array $file Reference to a single element of `$_FILES`.
|
||||
* Call the function once for each uploaded file.
|
||||
* @param array|bool $overrides Optional. An associative array of names => values
|
||||
* to override default variables. Default false.
|
||||
* @param string $time Optional. Time formatted in 'yyyy/mm'. Default null.
|
||||
* @param array $file Reference to a single element of `$_FILES`.
|
||||
* Call the function once for each uploaded file.
|
||||
* @param array|false $overrides Optional. An associative array of names => values
|
||||
* to override default variables. Default false.
|
||||
* @param string $time Optional. Time formatted in 'yyyy/mm'. Default null.
|
||||
* @return array On success, returns an associative array of file attributes.
|
||||
* On failure, returns `$overrides['upload_error_handler']( &$file, $message )`
|
||||
* or `array( 'error' => $message )`.
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
*
|
||||
* @since 2.9.0
|
||||
*
|
||||
* @param int $post_id Attachment post ID.
|
||||
* @param bool|object $msg Optional. Message to display for image editor updates or errors.
|
||||
* Default false.
|
||||
* @param int $post_id Attachment post ID.
|
||||
* @param false|object $msg Optional. Message to display for image editor updates or errors.
|
||||
* Default false.
|
||||
*/
|
||||
function wp_image_editor( $post_id, $msg = false ) {
|
||||
$nonce = wp_create_nonce( "image_editor-$post_id" );
|
||||
|
||||
@@ -680,7 +680,7 @@ function wp_exif_date2ts( $str ) {
|
||||
* @since 2.5.0
|
||||
*
|
||||
* @param string $file
|
||||
* @return bool|array False on failure. Image metadata array on success.
|
||||
* @return false|array False on failure. Image metadata array on success.
|
||||
*/
|
||||
function wp_read_image_metadata( $file ) {
|
||||
if ( ! file_exists( $file ) ) {
|
||||
@@ -1027,7 +1027,7 @@ function _load_image_to_edit_path( $attachment_id, $size = 'full' ) {
|
||||
*
|
||||
* @since 2.9.0
|
||||
*
|
||||
* @param string|bool $filepath File path or URL to current image, or false.
|
||||
* @param string|false $filepath File path or URL to current image, or false.
|
||||
* @param int $attachment_id Attachment ID.
|
||||
* @param string|int[] $size Requested image size. Can be any registered image size name, or
|
||||
* an array of width and height values in pixels (in that order).
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
*
|
||||
* @param string $class The type of the list table, which is the class name.
|
||||
* @param array $args Optional. Arguments to pass to the class. Accepts 'screen'.
|
||||
* @return WP_List_Table|bool List table object on success, false if the class does not exist.
|
||||
* @return WP_List_Table|false List table object on success, false if the class does not exist.
|
||||
*/
|
||||
function _get_list_table( $class, $args = array() ) {
|
||||
$core_classes = array(
|
||||
|
||||
@@ -3526,7 +3526,7 @@ function wp_add_id3_tag_data( &$metadata, $data ) {
|
||||
* @since 3.6.0
|
||||
*
|
||||
* @param string $file Path to file.
|
||||
* @return array|bool Returns array of metadata, if found.
|
||||
* @return array|false Returns array of metadata, if found.
|
||||
*/
|
||||
function wp_read_video_metadata( $file ) {
|
||||
if ( ! file_exists( $file ) ) {
|
||||
@@ -3637,7 +3637,7 @@ function wp_read_video_metadata( $file ) {
|
||||
* @since 3.6.0
|
||||
*
|
||||
* @param string $file Path to file.
|
||||
* @return array|bool Returns array of metadata, if found.
|
||||
* @return array|false Returns array of metadata, if found.
|
||||
*/
|
||||
function wp_read_audio_metadata( $file ) {
|
||||
if ( ! file_exists( $file ) ) {
|
||||
@@ -3706,8 +3706,8 @@ function wp_read_audio_metadata( $file ) {
|
||||
* @link https://github.com/JamesHeinrich/getID3/blob/master/structure.txt
|
||||
*
|
||||
* @param array $metadata The metadata returned by getID3::analyze().
|
||||
* @return int|bool A UNIX timestamp for the media's creation date if available
|
||||
* or a boolean FALSE if a timestamp could not be determined.
|
||||
* @return int|false A UNIX timestamp for the media's creation date if available
|
||||
* or a boolean FALSE if a timestamp could not be determined.
|
||||
*/
|
||||
function wp_get_media_creation_timestamp( $metadata ) {
|
||||
$creation_date = false;
|
||||
|
||||
@@ -311,7 +311,7 @@ function upload_space_setting( $id ) {
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param int $id The user ID.
|
||||
* @return bool|int The ID of the refreshed user or false if the user does not exist.
|
||||
* @return false|int The ID of the refreshed user or false if the user does not exist.
|
||||
*/
|
||||
function refresh_user_details( $id ) {
|
||||
$id = (int) $id;
|
||||
|
||||
@@ -1763,7 +1763,7 @@ function add_comments_page( $page_title, $menu_title, $capability, $menu_slug, $
|
||||
* @global array $menu
|
||||
*
|
||||
* @param string $menu_slug The slug of the menu.
|
||||
* @return array|bool The removed menu on success, false if not found.
|
||||
* @return array|false The removed menu on success, false if not found.
|
||||
*/
|
||||
function remove_menu_page( $menu_slug ) {
|
||||
global $menu;
|
||||
@@ -1787,7 +1787,7 @@ function remove_menu_page( $menu_slug ) {
|
||||
*
|
||||
* @param string $menu_slug The slug for the parent menu.
|
||||
* @param string $submenu_slug The slug of the submenu.
|
||||
* @return array|bool The removed submenu on success, false if not found.
|
||||
* @return array|false The removed submenu on success, false if not found.
|
||||
*/
|
||||
function remove_submenu_page( $menu_slug, $submenu_slug ) {
|
||||
global $submenu;
|
||||
|
||||
@@ -1115,7 +1115,7 @@ function get_available_post_statuses( $type = 'post' ) {
|
||||
*
|
||||
* @since 2.5.0
|
||||
*
|
||||
* @param array|bool $q Array of query variables to use to build the query or false to use $_GET superglobal.
|
||||
* @param array|false $q Array of query variables to use to build the query or false to use $_GET superglobal.
|
||||
* @return array
|
||||
*/
|
||||
function wp_edit_posts_query( $q = false ) {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* @access private
|
||||
*
|
||||
* @param int $request_id Request ID.
|
||||
* @return bool|WP_Error Returns true if sending the email was successful, or a WP_Error object.
|
||||
* @return true|WP_Error Returns true if sending the email was successful, or a WP_Error object.
|
||||
*/
|
||||
function _wp_privacy_resend_request( $request_id ) {
|
||||
$request_id = absint( $request_id );
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* @param WP_Post|int $post The post object or post ID.
|
||||
* @param int $compare_from The revision ID to compare from.
|
||||
* @param int $compare_to The revision ID to come to.
|
||||
* @return array|bool Associative array of a post's revisioned fields and their diffs.
|
||||
* @return array|false Associative array of a post's revisioned fields and their diffs.
|
||||
* Or, false on failure.
|
||||
*/
|
||||
function wp_get_revision_ui_diff( $post, $compare_from, $compare_to ) {
|
||||
|
||||
@@ -183,7 +183,7 @@ function wp_insert_category( $catarr, $wp_error = false ) {
|
||||
* @since 2.0.0
|
||||
*
|
||||
* @param array $catarr The 'cat_ID' value is required. All other keys are optional.
|
||||
* @return int|bool The ID number of the new or updated Category on success. Zero or FALSE on failure.
|
||||
* @return int|false The ID number of the new or updated Category on success. Zero or FALSE on failure.
|
||||
*/
|
||||
function wp_update_category( $catarr ) {
|
||||
$cat_ID = (int) $catarr['cat_ID'];
|
||||
@@ -240,7 +240,7 @@ function wp_create_tag( $tag_name ) {
|
||||
*
|
||||
* @param int $post_id
|
||||
* @param string $taxonomy Optional. The taxonomy for which to retrieve terms. Default 'post_tag'.
|
||||
* @return string|bool|WP_Error
|
||||
* @return string|false|WP_Error
|
||||
*/
|
||||
function get_tags_to_edit( $post_id, $taxonomy = 'post_tag' ) {
|
||||
return get_terms_to_edit( $post_id, $taxonomy );
|
||||
@@ -253,7 +253,7 @@ function get_tags_to_edit( $post_id, $taxonomy = 'post_tag' ) {
|
||||
*
|
||||
* @param int $post_id
|
||||
* @param string $taxonomy Optional. The taxonomy for which to retrieve terms. Default 'post_tag'.
|
||||
* @return string|bool|WP_Error
|
||||
* @return string|false|WP_Error
|
||||
*/
|
||||
function get_terms_to_edit( $post_id, $taxonomy = 'post_tag' ) {
|
||||
$post_id = (int) $post_id;
|
||||
|
||||
@@ -206,8 +206,8 @@ function wp_install_language_form( $languages ) {
|
||||
* @see wp_get_available_translations()
|
||||
*
|
||||
* @param string $download Language code to download.
|
||||
* @return string|bool Returns the language code if successfully downloaded
|
||||
* (or already installed), or false on failure.
|
||||
* @return string|false Returns the language code if successfully downloaded
|
||||
* (or already installed), or false on failure.
|
||||
*/
|
||||
function wp_download_language_pack( $download ) {
|
||||
// Check if the translation is already installed.
|
||||
|
||||
@@ -280,7 +280,7 @@ function get_editable_roles() {
|
||||
* @since 2.0.5
|
||||
*
|
||||
* @param int $user_id User ID.
|
||||
* @return WP_User|bool WP_User object on success, false on failure.
|
||||
* @return WP_User|false WP_User object on success, false on failure.
|
||||
*/
|
||||
function get_user_to_edit( $user_id ) {
|
||||
$user = get_userdata( $user_id );
|
||||
|
||||
Reference in New Issue
Block a user