# DiveWP Documentation

## License and Copyright
- License: GPL v2 or later
- License URI: http://www.gnu.org/licenses/gpl-2.0.html
- All code, including included libraries and assets, is GPL-compatible

## Privacy and Data Collection
DiveWP collects the following data locally on your server:
- Email logs (for email system monitoring)
- User events (for administrator activity tracking)
- Performance metrics
- Security scan results

**Important**: All data is stored locally in your WordPress database. No data is sent to external servers without explicit consent.

## Code and Development
- Source code is fully human-readable and documented
- Development repository: [GitHub Repository URL]
- Built using WordPress core libraries and functions
- No code obfuscation or hidden functionality

## Installation and Setup

### Automatic Installation (Recommended)
1. Upload the `divewp` folder to `/wp-content/plugins/`
2. Activate through WordPress admin panel
3. Access via 'DiveWP' in admin menu

### Database Tables
The plugin creates the following tables in your WordPress database:
1. `{prefix}_divewp_email_log`: Tracks email communications
2. `{prefix}_divewp_user_events`: Logs administrator activities

All tables use your WordPress database's charset and collation settings.

### Third-Party Libraries and APIs
This plugin uses:
- WordPress core libraries only
- No external services without user consent
- Standard WordPress hooks and filters

### Security and Permissions
- Requires 'manage_options' capability
- Implements WordPress security best practices
- Uses WordPress nonce verification
- Sanitizes all input/output

