Ejemplo n.º 1
0
 function axiom_core_customizer_add_custom_styles($custom_style)
 {
     // Custom fonts
     if (axiom_get_custom_option('typography_custom') == 'yes') {
         $fonts = axiom_get_list_fonts(false);
         $fname = axiom_get_custom_option('typography_p_font');
         if (isset($fonts[$fname])) {
             $fstyle = explode(',', axiom_get_custom_option('typography_p_style'));
             $fname2 = ($pos = axiom_strpos($fname, ' (')) !== false ? axiom_substr($fname, 0, $pos) : $fname;
             $i = in_array('i', $fstyle);
             $u = in_array('u', $fstyle);
             $c = axiom_get_custom_option('typography_p_color');
             $custom_style .= "\n\t\t\t\t\tbody, button, input, select, textarea {\n\t\t\t\t\t\tfont-family: '" . esc_attr($fname2) . "'" . (isset($fonts[$fname]['family']) ? ", " . esc_attr($fonts[$fname]['family']) : '') . ";\n\t\t\t\t\t}\n\t\t\t\t\tbody {\n\t\t\t\t\t\tfont-size: " . esc_attr(axiom_get_custom_option('typography_p_size')) . "px;\n\t\t\t\t\t\tfont-weight: " . esc_attr(axiom_get_custom_option('typography_p_weight')) . ";\n\t\t\t\t\t\tline-height: " . esc_attr(axiom_get_custom_option('typography_p_lineheight')) . "px;\n\t\t\t\t\t\t" . ($c ? "color: " . esc_attr($c) . ";" : '') . "\n\t\t\t\t\t\t" . ($i ? "font-style: italic;" : '') . "\n\t\t\t\t\t\t" . ($u ? "text-decoration: underline;" : '') . "\n\t\t\t\t\t}\n\t\t\t\t";
         }
         for ($h = 1; $h <= 6; $h++) {
             $fname = axiom_get_custom_option('typography_h' . $h . '_font');
             if (isset($fonts[$fname])) {
                 $fstyle = explode(',', axiom_get_custom_option('typography_h' . $h . '_style'));
                 $fname2 = ($pos = axiom_strpos($fname, ' (')) !== false ? axiom_substr($fname, 0, $pos) : $fname;
                 $i = in_array('i', $fstyle);
                 $u = in_array('u', $fstyle);
                 $c = axiom_get_custom_option('typography_h' . $h . '_color');
                 $custom_style .= "\n\t\t\t\t\t\th" . intval($h) . ", .h" . intval($h) . " {\n\t\t\t\t\t\t\tfont-family: '" . esc_attr($fname2) . "'" . (isset($fonts[$fname]['family']) ? ", " . esc_attr($fonts[$fname]['family']) : '') . ";\n\t\t\t\t\t\t\tfont-size: " . esc_attr(axiom_get_custom_option('typography_h' . intval($h) . '_size')) . "px;\n\t\t\t\t\t\t\tfont-weight: " . esc_attr(axiom_get_custom_option('typography_h' . intval($h) . '_weight')) . ";\n\t\t\t\t\t\t\tline-height: " . esc_attr(axiom_get_custom_option('typography_h' . intval($h) . '_lineheight')) . "px;\n\t\t\t\t\t\t\t" . ($c ? "color: " . esc_attr($c) . ";" : '') . "\n\t\t\t\t\t\t\t" . ($i ? "font-style: italic;" : '') . "\n\t\t\t\t\t\t\t" . ($u ? "text-decoration: underline;" : '') . "\n\t\t\t\t\t\t}\n\t\t\t\t\t\th" . $h . " a, .h" . $h . " a {\n\t\t\t\t\t\t\t" . ($c ? "color: " . esc_attr($c) . ";" : '') . "\n\t\t\t\t\t\t}\n\t\t\t\t\t";
             }
         }
     }
     // Submenu width
     $menu_width = axiom_get_theme_option('menu_width');
     if (!empty($menu_width)) {
         $custom_style .= "\n\t\t\t\t/* Submenu width */\n\t\t\t\t.menu_main_wrap .menu_main_nav > li ul {\n\t\t\t\t\twidth: " . intval($menu_width) . "px;\n\t\t\t\t}\n\t\t\t\t.menu_main_wrap .menu_main_nav > li > ul ul {\n\t\t\t\t\tleft:" . intval($menu_width + 4) . "px;\n\t\t\t\t}\n\t\t\t\t.menu_main_wrap .menu_main_nav > li > ul ul.submenu_left {\n\t\t\t\t\tleft:-" . intval($menu_width + 1) . "px;\n\t\t\t\t}\n\t\t\t";
     }
     // Logo height
     $logo_height = axiom_get_custom_option('logo_height');
     if (!empty($logo_height)) {
         $custom_style .= "\n\t\t\t\t/* Logo header height */\n\t\t\t\t.menu_main_wrap .logo_main {\n\t\t\t\t\theight:" . intval($logo_height) . "px;\n\t\t\t\t}\n\t\t\t";
     }
     // Logo top offset
     $logo_offset = axiom_get_custom_option('logo_offset');
     if (!empty($logo_offset)) {
         $custom_style .= "\n\t\t\t\t/* Logo header top offset */\n\t\t\t\t.menu_main_wrap .logo {\n\t\t\t\t\tmargin-top:" . intval($logo_offset) . "px;\n\t\t\t\t}\n\t\t\t";
     }
     // Logo footer height
     $logo_height = axiom_get_theme_option('logo_footer_height');
     if (!empty($logo_height)) {
         $custom_style .= "\n\t\t\t\t/* Logo footer height */\n\t\t\t\t.contacts_wrap .logo img {\n\t\t\t\t\theight:" . intval($logo_height) . "px;\n\t\t\t\t}\n\t\t\t";
     }
     // Custom css from theme options
     $custom_style .= axiom_get_custom_option('custom_css');
     return $custom_style;
 }
