<?php
/**
 * WordPress.com-specific functions and definitions.
 * This file is centrally included from `wp-content/mu-plugins/wpcom-theme-compat.php`.
 *
 * @package Chunk
 * @since Chunk 1.1
 */

/**
 * Adds support for wp.com-specific theme functions
 */
function chunk_add_wpcom_support() {
	global $themecolors;

	/**
	 * Set a default theme color array.
	 */
	$themecolors = array(
		'bg'     => 'ffffff',
		'border' => 'eeeeee',
		'text'   => '555555',
		'link'   => '36bcab',
		'url'    => '36bcab',
	);

	add_theme_support( 'print-style' );
}
add_action( 'after_setup_theme', 'chunk_add_wpcom_support' );

/**
 * Dequeue font styles.
 *
 * We don't want to enqueue the font scripts if the blog
 * has WP.com Custom Design and is using a 'Headings' font.
 */
function chunk_dequeue_fonts() {
	if ( class_exists( 'TypekitData' ) && class_exists( 'CustomDesign' ) && CustomDesign::is_upgrade_active() ) {
		$customfonts = TypekitData::get( 'families' );

		if ( $customfonts && $customfonts['headings']['id'] && $customfonts['site-title']['id'] )
			wp_dequeue_style( 'oswald' );
	}
}
add_action( 'wp_enqueue_scripts', 'chunk_dequeue_fonts' );

//WordPress.com specific styles
function chunk_wpcom_styles() {
	wp_enqueue_style( 'chunk-wpcom', get_template_directory_uri() . '/inc/style-wpcom.css', '20130005' );
}
add_action( 'wp_enqueue_scripts', 'chunk_wpcom_styles' );