<?php
/**
 * Youplay Plugins Activation
 *
 * @package Youplay
 */
require get_template_directory() . '/inc/lib/class-tgm-plugin-activation.php';


/**
 * Register Required Plugins
 */
add_action( 'tgmpa_register', 'youplay_register_required_plugins' );
function youplay_register_required_plugins() {

    /**
     * Array of plugin arrays. Required keys are name and slug.
     * If the source is NOT from the .org repo, then source is also required.
     */
    $plugins = array(

        // Visual Composer
        array(
            'name'               => 'WPBakery Visual Composer',
            'slug'               => 'js_composer',
            'source'             => 'http://a.nkdev.info/wp-plugins/js_composer.zip',
            'required'           => true
        ),

        // Rev Slider
        array(
            'name'               => 'Slider Revolution',
            'slug'               => 'revslider',
            'source'             => 'http://a.nkdev.info/wp-plugins/revslider.zip',
            'required'           => false
        ),

        // WooCommerce
        array(
            'name'      => 'WooCommerce',
            'slug'      => 'woocommerce',
            'required'  => false,
            'version'   => '2.4.12'
        ),

        // BuddyPress
        array(
            'name'      => 'BuddyPress',
            'slug'      => 'buddypress',
            'required'  => false,
            'version'   => '2.4.3'
        ),

        // bbPress
        array(
            'name'      => 'bbPress',
            'slug'      => 'bbpress',
            'required'  => false,
            'version'   => '2.5.8'
        ),

        // Envato Market
        array(
            'name'      => 'Envato Market',
            'slug'      => 'envato-market',
            'required'  => false,
            'source'    => 'http://envato.github.io/wp-envato-market/dist/envato-market.zip'
        ),

    );

    $config = array(
        
        'default_path'      => '',      /* Default absolute path to pre-packaged plugins */
        'has_notices'       => true,    /* Show admin notices or not */
        'is_automatic'      => true,    /* Automatically activate plugins after installation or not */
       
    );

    tgmpa( $plugins, $config );

}


// Visual Composer as theme
add_action( 'vc_before_init', 'youplay_vc_setastheme' );
function youplay_vc_setastheme() {
    vc_set_as_theme();
}

// Revolution Slider as theme
if(function_exists( 'set_revslider_as_theme' )) {
    add_action( 'init', 'youplay_rev_setastheme' );
    function youplay_rev_setastheme() {
        set_revslider_as_theme();
    }
}