-
Notifications
You must be signed in to change notification settings - Fork 0
/
bakrypt-wp-extension.php
65 lines (51 loc) · 1.59 KB
/
bakrypt-wp-extension.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
<?php
/**
* Plugin Name: ImmuPress: Transforming Content Creation on WordPress
* Plugin URI: https://bakrypt.io
* Description: Mint your blog posts into the Cardano Blockchain
* Version: 0.1.0
* Author: Wolfgang Leon
* Author URI: https://bakrypt.io/
* Developer: Wolfgang Leon
* Developer URI: https://bakrypt.io/pool/
* Text Domain: bakrypt-wp-extension
* License: GNU General Public License v3.0
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
*
*
*/
defined('ABSPATH') || exit;
define('WPBAK_ABSPATH', __DIR__ . '/');
define('WPBAK_PLUGIN_FILE', __FILE__);
# Autoload Classes with Composer
require_once "vendor/autoload.php";
// Initiate wc bakrypt class
use BakWP\core\BakWP;
# Add custom interval for every 3 minutes
add_filter('cron_schedules', 'bak_wp_add_every_three_minutes');
function bak_wp_add_every_three_minutes($schedules)
{
$schedules['every_three_minutes'] = array(
'interval' => 180,
'display' => __('Every 3 Minutes', 'textdomain')
);
return $schedules;
}
function wpbakrypt_init()
{
BakWP::init();
}
add_action('plugins_loaded', 'wpbakrypt_init', 11);
// ========= Cron Tasks =======
function bak_wp_cron_activate()
{
// Schedule the cron task to run every 3 minutes
wp_schedule_event(time(), 'every_three_minutes', 'bak_wp_cron_task');
}
function bak_wp_cron_deactivate()
{
wp_clear_scheduled_hook('bak_wp_cron_task');
}
register_activation_hook(WPBAK_PLUGIN_FILE, 'bak_wp_cron_activate');
add_action('bak_wp_cron_task', array("BakExtension\core\Cron", "bak_run_cron_task"), 12);
register_deactivation_hook(WPBAK_PLUGIN_FILE, 'bak_wp_cron_deactivate');