<?php
/* ThemeREX Updater support functions
------------------------------------------------------------------------------- */

// Theme init
if (!function_exists('healthcoach_trx_updater_theme_setup')) {
    add_action( 'healthcoach_action_before_init_theme', 'healthcoach_trx_updater_theme_setup' );
    function healthcoach_trx_updater_theme_setup() {

        if (is_admin()) {
            add_filter( 'healthcoach_filter_importer_required_plugins',	'healthcoach_trx_updater_importer_required_plugins', 10, 2 );
            add_filter( 'healthcoach_filter_required_plugins',				'healthcoach_trx_updater_required_plugins' );
        }
    }
}

// Check if RevSlider installed and activated
if ( !function_exists( 'healthcoach_exists_trx_updater' ) ) {
    function healthcoach_exists_trx_updater() {
        return defined( 'TRX_UPDATER_VERSION' );
    }
}

// Filter to add in the required plugins list
if ( !function_exists( 'healthcoach_trx_updater_required_plugins' ) ) {
    
    function healthcoach_trx_updater_required_plugins($list=array()) {
        $list[] = array(
            'name' 		=> 'ThemeREX Updater',
            'slug' 		=> 'trx_updater',
            'version'   => '1.4.1',
            'source'	=> healthcoach_get_file_dir('plugins/install/trx_updater.zip'),
            'required' 	=> false
        );

        return $list;
    }
}