_device_can_upload

The timeline below displays how wordpress function _device_can_upload has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.3

/**
 * Tests if the current device has the capability to upload files.
 *
 * @since 3.4.0
 * @access private
 *
 * @return bool Whether the device is able to upload files.
 */
function _device_can_upload()
{
    if (!wp_is_mobile()) {
        return true;
    }
    $ua = $_SERVER['HTTP_USER_AGENT'];
    if (str_contains($ua, 'iPhone') || str_contains($ua, 'iPad') || str_contains($ua, 'iPod')) {
        return preg_match('#OS ([\d_]+) like Mac OS X#', $ua, $version) && version_compare($version[1], '6', '>=');
    }
    return true;
}

WordPress Version: 6.1

/**
 * Tests if the current device has the capability to upload files.
 *
 * @since 3.4.0
 * @access private
 *
 * @return bool Whether the device is able to upload files.
 */
function _device_can_upload()
{
    if (!wp_is_mobile()) {
        return true;
    }
    $ua = $_SERVER['HTTP_USER_AGENT'];
    if (strpos($ua, 'iPhone') !== false || strpos($ua, 'iPad') !== false || strpos($ua, 'iPod') !== false) {
        return preg_match('#OS ([\d_]+) like Mac OS X#', $ua, $version) && version_compare($version[1], '6', '>=');
    }
    return true;
}

WordPress Version: 4.3

/**
 * Test if the current device has the capability to upload files.
 *
 * @since 3.4.0
 * @access private
 *
 * @return bool Whether the device is able to upload files.
 */
function _device_can_upload()
{
    if (!wp_is_mobile()) {
        return true;
    }
    $ua = $_SERVER['HTTP_USER_AGENT'];
    if (strpos($ua, 'iPhone') !== false || strpos($ua, 'iPad') !== false || strpos($ua, 'iPod') !== false) {
        return preg_match('#OS ([\d_]+) like Mac OS X#', $ua, $version) && version_compare($version[1], '6', '>=');
    }
    return true;
}

WordPress Version: 4.0

/**
 * Test if the current device has the capability to upload files.
 *
 * @since 3.4.0
 * @access private
 *
 * @return bool true|false Whether the device is able to upload files.
 */
function _device_can_upload()
{
    if (!wp_is_mobile()) {
        return true;
    }
    $ua = $_SERVER['HTTP_USER_AGENT'];
    if (strpos($ua, 'iPhone') !== false || strpos($ua, 'iPad') !== false || strpos($ua, 'iPod') !== false) {
        return preg_match('#OS ([\d_]+) like Mac OS X#', $ua, $version) && version_compare($version[1], '6', '>=');
    }
    return true;
}

WordPress Version: 3.7

/**
 * Test if the current device has the capability to upload files.
 *
 * @since 3.4.0
 * @access private
 *
 * @return bool true|false
 */
function _device_can_upload()
{
    if (!wp_is_mobile()) {
        return true;
    }
    $ua = $_SERVER['HTTP_USER_AGENT'];
    if (strpos($ua, 'iPhone') !== false || strpos($ua, 'iPad') !== false || strpos($ua, 'iPod') !== false) {
        return preg_match('#OS ([\d_]+) like Mac OS X#', $ua, $version) && version_compare($version[1], '6', '>=');
    }
    return true;
}