## Table of Contents
1. [Introduction](#introduction)
2. [Features Overview](#features-overview)
3. [Architecture](#architecture)
4. [Content Structure](#content-structure)
5. [Development Guide](#development-guide)
6. [Security](#security)
7. [Changelog](#changelog)
8. [File and Folder Structure](#file-and-folder-structure)

## File and Folder Structure
```
divewp/
├── assets/                        # Frontend and admin assets
│   ├── css/                      # Stylesheet files
│   │   ├── features/            # Feature-specific styles
│   │   │   ├── dashboard.css    # Dashboard layout and components
│   │   │   ├── email-communications.css  # Email feature styles
│   │   │   ├── feedback.css    # User feedback interface
│   │   │   ├── timeline.css    # Timeline visualization
│   │   │   └── user-events.css # User activity tracking styles
│   │   ├── divewp-global.css   # Global plugin styles
│   │   └── style.css          # Main plugin stylesheet
│   ├── images/                  # Plugin images and icons
│   │   ├── D.svg              # Plugin icon
│   │   ├── diveWP.svg         # Plugin logo
│   │   └── oleg_head.png      # Author avatar
│   └── js/                      # JavaScript files
│       ├── dashboard-counter.js # Dashboard statistics handler
│       ├── divewp-admin.js     # Main admin interface logic
│       ├── feedback.js         # User feedback functionality
│       └── recommendations.js  # Recommendation system logic
├── content/                      # Content and data files
│   ├── features/               # Feature-specific content
│   │   ├── db-insights/       # Database analysis content
│   │   ├── email-communications/  # Email system content
│   │   ├── performance-checks/    # Performance metrics content
│   │   ├── security-insights/     # Security analysis content
│   │   ├── seo-optimization/      # SEO recommendations
│   │   ├── server-insights-new/   # Server analysis content (to be renamed)
│   │   ├── theme-builder/         # Theme analysis content
│   │   └── woocommerce-best-practices/  # WooCommerce optimization content
│   └── sidebar-content/          # Sidebar widgets and content
├── includes/                     # Core plugin PHP files
│   ├── admin/                   # Admin interface components
│   │   └── templates/          # Admin page templates
│   │       ├── admin-left-sidebar.php   # Left sidebar template
│   │       ├── admin-page.php           # Main admin page template
│   │       └── admin-right-sidebar.php  # Right sidebar template
│   ├── features/                # Feature implementation classes
│   │   ├── db-insights/        # Database analysis logic
│   │   ├── email-communications/  # Email system handlers
│   │   ├── performance-optimizations/  # Performance check logic
│   │   ├── security-insights/     # Security analysis system
│   │   ├── seo-optimization/      # SEO check implementation
│   │   ├── server-insights/       # Server analysis logic
│   │   ├── theme-builder/         # Theme analysis system
│   │   ├── user-events/          # User activity tracking
│   │   └── woocommerce-best-practices/  # WooCommerce optimization
│   ├── templates/               # Reusable template components
│   │   └── card-template.php   # Card visualization template
│   ├── class-content-loader.php     # JSON content loading system
│   ├── class-dashboard-overview.php  # Main dashboard controller
│   ├── class-divewp-database.php    # Database operations handler
│   ├── class-divewp-db-access.php   # Database access layer
│   ├── class-divewp-feedback.php    # User feedback system
│   ├── class-divewp-main.php        # Main plugin controller
│   └── class-update-checker.php     # Plugin update system
├── languages/                    # Internationalization files
│   └── divewp.pot              # Translation template
├── divewp.php                   # Main plugin file, bootstrap
├── index.php                    # Security file, prevents direct access
├── README.txt                   # WordPress.org plugin readme
├── documentation.md             # Technical documentation
└── uninstall.php               # Clean uninstallation handler
```

## Introduction
DiveWP is a comprehensive WordPress plugin designed to provide deep insights and management capabilities for your WordPress site. The plugin offers a modular architecture with multiple features focused on site optimization, security, and performance monitoring.

## Core Features
Based on the main plugin class (`DiveWP_Main`), the plugin includes the following core components:

1. **Server Insights**
   - New server analysis system
   - Performance monitoring
   - Server configuration analysis

2. **Security Module**
   - Security best practices implementation
   - Security headers management
   - XSS prevention
   - Path traversal prevention

3. **Email Communications**
   - Email insights and analytics
   - Email logging system
   - Communication tracking

4. **Performance Optimization**
   - Performance checks and monitoring
   - Timing data analysis
   - Optimization recommendations

5. **Database Management**
   - Database insights
   - Table management
   - Performance optimization
   - Custom tables for:
     - Email logging
     - User events tracking

6. **User Interface**
   - Modern dashboard overview
   - Theme builder integration
   - Admin bar integration
   - Custom styling with Google Fonts integration

7. **Additional Features**
   - WooCommerce best practices
   - SEO optimization
   - User event tracking
   - Feedback system

## Technical Requirements

### Minimum Requirements
- WordPress 5.3.18 or higher
- PHP 7.4 or higher
- MySQL with InnoDB support
- WordPress user with 'manage_options' capability

## Features Overview
- **Dashboard Overview**: Card-based visualization system
- **Server Insights**: PHP, MySQL, server configuration analysis
- **Security Checks**: SSL, file permissions, security best practices
- **Performance Optimization**: Caching, compression, speed factors
- **Database Health**: Size monitoring, optimization recommendations
- **SEO Status**: Sitemap, meta tags, search engine visibility
- **Email System**: SMTP configuration, delivery monitoring
- **WooCommerce Integration**: Performance analysis for stores
- **Administrator Activity Tracking**: Comprehensive user action logging

## Architecture
- **Core Classes**: Located in `/includes/`
- **Feature Modules**: Modular structure in `/includes/features/`
- **Admin Interface**: Templates in `/includes/admin/templates/`
- **Assets**: CSS/JS/Images in `/assets/`
- **Content**: JSON-based content in `/content/`

## Content Structure
- JSON-based content system for maintainability
- Separate content from logic
- Easy to update without code changes
- Located in `/content/features/`

## Development Guide
- Modular architecture for easy extensions
- WordPress coding standards compliance
- Action/Filter hooks for customization
- Feature-specific classes in dedicated directories

## Security
- Enhanced security measures
- Input sanitization and validation
- Nonce verification
- Capability checks
- Secure data handling

## Changelog
### Version 1.0.0
- First public release on WordPress.org
- Complete UI redesign
- New card-based visualization
- JSON content loading system
- Administrator Activity Tracking
- Enhanced security measures
- Improved feature checks
- Architectural improvements

[Previous Development Versions]
### Version 2.0.0-2.0.2 Beta
- Development and beta testing versions
- Not publicly released

## Development and Contributions
- Code follows WordPress coding standards
- Pull requests welcome via GitHub
- Bug reports and feature requests tracked on GitHub
- Documentation maintained in repository

## Support and Updates
- Regular updates via WordPress.org
- Support via WordPress.org forums
- Security updates prioritized
- Version numbering follows semantic versioning

## Privacy Notice
This plugin:
- Does not send data to external servers
- Stores all data in your WordPress database
- Requires user consent for any data collection
- Provides data export/erasure tools 