<?php
/* Custom Feeds for Instagram support functions
------------------------------------------------------------------------------- */

// Theme init priorities:
// 9 - register other filters (for installer, etc.)
if (!function_exists('ostende_instagram_feed_theme_setup9')) {
	add_action( 'after_setup_theme', 'ostende_instagram_feed_theme_setup9', 9 );
	function ostende_instagram_feed_theme_setup9() {

		add_filter('ostende_filter_merge_styles_responsive',		'ostende_instagram_merge_styles_responsive');
		
		if (is_admin()) {
			add_filter( 'ostende_filter_tgmpa_required_plugins',	'ostende_instagram_feed_tgmpa_required_plugins' );
		}
	}
}

// Filter to add in the required plugins list
if ( !function_exists( 'ostende_instagram_feed_tgmpa_required_plugins' ) ) {
	function ostende_instagram_feed_tgmpa_required_plugins($list=array()) {
		if (ostende_storage_isset('required_plugins', 'instagram-feed')) {
			$list[] = array(
					'name' 		=> ostende_storage_get_array('required_plugins', 'instagram-feed'),
					'slug' 		=> 'instagram-feed',
					'required' 	=> false
				);
		}
		return $list;
	}
}

// Check if Custom Feeds for Instagram installed and activated
if ( !function_exists( 'ostende_exists_instagram_feed' ) ) {
	function ostende_exists_instagram_feed() {
		return defined('SBIVER');
	}
}


// Merge responsive styles
if ( !function_exists( 'ostende_instagram_merge_styles_responsive' ) ) {
	function ostende_instagram_merge_styles_responsive($list) {
		if (ostende_exists_instagram_feed()) {
			$list[] = 'plugins/instagram/_instagram-responsive.scss';
		}
		return $list;
	}
}
?>