-
Notifications
You must be signed in to change notification settings - Fork 0
/
wordpress-liveblog.php
44 lines (36 loc) · 1.48 KB
/
wordpress-liveblog.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
<?php
/*
Plugin Name: Wordpress Liveblog
Description: Wordpress Liveblog is a WordPress plugin designed to bridge the gap between your WordPress website and your Slack workspace. The plugin allows you to establish a seamless connection between a specific WordPress post or page and a corresponding Slack channel, ensuring that every message, update, or edit made in the channel is synced in real-time to the WordPress post.
Author: Harvard Law School, Berkman Klein Center
Author URI: https://cyber.harvard.edu
Version: 1.0
*/
require 'vendor/autoload.php';
require(__DIR__ . '/install.php');
require(__DIR__ . '/upgrade.php');
define('WORDPRESS_LIVEBLOG_DIR_PATH', plugin_dir_path(__FILE__));
// Load env variables if .env file does exist
if (file_exists(__DIR__ . '/.env')) {
$dotenv = new Symfony\Component\Dotenv\Dotenv();
$dotenv->load(__DIR__ . '/.env');
}
// Start the core
add_action('plugins_loaded', function () {
if (is_admin()) {
\WordpressLiveblog\AdminCore::init();
} else {
\WordpressLiveblog\FrontCore::init();
}
});
// Trigger the install script on plugin activation
register_activation_hook(__FILE__, 'wordpress_liveblog_install');
// Trigger the upgrade script
add_action('upgrader_process_complete', 'wordpress_liveblog_upgrade', 10, 2);
add_filter('dbi_wp_migrations_path', function ($path) {
return __DIR__ . '/migrations';
});
// Setup db migrations in CLI
if (defined('WP_CLI') && WP_CLI) {
\DeliciousBrains\WPMigrations\Database\Migrator::instance('migrations');
}