Restore to commit 74e578279624c6045ca440a3459ebfa1f8d54191
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# PC Form Builder Plugin Validation Script
|
||||
#
|
||||
# Lints all PHP files and verifies plugin header.
|
||||
#
|
||||
|
||||
set -e
|
||||
|
||||
PLUGIN_DIR="$1"
|
||||
|
||||
if [ -z "$PLUGIN_DIR" ]; then
|
||||
echo "Usage: ./scripts/validate-wordpress-plugin.sh <plugin-root-directory>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d "$PLUGIN_DIR" ]; then
|
||||
echo "Error: Directory $PLUGIN_DIR does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Validating WordPress Plugin: $PLUGIN_DIR"
|
||||
echo "=========================================="
|
||||
|
||||
ERRORS=0
|
||||
|
||||
for php_file in $(find "$PLUGIN_DIR" -name "*.php" -type f); do
|
||||
echo "Checking: $php_file"
|
||||
|
||||
output=$(php -l "$php_file" 2>&1)
|
||||
|
||||
if echo "$output" | grep -q "No syntax errors detected"; then
|
||||
echo " ✓ Syntax OK"
|
||||
else
|
||||
echo " ✗ Syntax Error:"
|
||||
echo "$output"
|
||||
ERRORS=$((ERRORS + 1))
|
||||
fi
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "=========================================="
|
||||
|
||||
if [ $ERRORS -gt 0 ]; then
|
||||
echo "Found $ERRORS error(s)"
|
||||
exit 1
|
||||
else
|
||||
echo "All PHP files passed syntax validation!"
|
||||
exit 0
|
||||
fi
|
||||
Reference in New Issue
Block a user