74 lines
2.1 KiB
PHP
74 lines
2.1 KiB
PHP
|
|
<?php
|
||
|
|
/**
|
||
|
|
* Plugin Name: Sirius Press Publishing
|
||
|
|
* Plugin URI: https://code.silentmode.st/silentmode/sirius-press
|
||
|
|
* Description: Publishes a static copy of every page to the site's BCNR name, so the site keeps serving from decentralised storage even when this server does not.
|
||
|
|
* Version: 0.1.0
|
||
|
|
* Requires at least: 6.5
|
||
|
|
* Requires PHP: 7.4
|
||
|
|
* Requires Plugins: sirius-press-core
|
||
|
|
* Author: Silent Mode
|
||
|
|
* Author URI: https://silentmode.st
|
||
|
|
* License: GPL-2.0-or-later
|
||
|
|
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
||
|
|
* Text Domain: sirius-press
|
||
|
|
*
|
||
|
|
* @package SiriusPress
|
||
|
|
*/
|
||
|
|
|
||
|
|
defined( 'ABSPATH' ) || exit;
|
||
|
|
|
||
|
|
define( 'SIRIUS_PRESS_EXPORT_VERSION', '0.1.0' );
|
||
|
|
define( 'SIRIUS_PRESS_EXPORT_DIR', plugin_dir_path( __FILE__ ) );
|
||
|
|
define( 'SIRIUS_PRESS_EXPORT_URL', plugin_dir_url( __FILE__ ) );
|
||
|
|
|
||
|
|
register_activation_hook(
|
||
|
|
__FILE__,
|
||
|
|
function () {
|
||
|
|
require_once SIRIUS_PRESS_EXPORT_DIR . 'includes/class-spe-queue.php';
|
||
|
|
SPE_Queue::install();
|
||
|
|
require_once SIRIUS_PRESS_EXPORT_DIR . 'includes/class-spe-runner.php';
|
||
|
|
SPE_Runner::schedule();
|
||
|
|
}
|
||
|
|
);
|
||
|
|
|
||
|
|
register_deactivation_hook(
|
||
|
|
__FILE__,
|
||
|
|
function () {
|
||
|
|
require_once SIRIUS_PRESS_EXPORT_DIR . 'includes/class-spe-runner.php';
|
||
|
|
SPE_Runner::unschedule();
|
||
|
|
}
|
||
|
|
);
|
||
|
|
|
||
|
|
add_action(
|
||
|
|
'plugins_loaded',
|
||
|
|
function () {
|
||
|
|
if ( ! class_exists( 'SP_Gateway' ) ) {
|
||
|
|
add_action(
|
||
|
|
'admin_notices',
|
||
|
|
function () {
|
||
|
|
printf(
|
||
|
|
'<div class="notice notice-error"><p>%s</p></div>',
|
||
|
|
esc_html__( 'Sirius Press Publishing needs Sirius Press Core to be active. Nothing is being published.', 'sirius-press' )
|
||
|
|
);
|
||
|
|
}
|
||
|
|
);
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
foreach ( array( 'queue', 'mapper', 'renderer', 'runner', 'hooks', 'admin', 'cli' ) as $part ) {
|
||
|
|
require_once SIRIUS_PRESS_EXPORT_DIR . 'includes/class-spe-' . $part . '.php';
|
||
|
|
}
|
||
|
|
|
||
|
|
if ( (int) get_option( 'sirius_press_export_db_version', 0 ) < SPE_Queue::VERSION ) {
|
||
|
|
SPE_Queue::install();
|
||
|
|
}
|
||
|
|
|
||
|
|
SPE_Renderer::hooks();
|
||
|
|
SPE_Runner::hooks();
|
||
|
|
SPE_Hooks::hooks();
|
||
|
|
SPE_Admin::hooks();
|
||
|
|
SPE_Runner::schedule();
|
||
|
|
}
|
||
|
|
);
|