<?php

global $wpdb;

// Determine actual charset/collation if not set in wp-config.php
$actualCharset   = !empty($wpdb->charset) ? $wpdb->charset : $wpdb->get_var("SELECT @@character_set_database");
$actualCollation = !empty($wpdb->collate) ? $wpdb->collate : $wpdb->get_var("SELECT @@collation_database");

return [
    'plugin' => [
        'name'                      => 'Reloadify',
        'nameshort'                 => 'Reloadify',
        'tag'                       => 'reloadify',
        'version'                   => '1.9.0',
        'path'                      => dirname(__DIR__),
        'url'                       => plugin_dir_url(__DIR__),
        'assets'                    => plugin_dir_url(__DIR__) . 'assets/',
        'dir'                       => plugin_basename(dirname(__DIR__)),
        'basepath'                  => dirname(__DIR__) . '/' . plugin_basename(dirname(__DIR__)) . '.php',
        'basefile'                  => plugin_basename(dirname(__DIR__)) . '/' . plugin_basename(dirname(__DIR__)) . '.php',
        'lang'                      => plugin_basename(dirname(__DIR__)) . '/assets/languages',
        'php_minimum'               => '7.4',
        'php_minimum_id'            => 70400,
        'recovery_parameter'        => 'wc-cart-recovery',
        'recovery_admin_parameter'  => 'reloadify-admin-recovery',
        'settings_url'              => admin_url('admin.php?page=wc-settings&tab=reloadify_settings'),
    ],

    'checkout' => [
        'form_class'                => 'woocommerce-checkout',
        'first_name_class'         => 'form-reloadify-first-name',
        'last_name_class'          => 'form-reloadify-last-name',
        'email_class'              => 'form-reloadify-email',
        'nonce_id'                 => 'woocommerce-process-checkout-nonce',
        'billing_street_class'     => 'form-reloadify-billing-street',
        'billing_city_class'       => 'form-reloadify-billing-city',
        'billing_state_class'      => 'form-reloadify-billing-state',
        'billing_postcode_class'   => 'form-reloadify-billing-postcode',
        'billing_country_class'    => 'billing_country',
        'shipping_street_class'    => 'form-reloadify-shipping-street',
        'shipping_city_class'      => 'form-reloadify-shipping-city',
        'shipping_state_class'     => 'form-reloadify-shipping-state',
        'shipping_postcode_class'  => 'form-reloadify-shipping-postcode',
        'shipping_country_class'   => 'form-reloadify-shipping-country',
    ],

    'database.settings' => [
        'driver'    => 'mysql',
        'host'      => DB_HOST,
        'database'  => DB_NAME,
        'username'  => DB_USER,
        'password'  => DB_PASSWORD,
        'prefix'    => apply_filters('tsd_reloadify_database_prefix', $wpdb->prefix),
        'database.settings' => [
            'driver'    => 'mysql',
            'host'      => DB_HOST,
            'database'  => DB_NAME,
            'username'  => DB_USER,
            'password'  => DB_PASSWORD,
            'prefix'    => apply_filters('tsd_reloadify_database_prefix', $wpdb->prefix),
            'charset'   => apply_filters('tsd_reloadify_database_charset', $actualCharset),
            'collation' => apply_filters('tsd_reloadify_database_collation', $actualCollation),
            'strict'    => false,
        ],
        'strict'    => false,
    ],
];
