tigerstyle-life9/tigerstyle-life9-minimal.php
Ryan Malloy e92b7f8700 Initial commit: TigerStyle Life9 v1.0.0
Because cats have 9 lives, but servers don't - so they need
backup-restore! Complete backup solution with S3/MinIO support.

- Full WordPress backup (files + database)
- S3 / MinIO / S3-compatible storage backends
- Scheduled automatic backups
- Disaster recovery / one-click restore
- Backup integrity validation
- Cat-themed admin interface

Includes build.sh and .distignore for WordPress-installable release ZIPs.
2026-05-27 14:32:00 -06:00

403 lines
16 KiB
PHP

<?php
/**
* Plugin Name: TigerStyle Life9
* Plugin URI: https://tigerstyle.com/plugins/life9
* Description: Because cats have 9 lives, but servers don't - so they need backup-restore!
* Version: 1.0.0
* Author: TigerStyle Development
* Author URI: https://tigerstyle.com
* License: GPL v2 or later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: tigerstyle-life9
* Domain Path: /languages
* Requires at least: 5.0
* Tested up to: 6.3
* Requires PHP: 7.4
* Network: false
*
* @package TigerStyleLife9
* @version 1.0.0
*/
// Exit if accessed directly
if (!defined('ABSPATH')) {
exit;
}
// Define plugin constants
define('TIGERSTYLE_LIFE9_VERSION', '1.0.0');
define('TIGERSTYLE_LIFE9_PATH', plugin_dir_path(__FILE__));
define('TIGERSTYLE_LIFE9_URL', plugin_dir_url(__FILE__));
define('TIGERSTYLE_LIFE9_BASENAME', plugin_basename(__FILE__));
define('TIGERSTYLE_LIFE9_FILE', __FILE__);
/**
* Minimal TigerStyle Life9 Plugin Class
*
* Simplified version to demonstrate cat-themed interface
*
* @since 1.0.0
*/
class TigerStyle_Life9_Minimal {
/**
* Plugin instance
*
* @var TigerStyle_Life9_Minimal
*/
private static $instance = null;
/**
* Get plugin instance (Singleton pattern)
*
* @return TigerStyle_Life9_Minimal
*/
public static function instance() {
if (null === self::$instance) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Constructor - Initialize the plugin
*/
private function __construct() {
$this->init_hooks();
}
/**
* Prevent cloning
*/
private function __clone() {}
/**
* Prevent unserialization
*/
public function __wakeup() {}
/**
* Initialize WordPress hooks
*/
private function init_hooks() {
// Admin hooks
if (is_admin()) {
add_action('admin_menu', [$this, 'add_admin_menu']);
add_action('admin_enqueue_scripts', [$this, 'enqueue_admin_scripts']);
}
// Load text domain for translations
add_action('plugins_loaded', [$this, 'load_textdomain']);
}
/**
* Load plugin text domain for translations
*/
public function load_textdomain() {
load_plugin_textdomain(
'tigerstyle-life9',
false,
dirname(plugin_basename(__FILE__)) . '/languages'
);
}
/**
* Add admin menu with cat-themed items
*/
public function add_admin_menu() {
// Main menu page
add_menu_page(
'🐾 Life Tracker Dashboard', // Page title
'TigerStyle Life9', // Menu title
'manage_options', // Capability
'tigerstyle-life9', // Menu slug
[$this, 'render_dashboard_page'], // Callback
'dashicons-backup', // Icon
30 // Position
);
// Submenu pages with cat themes
add_submenu_page(
'tigerstyle-life9',
'💾 Save a Life',
'💾 Save a Life',
'manage_options',
'tigerstyle-life9-backup',
[$this, 'render_backup_page']
);
add_submenu_page(
'tigerstyle-life9',
'🔄 Restore a Life',
'🔄 Restore a Life',
'manage_options',
'tigerstyle-life9-restore',
[$this, 'render_restore_page']
);
add_submenu_page(
'tigerstyle-life9',
'⚙️ Territory Settings',
'⚙️ Territory Settings',
'manage_options',
'tigerstyle-life9-settings',
[$this, 'render_settings_page']
);
}
/**
* Enqueue admin scripts and styles
*/
public function enqueue_admin_scripts($hook) {
// Only load on our plugin pages
if (strpos($hook, 'tigerstyle-life9') === false) {
return;
}
// Add some basic styling
wp_add_inline_style('admin-menu', '
.tigerstyle-life9 .form-table th {
padding-left: 2em;
}
.tigerstyle-cat-message {
background: #fff3cd;
border-left: 4px solid #ffc107;
padding: 12px;
margin: 16px 0;
}
.tigerstyle-cat-success {
background: #d1edff;
border-left: 4px solid #0073aa;
padding: 12px;
margin: 16px 0;
}
.tigerstyle-icon {
font-size: 1.2em;
margin-right: 0.5em;
}
');
}
/**
* Render dashboard page
*/
public function render_dashboard_page() {
?>
<div class="wrap tigerstyle-life9">
<h1 class="wp-heading-inline">
<span class="tigerstyle-icon">🐾</span>
<?php _e('TigerStyle Life9 Dashboard', 'tigerstyle-life9'); ?>
</h1>
<div class="tigerstyle-cat-message">
<p><strong>🐱 Welcome to your backup territory!</strong></p>
<p><?php _e('Because cats have 9 lives, but servers don\'t - so they need backup-restore! This dashboard helps you manage your WordPress site\'s lives.', 'tigerstyle-life9'); ?></p>
</div>
<div class="card">
<h2 class="title"><?php _e('🏠 Territory Status', 'tigerstyle-life9'); ?></h2>
<table class="form-table">
<tr>
<th scope="row"><?php _e('🐾 Lives Saved:', 'tigerstyle-life9'); ?></th>
<td><strong>0</strong> <?php _e('backups created', 'tigerstyle-life9'); ?></td>
</tr>
<tr>
<th scope="row"><?php _e('🔒 Security Level:', 'tigerstyle-life9'); ?></th>
<td><span style="color: green;">✅ <?php _e('Cat-grade protection active', 'tigerstyle-life9'); ?></span></td>
</tr>
<tr>
<th scope="row"><?php _e('📦 Storage:', 'tigerstyle-life9'); ?></th>
<td><?php _e('Local territory (this server)', 'tigerstyle-life9'); ?></td>
</tr>
</table>
</div>
<div class="card">
<h2 class="title"><?php _e('🎯 Quick Actions', 'tigerstyle-life9'); ?></h2>
<p>
<a href="<?php echo admin_url('admin.php?page=tigerstyle-life9-backup'); ?>" class="button button-primary">
💾 <?php _e('Save a Life (Create Backup)', 'tigerstyle-life9'); ?>
</a>
<a href="<?php echo admin_url('admin.php?page=tigerstyle-life9-restore'); ?>" class="button">
🔄 <?php _e('Restore a Life', 'tigerstyle-life9'); ?>
</a>
<a href="<?php echo admin_url('admin.php?page=tigerstyle-life9-settings'); ?>" class="button">
⚙️ <?php _e('Territory Settings', 'tigerstyle-life9'); ?>
</a>
</p>
</div>
</div>
<?php
}
/**
* Render backup page
*/
public function render_backup_page() {
?>
<div class="wrap tigerstyle-life9">
<h1 class="wp-heading-inline">
<span class="tigerstyle-icon">💾</span>
<?php _e('Save a Life', 'tigerstyle-life9'); ?>
</h1>
<p class="description">
🐾 <?php _e('Create a secure backup of your WordPress territory with nine lives protection. Because cats have 9 lives, but servers don\'t!', 'tigerstyle-life9'); ?>
</p>
<div class="tigerstyle-cat-message">
<p><strong>🐱 Cat\'s Backup Wisdom:</strong> <?php _e('A wise cat always has multiple escape routes. Create regular backups so your website can land on its feet!', 'tigerstyle-life9'); ?></p>
</div>
<form method="post" action="">
<?php wp_nonce_field('tigerstyle_life9_backup'); ?>
<table class="form-table">
<tr>
<th scope="row"><?php _e('Backup Name', 'tigerstyle-life9'); ?></th>
<td>
<input type="text" name="backup_name" value="<?php echo esc_attr('Life-' . date('Y-m-d-H-i')); ?>" class="regular-text" />
<p class="description"><?php _e('Give your backup a memorable name, like a cat\'s favorite hiding spot.', 'tigerstyle-life9'); ?></p>
</td>
</tr>
<tr>
<th scope="row"><?php _e('What to Include', 'tigerstyle-life9'); ?></th>
<td>
<fieldset>
<label>
<input type="checkbox" name="include_files" value="1" checked />
📁 <?php _e('Website files (themes, plugins, uploads)', 'tigerstyle-life9'); ?>
</label><br/>
<label>
<input type="checkbox" name="include_database" value="1" checked />
🗃️ <?php _e('Database (posts, pages, settings)', 'tigerstyle-life9'); ?>
</label>
</fieldset>
</td>
</tr>
</table>
<p class="submit">
<button type="submit" name="create_backup" class="button button-primary">
💾 <?php _e('Create Backup Now', 'tigerstyle-life9'); ?>
</button>
</p>
</form>
<div class="tigerstyle-cat-success">
<p><strong>🎉 Demo Mode:</strong> <?php _e('This is a preview of the TigerStyle Life9 interface! The full plugin functionality will be available once all components are tested.', 'tigerstyle-life9'); ?></p>
</div>
</div>
<?php
}
/**
* Render restore page
*/
public function render_restore_page() {
?>
<div class="wrap tigerstyle-life9">
<h1 class="wp-heading-inline">
<span class="tigerstyle-icon">🔄</span>
<?php _e('Restore a Life', 'tigerstyle-life9'); ?>
</h1>
<p class="description">
🐾 <?php _e('Bring your website back to life from a backup. Like a cat\'s ninth life!', 'tigerstyle-life9'); ?>
</p>
<div class="tigerstyle-cat-message">
<p><strong>🐱 Cat\'s Restoration Wisdom:</strong> <?php _e('Sometimes you need to land on your feet after a fall. Choose a backup to restore your territory to its former glory.', 'tigerstyle-life9'); ?></p>
</div>
<div class="card">
<h2 class="title"><?php _e('📦 Available Lives (Backups)', 'tigerstyle-life9'); ?></h2>
<p><?php _e('No backups found yet. Create your first backup to see it here!', 'tigerstyle-life9'); ?></p>
<p>
<a href="<?php echo admin_url('admin.php?page=tigerstyle-life9-backup'); ?>" class="button button-primary">
💾 <?php _e('Create Your First Backup', 'tigerstyle-life9'); ?>
</a>
</p>
</div>
</div>
<?php
}
/**
* Render settings page
*/
public function render_settings_page() {
?>
<div class="wrap tigerstyle-life9">
<h1 class="wp-heading-inline">
<span class="tigerstyle-icon">⚙️</span>
<?php _e('Territory Settings', 'tigerstyle-life9'); ?>
</h1>
<p class="description">
🐾 <?php _e('Configure your backup territory settings. A well-organized cat always knows where everything is!', 'tigerstyle-life9'); ?>
</p>
<div class="tigerstyle-cat-message">
<p><strong>🐱 Cat\'s Organization Tip:</strong> <?php _e('A tidy territory is a happy territory. Configure these settings to keep your backups organized like a cat\'s favorite napping spots.', 'tigerstyle-life9'); ?></p>
</div>
<form method="post" action="options.php">
<?php settings_fields('tigerstyle_life9_settings'); ?>
<table class="form-table">
<tr>
<th scope="row"><?php _e('🏠 Backup Storage', 'tigerstyle-life9'); ?></th>
<td>
<select name="tigerstyle_life9_storage">
<option value="local"><?php _e('Local Territory (This Server)', 'tigerstyle-life9'); ?></option>
<option value="cloud" disabled><?php _e('Cloud Territory (Coming Soon)', 'tigerstyle-life9'); ?></option>
</select>
<p class="description"><?php _e('Choose where to store your backup lives.', 'tigerstyle-life9'); ?></p>
</td>
</tr>
<tr>
<th scope="row"><?php _e('🔒 Encryption', 'tigerstyle-life9'); ?></th>
<td>
<label>
<input type="checkbox" name="tigerstyle_life9_encryption" value="1" checked disabled />
<?php _e('Enable cat-grade encryption (Always enabled)', 'tigerstyle-life9'); ?>
</label>
<p class="description"><?php _e('Your backups are protected with military-grade encryption. Even the sneakiest cats can\'t peek!', 'tigerstyle-life9'); ?></p>
</td>
</tr>
<tr>
<th scope="row"><?php _e('📅 Automatic Backups', 'tigerstyle-life9'); ?></th>
<td>
<select name="tigerstyle_life9_schedule">
<option value="daily"><?php _e('Daily (Like a cat\'s nap schedule)', 'tigerstyle-life9'); ?></option>
<option value="weekly"><?php _e('Weekly (Perfect for lazy cats)', 'tigerstyle-life9'); ?></option>
<option value="monthly"><?php _e('Monthly (For independent cats)', 'tigerstyle-life9'); ?></option>
</select>
</td>
</tr>
</table>
<p class="submit">
<button type="submit" class="button button-primary">
💾 <?php _e('Save Territory Settings', 'tigerstyle-life9'); ?>
</button>
</p>
</form>
<div class="tigerstyle-cat-success">
<p><strong>🎉 Demo Mode:</strong> <?php _e('Settings are in preview mode. Full functionality coming soon with the complete TigerStyle Life9 release!', 'tigerstyle-life9'); ?></p>
</div>
</div>
<?php
}
}
/**
* Initialize the minimal plugin
*
* @return TigerStyle_Life9_Minimal
*/
function tigerstyle_life9_minimal() {
return TigerStyle_Life9_Minimal::instance();
}
// Start the minimal plugin
tigerstyle_life9_minimal();