Eliyahna's picture
a web app that will create or alter WordPress plugins by text prompt and allow file uploads for editing with no file size limits.
d662ae0 verified
Raw History Blame Contribute Delete
16.4 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>WordWizard - AI-Powered WordPress Plugin Creator</title>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://unpkg.com/feather-icons"></script>
<script src="https://cdn.jsdelivr.net/npm/vanta@latest/dist/vanta.globe.min.js"></script>
<style>
.vanta-container {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: -1;
}
.file-drop-area {
border: 3px dashed rgba(255, 255, 255, 0.4);
transition: all 0.3s ease;
}
.file-drop-area.active {
border-color: #4F46E5;
background-color: rgba(79, 70, 229, 0.1);
}
.code-block {
font-family: 'Courier New', monospace;
}
.gradient-bg {
background: linear-gradient(135deg, #4F46E5 0%, #8B5CF6 50%, #EC4899 100%);
}
</style>
</head>
<body class="bg-gray-900 text-gray-100 min-h-screen">
<div id="vanta-bg" class="vanta-container"></div>
<div class="container mx-auto px-4 py-12 relative z-10">
<header class="text-center mb-12">
<div class="flex justify-center items-center mb-4">
<i data-feather="zap" class="w-12 h-12 text-yellow-400 mr-3"></i>
<h1 class="text-4xl md:text-5xl font-bold bg-clip-text text-transparent gradient-bg">
WordWizard
</h1>
</div>
<p class="text-xl text-gray-300 max-w-2xl mx-auto">
Magically create and edit WordPress plugins with AI ✨
</p>
</header>
<main class="max-w-4xl mx-auto">
<div class="grid md:grid-cols-2 gap-8">
<!-- Create New Plugin Section -->
<div class="bg-gray-800 rounded-xl p-6 shadow-2xl border border-gray-700">
<div class="flex items-center mb-4">
<i data-feather="plus-circle" class="w-6 h-6 text-green-400 mr-2"></i>
<h2 class="text-xl font-semibold">Create New Plugin</h2>
</div>
<textarea
id="pluginPrompt"
class="w-full bg-gray-700 rounded-lg p-4 h-40 text-gray-100 border border-gray-600 focus:border-indigo-500 focus:ring-1 focus:ring-indigo-500 mb-4"
placeholder="Describe the WordPress plugin you want to create..."></textarea>
<div class="flex flex-wrap gap-3 mb-4">
<div class="flex items-center">
<input type="checkbox" id="addOptions" class="mr-2">
<label for="addOptions">Settings Page</label>
</div>
<div class="flex items-center">
<input type="checkbox" id="addShortcode" class="mr-2">
<label for="addShortcode">Shortcode Support</label>
</div>
<div class="flex items-center">
<input type="checkbox" id="addWidget" class="mr-2">
<label for="addWidget">Widget Support</label>
</div>
</div>
<button id="generatePlugin" class="w-full bg-indigo-600 hover:bg-indigo-700 text-white py-3 px-4 rounded-lg font-medium transition duration-200 flex items-center justify-center">
<i data-feather="wand" class="w-5 h-5 mr-2"></i>
Generate Plugin
</button>
</div>
<!-- Edit Existing Plugin Section -->
<div class="bg-gray-800 rounded-xl p-6 shadow-2xl border border-gray-700">
<div class="flex items-center mb-4">
<i data-feather="edit" class="w-6 h-6 text-blue-400 mr-2"></i>
<h2 class="text-xl font-semibold">Edit Existing Plugin</h2>
</div>
<div id="fileDropArea" class="file-drop-area rounded-lg p-8 text-center mb-4">
<div class="flex flex-col items-center">
<i data-feather="upload" class="w-10 h-10 text-gray-400 mb-2"></i>
<p class="mb-2">Drag & drop your plugin files here</p>
<p class="text-sm text-gray-400 mb-3">or</p>
<label for="fileUpload" class="cursor-pointer bg-gray-700 hover:bg-gray-600 text-white py-2 px-4 rounded-lg font-medium transition duration-200">
Select Files
</label>
<input type="file" id="fileUpload" class="hidden" multiple webkitdirectory directory>
</div>
</div>
<textarea
id="editPrompt"
class="w-full bg-gray-700 rounded-lg p-4 h-24 text-gray-100 border border-gray-600 focus:border-indigo-500 focus:ring-1 focus:ring-indigo-500 mb-4"
placeholder="Describe the changes you want to make..."></textarea>
<button id="editPlugin" class="w-full bg-blue-600 hover:bg-blue-700 text-white py-3 px-4 rounded-lg font-medium transition duration-200 flex items-center justify-center" disabled>
<i data-feather="refresh-cw" class="w-5 h-5 mr-2"></i>
Update Plugin
</button>
</div>
</div>
<!-- Results Section -->
<div id="resultsSection" class="bg-gray-800 rounded-xl p-6 shadow-2xl border border-gray-700 mt-8 hidden">
<div class="flex items-center mb-4">
<i data-feather="file-text" class="w-6 h-6 text-purple-400 mr-2"></i>
<h2 class="text-xl font-semibold">Generated Plugin</h2>
</div>
<div class="flex justify-between items-center mb-4">
<div class="flex items-center">
<i data-feather="folder" class="w-5 h-5 text-gray-400 mr-2"></i>
<span id="pluginName" class="font-mono text-gray-300">my-awesome-plugin</span>
</div>
<div class="flex gap-2">
<button id="downloadZip" class="bg-purple-600 hover:bg-purple-700 text-white py-2 px-4 rounded-lg text-sm font-medium transition duration-200 flex items-center">
<i data-feather="download" class="w-4 h-4 mr-1"></i>
Download
</button>
<button id="copyCode" class="bg-gray-700 hover:bg-gray-600 text-white py-2 px-4 rounded-lg text-sm font-medium transition duration-200 flex items-center">
<i data-feather="copy" class="w-4 h-4 mr-1"></i>
Copy
</button>
</div>
</div>
<div class="overflow-auto">
<pre id="pluginCode" class="code-block bg-gray-900 text-green-400 p-4 rounded-lg text-sm max-h-96 overflow-y-auto"></pre>
</div>
</div>
</main>
<footer class="mt-16 text-center text-gray-400 text-sm">
<div class="flex justify-center space-x-4 mb-2">
<a href="#" class="hover:text-white transition">Docs</a>
<a href="#" class="hover:text-white transition">Pricing</a>
<a href="#" class="hover:text-white transition">API</a>
<a href="#" class="hover:text-white transition">Support</a>
</div>
<p>© 2023 WordWizard - All rights reserved</p>
</footer>
</div>
<script>
// Initialize Vanta.js background
VANTA.GLOBE({
el: "#vanta-bg",
mouseControls: true,
touchControls: true,
gyroControls: false,
minHeight: 200.00,
minWidth: 200.00,
scale: 1.00,
scaleMobile: 1.00,
color: 0x4f46e5,
backgroundColor: 0x111827
});
// File drag and drop functionality
const fileDropArea = document.getElementById('fileDropArea');
const fileUpload = document.getElementById('fileUpload');
const editPluginBtn = document.getElementById('editPlugin');
['dragenter', 'dragover', 'dragleave', 'drop'].forEach(eventName => {
fileDropArea.addEventListener(eventName, preventDefaults, false);
});
function preventDefaults(e) {
e.preventDefault();
e.stopPropagation();
}
['dragenter', 'dragover'].forEach(eventName => {
fileDropArea.addEventListener(eventName, highlight, false);
});
['dragleave', 'drop'].forEach(eventName => {
fileDropArea.addEventListener(eventName, unhighlight, false);
});
function highlight() {
fileDropArea.classList.add('active');
}
function unhighlight() {
fileDropArea.classList.remove('active');
}
fileDropArea.addEventListener('drop', handleDrop, false);
function handleDrop(e) {
const dt = e.dataTransfer;
const files = dt.files;
handleFiles(files);
}
fileUpload.addEventListener('change', function() {
handleFiles(this.files);
});
function handleFiles(files) {
if (files.length > 0) {
editPluginBtn.disabled = false;
fileDropArea.innerHTML = `
<div class="flex items-center justify-center">
<i data-feather="check-circle" class="w-6 h-6 text-green-400 mr-2"></i>
<span>${files.length} file(s) selected</span>
</div>
`;
feather.replace();
}
}
// Generate plugin button
document.getElementById('generatePlugin').addEventListener('click', function() {
const prompt = document.getElementById('pluginPrompt').value;
if (!prompt.trim()) {
alert('Please describe the plugin you want to create');
return;
}
// Simulate generation (in a real app, this would call an API)
const pluginName = prompt.toLowerCase().replace(/\s+/g, '-').substring(0, 20) + '-plugin';
document.getElementById('pluginName').textContent = pluginName;
// Generate sample plugin code based on checkboxes
const hasOptions = document.getElementById('addOptions').checked;
const hasShortcode = document.getElementById('addShortcode').checked;
const hasWidget = document.getElementById('addWidget').checked;
let pluginCode = `<?php
/**
* Plugin Name: ${pluginName.replace('-', ' ').replace(/\b\w/g, l => l.toUpperCase())}
* Description: ${prompt}
* Version: 1.0.0
* Author: WordWizard
*/
if (!defined('ABSPATH')) exit; // Exit if accessed directly\n\n`;
if (hasOptions) {
pluginCode += `// Admin settings page
add_action('admin_menu', function() {
add_options_page(
'${pluginName.replace('-', ' ').replace(/\b\w/g, l => l.toUpperCase())} Settings',
'${pluginName.replace('-', ' ').replace(/\b\w/g, l => l.toUpperCase())}',
'manage_options',
'${pluginName}-settings',
function() {
echo '<div class="wrap"><h1>${pluginName.replace('-', ' ').replace(/\b\w/g, l => l.toUpperCase())} Settings</h1><form method="post" action="options.php">';
settings_fields('${pluginName}_settings');
do_settings_sections('${pluginName}-settings');
submit_button();
echo '</form></div>';
}
);
});
add_action('admin_init', function() {
register_setting('${pluginName}_settings', '${pluginName}_options');
add_settings_section(
'${pluginName}_main',
'Main Settings',
function() { echo '<p>Configure the main settings for ${pluginName.replace('-', ' ')}</p>'; },
'${pluginName}-settings'
);
add_settings_field(
'${pluginName}_field',
'Sample Field',
function() {
$options = get_option('${pluginName}_options');
echo '<input type="text" name="${pluginName}_options[field]" value="' . esc_attr($options['field'] ?? '') . '">';
},
'${pluginName}-settings',
'${pluginName}_main'
);
});\n\n`;
}
if (hasShortcode) {
pluginCode += `// Shortcode implementation
add_shortcode('${pluginName.replace('-', '_')}', function($atts = [], $content = null) {
$atts = shortcode_atts([
'attribute' => 'default'
], $atts, '${pluginName.replace('-', '_')}');
return '<div class="${pluginName}">' . do_shortcode($content) . '</div>';
});\n\n`;
}
if (hasWidget) {
pluginCode += `// Widget implementation
class ${pluginName.replace(/-/g, '_').replace(/\b\w/g, l => l.toUpperCase())}_Widget extends WP_Widget {
public function __construct() {
parent::__construct(
'${pluginName}_widget',
'${pluginName.replace('-', ' ').replace(/\b\w/g, l => l.toUpperCase())} Widget',
['description' => 'A custom widget for ${pluginName.replace('-', ' ')}']
);
}
public function widget($args, $instance) {
echo $args['before_widget'];
if (!empty($instance['title'])) {
echo $args['before_title'] . apply_filters('widget_title', $instance['title']) . $args['after_title'];
}
echo '<div>Widget content goes here</div>';
echo $args['after_widget'];
}
public function form($instance) {
$title = !empty($instance['title']) ? $instance['title'] : '';
?>
<p>
<label for="<?php echo esc_attr($this->get_field_id('title')); ?>">Title:</label>
<input class="widefat" id="<?php echo esc_attr($this->get_field_id('title')); ?>"
name="<?php echo esc_attr($this->get_field_name('title')); ?>" type="text"
value="<?php echo esc_attr($title); ?>">
</p>
<?php
}
public function update($new_instance, $old_instance) {
$instance = [];
$instance['title'] = !empty($new_instance['title']) ? strip_tags($new_instance['title']) : '';
return $instance;
}
}
add_action('widgets_init', function() {
register_widget('${pluginName.replace(/-/g, '_').replace(/\b\w/g, l => l.toUpperCase())}_Widget');
});\n\n`;
}
pluginCode += `// Main plugin functionality
// Your custom code goes here\n\n?>`;
document.getElementById('pluginCode').textContent = pluginCode;
document.getElementById('resultsSection').classList.remove('hidden');
});
// Download and copy buttons
document.getElementById('downloadZip').addEventListener('click', function() {
alert('In a real implementation, this would download a ZIP file containing the plugin');
});
document.getElementById('copyCode').addEventListener('click', function() {
const code = document.getElementById('pluginCode').textContent;
navigator.clipboard.writeText(code).then(() => {
const btn = document.getElementById('copyCode');
btn.innerHTML = '<i data-feather="check" class="w-4 h-4 mr-1"></i>Copied!';
feather.replace();
setTimeout(() => {
btn.innerHTML = '<i data-feather="copy" class="w-4 h-4 mr-1"></i>Copy';
feather.replace();
}, 2000);
});
});
// Initialize feather icons
feather.replace();
</script>
</body>
</html>