示例#1
0
function weaverii_use_mobile($type = 'any')
{
    // Do we use mobile features?
    // Need the $skip_sim to avoid recursion on weaverii_getopt
    global $weaverii_mobile;
    if (!weaverii_in_mobile_view()) {
        return false;
    }
    // user set cookie to use full view
    if (!$weaverii_mobile) {
        return false;
    }
    switch (apply_filters('weaverii_use_mobile', $type)) {
        case 'mobile':
            return $weaverii_mobile['type'] == 'mobile' || $weaverii_mobile['type'] == 'touch' || $weaverii_mobile['type'] == 'smalltablet';
        case 'smalltablet':
            return $weaverii_mobile['type'] == 'smalltablet';
        case 'phone':
            return $weaverii_mobile['type'] == 'mobile' || $weaverii_mobile['type'] == 'touch';
        case 'touch':
            return $weaverii_mobile['type'] == 'touch';
        case 'tablet':
            return $weaverii_mobile['type'] == 'tablet';
        case 'any':
            return true;
        default:
            return false;
    }
    return false;
}
示例#2
0
function weaverii_enqueue_scripts()
{
    // action definition
    // need to know the page template for some conditional script inclusion
    global $weaverii_cur_template;
    $weaverii_cur_template = is_page() ? get_page_template() : 'nonpage';
    $vers = weaverii_getopt('wii_style_version');
    if (!$vers) {
        $vers = '1';
    } else {
        $vers = sprintf("%d", $vers);
    }
    if (is_singular() && comments_open() && get_option('thread_comments')) {
        wp_enqueue_script('comment-reply');
    }
    // emit Weaver js vars - must be here, before scripts
    // generate JS values for Weaver JS Lib
    echo '<script type="text/javascript">';
    echo 'var weaverIsMobile=' . (weaverii_use_mobile('mobile') ? 'true;' : 'false;');
    echo 'var weaverIsSimMobile=' . (weaverii_sim_mobile() && weaverii_in_mobile_view() && !weaverii_use_mobile('tablet') ? 'true;' : 'false;');
    echo 'var weaverIsStacked=' . (strpos(weaverii_getopt('_wii_mode_mobile'), 'nostack') === false ? 'true;' : 'false;');
    $tw = weaverii_getopt('wii_theme_width_int');
    if (!$tw) {
        $tw = 940;
    }
    echo 'var weaverThemeWidth=' . $tw . ';';
    $threshold = weaverii_getopt('wii_mobile_slide_threshold');
    $threshold = $threshold != '' ? $threshold : '640';
    echo 'var weaverMenuThreshold=' . $threshold . ';';
    echo 'var weaverHideMenuBar=' . (weaverii_getopt('wii_hide_menu_bar') ? 'true;' : 'false;');
    echo 'var weaverMobileDisabled=' . (weaverii_getopt('_wii_mobile_disable') ? 'true;' : 'false;');
    echo 'var weaverFlowToBottom=' . (weaverii_getopt_checked('wvr_flow_to_bottom') ? 'true;' : 'false;');
    echo 'var weaverHideTooltip=' . (weaverii_getopt('wii_hide_tooltip') ? 'true;' : 'false;');
    echo 'var weaverUseSuperfish=' . (weaverii_getopt('wii_use_superfish') ? 'true;' : 'false;');
    echo "</script>\n";
    //-- Weaver js lib - requires jQuery...
    wp_enqueue_script('weaverJSLib', get_template_directory_uri() . '/js/weaverjslib' . WEAVER_MINIFY . '.js', array('jquery'), WEAVERII_VERSION, true);
    // dynamic settings for menu fixer
    $default_selector = 'li:has(ul) > a';
    $default_selector_leaf = 'li li li:not(:has(ul)) > a';
    $params = array('selector' => apply_filters('weaver_menu_selector', $default_selector), 'selector_leaf' => apply_filters('weaver_menu_selector_leaf', $default_selector_leaf));
    wp_localize_script('weaverJSLib', 'weaver_menu_params', $params);
    //-- HTML Page template prettify
    if (is_page_template('paget-html.php')) {
        wp_enqueue_script('weaverPrettify', get_template_directory_uri() . '/js/theme/prettify' . WEAVER_MINIFY . '.js', array(), WEAVERII_VERSION, true);
    }
    // only for html page
    // include scripts from pro
    if (function_exists('weaverii_pro_enqueue_scripts')) {
        weaverii_pro_enqueue_scripts($vers);
    }
}
示例#3
0
?>
> <![endif]-->
<!--[if !(IE 6) | !(IE 7) | !(IE 8) ] | !(IE 9) ><!-->	<html <?php 
language_attributes();
?>
> <!--<![endif]-->
<head>
<meta charset="<?php 
bloginfo('charset');
?>
" />
<?php 
$viewport = "<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=2.0, user-scalable=yes' />\n";
// Need to see if the visitor has opened Full View on a mobile device - use viewport to get full desktop view
if (weaverii_sim_mobile() && !weaverii_in_mobile_view() || weaverii_is_mobile() && weaverii_mobile_gettype() != 'tablet') {
    if (!weaverii_in_mobile_view()) {
        $tw = weaverii_getopt('wii_theme_width_int');
        if (!$tw) {
            $tw = 940;
        }
        $viewport = "<meta name='viewport' content='width=" . $tw . "px, initial-scale=1.0, maximum-scale=1.0, user-scalable=yes' />\n";
    }
}
if (weaverii_getopt_checked('wii_theme_width_fixed') || weaverii_getopt_checked('_wii_mobile_disable')) {
    $viewport = "<!-- no viewport -->\n";
}
echo $viewport;
// comments_popup_script(400, 500);
?>
<title><?php 
// ++++++ HEAD TITLE ++++++