software-license-manager/includes/slm-init-time-tasks.php
Michel Velis f53672b4c5 improved license creation
improved api key and secret key
added screen options to license list table
removed unneeded files and code
removed auto updater
added new utility classes and functions
2019-05-13 15:14:40 -04:00

33 lines
No EOL
1.4 KiB
PHP
Executable file

<?php
class SLM_Init_Time_Tasks{
function __construct(){
$this->load_scripts();
//Add other init time operations here
add_action ('slm_daily_cron_event', array(&$this, 'slm_daily_cron_event_handler'));
}
function load_scripts(){
//Load all common scripts and styles only
wp_enqueue_script('jquery');
//Load all admin side scripts and styles only
if(is_admin()){
wp_enqueue_script('jquery-ui-datepicker');
wp_enqueue_script('wplm-custom-admin-js', SLM_ASSETS_URL . 'js/wplm-custom-admin.js', array( 'jquery-ui-dialog' ));//admin only custom js code
if (isset($_GET['page']) && $_GET['page'] == 'slm_manage_license') {//Only include if we are in the license add/edit interface
wp_enqueue_style('jquery-ui-style', SLM_ASSETS_URL .'css/jquery-ui.css');
}
}
}
function slm_daily_cron_event_handler(){
$options = get_option('slm_plugin_options');
do_action('slm_daily_cron_event_triggered');
if ( isset($options['enable_auto_key_expiry']) && $options['enable_auto_key_expiry'] == '1'){
//Do the auto key expiry task
SLM_Debug_Logger::log_debug_st("SLM daily cronjob - auto expiry of license key is enabled.");
SLM_Utility::do_auto_key_expiry();
}
//Do any ohter daily cronjob tasks.
}
}