Files
formipay-public/formipay.php

60 lines
1.7 KiB
PHP

<?php
/**
* Plugin Name: Formipay
* Description: -
* Version: 1.0.0
* Plugin URI: https://formipay.com/
* Author: Formipay
* Text Domain: formipay
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
*
* Requires at least: 6.2
* Tested up to: 6.8.1
*
* Copyright: © 2023 Formipay.
* License: GNU General Public License v3.0
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
*/
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) exit;
define( 'FORMIPAY_NAME', 'Formipay' );
define( 'FORMIPAY_VERSION', '1.0.0' );
define( 'FORMIPAY_PATH', plugin_dir_path( __FILE__ ) );
define( 'FORMIPAY_URL', plugin_dir_url( __FILE__ ) );
define( 'FORMIPAY_MENU_SLUG', 'formipay' );
define( 'FORMIPAY_OPTION_KEY', 'formipay_settings' );
require_once FORMIPAY_PATH . 'admin/functions.php';
spl_autoload_register(function ($class) {
$prefix = 'Formipay\\';
$base_dir = __DIR__ . '/includes/';
// Check if the class uses the plugin's namespace
if (strpos($class, $prefix) !== 0) return;
// Remove namespace prefix
$relative_class = substr($class, strlen($prefix));
// Convert namespace to file path
$file = $base_dir . str_replace('\\', '/', $relative_class) . '.php';
if (file_exists($file)) {
require_once $file;
}
});
\Formipay\Init::get_instance();
// function formipay_add_defer_attribute($tag, $handle) {
// if ( 'product-details' === $handle ) {
// // Add defer attribute
// return str_replace( '<script ', '<script defer ', $tag );
// }
// return $tag;
// }
// add_filter( 'script_loader_tag', 'formipay_add_defer_attribute', 10, 2 );