Example #1
0
 private static function settings()
 {
     if (!is_null(self::$processed_settings)) {
         return self::$processed_settings;
     }
     /* Get the font settings */
     $settings = apply_filters('youxi_font_settings', array());
     /* Process the raw settings */
     $processed = array();
     foreach (array_keys($settings) as $key) {
         $processed[$key] = self::walk_settings($settings, $key);
     }
     return self::$processed_settings = $processed;
 }
Example #2
0
 function helium_wp_enqueue_script()
 {
     /* Get theme version */
     $wp_theme = wp_get_theme();
     $theme_version = $wp_theme->exists() ? $wp_theme->get('Version') : false;
     /* Get script debug status */
     $script_debug = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG;
     $suffix = $script_debug ? '' : '.min';
     /* Enqueue Core Styles */
     wp_enqueue_style('helium-bootstrap', get_template_directory_uri() . "/assets/bootstrap/css/bootstrap{$suffix}.css", array(), '3.3.5', 'screen');
     wp_enqueue_style('helium-core', get_stylesheet_uri(), array('helium-bootstrap'), $theme_version, 'screen');
     /* Enqueue Google Fonts */
     if ($google_fonts_url = Youxi_Font::google_font_request_url()) {
         wp_enqueue_style('helium-google-fonts', $google_fonts_url, array(), $theme_version, 'screen');
     }
     /* Enqueue Icons */
     wp_enqueue_style('font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css', array(), '4.4.0', 'screen');
     /* Make sure the LESS compiler exists */
     if (!class_exists('Youxi_LESS_Compiler')) {
         require_once get_template_directory() . '/lib/framework/class-less-compiler.php';
     }
     $less_compiler = Youxi_LESS_Compiler::get();
     /* Prepare variables */
     $theme_options_vars = array();
     /* Get the accent color setting */
     $brand_primary = Youxi()->option->get('accent_color', helium_default_accent_color());
     /* Custom accent color styles */
     if (helium_default_accent_color() !== $brand_primary) {
         wp_add_inline_style('helium-bootstrap', $less_compiler->compile('/assets/less/mods/bootstrap.less', array('bs-override' => array('brand-primary' => $brand_primary))));
         $theme_options_vars['brand-primary'] = $brand_primary;
     }
     /* Custom theme styles */
     if ($header_logo_height = absint(Youxi()->option->get('logo_height'))) {
         $theme_options_vars['logo-height'] = sprintf('%dpx', $header_logo_height);
     }
     /* Add custom styles from theme options */
     $theme_options_css = $less_compiler->compile('/assets/less/mods/theme-options.less', array('theme-options' => $theme_options_vars));
     if (!is_wp_error($theme_options_css)) {
         wp_add_inline_style('helium-core', $theme_options_css);
     }
     /* Add custom fonts from theme options */
     $font_less_vars = Youxi_Font::get_less_vars();
     if (!empty($font_less_vars)) {
         $theme_fonts_css = $less_compiler->compile('/assets/less/mods/theme-fonts.less', array('theme-fonts' => $font_less_vars));
         if (!is_wp_error($theme_fonts_css)) {
             wp_add_inline_style('helium-core', $theme_fonts_css);
         }
     }
     /* Custom user styles */
     $custom_css = trim(Youxi()->option->get('custom_css'));
     if ($custom_css) {
         wp_add_inline_style('helium-core', $custom_css);
     }
     /* Core */
     if ($script_debug) {
         wp_enqueue_script('helium-plugins', get_template_directory_uri() . "/assets/js/helium.plugins.js", array('jquery'), $theme_version, true);
         wp_enqueue_script('helium-gridlist', get_template_directory_uri() . "/assets/js/helium.gridlist.js", array('jquery'), $theme_version, true);
         wp_enqueue_script('helium-core', get_template_directory_uri() . "/assets/js/helium.setup.js", array('jquery', 'helium-plugins', 'helium-gridlist'), $theme_version, true);
     } else {
         wp_enqueue_script('helium-core', get_template_directory_uri() . "/assets/js/helium.min.js", array('jquery'), $theme_version, true);
     }
     /* AJAX */
     $ajax_enabled = Youxi()->option->get('ajax_navigation');
     if ($ajax_enabled) {
         wp_enqueue_script('helium-ajax', get_template_directory_uri() . "/assets/js/helium.ajax{$suffix}.js", array('helium-core'), $theme_version, true);
     }
     /* Enqueue wp-mediaelement if AJAX is enabled */
     if ($ajax_enabled) {
         wp_enqueue_script('wp-mediaelement');
     }
     /* Enqueue Magnific Popup */
     wp_enqueue_script('helium-mfp', get_template_directory_uri() . "/assets/plugins/mfp/jquery.mfp-1.0.0{$suffix}.js", array('jquery'), '1.0.0', true);
     wp_enqueue_style('helium-mfp', get_template_directory_uri() . "/assets/plugins/mfp/mfp.css", array(), '1.0.0', 'screen');
     /* Enqueue Isotope */
     wp_enqueue_script('helium-isotope', get_template_directory_uri() . "/assets/plugins/isotope/isotope.pkgd{$suffix}.js", array('jquery'), '2.2.0', true);
     /* Enqueue RoyalSlider */
     wp_enqueue_script('helium-royalslider', get_template_directory_uri() . "/assets/plugins/royalslider/jquery.royalslider-9.5.7.min.js", array('jquery'), '9.5.7', true);
     wp_enqueue_style('helium-royalslider', get_template_directory_uri() . "/assets/plugins/royalslider/royalslider{$suffix}.css", array(), '1.0.5', 'screen');
     /* Enqueue Google Maps */
     wp_enqueue_script('helium-gmap3', get_template_directory_uri() . "/assets/plugins/gmap/gmap3{$suffix}.js", array('jquery'), '6.0.0.', true);
     /* Pass configuration to frontend */
     wp_localize_script('helium-core', '_helium', apply_filters('helium_js_vars', array('ajaxUrl' => admin_url('admin-ajax.php'), 'homeUrl' => home_url('/'))));
     /* Enqueue AddThis script on singular pages */
     if (is_singular(array('post', 'portfolio', 'download')) || $ajax_enabled) {
         $addthis_config = array('ui_delay' => 100);
         if ($addthis_profile_id = Youxi()->option->get('addthis_profile_id')) {
             $addthis_config['pubid'] = $addthis_profile_id;
         }
         wp_enqueue_script('helium-addthis', '//s7.addthis.com/js/300/addthis_widget.js', array(), 300, true);
         wp_localize_script('helium-addthis', 'addthis_config', $addthis_config);
     }
     /* Enqueue comment-reply */
     if ((is_singular(array('post', 'portfolio', 'download')) || $ajax_enabled) && comments_open() && get_option('thread_comments')) {
         wp_enqueue_script('comment-reply');
     }
 }