Thank you for considering contributing to EngineScript Site Optimizer! This document provides guidelines and instructions for contributors.
This project follows the WordPress Community Code of Conduct. By participating, you're expected to uphold this code.
- PHP: 7.4 or higher
- WordPress: 6.5 or higher
- Composer: For dependency management
- Node.js: 16+ (if working with build tools)
- Git: For version control
-
Fork the repository on GitHub
-
Clone your fork locally:
git clone https://github.com/YOUR-USERNAME/enginescript-site-optimizer.git cd enginescript-site-optimizer -
Install dependencies:
composer install
-
Create a feature branch:
git checkout -b feature/your-feature-name
This project adheres to WordPress Coding Standards:
- PHP: WordPress PHP Coding Standards
- JavaScript: WordPress JavaScript Coding Standards
- CSS: WordPress CSS Coding Standards
- HTML: WordPress HTML Coding Standards
-
Security First: All code must follow OWASP security guidelines
- Input validation and sanitization
- Output escaping with context-appropriate functions
- CSRF protection with nonces
- Capability checks for admin functions
-
Performance: Optimize for efficiency
- Use WordPress caching mechanisms
- Minimize database queries
- Conditional loading of assets
-
Internationalization: All user-facing strings must be translatable
- Use
__(),_e(),esc_html__(),esc_html_e()functions - Text domain:
enginescript-site-optimizer
- Use
-
Accessibility: Follow WCAG guidelines
- Proper semantic markup
- Keyboard navigation support
- Screen reader compatibility
Run coding standards checks:
composer run lint:php
# OR
./vendor/bin/phpcsRun static analysis:
./vendor/bin/phpstan analyseRun tests (when available):
./vendor/bin/phpunitenginescript-site-optimizer/
├── enginescript-site-optimizer.php # Main plugin file
├── README.md # Project documentation
├── readme.txt # WordPress.org readme
├── CHANGELOG.md # Version history
├── CONTRIBUTING.md # This file
├── LICENSE # GPL license
├── composer.json # PHP dependencies
├── phpcs.xml # PHPCS configuration
├── phpstan.neon # PHPStan configuration
├── phpmd.xml # PHPMD configuration
├── languages/ # Translation files
│ └── enginescript-site-optimizer.pot
└── .github/ # GitHub workflows
└── workflows/
- Check existing issues and pull requests
- Create an issue for significant changes to discuss the approach
- Follow the existing code patterns and conventions
- Input Validation: Validate all user inputs
- Output Escaping: Use
esc_html(),esc_attr(),esc_url()as appropriate - Sanitization: Use
sanitize_text_field(),sanitize_textarea_field(), etc. - Nonce Verification: Protect forms with WordPress nonces
- Capability Checks: Verify user permissions with
current_user_can()
- PHPDoc: All functions must have PHPDoc comments
- @since: Include version tags for new functions
- Inline Comments: Explain complex logic
- Security Notes: Document security measures taken
/**
* Example function with proper documentation
*
* @since 1.5.13
* @param string $input User input to process.
* @return string Sanitized output.
*/
function es_optimizer_example_function( $input ) {
// Security: Validate and sanitize input
if ( ! current_user_can( 'manage_options' ) ) {
return '';
}
$sanitized = sanitize_text_field( $input );
// Additional processing...
return esc_html( $sanitized );
}-
Manual Testing:
- Test in WordPress 6.5+ and latest version
- Test with PHP 7.4 and 8.3+
- Verify admin interface functionality
- Check frontend optimizations
-
Automated Testing:
- Run PHPCS for coding standards
- Run PHPStan for static analysis
- Ensure CI/CD tests pass
- Option Caching: Use the plugin's
es_optimizer_get_options()function - Conditional Loading: Only load assets when needed
- Database Queries: Minimize and optimize database interactions
- Hook Priority: Use appropriate hook priorities
-
Create Feature Branch:
git checkout -b feature/description-of-change
-
Make Changes:
- Follow coding standards
- Add/update tests if applicable
- Update documentation
-
Test Changes:
composer run lint:php ./vendor/bin/phpstan analyse
-
Commit Changes:
git add . git commit -m "feat: add new optimization feature"
-
Push and Create PR:
git push origin feature/description-of-change
Use Conventional Commits:
feat:New featuresfix:Bug fixesdocs:Documentation changesstyle:Code style changesrefactor:Code refactoringtest:Test additions/changeschore:Maintenance tasks
Examples:
feat: add DNS prefetch domain validation
fix: resolve jQuery migrate removal issue
docs: update installation instructions
style: fix PHPCS formatting violations
- Code follows WordPress coding standards
- All functions have proper PHPDoc documentation
- Security best practices implemented
- PHPCS and PHPStan checks pass
- Manual testing completed
- Documentation updated if needed
- CHANGELOG.md updated
When releasing new versions, update these files:
enginescript-site-optimizer.php(plugin header)README.mdreadme.txtCHANGELOG.mdlanguages/enginescript-site-optimizer.pot
This project follows Semantic Versioning:
- MAJOR: Breaking changes
- MINOR: New features (backward compatible)
- PATCH: Bug fixes (backward compatible)
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Security: Email security@enginescript.com for security issues
By contributing to EngineScript Site Optimizer, you agree that your contributions will be licensed under the GPL v2 or later license.
Thank you for contributing to EngineScript Site Optimizer! 🚀