<?php
/**
 * Addons list returned by SimpleStats_Admin_Ajax::get_addons().
 *
 * @package SimpleStats
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

return ( function () {
	// get_plugins() lives in an admin include that is not always loaded on the
	// code paths that pull this list in.
	if ( ! function_exists( 'get_plugins' ) ) {
		require_once ABSPATH . 'wp-admin/includes/plugin.php';
	}

	$installed_plugins = get_plugins();

	$aioseo_basename = array_key_exists( 'all-in-one-seo-pack-pro/all_in_one_seo_pack.php', $installed_plugins )
		? 'all-in-one-seo-pack-pro/all_in_one_seo_pack.php'
		: 'all-in-one-seo-pack/all_in_one_seo_pack.php';

	$wpforms_basename = array_key_exists( 'wpforms/wpforms.php', $installed_plugins )
		? 'wpforms/wpforms.php'
		: 'wpforms-lite/wpforms.php';

	$userfeedback_basename = array_key_exists( 'userfeedback/userfeedback.php', $installed_plugins )
		? 'userfeedback/userfeedback.php'
		: 'userfeedback-lite/userfeedback.php';

	return array(
		'userfeedback-lite'    => array(
			'active'    => function_exists( 'userfeedback' ),
			'icon'      => SIMPLESTATS_PLUGIN_URL . 'assets/images/addons/userfeedback.svg',
			'title'     => 'UserFeedback',
			'excerpt'   => __( 'Ask visitors questions about how they use your website or what features can make you more money.', 'simplestats-friendly-website-analytics' ),
			'installed' => array_key_exists( $userfeedback_basename, $installed_plugins ),
			'basename'  => $userfeedback_basename,
			'slug'      => 'userfeedback-lite',
		),
		'all-in-one-seo-pack'  => array(
			'active'    => function_exists( 'aioseo' ),
			'installed' => array_key_exists( $aioseo_basename, $installed_plugins ),
			'basename'  => $aioseo_basename,
			'icon'      => SIMPLESTATS_PLUGIN_URL . 'assets/images/addons/all-in-one-seo.png',
			'title'     => 'AIOSEO',
			'excerpt'   => __( 'The original SEO plugin and toolkit that improves your website\'s search rankings. Comes with all the SEO features like Local SEO, WooCommerce SEO, sitemaps, SEO optimizer, schema, and more.', 'simplestats-friendly-website-analytics' ),
			'slug'      => 'all-in-one-seo-pack',
		),
		'wpforms-lite'         => array(
			'active'    => function_exists( 'wpforms' ),
			'installed' => array_key_exists( $wpforms_basename, $installed_plugins ),
			'basename'  => $wpforms_basename,
			'slug'      => 'wpforms-lite',
			'title'     => 'WPForms',
			'excerpt'   => __( 'The best drag & drop form builder. Easily create beautiful contact forms, surveys, payment forms, and more with our 1000+ form templates. Trusted by over 6 million websites as the best forms plugin.', 'simplestats-friendly-website-analytics' ),
			'icon'      => SIMPLESTATS_PLUGIN_URL . 'assets/images/addons/wpforms.svg',
		),
		'wp-mail-smtp'         => array(
			'active'    => function_exists( 'wp_mail_smtp' ),
			'icon'      => SIMPLESTATS_PLUGIN_URL . 'assets/images/addons/mail-smtp.svg',
			'title'     => 'WP Mail SMTP',
			'excerpt'   => __( 'Improve your email deliverability and make sure that your website emails reach user\'s inbox with the #1 SMTP plugin. Over 3 million websites use it to fix email issues.', 'simplestats-friendly-website-analytics' ),
			'installed' => array_key_exists( 'wp-mail-smtp/wp_mail_smtp.php', $installed_plugins ),
			'basename'  => 'wp-mail-smtp/wp_mail_smtp.php',
			'slug'      => 'wp-mail-smtp',
		),
		'optinmonster'         => array(
			'active'    => class_exists( 'OMAPI' ),
			'icon'      => SIMPLESTATS_PLUGIN_URL . 'assets/images/addons/optinmonster.svg',
			'title'     => 'OptinMonster',
			'excerpt'   => __( 'Instantly get more subscribers, leads, and sales with the #1 conversion optimization toolkit. Create high converting popups, announcement bars, spin a wheel, and more with smart targeting and personalization.', 'simplestats-friendly-website-analytics' ),
			'installed' => array_key_exists( 'optinmonster/optin-monster-wp-api.php', $installed_plugins ),
			'basename'  => 'optinmonster/optin-monster-wp-api.php',
			'slug'      => 'optinmonster',
		),
		'coming-soon'          => array(
			'active'    => defined( 'SEEDPROD_VERSION' ),
			'icon'      => SIMPLESTATS_PLUGIN_URL . 'assets/images/addons/seedprod.svg',
			'title'     => 'SeedProd',
			'excerpt'   => __( 'The fastest drag & drop landing page builder. Create custom landing pages without writing code, connect them with your CRM, collect subscribers, and grow your audience. Trusted by 1 million sites.', 'simplestats-friendly-website-analytics' ),
			'installed' => array_key_exists( 'coming-soon/coming-soon.php', $installed_plugins ),
			'basename'  => 'coming-soon/coming-soon.php',
			'slug'      => 'coming-soon',
		),
		'rafflepress'          => array(
			'active'    => defined( 'RAFFLEPRESS_VERSION' ),
			'icon'      => SIMPLESTATS_PLUGIN_URL . 'assets/images/addons/rafflepress.svg',
			'title'     => 'RafflePress',
			'excerpt'   => __( 'Turn your website visitors into brand ambassadors! Easily grow your email list, website traffic, and social media followers with the most powerful giveaways & contests plugin.', 'simplestats-friendly-website-analytics' ),
			'installed' => array_key_exists( 'rafflepress/rafflepress.php', $installed_plugins ),
			'basename'  => 'rafflepress/rafflepress.php',
			'slug'      => 'rafflepress',
		),
		'trustpulse-api'       => array(
			'active'    => defined( 'TRUSTPULSE_PLUGIN_VERSION' ),
			'icon'      => SIMPLESTATS_PLUGIN_URL . 'assets/images/addons/trustpulse.svg',
			'title'     => 'TrustPulse',
			'excerpt'   => __( 'Boost your sales and conversions by up to 15% with real-time social proof notifications. TrustPulse helps you show live user activity and purchases to help convince other users to purchase.', 'simplestats-friendly-website-analytics' ),
			'installed' => array_key_exists( 'trustpulse-api/trustpulse.php', $installed_plugins ),
			'basename'  => 'trustpulse-api/trustpulse.php',
			'slug'      => 'trustpulse-api',
		),
		'instagram-feed'       => array(
			'active'    => defined( 'SBIVER' ),
			'icon'      => SIMPLESTATS_PLUGIN_URL . 'assets/images/addons/instagram-feed.svg',
			'title'     => 'Smash Balloon Instagram Feeds',
			'excerpt'   => __( 'Easily display Instagram content on your site without writing any code. Comes with multiple templates, ability to show content from multiple accounts, hashtags, and more. Trusted by 1 million websites.', 'simplestats-friendly-website-analytics' ),
			'installed' => array_key_exists( 'instagram-feed/instagram-feed.php', $installed_plugins ),
			'basename'  => 'instagram-feed/instagram-feed.php',
			'slug'      => 'instagram-feed',
		),
		'custom-facebook-feed' => array(
			'active'    => defined( 'CFFVER' ),
			'icon'      => SIMPLESTATS_PLUGIN_URL . 'assets/images/addons/facebook-feed.svg',
			'title'     => 'Smash Balloon Facebook Feeds',
			'excerpt'   => __( 'Easily display Facebook content on your site without writing any code. Comes with multiple templates, ability to embed albums, group content, reviews, live videos, comments, and reactions.', 'simplestats-friendly-website-analytics' ),
			'installed' => array_key_exists( 'custom-facebook-feed/custom-facebook-feed.php', $installed_plugins ),
			'basename'  => 'custom-facebook-feed/custom-facebook-feed.php',
			'slug'      => 'custom-facebook-feed',
		),
	);
} )();
