Jetpack_Options::get_option_and_ensure_autoload PHP Method

get_option_and_ensure_autoload() public static method

This does _not_ adjust the prefix in any way (does not prefix jetpack_%)
public static get_option_and_ensure_autoload ( string $name, mixed $default ) : mixed | void
$name string Option name
$default mixed (optional)
return mixed | void
    public static function get_option_and_ensure_autoload($name, $default)
    {
        $value = get_option($name);
        if ($value === false && $default !== false) {
            update_option($name, $default);
            $value = $default;
        }
        return $value;
    }

Usage Example

示例#1
0
function jetpack_check_mobile()
{
    if (defined('XMLRPC_REQUEST') && XMLRPC_REQUEST || defined('APP_REQUEST') && APP_REQUEST) {
        return false;
    }
    if (!isset($_SERVER["HTTP_USER_AGENT"]) || isset($_COOKIE['akm_mobile']) && $_COOKIE['akm_mobile'] == 'false') {
        return false;
    }
    if (jetpack_mobile_exclude()) {
        return false;
    }
    if (1 == Jetpack_Options::get_option_and_ensure_autoload('wp_mobile_disable', '0')) {
        return false;
    }
    if (isset($_COOKIE['akm_mobile']) && $_COOKIE['akm_mobile'] == 'true') {
        return true;
    }
    $is_mobile = jetpack_is_mobile();
    /**
     * Filter the Mobile check results.
     *
     * @module minileven
     *
     * @since 1.8.0
     *
     * @param bool $is_mobile Is the reader on a mobile device.
     */
    return apply_filters('jetpack_check_mobile', $is_mobile);
}
All Usage Examples Of Jetpack_Options::get_option_and_ensure_autoload