forked from Arsenal21/software-license-manager
-
-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathslm-plus.php
88 lines (76 loc) · 3.68 KB
/
slm-plus.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?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'));