<?php

/**
 * Plugin Name:   Voice Feedback 
 * Description:   Send Voice feedback to the site admin on the go. User can embed the voice feedback form in the contact form by shortcode. 
 * Version:       2.2.2
 * Author:        bPlugins
 * Author URI:    https://bplugins.com
 * License:       GPLv3
 * License URI:   https://www.gnu.org/licenses/gpl-3.0.txt
 * Text Domain:   voice-feedback
 */
if ( !defined( 'ABSPATH' ) ) {
    exit;
}
// Exit if accessed directly
if ( function_exists( 'bplvf' ) ) {
    bplvf()->set_basename( false, __FILE__ );
} else {
    define( 'BPLVF_DIR_PATH', plugin_dir_path( __FILE__ ) );
    define( 'BPLVF_DIR_URL', plugin_dir_url( __FILE__ ) );
    define( 'BPLVF_VERSION', "2.2.2" );
    define( 'BPLVF_HAS_PRO', 'voice-feedback-pro/voice-feedback.php' === plugin_basename( __FILE__ ) );
    if ( !function_exists( 'bplvf' ) ) {
        // Create a helper function for easy SDK access.
        function bplvf() {
            global $bplvf;
            if ( !isset( $bplvf ) ) {
                // Include Freemius SDK.
                require_once dirname( __FILE__ ) . '/vendor/freemius/start.php';
                $bplvf = fs_dynamic_init( array(
                    'id'               => '19712',
                    'slug'             => 'voice-feedback',
                    'premium_slug'     => 'voice-feedback-pro',
                    'type'             => 'plugin',
                    'public_key'       => 'pk_e2acd90aa2e40812def1d0880deae',
                    'is_premium'       => false,
                    'premium_suffix'   => 'Pro',
                    'has_addons'       => false,
                    'has_paid_plans'   => true,
                    'trial'            => array(
                        'days'               => 7,
                        'is_require_payment' => false,
                    ),
                    'has_affiliation'  => 'selected',
                    'menu'             => array(
                        'slug'        => 'voice-feedback',
                        'first-path'  => 'admin.php?page=bplvf-dashboard',
                        'contact'     => false,
                        'support'     => false,
                        'affiliation' => false,
                    ),
                    'is_live'          => true,
                    'is_org_compliant' => true,
                ) );
            }
            return $bplvf;
        }

        // Init Freemius.
        bplvf();
        // Signal that SDK was initiated.
        do_action( 'bplvf_loaded' );
    }
    // Load Main Plugin Class
    require_once BPLVF_DIR_PATH . 'includes/class-bplvf-main.php';
    new BPLVoiceFeedback();
    add_action( 'wp_mail_failed', function ( $error ) {
        if ( is_wp_error( $error ) ) {
            BPLVF_Handle_Email_Notification::$mail_error = $error->get_error_message();
            error_log( 'BPLVF MAIL FAILED: ' . $error->get_error_message() );
        }
    } );
}