Files
Umbra-Bookshelf/bd-bookshelf-plugin/bd-bookshelf.php
bdm 38cdebd0c6 Track Bookshelf WordPress theme, plugins and specs
Initial import of the bdmurphy Bookshelf work: the bd-bookshelf theme,
bd-bookshelf-plugin, bd-bookshelfhelper and bd-simpleemail plugins, plus
the specification documents, mockups and release archives.
2026-09-28 06:24:25 -07:00

156 lines
4.0 KiB
PHP

<?php
/**
* Plugin Name: BD Bookshelf
* Plugin URI: https://authorbdmurphy.com/plugins/bd-bookshelf
* Description: Book management plugin for authors with ISBN tracking, retail links, rating synchronization, and series management.
* Version: 0.1.0
* Author: B.D. Murphy
* Author URI: https://authorbdmurphy.com
* License: GPLv2 or later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: bd-bookshelf
* Domain Path: /languages
* Requires at least: 6.0
* Requires PHP: 7.4
*/
if (!defined('ABSPATH')) {
exit;
}
/**
* Plugin constants
*/
define('BD_BOOKSHELF_VERSION', '0.1.0');
define('BD_BOOKSHELF_DIR', plugin_dir_path(__FILE__));
define('BD_BOOKSHELF_URL', plugin_dir_url(__FILE__));
define('BD_BOOKSHELF_BASENAME', plugin_basename(__FILE__));
/**
* Include files
*/
require_once BD_BOOKSHELF_DIR . 'includes/class-bdm-database.php';
require_once BD_BOOKSHELF_DIR . 'includes/class-bdm-book-manager.php';
require_once BD_BOOKSHELF_DIR . 'includes/class-bdm-authors.php';
require_once BD_BOOKSHELF_DIR . 'includes/class-bdm-series.php';
require_once BD_BOOKSHELF_DIR . 'includes/class-bdm-retail-sites.php';
require_once BD_BOOKSHELF_DIR . 'includes/class-bdm-rating-sync.php';
require_once BD_BOOKSHELF_DIR . 'includes/class-bdm-shortcodes.php';
require_once BD_BOOKSHELF_DIR . 'includes/class-bdm-seo.php';
require_once BD_BOOKSHELF_DIR . 'includes/class-bdm-gdpr.php';
require_once BD_BOOKSHELF_DIR . 'includes/class-bdm-goodreads-scraper.php';
require_once BD_BOOKSHELF_DIR . 'includes/class-bdm-amazon-scraper.php';
require_once BD_BOOKSHELF_DIR . 'includes/class-bdm-admin.php';
require_once BD_BOOKSHELF_DIR . 'includes/class-bdm-migration.php';
require_once BD_BOOKSHELF_DIR . 'includes/class-bdm-theme-compatibility.php';
/**
* Main plugin class
*/
final class BD_Bookshelf {
/**
* Single instance of the class
*/
private static $instance = null;
/**
* Get single instance
*/
public static function instance() {
if (is_null(self::$instance)) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Constructor
*/
private function __construct() {
$this->init_hooks();
}
/**
* Initialize hooks
*/
private function init_hooks() {
register_activation_hook(__FILE__, [$this, 'activate']);
register_deactivation_hook(__FILE__, [$this, 'deactivate']);
add_action('init', [$this, 'init']);
add_action('plugins_loaded', [$this, 'plugins_loaded']);
// Initialize components
add_action('init', [$this, 'init_components']);
}
/**
* Plugin activation
*/
public function activate() {
$database = new BDM_Database();
$database->create_tables();
// Flush rewrite rules
flush_rewrite_rules();
// Store activation time
update_option('bd_bookshelf_activation_time', current_time('timestamp'));
}
/**
* Plugin deactivation
*/
public function deactivate() {
// Clear scheduled events
wp_clear_scheduled_hook('bd_bookshelf_sync_ratings');
// Flush rewrite rules
flush_rewrite_rules();
}
/**
* Init hook
*/
public function init() {
// Load text domain
load_plugin_textdomain('bd-bookshelf', false, dirname(BD_BOOKSHELF_BASENAME) . '/languages');
}
/**
* Plugins loaded hook
*/
public function plugins_loaded() {
// Check for updates, etc.
}
/**
* Initialize components
*/
public function init_components() {
// Initialize admin
if (is_admin()) {
new BDM_Admin();
new BDM_Migration();
}
// Initialize public facing features
new BDM_Shortcodes();
new BDM_GDPR();
// Initialize rating sync (cron)
new BDM_Rating_Sync();
}
}
/**
* Initialize plugin
*/
function bd_bookshelf() {
return BD_Bookshelf::instance();
}
// Start the plugin
bd_bookshelf();