function enlightenment_general_settings()
{
    add_settings_section('navbar', __('Navbar', 'enlightenment'), '__return_false', 'enlightenment_theme_options');
    add_settings_section('page_header', __('Page Header', 'enlightenment'), '__return_false', 'enlightenment_theme_options');
    add_settings_section('post_thumbnails', __('Post Thumbnails', 'enlightenment'), '__return_false', 'enlightenment_theme_options');
    add_settings_section('entry_meta', __('Entry Meta', 'enlightenment'), '__return_false', 'enlightenment_theme_options');
    add_settings_section('lightbox', __('Lightbox', 'enlightenment'), '__return_false', 'enlightenment_theme_options');
    add_settings_section('posts_nav', __('Posts Navigation', 'enlightenment'), '__return_false', 'enlightenment_theme_options');
    add_settings_section('footer', __('Footer', 'enlightenment'), '__return_false', 'enlightenment_theme_options');
    add_settings_field('navbar_position', __('Navbar Position', 'enlightenment'), 'enlightenment_select_box', 'enlightenment_theme_options', 'navbar', array('name' => 'navbar_position', 'options' => array('fixed-top' => 'Fixed on Top', 'static-top' => 'Static')));
    add_settings_field('navbar_background', __('Navbar Background Color', 'enlightenment'), 'enlightenment_select_box', 'enlightenment_theme_options', 'navbar', array('name' => 'navbar_background', 'options' => array('default' => 'Light', 'inverse' => 'Dark')));
    add_settings_field('navbar_size', __('Navbar Size', 'enlightenment'), 'enlightenment_select_box', 'enlightenment_theme_options', 'navbar', array('name' => 'navbar_size', 'options' => array('small' => 'Small', 'large' => 'Large'), 'description' => __('Menu Item Descriptions are hidden in the small Navbar.', 'enlightenment')));
    add_settings_field('shrink_navbar', __('Shrink Navbar', 'enlightenment'), 'enlightenment_checkbox', 'enlightenment_theme_options', 'navbar', array('name' => 'shrink_navbar', 'label' => __('Shrink Fixed Navbar when scrolling', 'enlightenment')));
    add_settings_field('blog_header_text', __('Blog Pages Header Text', 'enlightenment'), 'enlightenment_text_input', 'enlightenment_theme_options', 'page_header', array('name' => 'blog_header_text'));
    add_settings_field('blog_header_description', __('Blog Pages Description', 'enlightenment'), 'enlightenment_textarea', 'enlightenment_theme_options', 'page_header', array('name' => 'blog_header_description'));
    add_settings_field('thumbnail_header_image', __('Thumbnail Header Image', 'enlightenment'), 'enlightenment_checkbox', 'enlightenment_theme_options', 'page_header', array('name' => 'thumbnail_header_image', 'label' => __('Display post thumbnail as header image on single posts', 'enlightenment')));
    add_settings_field('thumbnails_crop_flag', __('Crop Thumbnails', 'enlightenment'), 'enlightenment_checkbox', 'enlightenment_theme_options', 'post_thumbnails', array('name' => 'thumbnails_crop_flag', 'label' => __('Hard crop post thumbnails', 'enlightenment'), 'description' => sprintf(__('After changing this option, it is recommended to recreate your thumbnails using a plugin like <a href="%s">AJAX Thumbnail Rebuild</a>', 'enlightenment'), esc_url('http://wordpress.org/extend/plugins/ajax-thumbnail-rebuild/'))));
    add_settings_field('thumbnails_size', __('Thumbnails Size', 'enlightenment'), 'enlightenment_select_box', 'enlightenment_theme_options', 'post_thumbnails', array('name' => 'thumbnails_size', 'options' => array('small' => 'Small', 'large' => 'Large')));
    $post_meta = enlightenment_theme_option('post_meta');
    add_settings_field('post_meta', __('Post Meta', 'enlightenment'), 'enlightenment_checkboxes', 'enlightenment_theme_options', 'entry_meta', array('boxes' => array(array('name' => 'post_meta[author]', 'label' => __('Author', 'enlightenment'), 'checked' => $post_meta['author']), array('name' => 'post_meta[date]', 'label' => __('Date', 'enlightenment'), 'checked' => $post_meta['date']), array('name' => 'post_meta[category]', 'label' => __('Category', 'enlightenment'), 'checked' => $post_meta['category']), array('name' => 'post_meta[comments]', 'label' => __('Comments', 'enlightenment'), 'checked' => $post_meta['comments']), array('name' => 'post_meta[edit_link]', 'label' => __('Edit Post Link', 'enlightenment'), 'checked' => $post_meta['edit_link']))));
    if (class_exists('Jetpack') && in_array('custom-content-types', Jetpack::get_active_modules())) {
        $post_meta = enlightenment_theme_option('portfolio_meta');
        add_settings_field('portfolio_meta', __('Portfolio Meta', 'enlightenment'), 'enlightenment_checkboxes', 'enlightenment_theme_options', 'entry_meta', array('boxes' => array(array('name' => 'portfolio_meta[author]', 'label' => __('Author', 'enlightenment'), 'checked' => $post_meta['author']), array('name' => 'portfolio_meta[date]', 'label' => __('Date', 'enlightenment'), 'checked' => $post_meta['date']), array('name' => 'portfolio_meta[project_type]', 'label' => __('Project Type', 'enlightenment'), 'checked' => $post_meta['project_type']), array('name' => 'portfolio_meta[comments]', 'label' => __('Comments', 'enlightenment'), 'checked' => $post_meta['comments']), array('name' => 'portfolio_meta[edit_link]', 'label' => __('Edit Project Link', 'enlightenment'), 'checked' => $post_meta['edit_link']))));
    }
    add_settings_field('enable_lightbox', __('Enable Lightbox', 'enlightenment'), 'enlightenment_checkbox', 'enlightenment_theme_options', 'lightbox', array('name' => 'enable_lightbox', 'label' => __('Open image links in a lightbox', 'enlightenment')));
    add_settings_field('lightbox_script', __('Lightbox Script', 'enlightenment'), 'enlightenment_select_box', 'enlightenment_theme_options', 'lightbox', array('name' => 'lightbox_script', 'options' => array('colorbox' => __('Colorbox', 'enlightenment'), 'fluidbox' => __('Fluidbox', 'enlightenment'), 'imagelightbox' => __('ImageLightbox.js', 'enlightenment'))));
    add_settings_field('posts_nav_style', __('Posts Navigation Style', 'enlightenment'), 'enlightenment_select_box', 'enlightenment_theme_options', 'posts_nav', array('name' => 'posts_nav_style', 'options' => array('static' => __('Static Links', 'enlightenment'), 'ajax' => 'AJAX Links', 'infinite' => 'Infinite Scroll')));
    add_settings_field('posts_nav_labels', __('Static Links Labels', 'enlightenment'), 'enlightenment_select_box', 'enlightenment_theme_options', 'posts_nav', array('name' => 'posts_nav_labels', 'options' => array('next/prev' => __('Next Page / Previous Page', 'enlightenment'), 'older/newer' => __('Older Posts / Newer Posts', 'enlightenment'), 'earlier/later' => __('Earlier Posts / Later Posts', 'enlightenment'), 'numbered' => __('Numbered Pagination', 'enlightenment'))));
    add_settings_field('copyright_notice', __('Copyright Notice', 'enlightenment'), 'enlightenment_text_input', 'enlightenment_theme_options', 'footer', array('name' => 'copyright_notice', 'description' => __('%year% = Current Year, %sitename% = Website Name', 'enlightenment')));
    add_settings_field('credit_links', __('Credit Links', 'enlightenment'), 'enlightenment_checkboxes', 'enlightenment_theme_options', 'footer', array('boxes' => array(array('name' => 'theme_credit_link', 'label' => 'Theme Credit Link'), array('name' => 'author_credit_link', 'label' => 'Theme Author Credit Link'), array('name' => 'wordpress_credit_link', 'label' => 'WordPress Credit Link'))));
}
function enlightenment_archive_layouts_merge_theme_options($layouts)
{
    $options = enlightenment_theme_option('layouts');
    if (!is_array($options)) {
        $options = array();
    }
    return array_merge($layouts, $options);
}
function enlightenment_page_design_form($post)
{
    wp_nonce_field('enlightenment_page_design_form', 'enlightenment_page_design_form_nonce');
    echo enlightenment_open_tag('p');
    global $wp_post_types;
    enlightenment_select_box(array('name' => 'enlightenment_page_design', 'value' => '' != get_post_meta($post->ID, '_enlightenment_page_design', true) ? get_post_meta($post->ID, '_enlightenment_page_design', true) : enlightenment_theme_option('page_design'), 'options' => array('boxed' => 'Boxed', 'full-screen' => 'Full Screen')));
    echo enlightenment_close_tag('p');
}
function enlightenment_archive_grids_merge_theme_options($grids)
{
    $options = enlightenment_theme_option('grids');
    if (!is_array($options)) {
        $options = array();
    }
    return array_merge($grids, $options);
}
function enlightenment_register_dynamic_sidebars()
{
    $sidebars = (array) enlightenment_theme_option('sidebars');
    foreach ($sidebars as $sidebar => $atts) {
        $before = '';
        $after = '';
        if (current_theme_supports('enlightenment-grid-loop') && isset($atts['grid'])) {
            $grid = enlightenment_get_grid($atts['grid']);
            $before = enlightenment_open_tag('div', $grid['entry_class']);
            $after = enlightenment_close_tag('div');
        }
        register_sidebar(array('name' => $atts['name'], 'id' => $sidebar, 'before_widget' => $before . '<aside id="%1$s" class="widget %2$s">' . "\n", 'after_widget' => '</aside>' . $after . "\n", 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>' . "\n"));
    }
}
function enlightenment_page_builder_form($post)
{
    if (!isset($_GET['post'])) {
        _e('Please save this post as Draft to use the Page Builder.', 'enlightenment');
        return;
    }
    wp_nonce_field('enlightenment_page_builder_form', 'enlightenment_page_builder_form_nonce');
    echo enlightenment_open_tag('p');
    enlightenment_checkbox(array('name' => 'enlightenment_default_template_hooks', 'checked' => '' == get_post_meta($post->ID, '_enlightenment_page_builder', true), 'label' => sprintf(__('Use default template hooks for %1$s', 'enlightenment'), $post->post_type)));
    echo enlightenment_close_tag('p');
    $template = enlightenment_get_template(get_post_type());
    $template['hooks'] = array_keys(enlightenment_template_hooks());
    do_action('enlightenment_before_page_builder');
    echo enlightenment_open_tag('div', 'template-hooks');
    foreach ($template['hooks'] as $hook) {
        $atts = enlightenment_get_template_hook($hook);
        $available_functions = $atts['functions'];
        $template_hooks = get_post_meta($post->ID, '_enlightenment_page_builder', true);
        if ('' == $template_hooks) {
            $template_hooks = enlightenment_theme_option('template_hooks');
        }
        if (isset($template_hooks[enlightenment_current_template()][$hook])) {
            $hooked_functions = $template_hooks[enlightenment_current_template()][$hook];
        } else {
            $hooked_functions = array();
            global $wp_filter;
            if (isset($wp_filter[$hook]) && isset($wp_filter[$hook][10])) {
                foreach ($wp_filter[$hook][10] as $function) {
                    $hooked_functions[] = $function['function'];
                }
            }
        }
        $available_functions = array_diff($available_functions, $hooked_functions);
        if (!empty($available_functions) || !empty($hooked_functions)) {
            echo '<h2>' . esc_attr($atts['name']) . '</h2>';
            enlightenment_template_hook_actions(array('hook' => $hook, 'name' => 'enlightenment_page_builder[' . $hook . ']', 'class' => 'template-hooks'));
        }
    }
    echo enlightenment_close_tag();
    do_action('enlightenment_after_page_builder');
}
function enlightenment_add_post_formats_actions()
{
    if (is_admin() || is_singular() || '' == get_post_format()) {
        return;
    }
    $hooks = enlightenment_theme_option('template_hooks');
    $format = get_post_format();
    if (current_theme_supports('enlightenment-grid-loop') && !enlightenment_is_lead_post()) {
        $format = $format . '-teaser';
    }
    if (isset($hooks[$format])) {
        foreach ($hooks[$format] as $hook => $functions) {
            remove_all_actions($hook, 10);
            if (!empty($functions)) {
                foreach ($functions as $function) {
                    add_action($hook, $function, 10, apply_filters('enlightenment_template_actions_accepted_args', 2));
                }
            }
        }
    }
}
Exemple #8
0
function enlightenment_validate_logo_theme_options($input)
{
    $logo = enlightenment_theme_option('logo');
    if ('' != $input['logo']['image']) {
        $input['logo']['image'] = intval($input['logo']['image']);
        $post = get_post($input['logo']['image']);
        if ('attachment' != $post->post_type || false === strpos($post->post_mime_type, 'image')) {
            $input['logo']['image'] = $logo['image'];
        }
    }
    $input['logo']['width'] = intval($input['logo']['width']);
    $input['logo']['height'] = intval($input['logo']['height']);
    if (!is_int($input['logo']['width'])) {
        $input['logo']['width'] = current_theme_supports('enlightenment-logo', 'width');
    }
    if (!is_int($input['logo']['height'])) {
        $input['logo']['height'] = current_theme_supports('enlightenment-logo', 'height');
    }
    $input['logo']['crop_flag'] = isset($input['logo']['crop_flag']);
    $input['logo']['insert_site_title'] = isset($input['logo']['insert_site_title']);
    $input['logo']['hide_text'] = isset($input['logo']['hide_text']);
    return $input;
}
Exemple #9
0
function enlightenment_web_fonts_theme_options_args($args)
{
    $subsets = enlightenment_theme_option('subsets');
    if (!empty($subsets)) {
        $args['subsets'] = $subsets;
    }
    $google_api_key = enlightenment_theme_option('google_api_key');
    if (!empty($google_api_key) || '' === $google_api_key) {
        $args['google_api_key'] = esc_attr($google_api_key);
    }
    $filter_by_subsets = enlightenment_theme_option('filter_by_subsets');
    if (!empty($filter_by_subsets) || false === $filter_by_subsets) {
        $args['filter_by_subsets'] = $filter_by_subsets;
    }
    $live_preview_fonts = enlightenment_theme_option('live_preview_fonts');
    if (!empty($live_preview_fonts) || false === $live_preview_fonts) {
        $args['live_preview_fonts'] = $live_preview_fonts;
    }
    $sort_fonts_by = enlightenment_theme_option('sort_fonts_by');
    if (!empty($sort_fonts_by)) {
        $args['sort_fonts_by'] = $sort_fonts_by;
    }
    return $args;
}
Exemple #10
0
function enlightenment_theme_settings_override_value($args)
{
    global $pagenow;
    if ('themes.php' == $pagenow && isset($_GET['page']) && current_theme_supports('enlightenment-theme-settings', 'menu_slug') == $_GET['page']) {
        if (false === strpos($args['name'], '[')) {
            if (doing_filter('enlightenment_checkbox_args') && empty($args['checked'])) {
                $checkbox = enlightenment_theme_option($args['name']);
                $args['checked'] = !empty($checkbox);
            } elseif (empty($args['value'])) {
                $args['value'] = enlightenment_theme_option($args['name']);
            }
        }
    }
    return $args;
}
Exemple #11
0
function enlightenment_auto_validate_font_options($input)
{
    global $wp_settings_fields;
    foreach ($wp_settings_fields as $page) {
        foreach ($page as $section) {
            foreach ($section as $field) {
                if (isset($field['args']['name']) && false !== strpos($field['args']['name'], '[')) {
                    continue;
                }
                if ('enlightenment_font_options' == $field['callback']) {
                    $input[$field['args']['name'] . '_font_family'] = enlightenment_validate_font_family($input[$field['args']['name'] . '_font_family'], enlightenment_theme_option($field['args']['name'] . '_font_family'));
                    $input[$field['args']['name'] . '_font_size'] = enlightenment_validate_font_size($input[$field['args']['name'] . '_font_size'], enlightenment_theme_option($field['args']['name'] . '_font_size'));
                    $input[$field['args']['name'] . '_font_style'] = enlightenment_validate_font_style($input[$field['args']['name'] . '_font_style'], enlightenment_theme_option($field['args']['name'] . '_font_style'));
                    $input[$field['args']['name'] . '_font_color'] = enlightenment_validate_color($input[$field['args']['name'] . '_font_color'], enlightenment_theme_option($field['args']['name'] . '_font_color'));
                }
            }
        }
    }
    return $input;
}
function enlightenment_validate_post_formats_editor($input)
{
    foreach ($input['template_hooks'] as $post_format => $hooks) {
        if ($post_format != $input['select_post_format']) {
            unset($input['template_hooks'][$post_format]);
        }
    }
    $post_format = $input['select_post_format'];
    unset($input['select_post_format']);
    foreach ($input['template_hooks'][$post_format] as $hook => $functions) {
        if (!in_array($hook, array_keys(enlightenment_entry_hooks()))) {
            unset($input['template_hooks'][$post_format][$hook]);
        }
    }
    foreach ($input['template_hooks'][$post_format] as $hook => $functions) {
        $functions = explode(',', $functions);
        $atts = enlightenment_get_template_hook($hook);
        foreach ($functions as $key => $function) {
            if (!in_array($function, $atts['functions'])) {
                unset($functions[$key]);
            }
        }
        $input['template_hooks'][$post_format][$hook] = $functions;
    }
    $option = enlightenment_theme_option('template_hooks', array());
    $input['template_hooks'] = array_merge($option, $input['template_hooks']);
    return $input;
}
function enlightenment_validate_unlimited_sidebars($input)
{
    global $wp_registered_sidebars;
    $parse = false;
    // var_dump($wp_registered_sidebars);
    foreach ($wp_registered_sidebars as $sidebar => $atts) {
        if (isset($input['sidebars'][$sidebar]['delete'])) {
            unset($input['sidebars'][$sidebar]);
            $parse = true;
        }
    }
    if (isset($input['submit-sidebars']) || $parse) {
        if (!isset($input['sidebars'])) {
            $input['sidebars'] = array();
        }
        foreach ($input['sidebars'] as $sidebar => $atts) {
            if ('' == $atts['name']) {
                unset($input['sidebars'][$sidebar]);
            }
            if (0 !== strpos($sidebar, 'sidebar-')) {
                unset($input['sidebars'][$sidebar]);
            }
            if (!is_numeric(str_replace('sidebar-', '', $sidebar))) {
                unset($input['sidebars'][$sidebar]);
            }
        }
        $template = $input['select_template'];
        unset($input['select_template']);
        foreach ($input['sidebar_locations'] as $tpl => $atts) {
            if ($tpl != $template) {
                unset($input['sidebar_locations'][$tpl]);
            }
        }
        $locations = enlightenment_sidebar_locations();
        foreach ($input['sidebar_locations'][$template] as $location => $sidebar) {
            if ('' != $location) {
                if (!array_key_exists($location, $locations)) {
                    unset($input['sidebar_locations'][$location]);
                }
                if (!array_key_exists($sidebar, $wp_registered_sidebars)) {
                    unset($input['sidebar_locations'][$location]);
                }
            }
        }
    }
    $option = enlightenment_theme_option('sidebar_locations', array());
    $input['sidebar_locations'] = array_merge($option, $input['sidebar_locations']);
    return $input;
}
Exemple #14
0
function enlightenment_print_background_color_option($selector, $option, $echo = true)
{
    $default_options = enlightenment_default_theme_options();
    if (!isset($default_options[$option])) {
        $default_options[$option] = false;
    }
    $defaults = apply_filters('enlightenment_print_background_color_option_settings_defaults', $default_options[$option], $selector, $option);
    $color = apply_filters('enlightenment_print_background_color_option_settings', enlightenment_theme_option($option), $selector, $option);
    $output = '';
    if ($color != $defaults) {
        $output = "{$selector} {\n";
        if (is_array($color)) {
            if (isset($color['transparent']) && $color['transparent']) {
                $output .= "\tbackground-color: transparent;\n";
            } else {
                if (strlen($color['hex']) === 4) {
                    list($r, $g, $b) = sscanf($color['hex'], "#%1x%1x%1x");
                    $r .= $r;
                    $g .= $g;
                    $b .= $b;
                } else {
                    list($r, $g, $b) = sscanf($color['hex'], "#%2x%2x%2x");
                }
                if (isset($color['alpha'])) {
                    $a = absint($color['alpha']) / 100;
                } else {
                    $a = 1;
                }
                $output .= "\tbackground-color: rgba({$r}, {$g}, {$b}, {$a});\n";
            }
        } else {
            $output .= sprintf("\tbackground-color: %s;\n", esc_attr($color));
        }
        $output .= "}\n";
    }
    $output = apply_filters('enlightenment_print_color_option', $output);
    if (!$echo) {
        return $output;
    }
    echo $output;
}
function enlightenment_registered_sidebars_merge_theme_options($sidebars)
{
    $options = (array) enlightenment_theme_option('sidebars');
    $defaults = enlightenment_registered_sidebars_default_atts();
    foreach ($options as $sidebar => $atts) {
        $options[$sidebar] = array_merge($defaults, $atts);
    }
    $sidebars = array_merge($sidebars, $options);
    return $sidebars;
}
function enlightenment_add_post_teaser_actions()
{
    if (current_theme_supports('enlightenment-grid-loop') && !enlightenment_is_lead_post() && '' == get_post_format()) {
        $hooks = enlightenment_theme_option('template_hooks');
        $template = 'post-teaser';
        if (isset($hooks[$template])) {
            foreach ($hooks[$template] as $hook => $functions) {
                remove_all_actions($hook, 10);
                if (!empty($functions)) {
                    foreach ($functions as $function) {
                        add_action($hook, $function, 10, apply_filters('enlightenment_template_actions_accepted_args', 2));
                    }
                }
            }
        } else {
            enlightenment_teaser_entry_hooks();
        }
    }
}
Exemple #17
0
function enlightenment_print_background_color_option($selector, $option, $echo = true)
{
    $defaults = enlightenment_default_theme_options();
    $output = '';
    if (enlightenment_theme_option($option) != $defaults[$option]) {
        $output = "{$selector} {\n";
        $output .= sprintf("\tbackground-color: %s;\n", enlightenment_theme_option($option));
        $output .= "}\n";
    }
    $output = apply_filters('enlightenment_print_color_option', $output);
    if (!$echo) {
        return $output;
    }
    echo $output;
}
Exemple #18
0
 function enlightenment_close_sidebar_row()
 {
     $sidebars = enlightenment_theme_option('sidebars');
     $sidebar = enlightenment_dynamic_sidebar();
     if (isset($sidebars[$sidebar]) && isset($sidebars[$sidebar]['grid'])) {
         $grid = enlightenment_get_grid($sidebars[$sidebar]['grid']);
         if (1 < $grid['content_columns']) {
             enlightenment_close_container();
         }
     }
 }
function enlightenment_validate_template_editor($input)
{
    foreach ($input['template_hooks'] as $template => $hooks) {
        if ($template != $input['select_template']) {
            unset($input['template_hooks'][$template]);
        }
    }
    $template = $input['select_template'];
    unset($input['select_template']);
    $atts = enlightenment_get_template($template);
    foreach ($input['template_hooks'][$template] as $hook => $functions) {
        if (!in_array($hook, $atts['hooks'])) {
            unset($input['template_hooks'][$template][$hook]);
        }
    }
    foreach ($input['template_hooks'][$template] as $hook => $functions) {
        $functions = explode(',', $functions);
        $atts = enlightenment_get_template_hook($hook);
        foreach ($functions as $key => $function) {
            if (!in_array($function, $atts['functions'])) {
                unset($functions[$key]);
            }
        }
        $input['template_hooks'][$template][$hook] = $functions;
    }
    $option = enlightenment_theme_option('template_hooks', array());
    $input['template_hooks'] = array_merge($option, $input['template_hooks']);
    return $input;
}
Exemple #20
0
function enlightenment_hide_site_title_text_theme_option($option)
{
    $logo = enlightenment_theme_option('logo');
    if (is_array($logo) && isset($logo['hide_text'])) {
        return $logo['hide_text'];
    }
    return $option;
}
function enlightenment_background_options($args, $echo = true)
{
    $defaults = array('class' => '', 'id' => '', 'description' => '');
    $args = wp_parse_args($args, $defaults);
    if (!isset($args['name']) || empty($args['name'])) {
        _doing_it_wrong(__FUNCTION__, __('Please specify a name attribute for your background options.', 'enlightenment'), '1.1.0');
        return;
    }
    $description = $args['description'];
    unset($args['description']);
    $option = enlightenment_theme_option($args['name']);
    $color_picker_args = array('name' => $args['name'] . '[color]', 'value' => isset($args['value']['color']) ? $args['value']['color'] : $option['color'], 'transparent' => true, 'alpha' => true, 'class' => 'background_color' . (!empty($args['class']) ? ' ' . $args['class'] . '_background_color' : ''), 'id' => !empty($args['id']) ? $args['id'] . '_background_color' : '');
    $image_uploader_args = array('name' => $args['name'] . '[image]', 'value' => isset($args['value']['image']) ? $args['value']['image'] : $option['image'], 'class' => 'background_image' . (!empty($args['class']) ? ' ' . $args['class'] . '_background_image' : ''), 'id' => !empty($args['id']) ? $args['id'] . '_background_image' : '', 'upload_button_text' => __('Choose Image', 'enlightenment'), 'uploader_title' => __('Select Image', 'enlightenment'), 'uploader_button_text' => __('Use Image', 'enlightenment'), 'remove_button_text' => __('Remove Image', 'enlightenment'), 'mime_type' => 'image', 'thumbnail' => 'thumbnail');
    $position_args = array('name' => $args['name'] . '[position]', 'value' => isset($args['value']['position']) ? $args['value']['position'] : $option['position'], 'class' => 'background_position' . (!empty($args['class']) ? ' ' . $args['class'] . '_background_position' : ''), 'id' => !empty($args['id']) ? $args['id'] . '_background_position' : '', 'options' => array('center' => __('Center', 'enlightenment'), 'center-top' => __('Center Top', 'enlightenment'), 'center-bottom' => __('Center Bottom', 'enlightenment'), 'left-top' => __('Left Top', 'enlightenment'), 'left-center' => __('Left Center', 'enlightenment'), 'left-bottm' => __('Left Bottom', 'enlightenment'), 'right-top' => __('Right Top', 'enlightenment'), 'right-center' => __('Right Center', 'enlightenment'), 'right-bottom' => __('Right Bottom', 'enlightenment')));
    $repeat_args = array('name' => $args['name'] . '[repeat]', 'value' => isset($args['value']['repeat']) ? $args['value']['repeat'] : $option['repeat'], 'class' => 'background_repeat' . (!empty($args['class']) ? ' ' . $args['class'] . '_background_repeat' : ''), 'id' => !empty($args['id']) ? $args['id'] . '_background_repeat' : '', 'options' => array('no-repeat' => __('No Repeat', 'enlightenment'), 'repeat' => __('Tiled', 'enlightenment'), 'repeat-x' => __('Tiled Horizontally', 'enlightenment'), 'repeat-y' => __('Tiled Vertically', 'enlightenment')));
    $size_args = array('name' => $args['name'] . '[size]', 'value' => isset($args['value']['size']) ? $args['value']['size'] : $option['size'], 'class' => 'background_size' . (!empty($args['class']) ? ' ' . $args['class'] . '_background_size' : ''), 'id' => !empty($args['id']) ? $args['id'] . '_background_size' : '', 'options' => array('auto' => __('Scaled', 'enlightenment'), 'cover' => __('Cover', 'enlightenment'), 'contain' => __('Contained', 'enlightenment')));
    $scroll_args = array('name' => $args['name'] . '[scroll]', 'value' => isset($args['value']['scroll']) ? $args['value']['scroll'] : $option['scroll'], 'class' => 'background_scroll' . (!empty($args['class']) ? ' ' . $args['class'] . '_background_scroll' : ''), 'id' => !empty($args['id']) ? $args['id'] . '_background_scroll' : '', 'options' => array('scroll' => __('Scroll', 'enlightenment'), 'fixed' => __('Fixed', 'enlightenment'), 'parallax' => __('Parallax', 'enlightenment')));
    $output = enlightenment_open_tag('fieldset', 'background-options');
    $output .= enlightenment_color_picker($color_picker_args, false);
    $output .= enlightenment_upload_media($image_uploader_args, false);
    $output .= enlightenment_select_box($position_args, false);
    $output .= enlightenment_select_box($repeat_args, false);
    $output .= enlightenment_select_box($size_args, false);
    $output .= enlightenment_select_box($scroll_args, false);
    $output .= enlightenment_close_tag('fieldset');
    $output .= empty($description) ? '' : '<p class="description">' . strip_tags($description, '<a><abbr><img>') . '</p>';
    $output = apply_filters('enlightenment_background_options', $output, $args);
    if (!$echo) {
        return $output;
    }
    echo $output;
}
Exemple #22
0
function enlightenment_filter_credit_links_args($args)
{
    $theme_credit_link = esc_url('https://www.onedesigns.com/themes/enlightenment');
    $author_credit_link = esc_url('https://www.onedesigns.com/');
    $wordpress_credit_link = esc_url('https://wordpress.org/');
    if (enlightenment_theme_option('theme_credit_link') && enlightenment_theme_option('author_credit_link') && enlightenment_theme_option('wordpress_credit_link')) {
        $args['text'] = sprintf(__('Built with <a href="%1$s">Enlightenment Theme</a> by <a href="%2$s" rel="designer">One Designs</a> and <a href="%3$s" rel="generator">WordPress</a>', 'enlightenment'), $theme_credit_link, $author_credit_link, $wordpress_credit_link) . "\n";
    } elseif (enlightenment_theme_option('theme_credit_link') && enlightenment_theme_option('author_credit_link') && !enlightenment_theme_option('wordpress_credit_link')) {
        $args['text'] = sprintf(__('Built with <a href="%1$s">Enlightenment Theme</a> by <a href="%2$s" rel="designer">One Designs</a>', 'enlightenment'), $theme_credit_link, $author_credit_link) . "\n";
    } elseif (enlightenment_theme_option('theme_credit_link') && !enlightenment_theme_option('author_credit_link') && enlightenment_theme_option('wordpress_credit_link')) {
        $args['text'] = sprintf(__('Built with <a href="%1$s">Enlightenment Theme</a> and <a href="%2$s" rel="generator">WordPress</a>', 'enlightenment'), $theme_credit_link, $wordpress_credit_link) . "\n";
    } elseif (!enlightenment_theme_option('theme_credit_link') && enlightenment_theme_option('author_credit_link') && enlightenment_theme_option('wordpress_credit_link')) {
        $args['text'] = sprintf(__('Designed by <a href="%1$s" rel="designer">One Designs</a> with <a href="%2$s" rel="generator">WordPress</a>', 'enlightenment'), $author_credit_link, $wordpress_credit_link) . "\n";
    } elseif (enlightenment_theme_option('theme_credit_link') && !enlightenment_theme_option('author_credit_link') && !enlightenment_theme_option('wordpress_credit_link')) {
        $args['text'] = sprintf(__('Built with <a href="%1$s">Enlightenment Theme</a>', 'enlightenment'), $theme_credit_link) . "\n";
    } elseif (!enlightenment_theme_option('theme_credit_link') && enlightenment_theme_option('author_credit_link') && !enlightenment_theme_option('wordpress_credit_link')) {
        $args['text'] = sprintf(__('Designed by <a href="%1$s" rel="designer">One Designs</a>', 'enlightenment'), $author_credit_link) . "\n";
    } elseif (!enlightenment_theme_option('theme_credit_link') && !enlightenment_theme_option('author_credit_link') && enlightenment_theme_option('wordpress_credit_link')) {
        $args['text'] = sprintf(__('Powered by <a href="%1$s" rel="generator">WordPress</a>', 'enlightenment'), $wordpress_credit_link) . "\n";
    } else {
        $args['echo'] = false;
    }
    return $args;
}
function enlightenment_validate_unlimited_sidebars($input)
{
    global $wp_registered_sidebars;
    if (!isset($input['sidebars'])) {
        $input['sidebars'] = array();
    }
    $delete = array();
    foreach ($input['sidebars'] as $sidebar => $atts) {
        if (isset($input['sidebars'][$sidebar]['delete'])) {
            $delete[] = $sidebar;
        }
    }
    foreach ($input['sidebars'] as $sidebar => $atts) {
        if (empty($atts['name'])) {
            unset($input['sidebars'][$sidebar]);
            continue;
        }
        if (0 !== strpos($sidebar, 'sidebar-')) {
            unset($input['sidebars'][$sidebar]);
        }
        if (!is_numeric(str_replace('sidebar-', '', $sidebar))) {
            unset($input['sidebars'][$sidebar]);
        }
        $input['sidebars'][$sidebar]['display_title'] = isset($input['sidebars'][$sidebar]['display_title']) && false !== $input['sidebars'][$sidebar]['display_title'];
        $input['sidebars'][$sidebar]['display_description'] = isset($input['sidebars'][$sidebar]['display_description']) && false !== $input['sidebars'][$sidebar]['display_description'];
        if (current_theme_supports('enlightenment-bootstrap')) {
            $input['sidebars'][$sidebar]['contain_widgets'] = isset($input['sidebars'][$sidebar]['contain_widgets']) && false !== $input['sidebars'][$sidebar]['contain_widgets'];
        }
        $input['sidebars'][$sidebar]['background'] = enlightenment_validate_background_options($input['sidebars'][$sidebar]['background']);
        $input['sidebars'][$sidebar]['sidebar_title_color'] = enlightenment_validate_color($input['sidebars'][$sidebar]['sidebar_title_color']);
        $input['sidebars'][$sidebar]['sidebar_text_color'] = enlightenment_validate_color($input['sidebars'][$sidebar]['sidebar_text_color']);
        $input['sidebars'][$sidebar]['widgets_background_color'] = enlightenment_validate_color($input['sidebars'][$sidebar]['widgets_background_color']);
        $input['sidebars'][$sidebar]['widgets_title_color'] = enlightenment_validate_color($input['sidebars'][$sidebar]['widgets_title_color']);
        $input['sidebars'][$sidebar]['widgets_text_color'] = enlightenment_validate_color($input['sidebars'][$sidebar]['widgets_text_color']);
        $input['sidebars'][$sidebar]['widgets_link_color'] = enlightenment_validate_color($input['sidebars'][$sidebar]['widgets_link_color']);
    }
    $option = enlightenment_theme_option('sidebars');
    if (!is_array($option)) {
        $option = array();
    }
    $input['sidebars'] = array_merge($option, $input['sidebars']);
    foreach ($input['sidebars'] as $sidebar => $atts) {
        if (in_array($sidebar, $delete)) {
            unset($input['sidebars'][$sidebar]);
        }
    }
    if (isset($input['select_template'])) {
        $template = $input['select_template'];
        unset($input['select_template']);
        foreach ($input['sidebar_locations'] as $tpl => $atts) {
            if ($tpl != $template) {
                unset($input['sidebar_locations'][$tpl]);
            }
        }
        $locations = enlightenment_sidebar_locations();
        foreach ($input['sidebar_locations'][$template] as $location => $sidebar) {
            if ('' != $location) {
                if (!array_key_exists($location, $locations)) {
                    unset($input['sidebar_locations'][$location]);
                }
                if (!array_key_exists($sidebar, $wp_registered_sidebars)) {
                    unset($input['sidebar_locations'][$location]);
                }
            }
        }
        $option = enlightenment_theme_option('sidebar_locations', array());
        $input['sidebar_locations'] = array_merge($option, $input['sidebar_locations']);
    }
    return $input;
}