File size: 16,365 Bytes
d662ae0 d3fab78 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 | <!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>
|