function enlightenment_current_template()
{
    global $pagenow;
    if ('post.php' == $pagenow && isset($_GET['action']) && 'edit' == $_GET['action']) {
        $template = get_post_type();
    } elseif (isset($_GET['template'])) {
        $template = esc_attr($_GET['template']);
    } elseif (isset($_GET['format'])) {
        $template = esc_attr($_GET['format']);
    } elseif (isset($_GET['tab']) && 'post_formats' == $_GET['tab']) {
        $template = esc_attr(key(enlightenment_post_formats()));
    } else {
        $templates = enlightenment_templates();
        reset($templates);
        $template = key($templates);
    }
    return $template;
}
function enlightenment_post_formats_available_functions($hooks)
{
    $functions = array();
    if (isset($_GET['format'])) {
        $post_format = esc_attr($_GET['format']);
    } elseif (isset($_POST['enlightenment_theme_options']['select_post_format'])) {
        $post_format = esc_attr($_POST['enlightenment_theme_options']['select_post_format']);
    } else {
        $post_format = key(enlightenment_post_formats());
    }
    $post_format = str_replace('-teaser', '', $post_format);
    if ('gallery' == $post_format) {
        $functions[] = 'enlightenment_entry_gallery';
    } elseif ('video' == $post_format) {
        $functions[] = 'enlightenment_entry_video';
    } elseif ('audio' == $post_format) {
        $functions[] = 'enlightenment_entry_audio';
    } elseif ('image' == $post_format) {
        $functions[] = 'enlightenment_entry_image';
    } elseif ('quote' == $post_format) {
        $functions[] = 'enlightenment_entry_blockquote';
    } elseif ('status' == $post_format) {
        $functions[] = 'enlightenment_entry_author_avatar';
    }
    $functions = apply_filters('enlightenment_post_formats_available_functions', $functions);
    $hooks['enlightenment_entry_header']['functions'] = array_merge($hooks['enlightenment_entry_header']['functions'], $functions);
    $hooks['enlightenment_entry_content']['functions'] = array_merge($hooks['enlightenment_entry_content']['functions'], $functions);
    return $hooks;
}