<?php
/*
Plugin Name:  Greet Bubble
Plugin URI:   https://wp-plugins.themeatelier.net/greet/
Description:  Professional video bubble plugin for putting videos on your website in a great and fun way.
Version:      4.2.2
Author:       ThemeAtelier
Author URI:   https://themeatelier.net/
License:      GPL-2.0+
License URI:  https://www.gnu.org/licenses/gpl-2.0.html
Text Domain:  greet-bubble
Domain Path:  /languages
*/

// Block Direct access
if (!defined('ABSPATH')) {
    die('You should not access this file directly!.');
}
require_once __DIR__ . '/vendor/autoload.php';

use ThemeAtelier\GreetBubble\Includes\GreetBubble;

if (!defined('GREET_BUBBLE_VERSION')) {
    define('GREET_BUBBLE_VERSION', '4.2.2');
}
if (!defined('GREET_BUBBLE_FILE')) {
    define('GREET_BUBBLE_FILE', __FILE__);
}
if (!defined('GREET_BUBBLE_DIRNAME')) {
    define('GREET_BUBBLE_DIRNAME', dirname(__FILE__));
}
if (!defined('GREET_DIR_PATH')) {
    define('GREET_DIR_PATH', plugin_dir_path(__FILE__));
}
if (!defined('GREET_DIR_URL')) {
    define('GREET_DIR_URL', plugin_dir_url(__FILE__));
}
if (!defined('GREET_BUBBLE_BASENAME')) {
    define('GREET_BUBBLE_BASENAME', plugin_basename(__FILE__));
}
if (!defined('GREET_BUBBLE_DEMO_URL')) {
define('GREET_BUBBLE_DEMO_URL', 'https://wp-plugins.themeatelier.net/greet/');
}
if (!defined('GREET_BUBBLE_DOCS_URL')) {
define('GREET_BUBBLE_DOCS_URL', 'https://docs.themeatelier.net/docs/greet-bubble-pro/');
}
function greet_bubble()
{
    // Launch the plugin.
    $greet_bubble = new GreetBubble();
    $greet_bubble->run();
}

include_once ABSPATH . 'wp-admin/includes/plugin.php';
if (! (is_plugin_active('greet-bubble-pro/greet-bubble-pro.php') || is_plugin_active_for_network('greet-bubble-pro/greet-bubble-pro.php'))) {
    greet_bubble();
}

/**
 * Initialize the plugin tracker
 *
 * @return void
 */
function greet_video_bubble_appsero_init()
{
    if (!class_exists('GreetAppSero\Insights')) {
        require_once GREET_DIR_PATH . 'src/Admin/appsero/Client.php';
    }
    $client = new GreetAppSero\Client('53de6d86-33fe-48d4-9e6f-57ee60b8e3f1', 'Greet - Video Bubble Warm Welcome Plugin', __FILE__);
    // Active insights
    $client->insights()->init();
}
greet_video_bubble_appsero_init();

function greet_bubble_get_taxonomy_terms() {
    $terms      = [];
    $taxonomies = get_taxonomies( [ 'public' => true ], 'objects' );
    foreach ( $taxonomies as $taxonomy ) {
        $all_terms = get_terms( [ 'taxonomy' => $taxonomy->name, 'hide_empty' => false ] );
        if ( ! is_wp_error( $all_terms ) ) {
            foreach ( $all_terms as $term ) {
                $terms[ $term->term_id ] = $taxonomy->label . ': ' . $term->name;
            }
        }
    }
    return $terms;
}