Skip to content

Commit 760cef5

Browse files
committed
Refactor
1 parent b0a4c98 commit 760cef5

37 files changed

Lines changed: 10832 additions & 2000 deletions

.github/ISSUE_TEMPLATE/phpcs-failure.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ The code does not meet WordPress coding standards as defined by PHPCS.
2222
1. Review the PHPCS output in the failed workflow run
2323
2. Fix coding standard violations in the code
2424
3. Ensure all PHP files follow WordPress coding standards
25-
4. Test locally with: `phpcs --standard=WordPress --extensions=php .`
25+
4. Test locally with: `composer run phpcs`
2626

2727
**Resources:**
2828
- [WordPress Coding Standards](https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/)

.github/ISSUE_TEMPLATE/phpmd-failure.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ The code has quality issues detected by PHPMD analysis.
2626
- Code duplication
2727
- Naming conventions
2828
- Design issues
29-
3. Test locally with: `phpmd . text cleancode,codesize,controversial,design,naming,unusedcode`
29+
3. Test locally with: `composer run phpmd`
3030

3131
**Resources:**
3232
- [PHPMD Documentation](https://phpmd.org/)

.github/ISSUE_TEMPLATE/psalm-failure.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Psalm has detected potential issues in the code through static analysis.
2626
- Incorrect return types
2727
- Unused code
2828
- Potential null pointer issues
29-
3. Test locally with: `./vendor/bin/psalm`
29+
3. Test locally with: `composer run psalm`
3030

3131
**Resources:**
3232
- [Psalm Documentation](https://psalm.dev/)

.github/ISSUE_TEMPLATE/security-failure.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ The security checker has identified known vulnerabilities in one or more of the
2828
- Implementing workarounds
2929
5. Test the application after updates
3030

31-
**⚠️ Priority:** This is a security issue and should be addressed immediately.
31+
**Priority:** This is a security issue and should be addressed immediately.
3232

3333
**Resources:**
3434
- [Symfony Security Checker](https://github.com/FriendsOfPHP/security-advisories)
Lines changed: 71 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,71 @@
1-
---
2-
title: WordPress VIP Coding Standards Failure - PHP ${{ env.PHP_VERSION }}
3-
labels: ['vip-standards', 'coding-standards', 'needs-review', 'php-${{ env.PHP_VERSION }}']
4-
assignees: []
5-
---
6-
7-
## WordPress VIP Coding Standards Failure
8-
9-
**PHP Version:** ${{ env.PHP_VERSION }}
10-
**Run ID:** ${{ env.RUN_ID }}
11-
**Workflow:** [View Failed Run](${{ env.WORKFLOW_URL }})
12-
13-
### Issue Description
14-
15-
The WordPress VIP coding standards check has failed during the automated workflow. This scan specifically checks for enterprise-level WordPress development standards required for WordPress VIP platform compatibility.
16-
17-
### VIP Standards Focus Areas
18-
19-
The WordPress VIP Go coding standards check for:
20-
21-
🏢 **Enterprise Platform Requirements:**
22-
- File system operation restrictions (VIP platform limitations)
23-
- Performance and caching best practices for high-traffic sites
24-
- Security vulnerabilities specific to enterprise WordPress environments
25-
- User experience guidelines for enterprise-level WordPress
26-
27-
🚀 **Performance & Caching:**
28-
- Uncached function usage patterns
29-
- Database query optimization
30-
- Remote data fetching best practices
31-
- Resource-heavy operation detection
32-
33-
🔒 **VIP-Specific Security:**
34-
- File operation security in restricted environments
35-
- Admin bar removal restrictions for VIP support users
36-
- Cookie and caching constraint validations
37-
- Restricted function usage for platform stability
38-
39-
### Important Notes
40-
41-
⚠️ **VIP Standards Context:**
42-
- Many VIP standards are specific to the WordPress VIP hosting platform
43-
- Not all VIP recommendations may apply to standard WordPress installations
44-
- Some restrictions are platform-specific (e.g., file system limitations)
45-
- This scan helps ensure compatibility with enterprise WordPress environments
46-
47-
### Next Steps
48-
49-
1. **Review the workflow logs** to identify specific VIP standard violations
50-
2. **Evaluate applicability** - determine which issues apply to your hosting environment
51-
3. **Prioritize fixes** based on your deployment target:
52-
- **High Priority:** Security and performance issues
53-
- **Medium Priority:** General code quality improvements
54-
- **Low Priority:** VIP platform-specific restrictions (if not targeting VIP)
55-
4. **Update code** to address applicable VIP standard violations
56-
5. **Re-run the workflow** to verify fixes
57-
58-
### Resources
59-
60-
- [WordPress VIP Code Quality Standards](https://docs.wpvip.com/technical-references/code-quality-and-best-practices/)
61-
- [VIP Coding Standards GitHub](https://github.com/Automattic/VIP-Coding-Standards)
62-
- [WordPress VIP Platform Documentation](https://docs.wpvip.com/)
63-
- [VIP Go File System Documentation](https://docs.wpvip.com/technical-references/vip-go-files-system/)
64-
65-
### Workflow Information
66-
67-
**Failed Workflow Run:** [View Details](${{ env.WORKFLOW_URL }})
68-
**PHP Version Tested:** ${{ env.PHP_VERSION }}
69-
**Standards Used:** WordPress-VIP-Go ruleset
70-
71-
This issue was automatically created when the WordPress VIP coding standards check failed. Please review the specific violations in the workflow logs and address them according to your project's deployment requirements.
1+
---
2+
title: WordPress VIP Coding Standards Failure - PHP ${{ env.PHP_VERSION }}
3+
labels: ['vip-standards', 'coding-standards', 'needs-review', 'php-${{ env.PHP_VERSION }}']
4+
assignees: []
5+
---
6+
7+
## WordPress VIP Coding Standards Failure
8+
9+
**PHP Version:** ${{ env.PHP_VERSION }}
10+
**Run ID:** ${{ env.RUN_ID }}
11+
**Workflow:** [View Failed Run](${{ env.WORKFLOW_URL }})
12+
13+
### Issue Description
14+
15+
The WordPress VIP coding standards check failed during the automated workflow. This scan checks for enterprise-level WordPress development standards required for WordPress VIP platform compatibility.
16+
17+
### VIP Standards Focus Areas
18+
19+
The WordPress VIP Go coding standards check covers the following areas:
20+
21+
**Enterprise Platform Requirements:**
22+
- File system operation restrictions (VIP platform limitations)
23+
- Performance and caching best practices for high-traffic sites
24+
- Security vulnerabilities specific to enterprise WordPress environments
25+
- User experience guidelines for enterprise-level WordPress
26+
27+
**Performance and Caching:**
28+
- Uncached function usage patterns
29+
- Database query optimization
30+
- Remote data fetching best practices
31+
- Resource-heavy operation detection
32+
33+
**VIP-Specific Security:**
34+
- File operation security in restricted environments
35+
- Admin bar removal restrictions for VIP support users
36+
- Cookie and caching constraint validations
37+
- Restricted function usage for platform stability
38+
39+
### Important Notes
40+
41+
**VIP Standards Context:**
42+
- Many VIP standards are specific to the WordPress VIP hosting platform
43+
- Not all VIP recommendations may apply to standard WordPress installations
44+
- Some restrictions are platform-specific (e.g., file system limitations)
45+
- This scan helps ensure compatibility with enterprise WordPress environments
46+
47+
### Next Steps
48+
49+
1. **Review the workflow logs** to identify specific VIP standard violations
50+
2. **Evaluate applicability**: Determine which issues apply to your hosting environment
51+
3. **Prioritize fixes** based on your deployment target:
52+
- **High Priority:** Security and performance issues
53+
- **Medium Priority:** General code quality improvements
54+
- **Low Priority:** VIP platform-specific restrictions (if not targeting VIP)
55+
4. **Update code** to address applicable VIP standard violations
56+
5. **Re-run the workflow** to verify fixes
57+
58+
### Resources
59+
60+
- [WordPress VIP Code Quality Standards](https://docs.wpvip.com/technical-references/code-quality-and-best-practices/)
61+
- [VIP Coding Standards GitHub](https://github.com/Automattic/VIP-Coding-Standards)
62+
- [WordPress VIP Platform Documentation](https://docs.wpvip.com/)
63+
- [VIP Go File System Documentation](https://docs.wpvip.com/technical-references/vip-go-files-system/)
64+
65+
### Workflow Information
66+
67+
**Failed Workflow Run:** [View Details](${{ env.WORKFLOW_URL }})
68+
**PHP Version Tested:** ${{ env.PHP_VERSION }}
69+
**Standards Used:** WordPress-VIP-Go ruleset
70+
71+
This issue was automatically created when the WordPress VIP coding standards check failed. Please review the specific violations in the workflow logs and address them according to your project's deployment requirements.

.github/copilot-instructions.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,23 @@
22
applyTo: '**'
33
---
44

5-
# EngineScript Site Optimizer Development Standards
5+
# EngineScript Site Optimizer - Development Standards
66

77
## Project Context
88

9-
- **Plugin:** EngineScript Site Optimizer WordPress performance optimization plugin
9+
- **Plugin:** EngineScript Site Optimizer - WordPress performance optimization plugin
1010
- **Text Domain:** `enginescript-site-optimizer`
1111
- **Function/Hook Prefix:** `es_optimizer_`
1212
- **Version Constant:** `ES_SITE_OPTIMIZER_VERSION`
13-
- **WordPress:** 6.6+ | **PHP:** 7.4+
13+
- **WordPress:** 6.6+ | **PHP:** 8.2+
1414
- **Work Environment:** GitHub Codespaces (remote). Never suggest local terminal commands.
1515

1616
## Code Standards
1717

1818
### WordPress & PHP
1919

2020
- Follow [WordPress Coding Standards](https://developer.wordpress.org/coding-standards/) for PHP, JS, CSS, HTML, and accessibility
21-
- Use WordPress APIs and hooks exclusively — no raw PHP/SQL or non-WP frameworks
21+
- Use WordPress APIs and hooks exclusively; avoid raw PHP/SQL and non-WP frameworks
2222
- Prefix all functions, classes, hooks, and globals with `es_optimizer_`
2323
- Use `wp_die()` instead of `die()` or `exit()`
2424
- Use `WP_Error` for error handling; log errors without exposing sensitive data
@@ -28,22 +28,22 @@ applyTo: '**'
2828

2929
### Modern PHP
3030

31-
- PHP 7.4+ features are required; PHP 8.x features are allowed if they degrade gracefully on 7.4
31+
- PHP 8.2+ features are available; keep code aligned with the configured PHP compatibility baseline
3232
- Use typed function signatures wherever possible
3333
- Before submitting changes, run `phpcs`, `phpmd`, and `phpstan` (config files present in project root)
3434

3535
## Security (Critical)
3636

37-
All code must follow OWASP Top 10 and WordPress security best practices. **Auto-identify and fix security vulnerabilities whenever foundnever leave them.**
37+
All code must follow OWASP Top 10 and WordPress security best practices. **Auto-identify and fix security vulnerabilities whenever found; never leave them unresolved.**
3838

3939
**Input:**
4040
- Sanitize with `sanitize_text_field()`, `sanitize_email()`, `absint()`, or `wp_kses()` as appropriate
41-
- Validate nonces with `wp_verify_nonce()` on all form submissions and AJAX handlers
41+
- Validate nonces with WordPress nonce helpers or Settings API nonces on form submissions and AJAX handlers
4242
- Use `$wpdb->prepare()` for every database query
4343

4444
**Output:**
4545
- Escape with context-appropriate functions: `esc_html()`, `esc_attr()`, `esc_url()`, `esc_js()`, `esc_textarea()`
46-
- Use `wp_nonce_field()` for all admin forms
46+
- Use `wp_nonce_field()` or `settings_fields()` for admin forms
4747

4848
**Access Control:**
4949
- Check `current_user_can('manage_options')` before any settings operation
@@ -73,11 +73,11 @@ All code must follow OWASP Top 10 and WordPress security best practices. **Auto-
7373
- Follow semantic versioning (MAJOR.MINOR.PATCH)
7474
- Update version in: plugin file header, `ES_SITE_OPTIMIZER_VERSION` constant, `README.md`, `readme.txt`, `CHANGELOG.md`, `GEMINI.md`, `composer.json`, and `languages/enginescript-site-optimizer.pot`
7575
- Move all `Unreleased` entries to the new version section in both `CHANGELOG.md` and `readme.txt`
76-
- **Never auto-bump versions** wait for an explicit instruction to do so
76+
- **Never auto-bump versions** - wait for an explicit instruction to do so
7777

7878
## Workflow
7979

80-
- Edit files in place never create duplicate files or unnecessary new files
80+
- Edit files in place; never create duplicate files or unnecessary new files
8181
- Proceed automatically on non-destructive changes; ask before deleting files or data
8282
- Auto-fix bugs and security issues when identified
83-
- Keep responses concise and focused on what changed — no summary `.md` files
83+
- Keep responses concise and focused on what changed; do not create summary `.md` files

.github/labeler.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ documentation:
3636
- any-glob-to-any-file: '*.md'
3737
- any-glob-to-any-file: docs/**/*
3838

39-
# Export functionality
39+
# Optimization functionality
4040
optimization:
4141
- changed-files:
4242
- any-glob-to-any-file: '**/optimi*.php'
@@ -80,4 +80,4 @@ testing:
8080
- any-glob-to-any-file: tests/**/*
8181
- any-glob-to-any-file: phpunit.xml
8282
- any-glob-to-any-file: .travis.yml
83-
- any-glob-to-any-file: .phpcs.xml
83+
- any-glob-to-any-file: .phpcs.xml

.github/workflows/branch-cleanup.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ permissions:
1515
jobs:
1616
cleanup:
1717
runs-on: ubuntu-latest
18-
18+
1919
steps:
2020
- uses: actions/checkout@v6
2121
with:
2222
fetch-depth: 0
2323
token: ${{ secrets.GITHUB_TOKEN }}
24-
24+
2525
- name: Delete merged branch
2626
if: github.event.pull_request.merged == true
2727
env:
@@ -30,13 +30,13 @@ jobs:
3030
REPOSITORY: ${{ github.repository }}
3131
run: |
3232
echo "Checking branch: $BRANCH_NAME"
33-
33+
3434
# Protected branch check - using quotes to prevent injection
3535
if [[ "$BRANCH_NAME" =~ ^(main|master|dev|develop|staging|production)$ ]]; then
3636
echo "::warning::Skipping deletion of protected branch: $BRANCH_NAME"
3737
exit 0
3838
fi
39-
39+
4040
# Attempt branch deletion - using quotes to prevent injection
4141
echo "Attempting to delete branch: $BRANCH_NAME"
4242
if git push origin --delete "$BRANCH_NAME" 2>/dev/null; then

.github/workflows/new-pull-request.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# This workflow automatically posts a guidance comment on new pull requests.
2-
# It welcomes contributors and provides a brief message to acknowledge their
2+
# It welcomes contributors and provides a brief message to acknowledge their
33
# contribution to the EngineScript Site Optimizer plugin.
44
# The workflow is triggered whenever a new pull request is opened.
55

@@ -21,18 +21,18 @@ jobs:
2121
with:
2222
issue-number: ${{ github.event.pull_request.number }}
2323
body: |
24-
Thanks for contributing to EngineScript Site Optimizer! 🎉
24+
Thanks for contributing to EngineScript Site Optimizer!
2525
2626
**Before we review:**
2727
- [ ] Have you tested your changes with WordPress 6.6+?
28-
- [ ] Are your changes compatible with PHP 7.4+?
28+
- [ ] Are your changes compatible with PHP 8.2+?
2929
- [ ] Have you followed WordPress coding standards?
3030
- [ ] Did you update the CHANGELOG.md if needed?
31-
31+
3232
**Security Reminder:**
3333
This plugin can handle sensitive site configuration information, so please ensure:
3434
- All user inputs are properly sanitized
3535
- All outputs are properly escaped
3636
- No security vulnerabilities are introduced
37-
38-
We'll review your PR soon! 🚀
37+
38+
We'll review your PR soon.

0 commit comments

Comments
 (0)