<?php
/**
 * The plugin bootstrap file
 *
 * This file is read by WordPress to generate the plugin information in the plugin
 * admin area. This file also includes all of the dependencies used by the plugin,
 * registers the activation and deactivation functions, and defines a function
 * that starts the plugin.
 *
 * @link              #
 * @since             1.0.0
 * @package           commenting-feature
 *
 * @wordpress-plugin
 * Plugin Name:       Multicollab: Content Team Collaboration and Editorial Workflow
 * Description:       Google Docs-style inline commenting and collaboration in the block editor. Add comments, manage permissions, and keep feedback in WordPress.
 * Version:           5.3
 * Author:            Multicollab
 * Author URI:        https://www.multicollab.com/
 * License:           GPL-2.0+
 * License URI:       http://www.gnu.org/licenses/gpl-2.0.txt
 * Text Domain:       commenting-feature
 * Domain Path:       /languages
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly
}
if ( defined( 'WP_CLI' ) && WP_CLI ) {
	return;
}

// Plugin version.
define( 'COMMENTING_BLOCK_VERSION', '5.3' );

// Define constants.
define( 'COMMENTING_BLOCK_URL', plugin_dir_url( __FILE__ ) );
define( 'COMMENTING_BLOCK_DIR', plugin_dir_path( __FILE__ ) );
define( 'COMMENTING_BLOCK_BASE', plugin_basename( __FILE__ ) );
define( 'COMMENTING_NONCE', 'BFaYbfonJ=n@R<8kId|nN8x #W[-S>1%Sazm%<' );

add_filter( 'plugin_row_meta', 'multicollab_custom_plugin_row_meta', 10, 4 );

/**
 * Added extra links to default meta row.
 *
 * @author: Himanshu shekhar
 * @version 4.1
 *
 * @param array  $plugin_meta An array of the plugin's metadata.
 * @param string $plugin_file The path to the main plugin file.
 */
if ( ! function_exists( 'multicollab_custom_plugin_row_meta' ) ) {
    function multicollab_custom_plugin_row_meta( $plugin_meta, $plugin_file ) {
    	if ( strpos( $plugin_file, plugin_basename( __FILE__ ) ) !== false ) {
    		$insert_position = array_search( 'By Multicollab', array_keys( $plugin_meta ) );
    		$links_array     = array();

    		// Add your custom links to the array.
    		$links_array['docs_link'] = '<a href="https://docs.multicollab.com/" target="_blank">Documentation</a>';

    		array_splice( $plugin_meta, $insert_position + 1, 0, $links_array );

    	}

    	return $plugin_meta;
    }
}

/**
 * Set Store variable and EDD plan IDs for localhost and Live servers.
 *
 * @author: Rishi Shah
 * @version 3.4
 */

    define( 'MULTICOLLAB_PROMOTIONAL_BANNER_API_URL', 'https://www.multicollab.com/' );
    define( 'MULTICOLLAB_STORE_URL', 'https://www.multicollab.com/' );




/**
 * The code that runs during plugin activation.
 * This action is documented in includes/class-commenting-block-activator.php
 */
if ( ! function_exists( 'multicollab_activate_commenting_block' ) ) {
	function multicollab_activate_commenting_block() {
        require_once plugin_dir_path( __FILE__ ) . 'includes/class-commenting-block-activator.php';
		Commenting_block_Activator::activate();
	}
}

/**
 * The code that runs during plugin deactivation.
 * This action is documented in includes/class-commenting-block-deactivator.php
 */
if ( ! function_exists( 'multicollab_deactivate_commenting_block' ) ) {
	function multicollab_deactivate_commenting_block() {
        require_once plugin_dir_path( __FILE__ ) . 'includes/class-commenting-block-deactivator.php';
		Commenting_block_Deactivator::deactivate();
	}
}

register_activation_hook( __FILE__, 'multicollab_activate_commenting_block' );
register_deactivation_hook( __FILE__, 'multicollab_deactivate_commenting_block' );

/**
 * The core plugin class that is used to define internationalization,
 * admin-specific hooks, and public-facing site hooks.
 */
require plugin_dir_path( __FILE__ ) . 'includes/class-commenting-block.php';

/**
 * Load global function file.
 */
require plugin_dir_path( __FILE__ ) . 'includes/commenting-block-functions.php';

/**
 * Load EDD plan details class file.
 */
require plugin_dir_path( __FILE__ ) . 'includes/class-edd-plan-details.php';

require plugin_dir_path( __FILE__ ) . 'includes/multicollab-legacy-migration.php';

/**
 * Begins execution of the plugin.
 *
 * Since everything within the plugin is registered via hooks,
 * then kicking off the plugin from this point in the file does
 * not affect the page life cycle.
 *
 * @since    1.0.0
 */
if ( ! function_exists( 'multicollab_run_commenting_block' ) ) {
	function multicollab_run_commenting_block() {
		$plugin = new Commenting_block();
		$plugin->run();
	}
}

multicollab_run_commenting_block();

/**
 * Redirect after plugin activation.
 *
 * @since 1.0.4
 */
add_action( 'activated_plugin', array( 'Commenting_block', 'multicollab_redirect_on_activate' ) );
