function foundation_setup_meta_area()
{
    $settings = foundation_get_settings();
    echo '<link rel="manifest" href="' . site_url() . '?wptouch_app_manifest">';
    echo '<meta name="apple-mobile-web-app-title" content="' . $settings->homescreen_icon_title . '">' . "\n";
    if (foundation_webapp_mode_enabled()) {
        // We're web-app capable
        echo '<meta name="apple-mobile-web-app-capable" content="yes">' . "\n";
        echo '<meta name="mobile-web-app-capable" content="yes">' . "\n";
        if (wptouch_fdn_is_web_app_mode()) {
            echo '<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" media="(device-height: 568px)" />';
        }
        // iOS7
        if (wptouch_fdn_iOS_7() || wptouch_fdn_iOS_8()) {
            echo '<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">' . "\n";
        } else {
            echo '<meta name="apple-mobile-web-app-status-bar-style" content="black">' . "\n";
        }
        // Check for startup screens
        if (wptouch_is_device_real_ipad()) {
            // Only output iPad startup screens
            // iPad Portrait
            if ($settings->startup_screen_ipad_1_portrait) {
                echo '<link href="' . WPTOUCH_BASE_CONTENT_URL . $settings->startup_screen_ipad_1_portrait . '" media="(device-width: 768px) and (device-height: 1024px) and (orientation: portrait) and (-webkit-device-pixel-ratio: 1)" rel="apple-touch-startup-image">' . "\n";
            }
            // iPad Landscape
            if ($settings->startup_screen_ipad_1_landscape) {
                echo '<link href="' . WPTOUCH_BASE_CONTENT_URL . $settings->startup_screen_ipad_1_landscape . '" media="(device-width: 768px) and (device-height: 1024px) and (orientation: landscape) and (-webkit-device-pixel-ratio: 1)" rel="apple-touch-startup-image">' . "\n";
            }
            // iPad Retina Portrait
            if ($settings->startup_screen_ipad_3_portrait) {
                echo '<link href="' . WPTOUCH_BASE_CONTENT_URL . $settings->startup_screen_ipad_3_portrait . '" media="(device-width: 768px) and (device-height: 1024px) and (orientation: portrait) and (-webkit-device-pixel-ratio: 2)" rel="apple-touch-startup-image">' . "\n";
            }
            // iPad Retina Landscape
            if ($settings->startup_screen_ipad_3_landscape) {
                echo '<link href="' . WPTOUCH_BASE_CONTENT_URL . $settings->startup_screen_ipad_3_landscape . '" media="(device-width: 768px) and (device-height: 1024px) and (orientation: landscape) and (-webkit-device-pixel-ratio: 2)" rel="apple-touch-startup-image">' . "\n";
            }
        } else {
            // iPhone
            if ($settings->startup_screen_iphone_2g_3g) {
                echo '<link href="' . WPTOUCH_BASE_CONTENT_URL . $settings->startup_screen_iphone_2g_3g . '" media="(device-width: 320px) and (device-height: 480px) and (-webkit-device-pixel-ratio: 1)" rel="apple-touch-startup-image">' . "\n";
            }
            // iPhone Retina
            if ($settings->startup_screen_iphone_4_4s) {
                echo '<link href="' . WPTOUCH_BASE_CONTENT_URL . $settings->startup_screen_iphone_4_4s . '" media="(device-width: 320px) and (device-height: 480px) and (-webkit-device-pixel-ratio: 2)" rel="apple-touch-startup-image">' . "\n";
            }
            // iPhone 5
            if ($settings->startup_screen_iphone_5) {
                echo '<link href="' . WPTOUCH_BASE_CONTENT_URL . $settings->startup_screen_iphone_5 . '"  media="(device-width: 320px) and (device-height: 568px) and (-webkit-device-pixel-ratio: 2)" rel="apple-touch-startup-image">' . "\n";
            }
            // iPhone 6
            if ($settings->startup_screen_iphone_6) {
                echo '<link href="' . WPTOUCH_BASE_CONTENT_URL . $settings->startup_screen_iphone_6 . '"  media="(device-width: 375px) and (device-height: 667px) and (-webkit-device-pixel-ratio: 2)" rel="apple-touch-startup-image">' . "\n";
                echo '<style>html{background-image:url("' . WPTOUCH_BASE_CONTENT_URL . $settings->startup_screen_iphone_6 . '") no-repeat top left;}</style>';
            }
            // iPhone 6+
            if ($settings->startup_screen_iphone_6plus) {
                echo '<link href="' . WPTOUCH_BASE_CONTENT_URL . $settings->startup_screen_iphone_6plus . '"  media="(device-width: 414px) and (device-height: 736px) and (-webkit-device-pixel-ratio: 3)" rel="apple-touch-startup-image">' . "\n";
            }
        }
    }
}
function foundation_setup_homescreen_icons()
{
    $settings = foundation_get_settings();
    $has_icon = $settings->android_others_icon;
    if (wptouch_is_device_real_ipad()) {
        // iPad home screen icons
        foundation_maybe_output_homescreen_icon($settings->ipad_icon_retina, 152, 152, 2);
        foundation_maybe_output_homescreen_icon($settings->ipad_icon_retina, 144, 144, 2);
        foundation_maybe_output_homescreen_icon($settings->ipad_icon_retina, 57, 57, 1);
        // Default (if no icon added in admin, or icon isn't formatted correctly, and as a catch-all)
        echo '<link rel="apple-touch-icon-precomposed" href="' . WPTOUCH_DEFAULT_HOMESCREEN_ICON . '" />' . "\n";
    } else {
        // iPhone / Android home screen icons
        foundation_maybe_output_homescreen_icon($settings->iphone_icon_retina, 180, 180, 2);
        foundation_maybe_output_homescreen_icon($settings->iphone_icon_retina, 120, 120, 2);
        foundation_maybe_output_homescreen_icon($settings->iphone_icon_retina, 114, 114, 2);
        foundation_maybe_output_homescreen_icon($settings->android_others_icon, 57, 57, 1);
        // Default (if no icon added in admin, or icon isn't formatted correctly, and as a catch-all)
        if (!$has_icon) {
            echo '<link rel="apple-touch-icon-precomposed" href="' . WPTOUCH_DEFAULT_HOMESCREEN_ICON . '" />' . "\n";
        }
    }
}
function foundation_setup_meta_area()
{
    $settings = foundation_get_settings();
    echo '<meta name="apple-mobile-web-app-title" content="' . $settings->homescreen_icon_title . '">' . "\n";
    if ($settings->webapp_mode_enabled) {
        // We're web-app capable
        echo '<meta name="apple-mobile-web-app-capable" content="yes">' . "\n";
        // iOS7
        if (wptouch_fdn_iOS_7()) {
            echo '<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">' . "\n";
        } else {
            echo '<meta name="apple-mobile-web-app-status-bar-style" content="black">' . "\n";
        }
        // Check for startup screens
        if (wptouch_is_device_real_ipad()) {
            // Only output iPad startup screens
            // iPad Portrait
            if ($settings->startup_screen_ipad_1_portrait) {
                echo '<link href="' . WPTOUCH_BASE_CONTENT_URL . $settings->startup_screen_ipad_1_portrait . '" media="(device-width: 768px) and (device-height: 1024px) and (orientation: portrait) and (-webkit-device-pixel-ratio: 1)" rel="apple-touch-startup-image">' . "\n";
            }
            // iPad Landscape
            if ($settings->startup_screen_ipad_1_landscape) {
                echo '<link href="' . WPTOUCH_BASE_CONTENT_URL . $settings->startup_screen_ipad_1_landscape . '" media="(device-width: 768px) and (device-height: 1024px) and (orientation: landscape) and (-webkit-device-pixel-ratio: 1)" rel="apple-touch-startup-image">' . "\n";
            }
            // iPad Retina Portrait
            if ($settings->startup_screen_ipad_3_portrait) {
                echo '<link href="' . WPTOUCH_BASE_CONTENT_URL . $settings->startup_screen_ipad_3_portrait . '" media="(device-width: 768px) and (device-height: 1024px) and (orientation: portrait) and (-webkit-device-pixel-ratio: 2)" rel="apple-touch-startup-image">' . "\n";
            }
            // iPad Retina Landscape
            if ($settings->startup_screen_ipad_3_landscape) {
                echo '<link href="' . WPTOUCH_BASE_CONTENT_URL . $settings->startup_screen_ipad_3_landscape . '" media="(device-width: 768px) and (device-height: 1024px) and (orientation: landscape) and (-webkit-device-pixel-ratio: 2)" rel="apple-touch-startup-image">' . "\n";
            }
        } else {
            // iPhone
            if ($settings->startup_screen_iphone_2g_3g) {
                echo '<link href="' . WPTOUCH_BASE_CONTENT_URL . $settings->startup_screen_iphone_2g_3g . '" media="(device-width: 320px) and (device-height: 480px) and (-webkit-device-pixel-ratio: 1)" rel="apple-touch-startup-image">' . "\n";
            }
            // iPhone Retina
            if ($settings->startup_screen_iphone_4_4s) {
                echo '<link href="' . WPTOUCH_BASE_CONTENT_URL . $settings->startup_screen_iphone_4_4s . '" media="(device-width: 320px) and (device-height: 480px) and (-webkit-device-pixel-ratio: 2)" rel="apple-touch-startup-image">' . "\n";
            }
            // iPhone 5
            if ($settings->startup_screen_iphone_5) {
                echo '<link href="' . WPTOUCH_BASE_CONTENT_URL . $settings->startup_screen_iphone_5 . '"  media="(device-width: 320px) and (device-height: 568px) and (-webkit-device-pixel-ratio: 2)" rel="apple-touch-startup-image">' . "\n";
            }
        }
    }
}