<commit_before><?php

/*  functions.php
 *
 *  Copernicus functions and definitions.

 *  @package    WordPress
 *  @subpackage Copernicus
 *  @since      Copernicus 1.0
 *
 */


/*  Setup
 *
 *   Sets up theme defaults and registers the various WordPress features that 
 *   Copernicus supports:
 * 
 *   - RSS feed links added to preamble
 *   - Default core markup switched to valid HTML5 for forms
 *   - Post formats (see http://codex.wordpress.org/Post_Formats)
 *   - Post thumbnails
 *   - Header icon
 * 
 *   @uses add_theme_support() To add support for automatic feed links, post 
 *   formats, and post thumbnails.
 *   @uses register_nav_menu() To add support for a navigation menu.
 *   @uses set_post_thumbnail_size() To set a custom post thumbnail size.
 * 
 *   @since Copernicus 1.0
 *
 */

function copernicus_setup()
{
    add_theme_support('automatic-feed-links');
    add_theme_support('html5', array('search-form', 'comment-form', 'comment-list'));
    add_theme_support('post-formats', array('aside','image', 'link'));
    add_theme_support('post-thumbnails');
    add_theme_support('custom-header', array(
        'width'         => 50,
        'height'        => 50,
        'default-image' => get_template_directory_uri() . '/img/header.png',
        'uploads'       => true,
       ));

    set_post_thumbnail_size(688);

    register_nav_menu('primary', __('Navigation Menu', 'copernicus'));

}

add_action('after_setup_theme', 'copernicus_setup');


/*  Scripts and styles
 * 
 *  Enqueues scripts and styles for the front end:
 *   
 *  - JavaScript for pages with threaded comments
 *  - Theme-specific JavaScript
 *  - Main stylesheet
 * 
 *  @since Copernicus 1.0
 *
 */

function copernicus_scripts_styles()
{
    wp_enqueue_script(
        'copernicus-responsive-nav',
        get_template_directory_uri() . '/features/responsive-nav.min.js'
    );
    wp_enqueue_style(
        'copernicus-style',
        get_template_directory_uri().'/styles/main.css'
    );
}

function copernicus_colourize()
{
    wp_enqueue_style(
        'copernicus-colours',
        get_template_directory_uri().'/styles/colour.css'
    );
}

add_action('wp_enqueue_scripts', 'copernicus_scripts_styles');
add_action('wp_enqueue_scripts', 'copernicus_colourize');


/*  WordPress enhancements
 * 
 *  Enables two things that WordPress doesn't have out of the box: SVG support
 *  and featured images in RSS feeds.
 *
 *  @since Copernicus 1.0
 *
 */

function copernicus_mime_types($mimes)
{
    $mimes['svg'] = 'image/svg+xml';
    return $mimes;
}

add_filter('upload_mimes', 'copernicus_mime_types');

require_once('features/add-featured-image-to-rss-feed.php');


/*  Simplifications
 * 
 *  Removes version and pointless links from head for security and simplicity.
 *  Removes version queries from script and style requests to improve caching.
 *  Removes comment-related widgets because Copernicus supports neither
 *  neither comments nor widgets, and the Recent Comments widget injects
 *  pointless CSS into every page.
 *<commit_msg>Better support for child theme colour modifications<commit_after><?php

/*  functions.php
 *
 *  Copernicus functions and definitions.
 *
 *  @package    WordPress
 *  @subpackage Copernicus
 *  @since      Copernicus 1.0
 *
 */


/*  Setup
 *
 *   Sets up theme defaults and registers the various WordPress features that 
 *   Copernicus supports:
 * 
 *   - RSS feed links added to preamble
 *   - Default core markup switched to valid HTML5 for forms
 *   - Post formats (see http://codex.wordpress.org/Post_Formats)
 *   - Post thumbnails
 *   - Header icon
 * 
 *   @uses add_theme_support() To add support for automatic feed links, post 
 *   formats, and post thumbnails.
 *   @uses register_nav_menu() To add support for a navigation menu.
 *   @uses set_post_thumbnail_size() To set a custom post thumbnail size.
 * 
 *   @since Copernicus 1.0
 *
 */

function copernicus_setup()
{
    add_theme_support('automatic-feed-links');
    add_theme_support('html5', array('search-form', 'comment-form', 'comment-list'));
    add_theme_support('post-formats', array('aside','image', 'link'));
    add_theme_support('post-thumbnails');
    add_theme_support('custom-header', array(
        'width'         => 50,
        'height'        => 50,
        'default-image' => get_template_directory_uri() . '/img/header.png',
        'uploads'       => true,
       ));

    set_post_thumbnail_size(688);

    register_nav_menu('primary', __('Navigation Menu', 'copernicus'));

}

add_action('after_setup_theme', 'copernicus_setup');


/*  Scripts and styles
 * 
 *  Enqueues scripts and styles for the front end:
 *   
 *  - JavaScript for pages with threaded comments
 *  - Theme-specific JavaScript
 *  - Main stylesheet
 * 
 *  @since Copernicus 1.0
 *
 */

function copernicus_scripts_styles()
{
    wp_enqueue_script(
        'copernicus-responsive-nav',
        get_template_directory_uri() . '/features/responsive-nav.min.js'
    );
    wp_enqueue_style(
        'copernicus-style',
        get_template_directory_uri().'/styles/main.css'
    );
}

if (!function_exists('colourize')) {
    function colourize()
    {
        wp_enqueue_style(
            'copernicus-colours',
            get_template_directory_uri().'/styles/colour.css'
        );
    }
}

add_action('wp_enqueue_scripts', 'copernicus_scripts_styles');
add_action('wp_enqueue_scripts', 'colourize');


/*  WordPress enhancements
 * 
 *  Enables two things that WordPress doesn't have out of the box: SVG support
 *  and featured images in RSS feeds.
 *
 *  @since Copernicus 1.0
 *
 */

function copernicus_mime_types($mimes)
{
    $mimes['svg'] = 'image/svg+xml';
    return $mimes;
}

add_filter('upload_mimes', 'copernicus_mime_types');

require_once('features/add-featured-image-to-rss-feed.php');


/*  Simplifications
 * 
 *  Removes version and pointless links from head for security and simplicity.
 *  Removes version queries from script and style requests to improve caching.
 *  Removes comment-related widgets because Copernicus supports neither
 *  neither comments nor widgets, and the Recent Comments widget injects
 *  pointless CSS into every page.
 *
{'fraction_non_alphanumeric': 0.11328061965467162, 'fraction_numerical': 0.005486525738260448, 'mean_word_length': 3.3403361344537816, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3772613', 'n_tokens_mistral': 1998, 'n_tokens_neox': 1915, 'n_words': 476}