Example #1
0
function wpmp_switcher_option($option, $onchange = '')
{
    switch ($option) {
        case 'wpmp_switcher_mode':
            return wpmp_switcher_option_dropdown($option, array('none' => __('Disabled', 'wpmp'), 'browser' => __('Browser detection', 'wpmp'), 'domain' => __('Domain mapping', 'wpmp'), 'browserdomain' => __('BOTH: browser detection and domain mapping', 'wpmp')), $onchange);
        case 'wpmp_switcher_mobile_theme':
            return wpmp_switcher_option_themes($option);
        case 'wpmp_switcher_detection':
            $options = array('simple' => __('User-agent prefixes', 'wpmp'));
            if (function_exists('wpmp_deviceatlas_enabled') && wpmp_deviceatlas_enabled()) {
                $options['simple'] = __('SIMPLE: User-agent prefixes', 'wpmp');
                $options['deviceatlas'] = __('ADVANCED: DeviceAtlas recognition', 'wpmp');
            }
            return wpmp_switcher_option_dropdown($option, $options, $onchange);
        case 'wpmp_switcher_desktop_domains':
        case 'wpmp_switcher_mobile_domains':
            return wpmp_switcher_option_text($option, $onchange);
        case 'wpmp_switcher_footer_links':
            return wpmp_switcher_option_checkbox($option, $onchange);
    }
}
function wpmp_transcoder_max_screen_height()
{
    $default = 124;
    if (function_exists('wpmp_deviceatlas_enabled') && wpmp_deviceatlas_enabled()) {
        $height = wpmp_deviceatlas_property('usableDisplayHeight');
        if (!is_numeric($height)) {
            return $default;
        }
        if ($height < 40) {
            return 40;
        }
        if ($height > 300) {
            return 300;
        }
        return $height - 4;
    }
    return $default;
}