mirror of
https://gh.wpcy.net/https://github.com/michelve/software-license-manager.git
synced 2026-07-15 19:03:28 +08:00
- added: support for email reminder, user will receive an email when license has expired - fixed: a bug where email will be send-out - added: custom fields to woocommece order - added: product type (license) for woocommerce - rebuilt my licenses in my account page - added: until version and current version to api - ui: change styles to match more wp interface
44 lines
1.5 KiB
PHP
44 lines
1.5 KiB
PHP
<?php
|
|
|
|
// add admin styles and scipts
|
|
function slm_admin_assets() {
|
|
wp_enqueue_style('softwarelicensemanager', SLM_ASSETS_URL .'css/slm.css');
|
|
wp_enqueue_script('slm_validate', 'https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.19.0/jquery.validate.js', array('jquery'), '1.19.0', true);
|
|
wp_enqueue_script('slm_validate_js', SLM_ASSETS_URL .'js/slm.js', array('jquery'), '1.0.1', true );
|
|
}
|
|
|
|
// load frontend styles
|
|
function slm_js_license(){
|
|
wp_enqueue_script('slm_js', SLM_ASSETS_URL . 'js/slm-js.js', array('jquery'), '1.0.1', true);
|
|
}
|
|
|
|
function slm_frontend_assets() {
|
|
/**
|
|
* Check if WooCommerce is activated
|
|
*/
|
|
if (!function_exists('is_woocommerce_activated') && is_account_page()) {
|
|
wp_enqueue_style('bootstrapcdn-slm', 'https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css');
|
|
wp_enqueue_script( 'bootstrapcdn-slm-js', 'https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js', array('jquery'), '4.1.3', true );
|
|
}
|
|
// custom css
|
|
wp_enqueue_style('softwarelicensemanager', SLM_ASSETS_URL .'css/slm-front-end.css');
|
|
}
|
|
|
|
add_action('wp_enqueue_scripts', 'slm_frontend_assets');
|
|
add_action('admin_enqueue_scripts', 'slm_admin_assets');
|
|
|
|
|
|
/**
|
|
* Check if WooCommerce is activated
|
|
*/
|
|
if (!function_exists('is_woocommerce_activated')) {
|
|
add_action('template_redirect', 'slm_get_page');
|
|
}
|
|
|
|
function slm_get_page(){
|
|
if (is_page('my-account')) {
|
|
add_action('wp_enqueue_scripts', 'slm_js_license');
|
|
}
|
|
}
|
|
|
|
|