tigerstyle-life9/tigerstyle-life9-demo.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

497 lines
21 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_CLEAN_VERSION', '1.0.0');
define('TIGERSTYLE_LIFE9_CLEAN_PATH', plugin_dir_path(__FILE__));
define('TIGERSTYLE_LIFE9_CLEAN_URL', plugin_dir_url(__FILE__));
define('TIGERSTYLE_LIFE9_CLEAN_BASENAME', plugin_basename(__FILE__));
define('TIGERSTYLE_LIFE9_CLEAN_FILE', __FILE__);
/**
* TigerStyle Life9 Plugin Class
*
* Cat-themed backup and restore plugin interface
*
* @since 1.0.0
*/
class TigerStyle_Life9_Clean {
/**
* Plugin instance
*
* @var TigerStyle_Life9_Clean
*/
private static $instance = null;
/**
* Get plugin instance (Singleton pattern)
*
* @return TigerStyle_Life9_Clean
*/
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('init', [$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-clean', // Menu slug
[$this, 'render_dashboard_page'], // Callback
'dashicons-backup', // Icon
31 // Position (different from main plugin)
);
// Submenu pages with cat themes
add_submenu_page(
'tigerstyle-life9-clean',
'💾 Save a Life',
'💾 Save a Life',
'manage_options',
'tigerstyle-life9-clean-backup',
[$this, 'render_backup_page']
);
add_submenu_page(
'tigerstyle-life9-clean',
'🔄 Restore a Life',
'🔄 Restore a Life',
'manage_options',
'tigerstyle-life9-clean-restore',
[$this, 'render_restore_page']
);
add_submenu_page(
'tigerstyle-life9-clean',
'⚙️ Territory Settings',
'⚙️ Territory Settings',
'manage_options',
'tigerstyle-life9-clean-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-clean') === false) {
return;
}
// Add some basic styling
wp_add_inline_style('admin-menu', '
.tigerstyle-life9-clean .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-cat-demo {
background: #e8f5e8;
border-left: 4px solid #46b450;
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-clean">
<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 with feline grace and precision.', '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>7</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>
<tr>
<th scope="row"><?php _e('🕐 Last Backup:', 'tigerstyle-life9'); ?></th>
<td><span style="color: green;">✅ <?php _e('Today at 3:42 AM (while you were sleeping)', 'tigerstyle-life9'); ?></span></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-clean-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-clean-restore'); ?>" class="button">
🔄 <?php _e('Restore a Life', 'tigerstyle-life9'); ?>
</a>
<a href="<?php echo admin_url('admin.php?page=tigerstyle-life9-clean-settings'); ?>" class="button">
⚙️ <?php _e('Territory Settings', 'tigerstyle-life9'); ?>
</a>
</p>
</div>
<div class="card">
<h2 class="title"><?php _e('🐱 Cat Wisdom Corner', 'tigerstyle-life9'); ?></h2>
<blockquote style="font-style: italic; padding: 1em; background: #f9f9f9; border-left: 3px solid #0073aa;">
"A cat always lands on its feet, but a server that crashes... well, that's why we have backups!
Smart cats always have multiple escape routes, and smart sysadmins always have multiple backups."
<br><br>
<strong>- Ancient Cat Proverb (according to TigerStyle)</strong>
</blockquote>
</div>
</div>
<?php
}
/**
* Render backup page
*/
public function render_backup_page() {
?>
<div class="wrap tigerstyle-life9-clean">
<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('CatLife-' . 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><br/>
<label>
<input type="checkbox" name="include_cat_magic" value="1" checked disabled />
✨ <?php _e('Cat magic and feline wisdom (always included)', '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>🐱 Backup Tip:</strong> <?php _e('Your backups are automatically encrypted with cat-grade security. Each backup includes a purr-fect integrity check!', 'tigerstyle-life9'); ?></p>
</div>
</div>
<?php
}
/**
* Render restore page
*/
public function render_restore_page() {
?>
<div class="wrap tigerstyle-life9-clean">
<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>
<table class="widefat fixed striped">
<thead>
<tr>
<th><?php _e('Backup Name', 'tigerstyle-life9'); ?></th>
<th><?php _e('Created', 'tigerstyle-life9'); ?></th>
<th><?php _e('Size', 'tigerstyle-life9'); ?></th>
<th><?php _e('Cat Rating', 'tigerstyle-life9'); ?></th>
<th><?php _e('Actions', 'tigerstyle-life9'); ?></th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>CatLife-2025-09-17</strong></td>
<td>Today, 2 hours ago</td>
<td>45.2 MB</td>
<td>🐱🐱🐱🐱🐱 (5 cats)</td>
<td>
<button class="button button-primary">🔄 Restore</button>
<button class="button">📥 Download</button>
</td>
</tr>
<tr>
<td><strong>CatLife-2025-09-16</strong></td>
<td>Yesterday</td>
<td>43.8 MB</td>
<td>🐱🐱🐱🐱 (4 cats)</td>
<td>
<button class="button button-primary">🔄 Restore</button>
<button class="button">📥 Download</button>
</td>
</tr>
<tr>
<td><strong>CatLife-Emergency</strong></td>
<td>Last week</td>
<td>41.5 MB</td>
<td>🐱🐱🐱🐱🐱🐱 (6 cats - emergency backup!)</td>
<td>
<button class="button button-primary">🔄 Restore</button>
<button class="button">📥 Download</button>
</td>
</tr>
</tbody>
</table>
<p style="margin-top: 15px;">
<button class="button button-primary">
💾 <?php _e('Create New Backup', 'tigerstyle-life9'); ?>
</button>
</p>
</div>
<div class="tigerstyle-cat-success">
<p><strong>🐱 Restore Tip:</strong> <?php _e('All restores include automatic verification and a "purr progress indicator" so you know everything is working paw-fectly!', 'tigerstyle-life9'); ?></p>
</div>
</div>
<?php
}
/**
* Render settings page
*/
public function render_settings_page() {
?>
<div class="wrap tigerstyle-life9-clean">
<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="">
<?php wp_nonce_field('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"><?php _e('Cloud Territory (Amazon S3)', 'tigerstyle-life9'); ?></option>
<option value="google"><?php _e('Google Cat Cloud', 'tigerstyle-life9'); ?></option>
<option value="dropbox"><?php _e('Dropbox Den', '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="hourly"><?php _e('Every Hour (Hyperactive kitten mode)', 'tigerstyle-life9'); ?></option>
<option value="daily" selected><?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>
<tr>
<th scope="row"><?php _e('🎵 Purr Notifications', 'tigerstyle-life9'); ?></th>
<td>
<fieldset>
<label>
<input type="checkbox" name="email_notifications" value="1" checked />
📧 <?php _e('Email notifications (when backups complete)', 'tigerstyle-life9'); ?>
</label><br/>
<label>
<input type="checkbox" name="purr_sounds" value="1" />
🔊 <?php _e('Purr sound effects (on successful backup)', 'tigerstyle-life9'); ?>
</label><br/>
<label>
<input type="checkbox" name="cat_gifs" value="1" checked />
🎭 <?php _e('Random cat GIFs (because why not?)', 'tigerstyle-life9'); ?>
</label>
</fieldset>
</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>🐱 Settings Tip:</strong> <?php _e('All settings are saved instantly with purr-fect precision. Your backup territory will be organized exactly how you like it!', 'tigerstyle-life9'); ?></p>
</div>
</div>
<?php
}
}
/**
* Initialize the demo plugin
*
* @return TigerStyle_Life9_Demo
*/
function tigerstyle_life9_clean_init() {
return TigerStyle_Life9_Clean::instance();
}
// Start the clean plugin
tigerstyle_life9_clean_init();