# Contributing to Stintlief WebP Converter

Thank you for your interest in contributing to Stintlief WebP Converter! This document provides guidelines for contributing to the project.

## Code of Conduct

This project adheres to the WordPress Community Code of Conduct. By participating, you are expected to uphold this code.

## How to Contribute

### Reporting Bugs

Before creating bug reports, please check existing issues to avoid duplicates. When creating a bug report, include:

- A clear and descriptive title
- Detailed steps to reproduce the problem
- Expected behavior vs. actual behavior
- WordPress version, PHP version, and server environment
- Screenshots if applicable
- Any error messages from debug.log

### Suggesting Enhancements

Enhancement suggestions are welcome! Please provide:

- A clear and descriptive title
- Detailed description of the proposed feature
- Use cases and benefits
- Any implementation ideas you may have

### Pull Requests

1. Fork the repository
2. Create a new branch (`git checkout -b feature/your-feature-name`)
3. Make your changes following the coding standards below
4. Test your changes thoroughly
5. Commit your changes with clear, descriptive messages
6. Push to your branch
7. Open a Pull Request with a clear description

## Coding Standards

### WordPress Coding Standards

All code must follow the [WordPress Coding Standards](https://developer.wordpress.org/coding-standards/wordpress-coding-standards/).

- Use tabs for indentation, not spaces
- Follow WordPress naming conventions (snake_case for functions, PascalCase for classes)
- Use WordPress functions instead of PHP alternatives when available
- Prefix all function names, classes, and globals with `stwp_` or `STWP\\`

### PHPDoc Comments

- All classes, methods, and functions must have proper PHPDoc blocks
- Include `@since` tags indicating the version when added
- Document all parameters with `@param` tags
- Document return values with `@return` tags
- Add `@package STWP` to file headers

### Security

- Always sanitize user inputs
- Always escape outputs
- Use nonces for form submissions
- Check user capabilities before performing actions
- Prevent direct file access with `if ( ! defined( 'ABSPATH' ) )`

### Internationalization

- Wrap all user-facing strings in translation functions
- Use 'stwp' as the text domain consistently
- Add translator comments where context is needed

### Testing

- Test on multiple WordPress versions (5.8+)
- Test on multiple PHP versions (7.4+)
- Test with both Imagick and GD
- Verify security measures work correctly

## Development Setup

1. Install WordPress locally
2. Clone or link this plugin to `wp-content/plugins/`
3. Activate the plugin
4. Enable `WP_DEBUG` and `WP_DEBUG_LOG` in wp-config.php
5. Make changes and test thoroughly

## Questions?

Feel free to open an issue for questions or discussions about the plugin development.

## License

By contributing, you agree that your contributions will be licensed under the GPLv2 or later license.
