# Raptive SEO Plugin

This WordPress plugin adds functionality to sync posts to an external webhook API.

![Plugin Workflow](https://at-chrome-extension.s3.us-east-2.amazonaws.com/raptive-seo-plugin.png) 

## Installation

1. Upload the `sync-plugin` directory (zipped) to the `/wp-content/plugins/` directory
2. Activate the plugin through the 'Plugins' menu in WordPress

## Local Development Setup

### Prerequisites
- PHP 7.4 or higher
- WordPress 5.0 or higher

### Setting up a Local Environment

#### Option 1: Using Local by Flywheel
1. Download and install [Local by Flywheel](https://localwp.com/)
2. Create a new site in Local
3. Choose your preferred environment settings (PHP version, web server, etc.)
4. Once the site is created, navigate to the site's `wp-content/plugins` directory
5. Clone this repository into the plugins directory:
   ```bash
   git clone [repository-url] sync-plugin
   ```
6. Activate the plugin through WordPress admin panel

#### Option 2: Using MAMP
1. Download and install [MAMP](https://www.mamp.info/)
2. Start MAMP and ensure Apache and MySQL are running
3. Download WordPress from [wordpress.org](https://wordpress.org/download/)
4. Extract WordPress to MAMP's htdocs directory
5. Create a new database through phpMyAdmin (accessible via MAMP)
6. Complete WordPress installation through the web interface
7. Navigate to `wp-content/plugins` in your WordPress installation
8. Clone this repository:
   ```bash
   git clone [repository-url] sync-plugin
   ```
9. Activate the plugin through WordPress admin panel


### Development Workflow
1. Make your changes to the plugin code
2. Test your changes in the local environment (may need to refresh)
3. Commit your changes to version control

## Configuration

By default, the plugin is configured to send posts to `https://seo-plugin-api.production.raptive.com` (production) / `https://seo-plugin-api.development.raptive.com` (development) / `http://local.webhook.raptive.com:3000` (local). To change this endpoint:

1. Edit the `includes/class-raptive-seo-api.php` file
2. Update the `$endpoint` property with your API endpoint URL

## Plugin Structure

```
raptive-seo-plugin/
├── admin/                   # Admin-specific functionality
│   ├── js/                  # Admin JavaScript files
│   ├── class-raptive-seo-admin.php     # Admin class
│   └── class-raptive-seo-log-table.php # Log table class
├── includes/                # Core plugin functionality
│   ├── class-raptive-seo.php           # Main plugin class
│   ├── class-raptive-seo-loader.php    # Hook loader class
│   ├── class-raptive-seo-logger.php    # Logger class
│   └── class-raptive-seo-api.php       # API communication class
├── public/                  # Public-facing functionality
│   └── class-raptive-seo-public.php    # Public class
├── assets/                  # Plugin assets
├── scripts/                 # Build scripts
├── sync-plugin.php          # Main plugin file
├── uninstall.php            # Uninstall file
└── README.md                # This file
``` 