Skip to content

Ref34t/ai-content-classifier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

23 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ€– AI Content Classifier

Generate SEO-optimized WordPress content using OpenAI's GPT models. Create blog posts, pages, and more with AI-powered content generation.

WordPress Plugin Version WordPress.org Plugin WordPress Compatibility PHP Version License Security Hardened

🌟 WordPress.org Plugin Directory - LIVE!

AI Content Classifier is now officially available on WordPress.org! Install directly from your WordPress admin dashboard.

πŸ“¦ Install from WordPress.org | πŸ”— Plugin Directory Page


πŸ“– Description

AI Content Classifier is a security-hardened, WordPress.org compliant plugin that leverages OpenAI's most advanced GPT models to help you create high-quality, SEO-optimized content directly from your WordPress dashboard. Built with enterprise-grade security and performance optimization.

πŸ† Why Choose AI Content Classifier?

  • βœ… WordPress.org Official - Fully compliant and approved
  • βœ… Security Hardened - Enterprise-grade protection
  • βœ… Performance Optimized - Built for high-traffic sites
  • βœ… Cost Tracking - Monitor every penny spent
  • βœ… Professional Support - Community and documentation

✨ Key Features

πŸ€– AI-Powered Content Generation

  • Multiple AI Models - GPT-3.5 Turbo, GPT-4, GPT-4 Turbo support
  • Smart Content Types - Blog posts, pages, product descriptions, emails
  • Context Awareness - Understands your brand and tone
  • Bulk Operations - Generate multiple pieces simultaneously

πŸ“ˆ SEO Optimization Engine

  • Auto Meta Descriptions - SEO-optimized meta tags
  • Keyword Integration - Smart keyword placement
  • Content Scoring - Real-time SEO analysis
  • Readability Metrics - Ensure engaging content

πŸ“ Advanced Template System

  • Custom Templates - Save and reuse prompts
  • Variable Support - Dynamic content with {{variables}}
  • Team Sharing - Collaborate with your team
  • Template Library - Pre-built professional templates

πŸ”’ Enterprise Security

  • Input Sanitization - All user input properly cleaned
  • XSS Protection - Cross-site scripting prevention
  • CSRF Protection - Nonce verification on all actions
  • Rate Limiting - Configurable API abuse protection
  • Encrypted Storage - API keys stored securely

πŸ“Š Analytics & Tracking

  • Cost Monitoring - Real-time expense tracking
  • Usage Analytics - Token consumption insights
  • Performance Metrics - Generation success rates
  • Export Reports - Download usage data

πŸ”Œ Developer Features

  • REST API - Programmatic content generation
  • Hooks & Filters - Extensive customization options
  • Multisite Compatible - Works with WordPress networks
  • WP-CLI Support - Command-line operations

🎯 Perfect For

Content Creators E-commerce Agencies Developers
βœ… Blog posts βœ… Product descriptions βœ… Client content βœ… API integration
βœ… Social media βœ… Category pages βœ… Bulk operations βœ… Custom workflows
βœ… Email campaigns βœ… Marketing copy βœ… Template sharing βœ… Automation
βœ… Landing pages βœ… SEO content βœ… Multi-site βœ… White-label

πŸš€ Installation

Option 1: WordPress Admin (Recommended)

  1. Go to Plugins β†’ Add New in your WordPress admin
  2. Search for "AI Content Classifier"
  3. Click Install Now β†’ Activate
  4. Navigate to AI Content β†’ Settings
  5. Add your OpenAI API key

Option 2: Manual Installation

  1. Download from WordPress.org
  2. Upload to /wp-content/plugins/ai-content-classifier/
  3. Activate through the Plugins screen
  4. Configure in AI Content β†’ Settings

Option 3: WP-CLI

wp plugin install ai-content-classifier --activate
wp plugin update ai-content-classifier

βš™οΈ Quick Setup

1. Get Your OpenAI API Key

# Visit: https://platform.openai.com/api-keys
# 1. Create account or sign in
# 2. Generate new API key
# 3. Add billing method
# 4. Copy API key (starts with 'sk-')

2. Configure Plugin

  1. WordPress Admin β†’ AI Content β†’ Settings
  2. Paste API Key in the secure field
  3. Select Model (GPT-3.5 Turbo recommended)
  4. Set Rate Limits (50 requests/hour default)
  5. Test Connection to verify setup

3. Generate Your First Content

  1. AI Content β†’ Generate
  2. Enter your topic: "Benefits of AI in small business marketing"
  3. Add target keywords: "AI marketing, small business, automation"
  4. Click πŸš€ Generate Content
  5. Review, edit, and publish!

πŸ“‹ System Requirements

Requirement Minimum Recommended
WordPress 5.0+ Latest version
PHP 7.4+ 8.1+
MySQL 5.6+ 8.0+
Memory 128MB 256MB+
Extensions cURL, JSON cURL, JSON, OpenSSL