Ejemplo n.º 2
0
 function axiom_core_frontend_scripts()
 {
     global $wp_styles, $AXIOM_GLOBALS;
     // Enqueue styles
     //-----------------------------------------------------------------------------------------------------
     // Prepare custom fonts
     $fonts = axiom_get_list_fonts(false);
     $theme_fonts = array();
     if (axiom_get_custom_option('typography_custom') == 'yes') {
         $selectors = array('p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6');
         foreach ($selectors as $s) {
             $font = axiom_get_custom_option('typography_' . $s . '_font');
             if (!empty($font)) {
                 $theme_fonts[$font] = 1;
             }
         }
     }
     // Prepare current skin fonts
     $theme_fonts = apply_filters('axiom_filter_used_fonts', $theme_fonts);
     // Link to selected fonts
     foreach ($theme_fonts as $font => $v) {
         if (isset($fonts[$font])) {
             $font_name = ($pos = axiom_strpos($font, ' (')) !== false ? axiom_substr($font, 0, $pos) : $font;
             $css = !empty($fonts[$font]['css']) ? $fonts[$font]['css'] : 'http://fonts.googleapis.com/css?family=' . (!empty($fonts[$font]['link']) ? $fonts[$font]['link'] : str_replace(' ', '+', $font_name) . ':100,100italic,300,300italic,400,400italic,700,700italic') . (empty($fonts[$font]['link']) || axiom_strpos($fonts[$font]['link'], 'subset=') === false ? '&subset=latin,latin-ext,cyrillic,cyrillic-ext' : '');
             axiom_enqueue_style('theme-font-' . str_replace(' ', '-', $font_name), $css, array(), null);
         }
     }
     // Fontello styles must be loaded before main stylesheet
     axiom_enqueue_style('axiom-fontello-style', axiom_get_file_url('css/fontello/css/fontello.css'), array(), null);
     //axiom_enqueue_style( 'axiom-fontello-animation-style', axiom_get_file_url('css/fontello/css/animation.css'), array(), null);
     // Main stylesheet
     axiom_enqueue_style('axiom-main-style', get_stylesheet_uri(), array(), null);
     if (axiom_get_theme_option('debug_mode') == 'no' && axiom_get_theme_option('packed_scripts') == 'yes' && file_exists(axiom_get_file_dir('css/__packed.css'))) {
         // Load packed styles
         axiom_enqueue_style('axiom-packed-style', axiom_get_file_url('css/__packed.css'), array(), null);
     } else {
         // Shortcodes
         axiom_enqueue_style('axiom-shortcodes-style', axiom_get_file_url('shortcodes/shortcodes.css'), array(), null);
         // Animations
         if (axiom_get_theme_option('css_animation') == 'yes') {
             axiom_enqueue_style('axiom-animation-style', axiom_get_file_url('css/core.animation.css'), array(), null);
         }
     }
     // Theme skin stylesheet
     do_action('axiom_action_add_styles');
     // Theme customizer stylesheet and inline styles
     axiom_enqueue_custom_styles();
     // Responsive
     if (axiom_get_theme_option('responsive_layouts') == 'yes') {
         axiom_enqueue_style('axiom-responsive-style', axiom_get_file_url('css/responsive.css'), array(), null);
         do_action('axiom_action_add_responsive');
         if (axiom_get_custom_option('theme_skin') != '') {
             $css = apply_filters('axiom_filter_add_responsive_inline', '');
             if (!empty($css)) {
                 wp_add_inline_style('axiom-responsive-style', $css);
             }
         }
     }
     // Enqueue scripts
     //----------------------------------------------------------------------------------------------------------------------------
     if (axiom_get_theme_option('debug_mode') == 'no' && axiom_get_theme_option('packed_scripts') == 'yes' && file_exists(axiom_get_file_dir('js/__packed.js'))) {
         // Load packed theme scripts
         axiom_enqueue_script('axiom-packed-scripts', axiom_get_file_url('js/__packed.js'), array('jquery'), null, true);
     } else {
         // Load separate theme scripts
         axiom_enqueue_script('superfish', axiom_get_file_url('js/superfish.min.js'), array('jquery'), null, true);
         if (axiom_get_theme_option('menu_slider') == 'yes') {
             axiom_enqueue_script('axiom-slidemenu-script', axiom_get_file_url('js/jquery.slidemenu.js'), array('jquery'), null, true);
             //axiom_enqueue_script( 'axiom-jquery-easing-script', axiom_get_file_url('js/jquery.easing.js'), array('jquery'), null, true );
         }
         // Load this script only if any shortcode run
         //axiom_enqueue_script( 'axiom-shortcodes-script', axiom_get_file_url('shortcodes/shortcodes.js'), array('jquery'), null, true );
         if (is_single() && axiom_get_custom_option('show_reviews') == 'yes') {
             axiom_enqueue_script('axiom-core-reviews-script', axiom_get_file_url('js/core.reviews.js'), array('jquery'), null, true);
         }
         axiom_enqueue_script('axiom-core-utils-script', axiom_get_file_url('js/core.utils.js'), array('jquery'), null, true);
         axiom_enqueue_script('axiom-core-init-script', axiom_get_file_url('js/core.init.js'), array('jquery'), null, true);
     }
     // Media elements library
     if (axiom_get_theme_option('use_mediaelement') == 'yes') {
         wp_enqueue_style('mediaelement');
         wp_enqueue_style('wp-mediaelement');
         wp_enqueue_script('mediaelement');
         wp_enqueue_script('wp-mediaelement');
     } else {
         global $wp_scripts;
         $wp_scripts->done[] = 'mediaelement';
         $wp_scripts->done[] = 'wp-mediaelement';
         $wp_styles->done[] = 'mediaelement';
         $wp_styles->done[] = 'wp-mediaelement';
     }
     // Video background
     if (axiom_get_custom_option('show_video_bg') == 'yes' && axiom_get_custom_option('video_bg_youtube_code') != '') {
         axiom_enqueue_script('axiom-video-bg-script', axiom_get_file_url('js/jquery.tubular.1.0.js'), array('jquery'), null, true);
     }
     // Google map
     if (axiom_get_custom_option('show_googlemap') == 'yes') {
         axiom_enqueue_script('googlemap', 'http://maps.google.com/maps/api/js?sensor=false', array(), null, true);
         axiom_enqueue_script('axiom-googlemap-script', axiom_get_file_url('js/core.googlemap.js'), array(), null, true);
     }
     // Social share buttons
     if (is_singular() && !axiom_get_global('blog_streampage') && axiom_get_custom_option('show_share') != 'hide') {
         axiom_enqueue_script('axiom-social-share-script', axiom_get_file_url('js/social/social-share.js'), array('jquery'), null, true);
     }
     // Comments
     if (is_singular() && !axiom_get_global('blog_streampage') && comments_open() && get_option('thread_comments')) {
         axiom_enqueue_script('comment-reply', false, array(), null, true);
     }
     // Custom panel
     if (axiom_get_custom_option('show_theme_customizer') == 'yes') {
         if (file_exists(axiom_get_file_dir('core/core.customizer/front.customizer.css'))) {
             axiom_enqueue_style('axiom-customizer-style', axiom_get_file_url('core/core.customizer/front.customizer.css'), array(), null);
         }
         if (file_exists(axiom_get_file_dir('core/core.customizer/front.customizer.js'))) {
             axiom_enqueue_script('axiom-customizer-script', axiom_get_file_url('core/core.customizer/front.customizer.js'), array(), null, true);
         }
     }
     //Debug utils
     if (axiom_get_theme_option('debug_mode') == 'yes') {
         axiom_enqueue_script('axiom-core-debug-script', axiom_get_file_url('js/core.debug.js'), array(), null, true);
     }
     // Theme skin script
     do_action('axiom_action_add_scripts');
 }