<?php
namespace WooSwatches;

/**
 * Protect direct access
 */
if ( ! defined( 'ABSPATH' ) ) exit;

add_action('plugins_loaded', function() {
    
    /**
     * Compatibility check with Pro plugin
     */
    if ( is_woo_compatible() && is_pro_compatible() ) {
        /**
         * Activation redirects
         */
        register_activation_hook( GS_WOO_SWATCHES_PLUGIN_FILE, 'WooSwatches\on_activation' );

        /**
         * Init Appsero
         */
        gs_appsero_init();

        /**
         * Load Main Plugin
         */
        require_once GS_WOO_SWATCHES_PLUGIN_DIR . 'includes/plugin.php';
    }
    
    /**
     * Remove Reviews Metadata on plugin Deactivation.
     */
    register_deactivation_hook( GS_WOO_SWATCHES_PLUGIN_FILE, 'WooSwatches\on_deactivation' );
    
    /**
     * Plugins action links
     */
    add_filter( 'plugin_action_links_' . plugin_basename( GS_WOO_SWATCHES_PLUGIN_FILE ), 'WooSwatches\add_pro_link' );

    /**
     * Org Review Link
     */
    add_filter( 'plugin_row_meta', 'WooSwatches\plugin_org_review_link', 10, 2 );
    
    /**
     * Plugins Load Text Domain
     */
    add_action( 'init', 'WooSwatches\gs_load_textdomain' );

}, -20 );