示例#1
0
 public static function init_data()
 {
     global $color_options, $theme_less_vars;
     $theme_less_vars = get_theme_options_less_vars();
     // Theme path
     $theme_path = get_stylesheet_directory_uri();
     // Google Font Options
     include_once file_require(ADMIN_PATH . 'functions/google-fonts.php');
     $google_fonts = get_google_webfonts();
     $google_webfonts = array();
     $google_webfonts["default"] = "Default (Helvetica, Arial, sans-serif)";
     foreach ($google_fonts as $font) {
         $google_webfonts[$font['family']] = $font['family'];
     }
     $font_sizes = array();
     for ($i = 8; $i < 73; $i++) {
         $font_sizes = array_merge($font_sizes, array($i . 'px' => $i . 'px'));
     }
     $transparent_percent = array('10' => '10%', '20' => '20%', '30' => '30%', '40' => '40%', '50' => '50%', '60' => '60%', '70' => '70%', '80' => '80%', '90' => '90%', '100' => '100%');
     $header_heights = array();
     for ($i = 0; $i < 501; $i++) {
         $header_heights = array_merge($header_heights, array($i . 'px' => $i . 'px'));
     }
     $topbar_heights = array();
     for ($i = 0; $i < 100; $i++) {
         $topbar_heights = array_merge($topbar_heights, array($i . 'px' => $i . 'px'));
     }
     $color_options = array(array('id' => 'general_options', 'title' => 'Theme: General Option', 'description' => 'You can set site general layouts, options.', 'items' => array(array('id' => 'general-layout', 'label' => 'Container Layout', 'default' => 'full', 'type' => 'select', 'choices' => array('full' => 'Fullwidth Layout', 'boxed' => 'Boxed Layout')), array('id' => 'general-top-space', 'label' => 'Site Top Space', 'default' => '0px', 'type' => 'text'), array('id' => 'general-bottom-space', 'label' => 'Site Bottom Space', 'default' => '0px', 'type' => 'text'), array('id' => 'general-bg-image', 'label' => 'Background Image', 'default' => '', 'type' => 'image'), array('id' => 'general-bg-repeat', 'label' => 'Background Repeat', 'default' => 'no-repeat', 'type' => 'select', 'choices' => array('no-repeat' => 'No Repeat', 'repeat' => 'Tile', 'repeat-x' => 'Tile Horizontally', 'repeat-y' => 'Tile Vertically')), array('id' => 'general-bg-position', 'label' => 'Background Position (x,y)', 'default' => 'left top', 'type' => 'select', 'choices' => array('left top' => 'Left Top', 'left center' => 'Left Middle', 'left bottom' => 'Left Bottom', 'center top' => 'Center Top', 'center center' => 'Center Middle', 'center bottom' => 'Center Bottom', 'right top' => 'Right Top', 'right center' => 'Right Middle', 'right bottom' => 'Right Bottom')), array('id' => 'general-bg-attach', 'label' => 'Background Attachment', 'default' => 'scroll', 'type' => 'select', 'choices' => array('scroll' => 'Scroll', 'fixed' => 'Fixed')))), array('id' => 'header_options', 'title' => 'Theme: Header Option', 'description' => '', 'items' => array(array('id' => 'top-bar-height', 'label' => 'Topbar Height', 'default' => getLessValue('top-bar-height'), 'type' => 'select', 'choices' => $topbar_heights), array('id' => 'logo', 'label' => 'Logo Image', 'default' => $theme_path . "/assets/images/logo.png", 'type' => 'image'), array('id' => 'logo-height', 'label' => 'Logo Height', 'default' => getLessValue('logo-height'), 'type' => 'text'), array('id' => 'logo-width', 'label' => 'Logo Width', 'default' => getLessValue('logo-width'), 'type' => 'text'), array('id' => 'logo_retina', 'label' => 'Retina Logo Image', 'default' => $theme_path . "/assets/images/logo@2x.png", 'type' => 'image'), array('id' => 'icon_favicon', 'label' => 'Favicon ( 16x16, PNG/ICO/JPG )', 'default' => $theme_path . "/assets/images/favicon.png", 'type' => 'image'), array('id' => 'logo_admin', 'label' => 'Login Page Logo (up to 274x95px)', 'default' => $theme_path . "/assets/images/logo-admin.png", 'type' => 'image'), array('id' => 'header-height', 'label' => 'Header Height (higher than logo!)', 'default' => getLessValue('header-height'), 'type' => 'select', 'choices' => $header_heights), array('id' => 'fixed_menu', 'label' => 'Header Fixed at Top', 'default' => 1, 'type' => 'checkbox'), array('id' => 'search_box', 'label' => 'Enable Search Box', 'default' => 1, 'type' => 'checkbox'), array('id' => 'menu_alignment', 'label' => 'Menu Alignment', 'default' => 'right', 'type' => 'select', 'choices' => array('right' => 'Right', 'center' => 'Center', 'left' => 'Left')), array('id' => 'header_transparent', 'label' => 'Header Transparent (removes top bar)', 'default' => 0, 'type' => 'checkbox'), array('id' => 'header-transparent-opacity', 'label' => 'Header Opacity', 'default' => (int) getLessValue('header-transparent-opacity') . '%', 'type' => 'select', 'choices' => $transparent_percent))), array('id' => 'title_options', 'title' => 'Theme: Title Area Option', 'description' => 'You can control page title section here', 'items' => array(array('id' => 'title-padding', 'label' => 'Title Area Space', 'default' => getLessValue('title-padding'), 'type' => 'text'), array('id' => 'title-bg-image', 'label' => 'Background Image', 'default' => '', 'type' => 'image'), array('id' => 'title-bg-repeat', 'label' => 'Background Repeat', 'default' => 'no-repeat', 'type' => 'select', 'choices' => array('no-repeat' => 'No Repeat', 'repeat' => 'Tile', 'repeat-x' => 'Tile Horizontally', 'repeat-y' => 'Tile Vertically')), array('id' => 'title-bg-position', 'label' => 'Background Position (x,y)', 'default' => 'left top', 'type' => 'select', 'choices' => array('left top' => 'Left Top', 'left center' => 'Left Middle', 'left bottom' => 'Left Bottom', 'center top' => 'Center Top', 'center center' => 'Center Middle', 'center bottom' => 'Center Bottom', 'right top' => 'Right Top', 'right center' => 'Right Middle', 'right bottom' => 'Right Bottom')), array('id' => 'title-bg-attach', 'label' => 'Background Attachment', 'default' => 'scroll', 'type' => 'select', 'choices' => array('scroll' => 'Scroll', 'fixed' => 'Fixed')))), array('id' => 'color_general', 'title' => 'Theme: Color Options', 'description' => '', 'items' => array(array('id' => 'brand-primary', 'label' => 'Primary Color', 'default' => getLessValue('brand-primary')), array('id' => 'text-color', 'label' => 'Text Color', 'default' => getLessValue('text-color')), array('id' => 'body-bg', 'label' => 'Body Background Color (for boxed)', 'default' => getLessValue('body-bg')), array('id' => 'title-background', 'label' => 'Title Background Color', 'default' => getLessValue('title-background')), array('id' => 'primary-background', 'label' => 'Content Background Color', 'default' => getLessValue('primary-background')), array('id' => 'top-bar-background', 'label' => 'Top Bar Background Color', 'default' => getLessValue('top-bar-background')), array('id' => 'header-background', 'label' => 'Header Background Color', 'default' => getLessValue('header-background')), array('id' => 'footer-background', 'label' => 'Footer Background Color', 'default' => getLessValue('footer-background')), array('id' => 'brand-success', 'label' => 'Brand Success', 'default' => getLessValue('brand-success')), array('id' => 'brand-info', 'label' => 'Brand Info', 'default' => getLessValue('brand-info')), array('id' => 'brand-warning', 'label' => 'Brand Warning', 'default' => getLessValue('brand-warning')), array('id' => 'brand-danger', 'label' => 'Brand Danger', 'default' => getLessValue('brand-danger')))), array('id' => 'font_options', 'title' => 'Theme : Font Options', 'description' => '', 'items' => array(array('id' => 'base-font-body', 'label' => 'General Font Family', 'default' => getLessValue('base-font-body'), 'type' => 'select', 'choices' => $google_webfonts), array('id' => 'font-size-base', 'label' => 'General Font Size', 'default' => getLessValue('font-size-base'), 'type' => 'select', 'choices' => $font_sizes), array('id' => 'font-weight-base', 'label' => 'General Font Weight', 'default' => getLessValue('font-weight-base'), 'type' => 'select', 'choices' => array('100' => '100', '200' => '200', '300' => '300', '400' => '400', '500' => '500', '600' => '600', '700' => '700')), array('id' => 'base-font-menu', 'label' => 'Menu Font Family', 'default' => getLessValue('base-font-menu'), 'type' => 'select', 'choices' => $google_webfonts), array('id' => 'menu-font-size', 'label' => 'Menu Font Size', 'default' => getLessValue('menu-font-size'), 'type' => 'select', 'choices' => $font_sizes), array('id' => 'top-bar-font-size', 'label' => 'Topbar Font Size', 'default' => getLessValue('top-bar-font-size'), 'type' => 'select', 'choices' => $font_sizes), array('id' => 'base-font-heading', 'label' => 'Heading Font Family', 'default' => getLessValue('base-font-heading'), 'type' => 'select', 'choices' => $google_webfonts), array('id' => 'font-size-h1', 'label' => 'H1 Size', 'default' => (int) ((int) getLessValue('font-size-base') * 2.25 + 1) . 'px', 'type' => 'select', 'choices' => $font_sizes), array('id' => 'font-size-h2', 'label' => 'H2 Size', 'default' => (int) ((int) getLessValue('font-size-base') * 1.75 + 1) . 'px', 'type' => 'select', 'choices' => $font_sizes), array('id' => 'font-size-h3', 'label' => 'H3 Size', 'default' => (int) ((int) getLessValue('font-size-base') * 1.5 + 1) . 'px', 'type' => 'select', 'choices' => $font_sizes), array('id' => 'font-size-h4', 'label' => 'H4 Size', 'default' => (int) ((int) getLessValue('font-size-base') * 1.25 + 1) . 'px', 'type' => 'select', 'choices' => $font_sizes), array('id' => 'font-size-h5', 'label' => 'H5 Size', 'default' => getLessValue('font-size-base'), 'type' => 'select', 'choices' => $font_sizes), array('id' => 'font-size-h6', 'label' => 'H6 Size', 'default' => (int) ((int) getLessValue('font-size-base') * 0.85 + 1) . 'px', 'type' => 'select', 'choices' => $font_sizes))));
 }
