Skip to content

Commit 7adaf55

Browse files
authored
Update
1 parent f95ed0b commit 7adaf55

File tree

2 files changed

+33
-6
lines changed

2 files changed

+33
-6
lines changed

.github/copilot-instructions.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,14 @@ applyTo: '**'
1717
## 📋 Essential Requirements
1818

1919
### WordPress Compatibility
20+
2021
- **WordPress:** 6.5+ minimum
2122
- **PHP:** 7.4+ minimum
2223
- **WooCommerce:** 5.0+ (when applicable)
2324
- Follow [WordPress Coding Standards](https://developer.wordpress.org/coding-standards/) for PHP, JS, CSS, HTML, and accessibility
2425

2526
### Code Quality Standards
27+
2628
1. **Security First:** Always sanitize input (`sanitize_*()`) and escape output (`esc_*()`)
2729
2. **WordPress APIs:** Use WP functions instead of raw PHP/SQL
2830
3. **Hook System:** Proper use of `add_action()` and `add_filter()`
@@ -55,8 +57,7 @@ applyTo: '**'
5557

5658
**Version Release Process (only when instructed):**
5759
- Follow semantic versioning (MAJOR.MINOR.PATCH)
58-
- Update version in: plugin header, README.md, readme.txt, CHANGELOG.md
59-
- Update version in: constants section, .pot files, package.json, composer.json
60+
- Update version in: plugin header, README.md, readme.txt, CHANGELOG.md, GEMINI.md, and `.pot` language files, constants section, package.json, and composer.json
6061
- Move "Unreleased" changes to new version section in both changelogs
6162
- **Never auto-update versions** - wait for explicit instruction
6263

@@ -65,6 +66,11 @@ applyTo: '**'
6566
- Write clear function/class descriptions
6667
- Document security considerations and hooks used
6768

69+
**Internationalization (i18n):**
70+
- Update `.pot` language files when adding or modifying translatable strings
71+
- Always use the correct text domain when dealing with translation functions
72+
- Mark all user-facing strings with `__()`, `_e()`, `esc_html__()`, `esc_attr__()`, etc.
73+
6874
## ⚡ Performance & Quality
6975

7076
**Performance Optimization:**

GEMINI.md

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
# Project-specific instructions for Gemini AI
2-
# This file provides context about the Simple WP Site Exporter WordPress plugin
3-
# to help Gemini understand the codebase and provide better analysis
4-
51
# Simple WP Site Exporter - WordPress Plugin
62

73
## Project Overview
4+
85
This is a secure WordPress site export plugin that creates complete site backups including files and database as downloadable ZIP archives. Designed for WordPress administrators who need reliable, secure site exports for migrations, backups, or development purposes.
96

107
## Plugin Details
8+
119
- **Name:** Simple WP Site Exporter
1210
- **Version:** 1.8.4
1311
- **WordPress Compatibility:** 6.5+
@@ -18,7 +16,9 @@ This is a secure WordPress site export plugin that creates complete site backups
1816
## Architecture & Design Patterns
1917

2018
### Single-File Plugin Architecture
19+
2120
The plugin follows a single-file architecture pattern for simplicity:
21+
2222
```php
2323
// All functionality contained in simple-wp-site-exporter.php
2424
// Functions prefixed with 'sse_' for namespace consistency
@@ -28,7 +28,9 @@ function sse_function_name() {
2828
```
2929

3030
### Plugin Initialization
31+
3132
The plugin uses proper WordPress initialization patterns:
33+
3234
```php
3335
function sse_init_plugin() {
3436
// Hook admin menu creation
@@ -39,6 +41,7 @@ add_action( 'plugins_loaded', 'sse_init_plugin' );
3941
```
4042

4143
### File Structure
44+
4245
- `simple-wp-site-exporter.php` - Main plugin file (all functionality)
4346
- `languages/` - Translation files (.pot file included)
4447
- `CHANGELOG.md` - Developer changelog
@@ -49,12 +52,14 @@ add_action( 'plugins_loaded', 'sse_init_plugin' );
4952
## WordPress Coding Standards
5053

5154
### Naming Conventions
55+
5256
- **Functions:** `sse_snake_case` (WordPress standard with plugin prefix)
5357
- **Variables:** `$snake_case`
5458
- **Constants:** `SSE_UPPER_SNAKE_CASE`
5559
- **Text Domain:** Always use `'simple-wp-site-exporter'`
5660

5761
### Security Requirements
62+
5863
- Always use `esc_html()`, `esc_attr()`, `esc_url()` for output
5964
- Sanitize input with `sanitize_text_field()`, `wp_unslash()`, etc.
6065
- Use `current_user_can( 'manage_options' )` for capability checks
@@ -63,6 +68,7 @@ add_action( 'plugins_loaded', 'sse_init_plugin' );
6368
- Validate all file paths to prevent directory traversal
6469

6570
### WordPress Integration
71+
6672
- **Hooks:** Proper use of actions and filters
6773
- **File Operations:** WordPress Filesystem API only
6874
- **Database:** WP-CLI integration for secure database exports
@@ -74,43 +80,50 @@ add_action( 'plugins_loaded', 'sse_init_plugin' );
7480
### Core Functionality
7581

7682
#### Site Export Process
83+
7784
- **File Export:** Complete WordPress installation including themes, plugins, uploads
7885
- **Database Export:** Secure database dump using WP-CLI when available
7986
- **ZIP Creation:** All files compressed into downloadable archive
8087
- **Automatic Cleanup:** Export files auto-deleted after 5 minutes for security
8188

8289
#### Security Features
90+
8391
- **Path Traversal Protection:** Comprehensive file path validation
8492
- **File Access Control:** Strict file extension allowlist (ZIP, SQL only)
8593
- **Authentication:** Admin capability checks for all operations
8694
- **Rate Limiting:** Download throttling (1 request per minute per user)
8795
- **Nonce Verification:** CSRF protection on all forms and actions
8896

8997
#### Performance Optimizations
98+
9099
- **Export Locking:** Transient-based system prevents concurrent exports
91100
- **Memory Management:** Stream-based file operations for large files
92101
- **User-Configurable Limits:** File size filtering (100MB, 500MB, 1GB options)
93102
- **Resource Management:** Proper execution time limits and cleanup
94103

95104
#### Admin Interface
105+
96106
- **Export Form:** User-friendly interface with file size options
97107
- **File Management:** Download and delete export files
98108
- **Status Feedback:** Clear success/error messages
99109
- **Security Notices:** User guidance on file security
100110

101111
### File Operation Security
112+
102113
- **Directory Validation:** All paths validated within WordPress upload directory
103114
- **Extension Allowlist:** Only ZIP and SQL files allowed for download
104115
- **Path Resolution:** Multiple validation layers prevent symlink attacks
105116
- **Real Path Validation:** Prevents path manipulation vulnerabilities
106117

107118
### Performance Considerations
119+
108120
- **Large Site Support:** Handles multi-GB WordPress installations
109121
- **Memory Efficiency:** Files processed individually to avoid exhaustion
110122
- **Export Scalability:** Optimized for various hosting environments
111123
- **Cleanup Efficiency:** Automatic file removal prevents disk space issues
112124

113125
### WP-CLI Integration
126+
114127
- **Database Export:** Efficient database dumps when WP-CLI available
115128
- **Security Validation:** WP-CLI executable verification
116129
- **Error Handling:** Graceful fallback when WP-CLI unavailable
@@ -119,18 +132,21 @@ add_action( 'plugins_loaded', 'sse_init_plugin' );
119132
## Development Standards
120133

121134
### Error Handling
135+
122136
- **WP_Error Usage:** Consistent error object returns throughout
123137
- **Comprehensive Logging:** Structured logging with severity levels
124138
- **Security Logging:** Detailed logs for security events
125139
- **User Feedback:** Clear error messages without information disclosure
126140

127141
### Documentation
142+
128143
- **PHPDoc Compliance:** Complete documentation for all functions
129144
- **Security Comments:** Detailed security justifications
130145
- **Code Examples:** Clear usage examples in documentation
131146
- **Version Control:** Comprehensive changelog maintenance
132147

133148
### Testing & Quality Assurance
149+
134150
- **PHPStan Level 5:** Static analysis compliance
135151
- **PHPCS WordPress Standards:** Full coding standards compliance
136152
- **PHPMD Compliance:** Code quality and complexity management
@@ -139,34 +155,39 @@ add_action( 'plugins_loaded', 'sse_init_plugin' );
139155
## When Reviewing Code
140156

141157
### Critical Issues to Flag
158+
142159
1. **File Security Vulnerabilities** (path traversal, unauthorized access)
143160
2. **Export Process Security** (file cleanup, access controls)
144161
3. **Memory Management** (large file handling, resource limits)
145162
4. **WordPress Standard Violations** (coding standards, API usage)
146163
5. **Permission and Capability Issues** (admin access, nonce verification)
147164

148165
### Plugin-Specific Security Concerns
166+
149167
1. **File Path Validation:** Ensure all paths are properly validated
150168
2. **Export File Access:** Verify download security and cleanup
151169
3. **Database Export Security:** Check WP-CLI command construction
152170
4. **Upload Directory Security:** Validate file operations within allowed areas
153171
5. **Temporary File Management:** Ensure proper cleanup of export files
154172

155173
### Performance Focus Areas
174+
156175
1. **Large File Handling:** Memory-efficient file operations
157176
2. **Export Process Optimization:** Minimize resource usage
158177
3. **Concurrent Export Prevention:** Export locking mechanisms
159178
4. **File Size Management:** User-configurable limits and filtering
160179
5. **Cleanup Efficiency:** Automatic file removal processes
161180

162181
### Positive Patterns to Recognize
182+
163183
1. **Security-First Design:** Multiple validation layers
164184
2. **WordPress API Compliance:** Proper use of WordPress functions
165185
3. **User Experience:** Clear interface and feedback
166186
4. **Performance Optimization:** Efficient resource management
167187
5. **Documentation Quality:** Comprehensive code documentation
168188

169189
### Suggestions to Provide
190+
170191
1. **WordPress-Specific Solutions:** Prefer WordPress APIs over generic PHP
171192
2. **Security Enhancements:** Additional validation and protection layers
172193
3. **Performance Improvements:** Memory and resource optimizations

0 commit comments

Comments
 (0)