External Services

  • OpenAI API - Content generation (paid service)
  • API Key Required - Get from OpenAI Platform

πŸ’° Pricing & Costs

Content generation costs depend on the OpenAI model:

Model Input Cost Output Cost Typical Blog Post
GPT-3.5 Turbo $0.0005/1K tokens $0.0015/1K tokens $0.003
GPT-4 $0.03/1K tokens $0.06/1K tokens $0.08
GPT-4 Turbo $0.01/1K tokens $0.03/1K tokens $0.04

πŸ’‘ Pro Tip: Start with GPT-3.5 Turbo for cost-effective content, upgrade to GPT-4 for premium quality.


🎨 Plugin Screenshots

Content Generation SEO Analytics Template Management Settings Panel
Screenshot 1 Screenshot 2 Screenshot 3 Screenshot 4

πŸ” Security Features

WordPress.org Compliance

  • βœ… All WordPress Plugin Check tests passed
  • βœ… SQL injection prevention with prepared statements
  • βœ… Complete input sanitization and output escaping
  • βœ… Proper nonce verification on all actions
  • βœ… Capability checks for all user interactions

Enterprise Security Standards

// Input Sanitization
$user_input = sanitize_text_field($_POST['prompt']);

// Database Security
$results = $wpdb->prepare(
    "SELECT * FROM {$table} WHERE user_id = %d",
    $user_id
);

// Output Escaping
echo esc_html($generated_content);

// Nonce Verification
wp_verify_nonce($_POST['nonce'], 'generate_content');

πŸ›  Advanced Usage

REST API Integration

Generate Content

curl -X POST "https://yoursite.com/wp-json/aicg/v1/generate" \
  -H "Content-Type: application/json" \
  -H "X-WP-Nonce: YOUR_NONCE" \
  -d '{
    "prompt": "Write about sustainable business practices",
    "content_type": "post",
    "seo_enabled": true,
    "target_keywords": "sustainability, green business, eco-friendly"
  }'

Response Format

{
  "success": true,
  "data": {
    "title": "10 Sustainable Business Practices That Drive Growth",
    "content": "In today's environmentally conscious market...",
    "meta_description": "Discover 10 proven sustainable business practices...",
    "keywords": ["sustainability", "green business", "eco-friendly"],
    "seo_score": 8.5,
    "readability": 92,
    "tokens_used": 1247,
    "estimated_cost": 0.003
  }
}

WordPress Hooks

Actions

// Before content generation
add_action('aicg_before_generate', 'my_pre_generation_function');

// After content generation
add_action('aicg_after_generate', 'my_post_generation_function');

// Daily cleanup
add_action('aicg_cleanup_temp_data', 'my_cleanup_function');

Filters

// Customize prompts
add_filter('aicg_sanitize_prompt', 'my_prompt_customizer');

// Filter generated content
add_filter('aicg_filter_content', 'my_content_filter');

// Modify API responses
add_filter('aicg_api_response', 'my_response_modifier');

πŸ“Š Database Schema

Templates Table (wp_aicg_templates)

CREATE TABLE wp_aicg_templates (
  id mediumint(9) NOT NULL AUTO_INCREMENT,
  name varchar(100) NOT NULL,
  prompt text NOT NULL,
  content_type varchar(50) DEFAULT 'post',
  seo_enabled boolean DEFAULT true,
  created_at datetime DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (id)
);

Usage Log (wp_aicg_usage_log)

CREATE TABLE wp_aicg_usage_log (
  id mediumint(9) NOT NULL AUTO_INCREMENT,
  user_id bigint(20) NOT NULL,
  tokens_used int(11) NOT NULL DEFAULT 0,
  cost decimal(10,6) NOT NULL DEFAULT 0.000000,
  model varchar(50) NOT NULL,
  created_at datetime DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (id)
);

❓ Frequently Asked Questions

Q: Do I need an OpenAI API key?

A: Yes, you need an active OpenAI API key with billing enabled. Sign up at OpenAI Platform, add a payment method, and generate an API key.

Q: How much does content generation cost?

A: Costs vary by model:

  • GPT-3.5 Turbo: ~$0.003 per 1,000-word blog post
  • GPT-4: ~$0.08 per 1,000-word blog post
  • The plugin includes real-time cost tracking.
Q: Is my content stored externally?

A: No. Generated content is only stored in your WordPress database when you save it. The plugin doesn't store content externally.

Q: Can I customize the AI prompts?

A: Yes! Use the advanced template system to create custom prompts with variables like {{topic}}, {{keywords}}, and {{tone}}.

Q: Does this work with WordPress Multisite?

A: Yes, the plugin is fully compatible with WordPress Multisite installations.

Q: What about rate limiting?

