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

function pictorico_theme_colors() {
	global $themecolors;

	/**
	 * Set a default theme color array for WP.com.
	 *
	 * @global array $themecolors
	 */
	if ( ! isset( $themecolors ) ) :
		$themecolors = array(
			'bg' => 'e7f2f8',
			'border' => 'cccccc',
			'text' => '444444',
			'link' => '07a1f2',
			'url' => '07a1f2',
		);
	endif;
}
add_action( 'after_setup_theme', 'pictorico_theme_colors' );

/*
 * De-queue Google fonts if custom fonts are being used instead
 */
function pictorico_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( 'pictorico-open-sans-condensed' );
			wp_dequeue_style( 'pictorico-pt-serif' );
		}
	}
}

add_action( 'wp_enqueue_scripts', 'pictorico_dequeue_fonts' );

/**
 * Adds support for WP.com print styles and responsive videos
 */
function pictorico_theme_support() {
	add_theme_support( 'print-style' );
	add_theme_support( 'jetpack-responsive-videos' );
}
add_action( 'after_setup_theme', 'pictorico_theme_support' );

//WordPress.com specific styles
function pictorico_wpcom_styles() {
	wp_enqueue_style( 'pictorico-wpcom', get_template_directory_uri() . '/inc/style-wpcom.css', '20140414' );
}
add_action( 'wp_enqueue_scripts', 'pictorico_wpcom_styles' );