mirror of
https://gh.wpcy.net/https://github.com/michelve/software-license-manager.git
synced 2026-05-26 10:16:14 +08:00
- Updated the `create_log` method to handle the new `time` (DATETIME) and `time_only` (TIME) columns. - Ensured sanitized input for `license_key`, `action`, and `origin`. - Improved error handling with detailed success and failure logs. - Streamlined origin determination for better readability. - Added example usage and database insertion validation.
88 lines
3.7 KiB
PHP
88 lines
3.7 KiB
PHP
<?php
|
|
/*
|
|
Plugin Name: SLM Plus
|
|
Version: 6.3.6
|
|
Plugin URI: https://github.com/michelve/software-license-manager/
|
|
Author: Michel Velis
|
|
Author URI: https://github.com/michelve/
|
|
Description: A comprehensive software license management solution for web applications including WordPress plugins, themes, and PHP-based software. Seamlessly integrates with WooCommerce to offer license key generation, management, and validation. Ideal for developers managing software licenses across multiple platforms with built-in multilingual support and performance optimization.
|
|
Text Domain: slm-plus
|
|
Domain Path: /i18n/languages/
|
|
WC tested up to: 6.7
|
|
Requires at least: 5.6
|
|
Stable tag: 6.7
|
|
Requires PHP: 7.4
|
|
License: GPLv2 or later
|
|
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
|
Contributors: Tips and Tricks HQ
|
|
*/
|
|
|
|
// If this file is called directly, abort.
|
|
if (!defined('ABSPATH')) {
|
|
exit; // Secure the plugin by blocking direct access
|
|
}
|
|
|
|
// Load plugin textdomain for multilingual support
|
|
function slmplus_load_textdomain() {
|
|
load_plugin_textdomain('slm-plus', false, dirname(plugin_basename(__FILE__)) . '/i18n/languages');
|
|
}
|
|
add_action('plugins_loaded', 'slmplus_load_textdomain');
|
|
|
|
// Global variables for database interaction
|
|
global $wpdb, $slm_debug_logger;
|
|
|
|
// Define constants for plugin paths, URLs, and database tables
|
|
define('SLM_VERSION', '6.3.6');
|
|
define('SLM_DB_VERSION', '5.9.1');
|
|
define('SLM_REWRITE_VERSION', '3.1.3');
|
|
|
|
define('SLM_FOLDER', dirname(plugin_basename(__FILE__)));
|
|
define('SLM_URL', plugins_url('', __FILE__));
|
|
define('SLM_ASSETS_URL', SLM_URL . '/public/assets/');
|
|
define('SLM_PATH', plugin_dir_path(__FILE__));
|
|
define('SLM_LIB', SLM_PATH . 'includes/');
|
|
define('SLM_WOO', SLM_PATH . 'woocommerce/');
|
|
define('SLM_ADDONS', SLM_PATH . 'addons/');
|
|
define('SLM_ADMIN', SLM_PATH . 'admin/');
|
|
define('SLM_ADMIN_ADDONS', SLM_ADMIN . 'includes/');
|
|
define('SLM_CRONS', SLM_ADMIN_ADDONS . 'cronjobs/');
|
|
define('SLM_PUBLIC', SLM_PATH . 'public/');
|
|
define('SLM_TEMPLATES', SLM_PATH . 'templates/');
|
|
|
|
define('SLM_SITE_HOME_URL', get_home_url());
|
|
define('SLM_SITE_URL', get_site_url() . '/');
|
|
|
|
define('SLM_TBL_LICENSE_KEYS', $wpdb->prefix . "lic_key_tbl");
|
|
define('SLM_TBL_EMAILS', $wpdb->prefix . "lic_emails_tbl");
|
|
define('SLM_TBL_LIC_DOMAIN', $wpdb->prefix . "lic_reg_domain_tbl");
|
|
define('SLM_TBL_LIC_DEVICES', $wpdb->prefix . "lic_reg_devices_tbl");
|
|
define('SLM_TBL_LIC_LOG', $wpdb->prefix . "lic_log_tbl");
|
|
define('SLM_TBL_LICENSE_STATUS', $wpdb->prefix . "lic_status_tbl");
|
|
|
|
define('SLM_MANAGEMENT_PERMISSION', 'manage_options');
|
|
define('SLM_MAIN_MENU_SLUG', 'slm_overview');
|
|
define('SLM_MENU_ICON', 'dashicons-lock');
|
|
define('SLM_API_URL', SLM_SITE_URL);
|
|
|
|
// Load core plugin functionalities
|
|
if (file_exists(SLM_LIB . 'slm-plugin-core.php')) {
|
|
require_once SLM_LIB . 'slm-plugin-core.php';
|
|
}
|
|
|
|
// Add settings link to plugin action links
|
|
function slm_settings_link($links) {
|
|
$settings_link = '<a href="' . esc_url(admin_url('admin.php?page=slm_settings')) . '">' . __('Settings', 'slm-plus') . '</a>';
|
|
$links[] = $settings_link;
|
|
return $links;
|
|
}
|
|
add_filter('plugin_action_links_' . plugin_basename(__FILE__), 'slm_settings_link');
|
|
|
|
// Define default max domains and devices
|
|
define('SLM_DEFAULT_MAX_DOMAINS', SLM_API_Utility::get_slm_option('default_max_domains'));
|
|
define('SLM_DEFAULT_MAX_DEVICES', SLM_API_Utility::get_slm_option('default_max_devices'));
|
|
|
|
// Use native WordPress function for setting options
|
|
define('WOO_SLM_API_SECRET', SLM_API_Utility::get_slm_option('lic_creation_secret'));
|
|
define('KEY_API', SLM_API_Utility::get_slm_option('lic_creation_secret'));
|
|
define('VERIFY_KEY_API', SLM_API_Utility::get_slm_option('lic_verification_secret'));
|
|
define('KEY_API_PREFIX', SLM_API_Utility::get_slm_option('lic_prefix'));
|