A: The plugin includes configurable rate limiting (default: 50 requests/hour per user) to prevent API abuse and control costs.


πŸ› Troubleshooting

Common Issues

πŸ”‘ API Key Problems

# Symptoms: "Invalid API key" error
βœ… Verify key starts with 'sk-'
βœ… Check billing is enabled in OpenAI account
βœ… Ensure key has correct permissions
βœ… Test in plugin settings panel

🚫 Rate Limit Exceeded

# Symptoms: "Rate limit exceeded" message
βœ… Default limit is 50 requests/hour per user
βœ… Wait for rate limit reset (1 hour)
βœ… Increase limit in settings if needed
βœ… Use bulk operations for efficiency

⚠️ Content Not Generating

# Symptoms: Blank or error responses
βœ… Check WordPress error logs
βœ… Verify cURL is enabled (phpinfo())
βœ… Test API connection in settings
βœ… Ensure sufficient OpenAI credits

Debug Mode

Enable WordPress debugging for detailed error information:

// wp-config.php
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);

// Check logs at: /wp-content/debug.log

🀝 Contributing

We welcome contributions! Here's how to get involved:

Development Setup

# Clone repository
git clone https://github.com/ref34t/ai-content-classifier.git
cd ai-content-classifier

# Install dependencies (if using Composer)
composer install

# Create feature branch
git checkout -b feature/amazing-new-feature

# Make changes and test
# Submit pull request

Contribution Guidelines

  1. Follow WordPress coding standards
  2. Include unit tests for new features
  3. Update documentation as needed
  4. Test with WordPress Plugin Check
  5. Submit detailed pull requests

πŸ“ Changelog

[1.1.4] - 2024-08-11 - WordPress.org Release

βœ… WordPress.org Compliance

  • Complete SQL injection prevention with proper prepared statements
  • Enhanced security hardening across all database operations
  • Improved bulk operations with secure query construction
  • REST API security fixes with proper parameter handling
  • User activity monitoring with secure database queries
  • Zero critical vulnerabilities - fully submission ready

🎨 WordPress.org Assets

  • Professional banners (1544x500, 772x250) with AI branding
  • Modern icons (256x256, 128x128) with gradient design
  • Interface screenshots showcasing all major features
  • Complete plugin directory presentation ready

[1.1.3] - 2024-08-10

πŸ”’ Complete WordPress.org Compliance

  • Enhanced data sanitization with comprehensive JSON validation
  • Fixed all SQL injection vulnerabilities with wpdb::prepare()
  • Updated class naming conventions (OpenAI_Client β†’ AICG_OpenAI_Client)
  • Verified variable escaping in inline scripts
  • Comprehensive security audit completed
  • 100% WordPress.org submission ready

[1.1.2] - 2024-08-09

⚑ Performance & Security

  • Fixed SQL preparation errors in bulk operations and REST API
  • Enhanced WordPress coding standards compliance
  • Improved query preparation eliminating security violations
  • Streamlined database queries for better performance

[1.1.1] - 2024-08-08

πŸ›‘οΈ Critical Security Update

  • Fixed 3 critical database query errors with proper $wpdb->prepare()
  • Enhanced $_POST nonce validation across all AJAX handlers
  • 50+ input validation fixes resolved
  • Fixed $_SERVER sanitization for IP address handling
  • Improved template editor security with proper isset() checks

[1.0.0] - 2024-07-18 - Initial Release

πŸš€ Core Features

  • AI content generation with multiple GPT models
  • SEO optimization engine with meta tag generation
  • Template system for reusable prompts
  • REST API for developer integration
  • Rate limiting and cost tracking
  • Security hardening from day one

πŸ”— Links & Resources

Official Links

External Services

Support & Community


πŸ“„ License

This plugin is licensed under the GNU General Public License v2.0 or later.

AI Content Classifier - WordPress Plugin
Copyright (C) 2024 Mo Khaled

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

⚠️ Important Disclaimers

Third-Party Service

This plugin uses the OpenAI API, a third-party service. We are not responsible for:

  • Content generated by the AI models
  • Costs incurred through OpenAI API usage
  • OpenAI service availability or changes

Content Responsibility

  • AI-generated content may not always be accurate - Always review before publishing
  • You are responsible for all published content - Review and edit as needed
  • Respect copyright and intellectual property - Ensure content originality

Not Affiliated

We are not affiliated with OpenAI, Inc. This is an independent WordPress plugin.


🌟 Made with ❀️ for the WordPress Community

⭐ Enjoying AI Content Classifier?

Thank you for choosing AI Content Classifier! πŸš€


Last updated: August 11, 2024 | Version 1.1.4 | View all changes β†’

About

Generate SEO-optimized WordPress content using OpenAI's GPT API

Resources

License

Stars

Watchers

Forks

Packages

No packages published