示例#2
0
function import_google_fonts()
{
    global $post;
    global $smof_data;
    $fonts = array();
    // Load them option fonts
    $font_options = array('base-font-body', 'base-font-menu', 'base-font-heading');
    $theme_less_vars = get_theme_options_less_vars();
    foreach ($font_options as $option) {
        $font = isset($theme_less_vars[$option]) ? trim($theme_less_vars[$option]) : '';
        if ($font != '' && $font != 'default') {
            $fonts[] = $font;
        }
    }
    // load ultimate page fonts
    if (isset($post->ID) && get_post_meta($post->ID, '_wp_page_template', true) == 'page-ultimate.php') {
        $up_fonts = array('up_menu_font', 'up_heading_font', 'up_body_font');
        foreach ($up_fonts as $upfont) {
            $font = trim(tt_getmeta($upfont, $post->ID));
            if ($font != '' && $font != 'default') {
                $fonts[] = $font;
            }
        }
    }
    $protocol = is_ssl() ? 'https' : 'http';
    include_once file_require(ADMIN_PATH . 'functions/google-fonts.php');
    $google_fonts = get_google_webfonts();
    foreach ($fonts as $font) {
        $var = str_replace("'", '', trim($font));
        $var = str_replace('"', '', $var);
        $var = str_replace(' ', '-', $var);
        $val = str_replace("'", '', trim($font));
        $val = str_replace('"', '', $val);
        $val = str_replace(' ', '+', $val);
        $variants = $subsets = '';
        foreach ($google_fonts as $key => $current) {
            if (trim($current['family']) == trim($font)) {
                $variants = implode(',', $current['variants']);
                $subsets = '&subset=' . implode(',', $current['subsets']);
                break;
            }
        }
        wp_enqueue_style("themeton-google-font-" . strtolower($var), "{$protocol}://fonts.googleapis.com/css?family=" . $val . ":" . $variants . $subsets);
    }
}
示例#3
0
function get_post_type_options_page()
{
    global $smof_data, $tt_sidebars, $tt_sliders, $post;
    // init One Page menus
    $onepages_for_navs = array();
    $onepage_with_templates = get_pages(array('meta_key' => '_wp_page_template', 'meta_value' => 'page-one-page.php'));
    foreach ($onepage_with_templates as $page) {
        $onepage_menu = array();
        $onepage_menu['onepage_nav' . $page->ID] = $page->post_title;
        $onepages_for_navs = array_merge($onepages_for_navs, $onepage_menu);
    }
    // add_action('after_setup_theme', 'onepage_menu_setup');
    // function onepage_menu_setup() {
    //     global $onepages_for_navs;
    //     register_nav_menus($onepages_for_navs);
    // }
    // Google Font Options
    include_once file_require(ADMIN_PATH . 'functions/google-fonts.php');
    $google_fonts = get_google_webfonts();
    $google_webfonts = array();
    $google_webfonts["default"] = "Default (Helvetica, Arial, sans-serif)";
    foreach ($google_fonts as $font) {
        $google_webfonts[$font['family']] = $font['family'];
    }
    // Less Options
    $smof_vars = get_theme_options_less_vars();
    $less_options_orig = get_less_variables();
    $less_options = array();
    foreach ($less_options_orig as $opt) {
        if ($opt['variable'] != 'less-heading') {
            $page_vars = get_page_options_less_vars();
            $opt_value = tt_getmeta('less_' . $opt['variable']);
            if (isset($page_vars[$opt['variable']]) && !empty($page_vars[$opt['variable']])) {
                $opt_value = $page_vars[$opt['variable']];
            } elseif (!empty($opt_value)) {
                $opt_value = $opt_value;
            } elseif (isset($smof_vars[$opt['variable']]) && !empty($smof_vars[$opt['variable']])) {
                $opt_value = $smof_vars[$opt['variable']];
            } else {
                $opt_value = $opt['value'];
            }
            //$less_options[] = array( $opt['variable']=>$opt_value );
            $less_options = array_merge($less_options, array($opt['variable'] => $opt_value));
        }
    }
    global $post;
    $less_content = "";
    if (isset($post->ID)) {
        $less_vars = tt_getmeta("less_page_variables", $post->ID);
        $brand_primary = tt_getmeta("less_brand-primary", $post->ID);
        if ($less_vars == "" && $brand_primary != "") {
            $less_arr = array();
            foreach ($less_options as $key => $val) {
                if ($key != 'less-heading') {
                    $current_val = tt_getmeta('less_' . $key, $post->ID);
                    $current_val = $current_val != "" ? $current_val : $val;
                    $less_arr = array_merge($less_arr, array($key => $current_val));
                }
            }
            $encoded_arr = base64_encode(serialize($less_arr));
            if (count(get_post_meta($post->ID, "_less_page_variables")) == 0) {
                add_post_meta($post->ID, "_less_page_variables", $encoded_arr, true);
            } else {
                update_post_meta($post->ID, "_less_page_variables", $encoded_arr);
            }
        }
        $encoded_str = tt_getmeta("less_page_variables", $post->ID);
        $less_content = get_less_editor_content($encoded_str);
        update_post_meta($post->ID, "_up_less_editor", $less_content);
    }
    $url = ADMIN_IMAGES;
    $tmp_arr = array('onepage' => array('label' => 'One Page Options', 'post_type' => 'page', 'items' => array(array('name' => 'onepages', 'type' => 'onepage', 'label' => 'Pages for One Page Template', 'desc' => 'Build page with Multi pages', 'default' => ''), array('name' => 'onepages_names', 'type' => 'text', 'label' => 'Pages Names', 'default' => ''), array('name' => 'onepages_links', 'type' => 'text', 'label' => 'Pages Links', 'default' => ''), array('name' => 'onepage_menu', 'type' => 'checkbox', 'label' => 'Use One Page Menu', 'desc' => 'If you check this option, current pages menu would be selected pages titles.'))), 'page' => array('label' => 'Page Options', 'post_type' => 'page', 'items' => array(array('name' => 'slider', 'type' => 'select', 'label' => 'Top slider', 'option' => $tt_sliders, 'desc' => 'Select a slider that you\'ve created on LayerSlider and Revolution Slider. This slider shows up between header and page title.'), array('type' => 'checkbox', 'name' => 'slider_top', 'label' => 'Slider at the top of Page', 'default' => '0', 'desc' => 'If you wanna show fullscreen slider, hope you like this option.'), array('type' => 'checkbox', 'name' => 'hide_topbar', 'label' => 'Hide top bar', 'default' => '0', 'desc' => 'If you wanna hide top bar when Topbar enabled in theme option.'), array('name' => 'page_layout', 'type' => 'thumbs', 'label' => 'Page Layout', 'default' => 'full', 'option' => array('full' => ADMIN_DIR . 'assets/images/1col.png', 'right' => ADMIN_DIR . 'assets/images/2cr.png', 'left' => ADMIN_DIR . 'assets/images/2cl.png'), 'desc' => 'Select Page Layout (Fullwidth | Right Sidebar | Left Sidebar)'), array('name' => 'sidebar', 'type' => 'select', 'label' => 'Page Sidebar', 'default' => 'page-sidebar', 'option' => $tt_sidebars, 'desc' => 'You should select a sidebar If you\'ve chosen page layout with sidebar. And if you need an unique sidebar for this page, you have to create new one on Theme Options => <b>Custom Sidebar</b> and then add your Appearence => <b>Widgets</b>. Later on select it here.'), array('type' => 'checkbox', 'name' => 'title_show', 'label' => 'Title (show/hide)', 'default' => '1'), array('type' => 'start_group', 'name' => 'title_options', 'visible' => true), array('type' => 'select', 'name' => 'title_align', 'label' => 'Title align', 'default' => 'left', 'option' => array('left' => 'Left', 'center' => 'Center', 'right' => 'Right'), 'desc' => 'Title alignment'), array('name' => 'title_padding', 'type' => 'text', 'label' => 'Title Spacing from Top', 'default' => '', 'desc' => 'Page Title Sections padding-top size (px)'), array('name' => 'title_padding_bottom', 'type' => 'text', 'label' => 'Title Spacing from Bottom', 'default' => '', 'desc' => 'Page Title Sections padding-bottom size (px)'), array('name' => 'teaser', 'type' => 'textarea', 'label' => 'Teaser text', 'default' => '', 'desc' => 'Add description text which shows up at bottom of Page Title.'), array('type' => 'checkbox', 'name' => 'title_color', 'label' => 'Title text invert color ?', 'default' => '0', 'desc' => 'If this option not active, text color is default color'), array('type' => 'colorpicker', 'name' => 'title_bg_color', 'label' => 'Title background color', 'default' => get_theme_mod('title_bg_color'), 'desc' => 'Page Title Section Background Color'), array('type' => 'background', 'name' => 'title_bg', 'label' => 'Title Background Image', 'default' => '', 'desc' => 'If you want to show your title area beautiful, this option exactly you need.'), array('type' => 'colorpicker', 'name' => 'title_overlay_color', 'label' => 'Overlay Color', 'default' => '', 'desc' => 'It needs when use background image'), array('name' => 'title_overlay_opacity', 'type' => 'text', 'label' => 'Overlay Opacity', 'default' => '', 'desc' => 'Overlay opacity value: [0, 0.1, ..1]'), array('name' => 'title_options', 'type' => 'end_group'))), 'ultimate_page' => array('label' => 'Ultimate Page Options', 'post_type' => 'page', 'items' => array(array('type' => 'select', 'name' => 'up_layout', 'label' => 'Container Layout', 'default' => 'full', 'option' => array('full' => 'Full (Wide) Layout', 'boxed' => 'Boxed Layout')), array('name' => 'up_margin_top', 'type' => 'number', 'label' => 'Site Top Spacing', 'default' => '0', 'desc' => 'Please set site top margin space. Number value in pixels. Note: This style appects only on large screens (>1200px).'), array('name' => 'up_margin_bottom', 'type' => 'number', 'label' => 'Site Bottom Spacing', 'default' => '0', 'desc' => 'Please set site bottom margin space. Number value in pixels. Note: This style appects only on large screens (>1200px).'), array('type' => 'background', 'name' => 'up_background_img', 'label' => 'Background Image', 'default' => '', 'desc' => 'Add here your body background image. Image and custom pattern are acceptable.'), array('name' => 'up_logo', 'type' => 'image', 'label' => 'Logo', 'default' => '', 'desc' => 'If you wanna use custom logo on this page, you should use it.'), array('type' => 'checkbox', 'name' => 'up_header', 'label' => 'Enable Header', 'default' => '1'), array('type' => 'start_group', 'name' => 'up_header_group', 'visible' => true), array('type' => 'checkbox', 'name' => 'up_topbar', 'label' => 'Enable Topbar', 'default' => '0'), array('type' => 'checkbox', 'name' => 'up_fixed_menu', 'label' => 'Navigation Fixed at Top', 'default' => '0', 'desc' => 'Navigation menu stays fixed at top of your site when you scroll down.'), array('type' => 'checkbox', 'name' => 'up_enable_logo', 'label' => 'Enable Logo', 'default' => '1', 'desc' => 'You can remove logo.'), array('type' => 'checkbox', 'name' => 'up_enable_search', 'label' => 'Enable Search Box', 'default' => '1', 'desc' => 'You can remove search box at next of your main menu.'), array('type' => 'select', 'name' => 'up_menu_align', 'label' => 'Menu Alignment', 'default' => 'center', 'option' => array('left' => 'Left', 'center' => 'Center', 'right' => 'Right'), 'desc' => 'Menu alignment (left, center, right).'), array('type' => 'checkbox', 'name' => 'up_header_transparent', 'label' => 'Enable Header Transparent', 'default' => '0', 'desc' => 'If you enable this option, header is transparent.'), array('name' => 'up_header_height', 'type' => 'number', 'label' => 'Header Height', 'default' => isset($smof_vars['header-height']) ? (int) $smof_vars['header-height'] : '80', 'desc' => 'Default : 80px'), array('name' => 'up_header_group', 'type' => 'end_group'), array('type' => 'checkbox', 'name' => 'up_footer', 'label' => 'Enable Footer', 'default' => '1'), array('type' => 'checkbox', 'name' => 'up_footer_bar', 'label' => 'Enable Footer Bar', 'default' => '1'), array('type' => 'select', 'name' => 'up_menu_font', 'label' => 'Menu Font', 'default' => isset($smof_vars['base-font-menu']) ? str_replace("'", '', str_replace('"', '', $smof_vars['base-font-menu'])) : 'default', 'option' => $google_webfonts, 'desc' => 'Menu link font including sub menu links and description texts.'), array('type' => 'select', 'name' => 'up_heading_font', 'label' => 'Heading Font', 'default' => isset($smof_vars['base-font-heading']) ? str_replace("'", '', str_replace('"', '', $smof_vars['base-font-heading'])) : 'default', 'option' => $google_webfonts, 'desc' => 'All heading tags (H1 through H6) font incluing Post title and Widget title etc.'), array('type' => 'select', 'name' => 'up_body_font', 'label' => 'Body Font', 'default' => isset($smof_vars['base-font-body']) ? str_replace("'", '', str_replace('"', '', $smof_vars['base-font-body'])) : 'default', 'option' => $google_webfonts, 'desc' => 'Main body text.'))), 'less_option' => array('label' => 'Less Options (Current Page)', 'post_type' => 'page', 'items' => array(array('name' => 'up_less_editor', 'type' => 'textarea', 'label' => 'LESS Editor', 'default' => $less_content))));
    return $tmp_arr;
}