Files
Hi-School-Slide-Manager/hi-school-slide-manager.php
T

84 lines
2.5 KiB
PHP

<?php
/**
* Plugin Name: Hi-School Slide Manager
* Plugin URI: https://hi-school.com/slide-manager
* Description: Multi-site slide management system for Hi-School websites. Allows staff to create and schedule slides on the main site, display them as headers on companion sites via REST API, with advanced preview and editing capabilities.
* Version: 1.1.2
* Author: Hi-School Development Team
* Author URI: https://hi-school.com
* License: GPL v2 or later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: hi-school-slide-manager
* Domain Path: /languages
* Network: false
* Requires at least: 5.0
* Tested up to: 6.4
* Requires PHP: 7.4
*/
// Prevent direct access
if ( ! defined( 'ABSPATH' ) ) {
exit( 'Direct access forbidden.' );
}
// Plugin constants
define( 'HSSM_VERSION', '1.1.2' );
define( 'HSSM_PLUGIN_FILE', __FILE__ );
define( 'HSSM_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
define( 'HSSM_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
define( 'HSSM_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
// Database table names (if needed for future features)
// define( 'HSSM_SLIDES_TABLE', 'hssm_slides' );
// define( 'HSSM_SITES_TABLE', 'hssm_companion_sites' );
/**
* Write a debug log line only when WP_DEBUG and WP_DEBUG_LOG are enabled.
*
* @since 1.1.2
* @param mixed $message Message or data to log.
*/
function hssm_debug_log( $message ) {
if ( ! defined( 'WP_DEBUG' ) || ! WP_DEBUG || ! defined( 'WP_DEBUG_LOG' ) || ! WP_DEBUG_LOG ) {
return;
}
if ( ! is_string( $message ) ) {
$message = print_r( $message, true );
}
error_log( 'HSSM: ' . $message );
}
// Include core files
require_once HSSM_PLUGIN_DIR . 'includes/class-hssm-autoloader.php';
require_once HSSM_PLUGIN_DIR . 'includes/class-hssm-main.php';
/**
* Initialize the Hi-School Slide Manager plugin
*
* @since 1.0.0
*/
function hssm_init() {
// Check if we're on the main site (this plugin should only run on main site)
if ( is_multisite() && ! is_main_site() ) {
return;
}
// Initialize autoloader
HSSM_Autoloader::init();
// Get the main plugin instance and initialize
$hssm = HSSM_Main::get_instance();
$hssm->init();
}
// Hook into WordPress
add_action( 'plugins_loaded', 'hssm_init' );
// Activation and deactivation hooks
register_activation_hook( __FILE__, array( 'HSSM_Main', 'activate' ) );
register_deactivation_hook( __FILE__, array( 'HSSM_Main', 'deactivate' ) );
register_uninstall_hook( __FILE__, array( 'HSSM_Main', 'uninstall' ) );