Пример #1
0
function foundation_base_init()
{
    wp_enqueue_script('foundation_base', foundation_get_base_module_url() . '/base/base.js', foundation_base_get_script_deps(), md5(FOUNDATION_VERSION), true);
    wp_enqueue_script('foundation__public_base', foundation_get_base_module_url() . '/base/base-public.js', foundation_base_get_script_deps(), md5(FOUNDATION_VERSION), true);
    // Only load preview script when we are in a preview window
    if (wptouch_in_preview()) {
        wp_enqueue_script('foundation-preview', foundation_get_base_module_url() . '/base/wptouch-preview.js', array('foundation_base'), md5(FOUNDATION_VERSION), true);
    }
    // Themes can add their own localization, but Foundation-aware modules can use this hook
    $foundation_strings = array('ajaxLoading' => __('Loading', 'wptouch-pro') . '…', 'isRTL' => wptouch_should_load_rtl() ? '1' : '0');
    $foundation_localized_strings = apply_filters('foundation_localized_strings', $foundation_strings);
    if (count($foundation_localized_strings)) {
        wp_localize_script('foundation_base', 'wptouchFdn', $foundation_localized_strings);
    }
}
Пример #2
0
function wptouch_get_body_classes()
{
    global $wptouch_pro;
    $body_classes = array();
    // Add a class to the body when we're in preview mode, or the preview window
    if (wptouch_in_preview()) {
        $body_classes[] = 'preview-mode';
    }
    $colors = foundation_get_theme_colors();
    foreach ($colors as $color) {
        $domain_settings = $wptouch_pro->get_settings($color->domain);
        if (isset($color->luma_threshold) && $color->luma_threshold != false) {
            $current_luma = wptouch_hex_to_luma($domain_settings->{$color->setting});
            if ($current_luma < $color->luma_threshold) {
                $body_classes[] = 'dark-' . $color->luma_class;
            } else {
                $body_classes[] = 'light-' . $color->luma_class;
            }
        }
    }
    return implode(' ', apply_filters('wptouch_body_classes', $body_classes));
}