function esplanade_validate_theme_options($input)
{
    if (isset($input['submit-general']) || isset($input['reset-general'])) {
        if (!in_array($input['home_page_layout'], array('grid', 'blog'))) {
            $input['home_page_layout'] = esplanade_get_option('home_page_layout');
        }
        if (!is_numeric(absint($input['home_page_excerpts'])) || $input['home_page_excerpts'] > get_option('posts_per_page') || '' == $input['home_page_excerpts']) {
            $input['home_page_excerpts'] = esplanade_get_option('home_page_excerpts');
        } else {
            $input['home_page_excerpts'] = absint($input['home_page_excerpts']);
        }
        $input['slider'] = isset($input['slider']) ? true : false;
        $input['location'] = isset($input['location']) ? true : false;
        $input['breadcrumbs'] = isset($input['breadcrumbs']) ? true : false;
        $input['lightbox'] = isset($input['lightbox']) ? true : false;
        if (!in_array($input['posts_nav_labels'], array('next/prev', 'older/newer', 'earlier/later', 'numbered'))) {
            $input['posts_nav_labels'] = esplanade_get_option('posts_nav_labels');
        }
        $input['fancy_dropdowns'] = isset($input['fancy_dropdowns']) ? true : false;
        $input['post_nav'] = isset($input['post_nav']) ? true : false;
        $input['facebook'] = isset($input['facebook']) ? true : false;
        $input['twitter'] = isset($input['twitter']) ? true : false;
        $input['google'] = isset($input['google']) ? true : false;
        $input['pinterest'] = isset($input['pinterest']) ? true : false;
        $input['author_box'] = isset($input['author_box']) ? true : false;
        $input['copyright_notice'] = esc_attr($input['copyright_notice']);
        $input['theme_credit_link'] = isset($input['theme_credit_link']) ? true : false;
        $input['author_credit_link'] = isset($input['author_credit_link']) ? true : false;
        $input['wordpress_credit_link'] = isset($input['wordpress_credit_link']) ? true : false;
    } elseif (isset($input['submit-layout']) || isset($input['reset-layout'])) {
        if (!in_array($input['layout'], array('content-sidebar', 'sidebar-content', 'sidebar-content-sidebar', 'no-sidebars', 'full-width'))) {
            $input['layout'] = esplanade_get_option('layout');
        }
        $input['header_height'] = absint($input['header_height']);
        $input['sidebar_size'] = str_replace('"', '', $input['sidebar_size']);
        $input['sidebar_size'] = str_replace('%', '', $input['sidebar_size']);
        $input['sidebar_size'] = '"' . filter_var($input['sidebar_size'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION) . '%"';
        $input['sidebar_left_size'] = str_replace('"', '', $input['sidebar_left_size']);
        $input['sidebar_left_size'] = str_replace('%', '', $input['sidebar_left_size']);
        $input['sidebar_left_size'] = '"' . filter_var($input['sidebar_left_size'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION) . '%"';
        $input['sidebar_right_size'] = str_replace('"', '', $input['sidebar_right_size']);
        $input['sidebar_right_size'] = str_replace('%', '', $input['sidebar_right_size']);
        $input['sidebar_right_size'] = '"' . filter_var($input['sidebar_right_size'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION) . '%"';
        $input['header_image_height'] = absint($input['header_image_height']);
    } elseif (isset($input['submit-design']) || isset($input['reset-general'])) {
        if (!in_array($input['color_scheme'], array('neutral', 'sand', 'nature', 'earth'))) {
            $input['color_scheme'] = esplanade_get_option('color_scheme');
        }
        $input['user_css'] = esc_html($input['user_css']);
    } elseif (isset($input['submit-typography']) || isset($input['reset-typography'])) {
        $fonts = esplanade_available_fonts();
        $units = array('px', 'pt', 'em', '%');
        $input['body_font'] = array_key_exists($input['body_font'], $fonts) ? $input['body_font'] : esplanade_get_option('body_font');
        $input['headings_font'] = array_key_exists($input['headings_font'], $fonts) ? $input['headings_font'] : esplanade_get_option('headings_font');
        $input['content_font'] = array_key_exists($input['content_font'], $fonts) ? $input['content_font'] : esplanade_get_option('content_font');
        $input['body_font_size'] = filter_var($input['body_font_size'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
        $input['body_font_size_unit'] = in_array($input['body_font_size_unit'], $units) ? $input['body_font_size_unit'] : esplanade_get_option('body_font_size_unit');
        $input['body_line_height'] = filter_var($input['body_line_height'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
        $input['body_line_height_unit'] = in_array($input['body_line_height_unit'], $units) ? $input['body_line_height_unit'] : esplanade_get_option('body_line_height_unit');
        $input['h1_font_size'] = filter_var($input['h1_font_size'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
        $input['h1_font_size_unit'] = in_array($input['h1_font_size_unit'], $units) ? $input['h1_font_size_unit'] : esplanade_get_option('h1_font_size_unit');
        $input['h2_font_size'] = filter_var($input['h2_font_size'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
        $input['h2_font_size_unit'] = in_array($input['h2_font_size_unit'], $units) ? $input['h2_font_size_unit'] : esplanade_get_option('h2_font_size_unit');
        $input['h3_font_size'] = filter_var($input['h3_font_size'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
        $input['h3_font_size_unit'] = in_array($input['h3_font_size_unit'], $units) ? $input['h3_font_size_unit'] : esplanade_get_option('h3_font_size_unit');
        $input['h4_font_size'] = filter_var($input['h4_font_size'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
        $input['h4_font_size_unit'] = in_array($input['h4_font_size_unit'], $units) ? $input['h4_font_size_unit'] : esplanade_get_option('h4_font_size_unit');
        $input['headings_line_height'] = filter_var($input['headings_line_height'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
        $input['headings_line_height_unit'] = in_array($input['headings_line_height_unit'], $units) ? $input['headings_line_height_unit'] : esplanade_get_option('headings_line_height_unit');
        $input['content_font_size'] = filter_var($input['content_font_size'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
        $input['content_font_size_unit'] = in_array($input['content_font_size_unit'], $units) ? $input['content_font_size_unit'] : esplanade_get_option('content_font_size_unit');
        $input['content_line_height'] = filter_var($input['content_line_height'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
        $input['content_line_height_unit'] = in_array($input['content_line_height_unit'], $units) ? $input['content_line_height_unit'] : esplanade_get_option('content_line_height_unit');
        $input['mobile_font_size'] = filter_var($input['mobile_font_size'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
        $input['mobile_font_size_unit'] = in_array($input['mobile_font_size_unit'], $units) ? $input['mobile_font_size_unit'] : esplanade_get_option('mobile_font_size_unit');
        $input['mobile_line_height'] = filter_var($input['mobile_line_height'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
        $input['mobile_line_height_unit'] = in_array($input['mobile_line_height_unit'], $units) ? $input['mobile_line_height_unit'] : esplanade_get_option('mobile_line_height_unit');
        $input['body_color'] = esc_attr($input['body_color']);
        $input['headings_color'] = esc_attr($input['headings_color']);
        $input['content_color'] = esc_attr($input['content_color']);
        $input['links_color'] = esc_attr($input['links_color']);
        $input['links_hover_color'] = esc_attr($input['links_hover_color']);
        $input['menu_color'] = esc_attr($input['menu_color']);
        $input['menu_hover_color'] = esc_attr($input['menu_hover_color']);
        $input['sidebar_color'] = esc_attr($input['sidebar_color']);
        $input['sidebar_title_color'] = esc_attr($input['sidebar_title_color']);
        $input['sidebar_links_color'] = esc_attr($input['sidebar_links_color']);
        $input['footer_color'] = esc_attr($input['footer_color']);
        $input['footer_title_color'] = esc_attr($input['footer_title_color']);
        $input['footer_links_color'] = esc_attr($input['footer_links_color']);
        $input['copyright_color'] = esc_attr($input['copyright_color']);
        $input['copyright_links_color'] = esc_attr($input['copyright_links_color']);
    } elseif (isset($input['submit-seo']) || isset($input['reset-seo'])) {
        $tags = array('h1', 'h2', 'h3', 'p', 'div');
        foreach ($input as $key => $tag) {
            if ('reset-seo' != $key && !in_array($tag, $tags)) {
                $input[$key] = esplanade_get_option($key);
            }
        }
    }
    if (isset($input['reset-general']) || isset($input['reset-layout']) || isset($input['reset-design']) || isset($input['reset-typography']) || isset($input['reset-seo'])) {
        $default_options = esplanade_default_options();
        foreach ($input as $name => $value) {
            $input[$name] = $default_options[$name];
        }
    }
    $input = wp_parse_args($input, get_option('esplanade_theme_options', esplanade_default_options()));
    return $input;
}
示例#2
0
        echo sprintf(__('Powered by %1$s and %2$s', 'esplanade'), $author_credit_link, $wordpress_credit_link);
        ?>
						<?php 
    } elseif (esplanade_get_option('theme_credit_link') && !esplanade_get_option('author_credit_link') && !esplanade_get_option('wordpress_credit_link')) {
        ?>
							<?php 
        echo sprintf(__('Powered by %1$s', 'esplanade'), $theme_credit_link);
        ?>
						<?php 
    } elseif (!esplanade_get_option('theme_credit_link') && esplanade_get_option('author_credit_link') && !esplanade_get_option('wordpress_credit_link')) {
        ?>
							<?php 
        echo sprintf(__('Powered by %1$s', 'esplanade'), $author_credit_link);
        ?>
						<?php 
    } elseif (!esplanade_get_option('theme_credit_link') && !esplanade_get_option('author_credit_link') && esplanade_get_option('wordpress_credit_link')) {
        ?>
							<?php 
        echo sprintf(__('Powered by %1$s', 'esplanade'), $wordpress_credit_link);
        ?>
						<?php 
    }
    ?>
					</p>
				<?php 
}
?>
				<div class="clear"></div>
			</div><!-- #copyright -->
		</div><!-- #footer -->
	</div><!-- #wrapper -->
 /**
  * Display notification no posts were found
  *
  * @since Esplanade 1.0
  */
 function esplanade_copyright_notice()
 {
     $copyright = esplanade_get_option('copyright_notice');
     $copyright = str_replace('%year%', date('Y'), $copyright);
     $copyright = str_replace('%blogname%', get_bloginfo('name'), $copyright);
     echo $copyright;
 }
	<div id="container">
		<section id="content">
			<?php 
if (have_posts()) {
    the_post();
    ?>
				<article <?php 
    post_class();
    ?>
 id="post-<?php 
    the_ID();
    ?>
">
					<div class="entry">
						<?php 
    if (esplanade_get_option('breadcrumbs')) {
        ?>
							<div id="location">
								<?php 
        esplanade_breadcrumbs();
        ?>
							</div><!-- #location -->
						<?php 
    }
    ?>
						<header class="entry-header">
							<h1 class="entry-title"><?php 
    the_title();
    ?>
</h1>
						</header><!-- .entry-header -->
示例#5
0
					</div><!-- #location -->
				<?php 
}
?>
				<?php 
esplanade_404();
?>
			</div><!-- .entry -->
		</section><!-- #content -->
		<?php 
if ('sidebar-content-sidebar' == esplanade_get_option('layout')) {
    ?>
				<?php 
    get_sidebar('left');
    ?>
			</div><!-- #content-sidebar-wrap -->
			<?php 
    get_sidebar('right');
    ?>
		<?php 
} elseif ('no-sidebars' != esplanade_get_option('layout') && 'full-width' != esplanade_get_option('layout')) {
    ?>
			<?php 
    get_sidebar();
    ?>
		<?php 
}
?>
	</div><!-- #container -->
<?php 
get_footer();