WP Integrator X
WordPress plugin integrating Google Drive and automated post maintenance with modern React and REST API tooling.
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/msalah11/wp-integrator-x/archive/refs/heads/main.zipWP Integrator X Plugin
A comprehensive WordPress plugin featuring Google Drive integration, posts maintenance functionality, and modern React-based admin interfaces. This plugin demonstrates advanced WordPress development practices including REST API implementation, OAuth authentication, background processing, and WP-CLI integration.
Features
🔗 Google Drive Integration
- OAuth 2.0 Authentication: Secure authentication flow with Google Drive API
- File Operations: Upload, download, and manage files directly from WordPress admin
- Folder Management: Create and organize folders in Google Drive
- React-based Interface: Modern, responsive admin interface built with React 18
- Encrypted Credentials: Secure storage of API credentials using WordPress salts
📝 Posts Maintenance System
- Automated Post Scanning: Scan and update metadata for all posts and pages
- Background Processing: Efficient batch processing with progress tracking
- Customizable Post Types: Filter by specific post types during maintenance
- Scheduled Tasks: Automatic daily maintenance via WordPress cron
- WP-CLI Integration: Command-line interface for server-side operations
🛠️ Developer Features
- REST API Endpoints: Comprehensive API for frontend-backend communication
- Unit Testing: PHPUnit test suite with WordPress testing framework
- Modern Build System: Webpack 5 with Babel, Sass, and asset optimization
- Code Quality: PHPCS, ESLint, and automated testing pipeline
- Internationalization: Full i18n support with translation-ready strings
Requirements
- WordPress: 6.1 or higher
- PHP: 7.4 or higher (8.3 recommended)
- Node.js: 16.x or higher
- Composer: 2.x
Installation
Development Setup
-
Clone the repository into your WordPress plugins directory:
cd wp-content/plugins/ git clone https://github.com/Msalah11/wp-integrator-x.git cd wp-integrator-x -
Install PHP dependencies:
composer install -
Install Node.js dependencies:
npm install -
Build assets:
npm run compile-dev -
Activate the plugin in WordPress admin
Production Build
For production deployment, use the optimized build process:
npm run build
This creates a production-ready plugin package in the /build/ directory with:
- Optimized and minified assets
- Production-only dependencies
- Cleaned vendor directories
- Translation files
Development
Available Commands
| Command | Description |
|---|---|
npm run watch |
Compile assets and watch for changes |
npm run compile |
Compile production-ready assets |
npm run compile-dev |
Compile development assets with source maps |
npm run build |
Create complete production build |
npm run test |
Run JavaScript tests with Jest |
npm run test:watch |
Run tests in watch mode |
npm run test:coverage |
Generate test coverage report |
composer test |
Run PHP unit tests |
composer phpcs |
Check PHP code standards |
composer phpcbf |
Fix PHP code standard violations |
Project Structure
wp-integrator-x/
├── app/ # Application logic
│ ├── admin-pages/ # WordPress admin pages
│ ├── cli/ # WP-CLI commands
│ ├── endpoints/v1/ # REST API endpoints
│ └── services/ # Business logic services
├── assets/ # Compiled assets
├── core/ # Core plugin classes
├── src/ # React source files
│ └── googledrive-page/ # Google Drive interface components
├── tests/ # PHP unit tests
├── languages/ # Translation files
└── vendor/ # PHP dependencies
Configuration
Google Drive Setup
-
Create Google Cloud Project:
- Go to Google Cloud Console
- Create a new project or select existing one
- Enable Google Drive API
- Create OAuth 2.0 credentials
- Add authorized redirect URI
- Add required scopes
-
Plugin Configuration:
- Navigate to Google Drive Test in WordPress admin
- Enter Client ID and Client Secret
- Complete OAuth authentication flow
Posts Maintenance
The Posts Maintenance feature automatically scans posts and updates metadata. Configure through:
- Admin Interface: WordPress Admin → Posts Maintenance
- WP-CLI:
wp wp-integrator-x posts-maintenance scan - Scheduled Tasks: Automatic daily execution via WordPress cron
API Endpoints
Google Drive API (/wp-json/wp-integrator-x/v1/drive/)
| Endpoint | Method | Description |
|---|---|---|
/save-credentials |
POST | Store OAuth credentials |
/auth |
POST | Initiate OAuth flow |
/callback |
GET | Handle OAuth callback |
/files |
GET | List Drive files |
/upload |
POST | Upload files |
/download |
GET | Download files |
/create-folder |
POST | Create folders |
WP-CLI Commands
Posts Maintenance
# Scan all posts
wp wp-integrator-x posts-maintenance scan
# Scan specific post types
wp wp-integrator-x posts-maintenance scan --post-types=post,page
# Custom batch size
wp wp-integrator-x posts-maintenance scan --batch-size=50
# Get help
wp wp-integrator-x posts-maintenance scan --help
Testing
PHP Unit Tests
# Run all tests
composer test
# Run specific test file
vendor/bin/phpunit tests/test-posts-maintenance.php
# Run with coverage
vendor/bin/phpunit --coverage-html coverage/
JavaScript Tests
# Run all tests
npm test
# Watch mode
npm run test:watch
# Coverage report
npm run test:coverage
Security
- Encrypted Credentials: All sensitive data encrypted using WordPress salts
- Capability Checks: Admin functions require
manage_optionscapability - Nonce Verification: All AJAX requests protected with WordPress nonces
- Input Sanitization: Comprehensive validation and sanitization
- File Upload Security: Type, size, and content validation
Performance
- Background Processing: Heavy operations run in background with progress tracking
- Caching: API responses cached using WordPress transients
- Asset Optimization: Minified CSS/JS with efficient loading
- Database Optimization: Efficient queries with proper indexing