public static function instance() { if (self::$_instance == null) { self::$_instance = new self(); } return self::$_instance; }
function k_font_preview($face) { $gwf = new VP_Site_GoogleWebFont(); $gwf->add($face); $links = $gwf->get_font_links(); $link = reset($links); $dom = <<<EOD <link href='{$link}' rel='stylesheet' type='text/css'> <p style="padding: 0 10px 0 10px; font-family: {$face}; font-weight: bold; font-size: 23px; line-height: 26px;"> \tThat's my title (ŠšĐđČčĆ掞) </p> <p style="padding: 0 10px 0 10px; font-family: {$face}; font-weight: normal; font-size: 16px; line-height: 26px;"> \tGrumpy wizards make toxic brew for the evil Queen and Jack (ŠšĐđČčĆ掞). \t<br /> \tPellentesque sed odio nisi. Sed ut pellentesque libero, quis bibendum nibh. Phasellus sodales scelerisque nisi, eu rutrum mi lorem ipsum dolor. </p> EOD; return $dom; }
function wpbpscripts_and_styles() { if (!is_admin()) { // register stylesheets and js wp_register_style('wpbp-styles', CSS . 'wpbp.css', '', '', 'all'); wp_register_script('wpbp-scripts', JS . 'wpbp.js', array('jquery'), '', true); // enqueue it all wp_enqueue_style('wpbp-styles'); wp_enqueue_script('wpbp-scripts'); if (is_singular() && comments_open() && get_option('thread_comments')) { wp_enqueue_script('comment-reply'); } // loading Google Fonts if chosen in global theme settings $font_face = vp_option('wpbp_option.wpbp_body_font_face'); $font_weight = vp_option('wpbp_option.wpbp_body_font_weight'); $font_style = vp_option('wpbp_option.wpbp_body_font_style'); VP_Site_GoogleWebFont::instance()->add($font_face, $font_weight, $font_style); VP_Site_GoogleWebFont::instance()->register_and_enqueue(); } }
/** * Enqueue Google font stylesheets */ function k_google_fonts_url() { // content $font_face_content = vp_option('vpt_option.font_family_content'); if (!empty($font_face_content)) { $font_style_content = vp_option('vpt_option.font_style_content'); $font_weight_content = vp_option('vpt_option.font_weight_content'); $font_subset_content = vp_option('vpt_option.font_subset_content'); VP_Site_GoogleWebFont::instance()->add($font_face_content, $font_weight_content, $font_style_content, $font_subset_content); } // titles $font_face_title = vp_option('vpt_option.font_family_title'); if (!empty($font_face_title)) { $font_style_title = vp_option('vpt_option.font_style_title'); $font_weight_title = vp_option('vpt_option.font_weight_title'); $font_subset_title = vp_option('vpt_option.font_subset_title'); VP_Site_GoogleWebFont::instance()->add($font_face_title, $font_weight_title, $font_style_title, $font_subset_title); } if (!empty($font_face_content) || !empty($font_face_title)) { VP_Site_GoogleWebFont::instance()->register_and_enqueue(); } }
function rehub_embed_fonts() { VP_Site_GoogleWebFont::instance()->register_and_enqueue(); }
function jeg_font_preview($face) { $gwf = new VP_Site_GoogleWebFont(); $gwf->add($face); $links = $gwf->get_font_links(); $link = reset($links); $dom = <<<EOD <link href='{$link}' rel='stylesheet' type='text/css'> <p style="padding: 0 10px 0 10px; font-family: {$face}; font-weight: {$weight}; font-size: 20px;"> \tGrumpy wizards make toxic brew for the evil Queen and Jack </p> EOD; return $dom; }
function sage_embed_fonts() { // add the font $options = vp_option('vpt_option'); $elements = array('body', 'logo', 'menu', 'headings', 'dropdown'); foreach ($elements as $el) { $font_face = $options[$el . '_font_face']; $font_weight = $options[$el . '_font_weight']; $font_style = $options[$el . '_font_style']; \VP_Site_GoogleWebFont::instance()->add($font_face, $font_weight, $font_style); } \VP_Site_GoogleWebFont::instance()->register_and_enqueue(); }
function wpurp_font_preview_with_text($text, $face, $style, $weight, $size) { VP_Site_GoogleWebFont::instance()->add($face, $weight, $style); $fonts = VP_Site_GoogleWebFont::instance()->get_font_links(); $out = ''; foreach ($fonts as $font) { $out .= '<link href="' . $font . '" rel="stylesheet" type="text/css">'; } $out .= '<div style="font-family: ' . $face . '; font-style: ' . $style . '; font-weight: ' . $weight . '; font-size: ' . $size . 'px; height: ' . ($size + 5) . 'px; margin-top: 15px;">' . $text . '</div>'; return $out; }
line-height: ' . hb_options('hb_font_h6_line_height') . 'px; letter-spacing: ' . hb_options('hb_font_h6_letter_spacing') . 'px; }'; } // Pre-Footer Callout if (hb_options('hb_pre_footer_font') == 'hb_font_custom') { $font_face = hb_options('hb_pre_footer_font_face'); VP_Site_GoogleWebFont::instance()->add($font_face, $font_weight, $font_style); echo '#pre-footer-area { font-family: ' . $font_face . '; font-size: ' . hb_options('hb_pre_footer_font_size') . 'px; line-height: ' . hb_options('hb_pre_footer_line_height') . 'px; letter-spacing: ' . hb_options('hb_pre_footer_letter_spacing') . 'px; }'; } VP_Site_GoogleWebFont::instance()->register_and_enqueue(); ?> </style> </head> <!-- END head --> <?php $smooth_scroll = hb_options('hb_smooth_scrolling'); $smooth_scroll_class = ""; if ($smooth_scroll) { $smooth_scroll_class = ' data-smooth-scroll="1"'; } else { $smooth_scroll_class = ' data-smooth-scroll="0"'; } $fixed_footer_data = hb_options('hb_fixed_footer_effect');
/** * Embed Scripts into Page */ function ld_theme_scripts() { $theme_data = wp_get_theme(); /** * CSS */ // Theme stylesheet wp_enqueue_style('style', get_stylesheet_uri()); // WP default stylesheet // GoogleFonts global $lovey_dovey_data; $font_weights = array(100, 200, 300, 400, 500, 600, 700, 800, 900); $font_styles = array('normal', 'italic'); foreach ($lovey_dovey_data['typography_types'] as $type => $label) { if (!in_array(ld_option($type . '_font_face'), ld_get_regular_font_faces())) { VP_Site_GoogleWebFont::instance()->add(ld_option($type . '_font_face'), $font_weights, $font_styles); } } VP_Site_GoogleWebFont::instance()->register_and_enqueue(); // Other CSS // wp_register_style( 'bootstrap', LD_CSS . 'bootstrap.min.css', array(), '3.1.1' ); wp_register_style('bootstrap-ld', LD_CSS . 'bootstrap.ld.css', array(), '3.1.1'); wp_register_style('fontawesome', LD_CSS . 'font-awesome.min.css', array(), '4.0.3'); wp_register_style('linecons', LD_CSS . 'linecons.css', array(), '1.0.0'); wp_register_style('socmed', LD_CSS . 'socmed.css', array()); wp_register_style('countdown', LD_CSS . 'jquery.countdown.css', array()); wp_register_style('jquery-magnific-popup', LD_CSS . 'magnific-popup.css', array(), '0.9.9'); wp_register_style('jquery-justifiedgallery', LD_CSS . 'justifiedgallery.min.css', array(), '3.2.0'); wp_register_style('ld-style', LD_CSS . 'style.css', array('bootstrap-ld', 'fontawesome', 'linecons', 'socmed', 'countdown', 'jquery-magnific-popup', 'jquery-justifiedgallery'), $theme_data->get('Version')); wp_enqueue_style('ld-style'); // Dynamic Style ob_start(); include LD_CSS_DIR . '/style-dynamic.php'; $dynamic_style = ob_get_clean(); wp_add_inline_style('ld-style', $dynamic_style); wp_add_inline_style('ld-style', ld_option('custom_css')); /** * JS */ wp_enqueue_script('modernizr', LD_JS . 'modernizr-latest.js'); wp_register_script('bootstrap', LD_JS . 'bootstrap.min.js', array('jquery'), '3.1.1'); wp_register_script('smoothscroll', LD_JS . 'smoothscroll.min.js', array('jquery'), '1.2.1'); wp_register_script('jquery-backstretch', LD_JS . 'jquery.backstretch.min.js', array('jquery'), '2.0.4'); wp_register_script('jquery-plugin', LD_JS . 'jquery.plugin.min.js', array('jquery')); wp_register_script('jquery-countdown', LD_JS . 'jquery.countdown.min.js', array('jquery', 'jquery-plugin')); wp_register_script('jquery-parallax', LD_JS . 'jquery.parallax.min.js', array('jquery'), '1.1.3'); wp_register_script('jquery-countdown-br', LD_JS . 'jquery.countdown.pt-BR.js', array('jquery'), '2.0.0'); wp_register_script('jquery-magnific-popup', LD_JS . 'jquery.magnific-popup.min.js', array('jquery'), '0.9.9'); wp_register_script('jquery-justifiedgallery', LD_JS . 'jquery.justifiedgallery.min.js', array('jquery', 'jquery-magnific-popup'), '3.2.0'); wp_register_script('jquery-waypoints', LD_JS . 'waypoints.min.js', array(), '2.0.4'); wp_register_script('imagesloaded', LD_JS . 'imagesloaded.pkgd.min.js', array(), '3.1.4'); wp_register_script('gmap-api', 'http://maps.google.com/maps/api/js?sensor=false'); wp_register_script('jquery-gmap3', LD_JS . 'gmap3.min.js', array('jquery', 'gmap-api'), '6.0.0'); wp_deregister_script('isotope'); wp_register_script('isotope', LD_JS . 'isotope.pkgd.min.js', array('imagesloaded'), '2.0.0'); wp_register_script('ld-script', LD_JS . 'script.js', array('jquery', 'bootstrap', 'smoothscroll', 'jquery-backstretch', 'jquery-countdown', 'jquery-magnific-popup', 'jquery-justifiedgallery', 'jquery-waypoints', 'jquery-gmap3', 'isotope', 'jquery-countdown-br'), $theme_data->get('Version')); wp_enqueue_script('ld-script'); wp_localize_script('ld-script', 'loveydovey', array('gb_name_id' => ld_option('gb_name_id'), 'gb_message_id' => ld_option('gb_message_id'), 'is_mobile_or_tablet' => Mobile_Detect::is_mobile_or_tablet() ? 'true' : 'false')); }
/** * Enqueue styles and scripts */ function willow_action_enqueue_scripts() { $theme_data = wp_get_theme(); /** * CSS */ // GoogleFonts $font_weights = array(100, 200, 300, 400, 500, 600, 700, 800, 900); $font_styles = array('normal', 'italic'); global $willow_data; foreach ($willow_data['typography_types'] as $type => $label) { if (!in_array(willow_option($type . '_font_face'), willow_get_regular_font_faces())) { VP_Site_GoogleWebFont::instance()->add(willow_option($type . '_font_face'), $font_weights, $font_styles); } } VP_Site_GoogleWebFont::instance()->register(); foreach (VP_Site_GoogleWebFont::instance()->get_names() as $name) { wp_enqueue_style($name); } // Other CSS wp_register_style('willow-bootstrap', WILLOW_CSS . 'bootstrap.willow.min.css', array(), '3.1.1'); wp_register_style('fontawesome', WILLOW_CSS . 'font-awesome.min.css', array(), '4.0.3'); wp_register_style('linecons', WILLOW_CSS . 'linecons.css', array(), '1.0.0'); wp_register_style('animate', WILLOW_CSS . 'animate.css', array(), '3.1.0-dev'); wp_register_style('mediaelement', WILLOW_CSS . 'mediaelementplayer.min.css', array(), '2.14.2'); wp_register_style('willow-jquery-magnific-popup', WILLOW_CSS . 'magnific-popup.willow.css', array(), '0.9.9'); wp_register_style('willow-style', WILLOW_CSS . 'style.css', array('willow-bootstrap', 'fontawesome', 'linecons', 'animate', 'mediaelement', 'willow-jquery-magnific-popup'), $theme_data->get('Version')); wp_enqueue_style('willow-style'); // Dynamic sStyle ob_start(); include WILLOW_CSS_DIR . '/style-dynamic.php'; $dynamic_style = ob_get_clean(); wp_add_inline_style('willow-style', $dynamic_style); wp_add_inline_style('willow-style', willow_option('custom_css')); // Theme stylesheet wp_enqueue_style('style', get_stylesheet_uri()); // WP default stylesheet /** * JS */ // Less than IE9 polyfills global $wp_scripts; wp_register_script('html5shiv', WILLOW_JS . 'html5shiv.js', array(), '3.7.0'); $wp_scripts->add_data('html5shiv', 'conditional', 'lt IE 9'); wp_enqueue_script('html5shiv'); wp_register_script('respond', WILLOW_JS . 'respond.min.js', array(), '1.4.2'); $wp_scripts->add_data('respond', 'conditional', 'lt IE 9'); wp_enqueue_script('respond'); wp_register_script('bootstrap', WILLOW_JS . 'bootstrap.min.js', array('jquery'), '3.1.1'); wp_register_script('smoothscroll', WILLOW_JS . 'smoothscroll.min.js', array('jquery'), '1.2.1'); wp_register_script('jquery-sharrre', WILLOW_JS . 'jquery.sharrre.min.js', array('jquery'), '1.3.5'); wp_register_script('jquery-touchswipe', WILLOW_JS . 'jquery.touchswipe.min.js', array('jquery'), '1.3.3'); wp_register_script('jquery-caroufredsel', WILLOW_JS . 'jquery.caroufredsel-packed.js', array('jquery', 'imagesloaded', 'jquery-touchswipe'), '6.2.1'); wp_register_script('jquery-waypoints', WILLOW_JS . 'waypoints.min.js', array(), '2.0.4'); wp_register_script('jquery-magnific-popup', WILLOW_JS . 'jquery.magnific-popup.min.js', array('jquery'), '0.9.9'); wp_register_script('jquery-parallax', WILLOW_JS . 'jquery.parallax.min.js', array('jquery'), '1.1.3'); wp_register_script('jquery-jpreloader', WILLOW_JS . 'jpreloader.min.js', array('jquery'), '2.1'); wp_register_script('jquery-hoverintent', WILLOW_JS . 'hoverintent.js', array('jquery'), '1.7.4'); wp_register_script('jquery-superfish', WILLOW_JS . 'superfish.js', array('jquery', 'jquery-hoverintent'), '1.7.4'); wp_register_script('jquery-fittext', WILLOW_JS . 'jquery.fittext.js', array('jquery'), '1.2'); wp_register_script('gmap-api', 'http://maps.google.com/maps/api/js?sensor=false'); wp_register_script('jquery-gmap3', WILLOW_JS . 'gmap3.min.js', array('jquery', 'gmap-api'), '6.0.0'); wp_register_script('imagesloaded', WILLOW_JS . 'imagesloaded.pkgd.min.js', array(), '3.1.4'); if (!wp_script_is('isotope', 'registered')) { wp_deregister_script('isotope'); wp_register_script('isotope', WILLOW_JS . 'isotope.pkgd.min.js', array('imagesloaded'), '2.0.0'); } else { willow_append_dependency('isotope', 'imagesloaded'); } wp_register_script('mediaelement', WILLOW_JS . 'mediaelement-and-player.min.js', array('jquery'), '2.14.2'); wp_register_script('countup', WILLOW_JS . 'countup.min.js', array(), '1.1.0'); wp_register_script('willow-modernizr', WILLOW_JS . 'modernizr.willow.min.js', array(), '2.8.1'); wp_register_script('willow-script', WILLOW_JS . 'script.js', array('jquery', 'jquery-waypoints', 'jquery-superfish', 'bootstrap', 'smoothscroll', 'mediaelement', 'jquery-fittext'), $theme_data->get('Version')); wp_enqueue_script('willow-script'); if (willow_option('enable_preloader', 1)) { wp_enqueue_script('jquery-jpreloader'); } $willow_data['localize']['gmap_style_json'] = trim(willow_option('gmap_style_json', '')); $willow_data['localize']['is_mobile_or_tablet'] = Mobile_Detect::is_mobile_or_tablet() ? 'true' : 'false'; wp_localize_script('willow-script', 'willow', $willow_data['localize']); }
function wp_branding_use_google_font() { $font_face = vp_option('agnet_branding.logo_font_face'); $font_weight = vp_option('agnet_branding.vp_get_gwf_weight'); $font_style = vp_option('agnet_branding.logo_font_style'); $gwf = new VP_Site_GoogleWebFont(); $gwf->add($font_face, $font_style, $font_weight); $links = $gwf->get_font_links(); $link = reset($links); ?> <style type="text/css"> body { font-family: <?php echo $font_face; ?> !important; font-style: <?php echo $font_style; ?> !important; font-weight: <?php echo $font_weight; ?> !important; } </style> <?php }
function vp_font_preview($face, $style, $weight, $size, $line_height) { $gwf = new VP_Site_GoogleWebFont(); $gwf->add($face, $style, $weight); $links = $gwf->get_font_links(); $link = reset($links); $dom = "\r\n<link href='{$link}' rel='stylesheet' type='text/css'>\r\n<p style=\"padding: 0 10px 0 10px; font-family: {$face}; font-style: {$style}; font-weight: {$weight}; font-size: {$size}px; line-height: {$line_height}em;\">\r\n\tGrumpy wizards make toxic brew for the evil Queen and Jack\r\n</p>\r\n"; return $dom; }