https://github.com/shahmal1yev/wppcpy
Verify that the directory is a WordPress plugin based on the defined constraints.
https://github.com/shahmal1yev/wppcpy
plugin-checker python wordpress wp-plugin-checker
Last synced: 6 months ago
JSON representation
Verify that the directory is a WordPress plugin based on the defined constraints.
- Host: GitHub
- URL: https://github.com/shahmal1yev/wppcpy
- Owner: shahmal1yev
- Created: 2024-08-17T18:05:36.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-08-17T20:02:13.000Z (about 1 year ago)
- Last Synced: 2024-10-11T03:42:11.219Z (12 months ago)
- Topics: plugin-checker, python, wordpress, wp-plugin-checker
- Language: Python
- Homepage:
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# WPPCPY - Wordpress Plugin Checker



```wppcpy``` is a Python package designed to verify if a directory meets the necessary constraints to be considered a
valid WordPress plugin. It checks for essential headers in the main PHP file and ensures the presence of required files
like `readme.txt`.## Features
- **Header Validation**: Checks for the existence of key headers in the main PHP file, such as `Plugin Name`,
`Plugin URI`, `Description`, `Version`, and more.
- **File Validation**: Ensures that required files like `readme.txt` are present in the plugin directory.## Installation
You can install the ```wppcpy``` using pip:
```bash
pip install wppcpy
```## Usage
Here's a basic example of how to use the Plugin Validator:
```python
import wppcpy.constraintsif __name__ == "__main__":
plugin_path = "/var/www/wordpress/vns/booknetic.run/wp-content/plugins/booknetic"main_file_name = 'init.php'
constraints = [
constraints.header.PluginName(plugin_path, main_file_name),
constraints.header.Description(plugin_path, main_file_name),
constraints.header.Version(plugin_path, main_file_name),
constraints.file.MainFile(plugin_path, main_file_name),
]all_valid = all(constraint.validate() for constraint in constraints)
if all_valid:
print("Directory is a wordpress plugin by constraints.")
else:
print("Directory is not a wordpress plugin by constraints.")
```## Contributing
Contributions are welcome! Please feel free to submit a pull request or open an issue if you find a bug or have a
suggestion.