Make your WordPress site irresistible. Natural SEO attraction with: - robots.txt management - sitemap.xml generation - LLMs.txt support - Google integration (Analytics, Search Console, Tag Manager) - Schema.org structured data - Open Graph / Twitter Card meta tags - AMP support - Visual elements gallery - Built-in backup/restore module Includes build.sh and .distignore for WordPress-installable release ZIPs.
191 lines
6.6 KiB
PHP
191 lines
6.6 KiB
PHP
<?php
|
|
/**
|
|
* Core plugin functionality
|
|
*/
|
|
|
|
// Prevent direct access
|
|
if (!defined('ABSPATH')) {
|
|
exit;
|
|
}
|
|
|
|
class TigerStyleSEO_Core {
|
|
|
|
/**
|
|
* Plugin activation
|
|
*/
|
|
public static function activate() {
|
|
// Set default options for all modules
|
|
self::set_default_options();
|
|
|
|
// Create database tables
|
|
self::create_database_tables();
|
|
|
|
// Flush rewrite rules
|
|
flush_rewrite_rules();
|
|
}
|
|
|
|
/**
|
|
* Plugin deactivation
|
|
*/
|
|
public static function deactivate() {
|
|
// Flush rewrite rules
|
|
flush_rewrite_rules();
|
|
}
|
|
|
|
/**
|
|
* Set default options for all modules
|
|
*/
|
|
private static function set_default_options() {
|
|
// Robots.txt options
|
|
add_option('tigerstyle_robots_txt_content', '');
|
|
add_option('tigerstyle_robots_txt_add_sitemap', true);
|
|
|
|
// Sitemap options
|
|
add_option('tigerstyle_sitemap_xml_enabled', false);
|
|
|
|
// LLMs.txt options
|
|
add_option('tigerstyle_llmstxt_enabled', false);
|
|
add_option('tigerstyle_llmstxt_content', '');
|
|
|
|
// Google Setup options
|
|
add_option('tigerstyle_google_analytics_id', '');
|
|
add_option('tigerstyle_google_tag_manager_id', '');
|
|
add_option('tigerstyle_google_site_verification', '');
|
|
|
|
// Meta Tags options
|
|
add_option('tigerstyle_meta_description_default', '');
|
|
add_option('tigerstyle_meta_keywords_default', '');
|
|
add_option('tigerstyle_meta_author_default', get_bloginfo('name'));
|
|
add_option('tigerstyle_og_site_name', get_bloginfo('name'));
|
|
add_option('tigerstyle_og_default_image', '');
|
|
add_option('tigerstyle_twitter_site', '');
|
|
add_option('tigerstyle_meta_charset_enabled', true);
|
|
add_option('tigerstyle_meta_viewport_enabled', true);
|
|
add_option('tigerstyle_meta_theme_color', '#000000');
|
|
add_option('tigerstyle_meta_robots_default', 'index,follow');
|
|
add_option('tigerstyle_meta_nosnippet_enabled', false);
|
|
add_option('tigerstyle_meta_max_snippet', '');
|
|
add_option('tigerstyle_meta_max_image_preview', '');
|
|
add_option('tigerstyle_meta_tag_patterns', array());
|
|
|
|
// Structured Data options
|
|
add_option('tigerstyle_organization_enabled', false);
|
|
add_option('tigerstyle_organization_name', get_bloginfo('name'));
|
|
add_option('tigerstyle_organization_logo', '');
|
|
add_option('tigerstyle_organization_description', '');
|
|
add_option('tigerstyle_organization_email', '');
|
|
add_option('tigerstyle_organization_phone', '');
|
|
add_option('tigerstyle_organization_social_profiles', '');
|
|
add_option('tigerstyle_local_business_enabled', false);
|
|
add_option('tigerstyle_business_type', 'LocalBusiness');
|
|
add_option('tigerstyle_business_address_street', '');
|
|
add_option('tigerstyle_business_address_city', '');
|
|
add_option('tigerstyle_business_address_state', '');
|
|
add_option('tigerstyle_business_address_zip', '');
|
|
add_option('tigerstyle_business_address_country', 'US');
|
|
add_option('tigerstyle_business_latitude', '');
|
|
add_option('tigerstyle_business_longitude', '');
|
|
add_option('tigerstyle_business_hours', '');
|
|
add_option('tigerstyle_business_price_range', '');
|
|
|
|
// Head/Footer injection options
|
|
add_option('tigerstyle_head_enabled', false);
|
|
add_option('tigerstyle_footer_enabled', false);
|
|
add_option('tigerstyle_head_content', '');
|
|
add_option('tigerstyle_footer_content', '');
|
|
|
|
// Performance options
|
|
add_option('tigerstyle_compression_enabled', false);
|
|
add_option('tigerstyle_compression_level', 6);
|
|
add_option('tigerstyle_compression_type', 'gzip');
|
|
|
|
// Backup & Restore options
|
|
add_option('tigerstyle_backup_settings', array(
|
|
'compression' => 'zip',
|
|
'storage_location' => 'local',
|
|
'schedule_enabled' => false,
|
|
'schedule_frequency' => 'daily',
|
|
'retention_days' => 30,
|
|
'include_files' => true,
|
|
'include_database' => true,
|
|
'chunk_size' => 5,
|
|
's3_bucket' => '',
|
|
's3_access_key' => '',
|
|
's3_secret_key' => '',
|
|
's3_region' => 'us-east-1',
|
|
's3_endpoint' => '',
|
|
'email_notifications' => false,
|
|
'notification_email' => get_option('admin_email')
|
|
));
|
|
}
|
|
|
|
/**
|
|
* Create database tables
|
|
*/
|
|
private static function create_database_tables() {
|
|
global $wpdb;
|
|
|
|
$charset_collate = $wpdb->get_charset_collate();
|
|
|
|
// Backup metadata table
|
|
$backup_metadata_table = $wpdb->prefix . 'tigerstyle_backup_metadata';
|
|
$sql = "CREATE TABLE IF NOT EXISTS {$backup_metadata_table} (
|
|
id int(11) NOT NULL AUTO_INCREMENT,
|
|
backup_id varchar(255) NOT NULL,
|
|
storage_type varchar(50) NOT NULL,
|
|
file_path text,
|
|
s3_bucket varchar(255),
|
|
s3_key varchar(500),
|
|
s3_url text,
|
|
file_size bigint(20) NOT NULL DEFAULT 0,
|
|
created_at datetime NOT NULL,
|
|
metadata_json text,
|
|
PRIMARY KEY (id),
|
|
UNIQUE KEY backup_id (backup_id),
|
|
KEY storage_type (storage_type),
|
|
KEY created_at (created_at)
|
|
) {$charset_collate};";
|
|
|
|
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
|
|
dbDelta($sql);
|
|
|
|
// Backup logs table
|
|
$backup_logs_table = $wpdb->prefix . 'tigerstyle_backup_logs';
|
|
$sql = "CREATE TABLE IF NOT EXISTS {$backup_logs_table} (
|
|
id int(11) NOT NULL AUTO_INCREMENT,
|
|
level varchar(20) NOT NULL,
|
|
message text NOT NULL,
|
|
context longtext,
|
|
user_id int(11) DEFAULT 0,
|
|
ip_address varchar(45),
|
|
created_at datetime NOT NULL,
|
|
PRIMARY KEY (id),
|
|
KEY level (level),
|
|
KEY created_at (created_at),
|
|
KEY user_id (user_id)
|
|
) {$charset_collate};";
|
|
|
|
dbDelta($sql);
|
|
}
|
|
|
|
/**
|
|
* Get plugin version
|
|
*/
|
|
public static function get_version() {
|
|
return TIGERSTYLE_HEAT_VERSION;
|
|
}
|
|
|
|
/**
|
|
* Get plugin directory path
|
|
*/
|
|
public static function get_plugin_dir() {
|
|
return TIGERSTYLE_HEAT_PLUGIN_DIR;
|
|
}
|
|
|
|
/**
|
|
* Get plugin URL
|
|
*/
|
|
public static function get_plugin_url() {
|
|
return TIGERSTYLE_HEAT_PLUGIN_URL;
|
|
}
|
|
} |