<?php

/**
 * Plugin Name:       Uply — Scroll to Top, Progress Bar & Read Time
 * Plugin URI:        
 * Description:       Adds a scroll to top button, reading progress bar, and read time to your posts.
 * Version:           1.0.2
 * Requires at least: 6.0
 * Requires PHP:      7.4
 * Author:            shoiswp
 * Text Domain:       uply-scroll-to-top-and-progress-bar
 * License:           GPLv2 or later
 * License URI:       https://www.gnu.org/licenses/gpl-2.0.html
 */
namespace USTT;

if ( !defined( 'ABSPATH' ) ) {
    exit;
}
if ( function_exists( __NAMESPACE__ . '\\usttapb_fs' ) ) {
    usttapb_fs()->set_basename( false, __FILE__ );
} else {
    if ( !function_exists( __NAMESPACE__ . '\\usttapb_fs' ) ) {
        // Create a helper function for easy SDK access.
        function usttapb_fs() {
            global $usttapb_fs;
            if ( !isset( $usttapb_fs ) ) {
                // Activate multisite network integration.
                if ( !defined( 'WP_FS__PRODUCT_24303_MULTISITE' ) ) {
                    define( 'WP_FS__PRODUCT_24303_MULTISITE', true );
                }
                // Include Freemius SDK.
                require_once dirname( __FILE__ ) . '/freemius/start.php';
                $usttapb_fs = fs_dynamic_init( array(
                    'id'             => '24303',
                    'slug'           => 'uply-scroll-to-top-and-progress-bar',
                    'type'           => 'plugin',
                    'public_key'     => 'pk_f102a4b204ec37153412415acc612',
                    'is_premium'     => false,
                    'has_addons'     => false,
                    'has_paid_plans' => true,
                    'menu'           => array(
                        'slug'       => 'ustt-settings',
                        'first-path' => 'admin.php?page=ustt-settings',
                        'contact'    => false,
                        'support'    => false,
                        'account'    => true,
                        'parent'     => array(
                            'slug' => 'ustt-settings',
                        ),
                    ),
                    'is_live'        => true,
                ) );
            }
            return $usttapb_fs;
        }

        // Init Freemius.
        usttapb_fs();
        // Signal that SDK was initiated.
        do_action( 'usttapb_fs_loaded' );
    }
    define( 'USTT_VERSION', '1.0.0' );
    define( 'USTT_DIR', plugin_dir_path( __FILE__ ) );
    define( 'USTT_URL', plugin_dir_url( __FILE__ ) );
    /**
     * Returns allowed HTML tags and attributes for SVG elements.
     * Used with wp_kses() to safely output inline SVGs.
     */
    function ustt_get_svg_allowed_html() {
        return array(
            'svg'      => array(
                'xmlns'           => true,
                'viewbox'         => true,
                'width'           => true,
                'height'          => true,
                'fill'            => true,
                'stroke'          => true,
                'stroke-width'    => true,
                'stroke-linecap'  => true,
                'stroke-linejoin' => true,
                'class'           => true,
                'id'              => true,
                'style'           => true,
                'aria-hidden'     => true,
                'role'            => true,
            ),
            'path'     => array(
                'd'               => true,
                'fill'            => true,
                'stroke'          => true,
                'stroke-width'    => true,
                'stroke-linecap'  => true,
                'stroke-linejoin' => true,
                'fill-rule'       => true,
                'clip-rule'       => true,
                'transform'       => true,
            ),
            'circle'   => array(
                'cx'           => true,
                'cy'           => true,
                'r'            => true,
                'fill'         => true,
                'stroke'       => true,
                'stroke-width' => true,
            ),
            'rect'     => array(
                'x'            => true,
                'y'            => true,
                'width'        => true,
                'height'       => true,
                'rx'           => true,
                'ry'           => true,
                'fill'         => true,
                'stroke'       => true,
                'stroke-width' => true,
            ),
            'line'     => array(
                'x1'             => true,
                'y1'             => true,
                'x2'             => true,
                'y2'             => true,
                'stroke'         => true,
                'stroke-width'   => true,
                'stroke-linecap' => true,
            ),
            'polyline' => array(
                'points'          => true,
                'fill'            => true,
                'stroke'          => true,
                'stroke-width'    => true,
                'stroke-linecap'  => true,
                'stroke-linejoin' => true,
            ),
            'polygon'  => array(
                'points'       => true,
                'fill'         => true,
                'stroke'       => true,
                'stroke-width' => true,
            ),
            'g'        => array(
                'fill'      => true,
                'transform' => true,
                'id'        => true,
                'class'     => true,
            ),
            'defs'     => array(),
            'use'      => array(
                'href'       => true,
                'xlink:href' => true,
            ),
        );
    }

    /**
     * The code that runs during plugin activation.
     */
    function activate_ustt() {
        // require_once plugin_dir_path( __FILE__ ) . 'includes/class-ustt-activator.php';
        // USTT_Activator::activate();
        set_transient( 'ustt_activation_redirect', true, 30 );
    }

    /**
     * The code that runs during plugin deactivation.
     */
    function deactivate_ustt() {
        // require_once plugin_dir_path( __FILE__ ) . 'includes/class-ustt-deactivator.php';
        // USTT_Deactivator::deactivate();
    }

    register_activation_hook( __FILE__, __NAMESPACE__ . '\\activate_ustt' );
    register_deactivation_hook( __FILE__, __NAMESPACE__ . '\\deactivate_ustt' );
    /**
     * 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-ustt-core.php';
    /**
     * Begins execution of the plugin.
     */
    function run_ustt() {
        $plugin = new Core();
        $plugin->run();
    }

    run_ustt();
}