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

function shine_on_theme_colors() {
	global $themecolors;

	/**
	 * Set a default theme color array for WP.com.
	 *
	 * @global array $themecolors
	 */
	if ( ! isset( $themecolors ) ) :
		$themecolors = array(
			'bg'     => 'f5efe3',
			'border' => 'eae0cc',
			'text'   => '312940',
			'link'   => 'd88a40',
			'url'    => 'd88a40',
		);
	endif;
}
add_action( 'after_setup_theme', 'shine_on_theme_colors' );


/*
 * De-queue Google fonts if custom fonts are being used instead
 */
function shine_on_dequeue_fonts() {
	if ( class_exists( 'TypekitData' ) && class_exists( 'CustomDesign' ) && CustomDesign::is_upgrade_active() ) {
		$customfonts = TypekitData::get( 'families' );
		if ( $customfonts && $customfonts['site-title']['id'] && $customfonts['headings']['id'] && $customfonts['body-text']['id'] ) {
			wp_dequeue_style( 'shine-on-headland-one' );
		}
	}
}

add_action( 'wp_enqueue_scripts', 'shine_on_dequeue_fonts' );

//WordPress.com specific styles
function shine_on_wpcom_styles() {
	wp_enqueue_style( 'shine_on-wpcom', get_stylesheet_directory_uri() . '/inc/style-wpcom.css', '120213' );
}
add_action( 'wp_enqueue_scripts', 'shine_on_wpcom_styles', 99 );