# PromioSync

**Version:** 1.0.0  
**Author:** [WJD Designs](https://wjddesigns.com)  
**License:** GPL-2.0+

## Description

PromioSync is a powerful WordPress plugin that enables centralized promotional content management across multiple WordPress sites. Perfect for franchise networks, multi-site promotions, and centralized marketing campaigns.

Push promotional content (coupons, sales, offers) from a parent site to unlimited child sites with:
- **Real-time webhook-based synchronization**
- **Advanced scheduling** with timezone support and recurring rules
- **Complete override capabilities** at both global and shortcode levels
- **Beautiful, responsive promo displays**

## Features

### For Parent Sites
- Create and manage unlimited promotional content
- Connect unlimited child sites via secure API keys
- Push updates instantly via webhooks
- Monitor sync status and connection health
- Drag-and-drop promo ordering
- Advanced scheduling (one-time, daily, weekly, monthly, seasonal)

### For Child Sites
- Receive promos automatically from parent
- Override any promo attribute globally or per-shortcode
- Customize branding, colors, phone numbers, and more
- Local caching for fast display
- Fallback polling when webhooks fail

### Display Options
- Multiple layouts: Banner, Card, Slider, Grid, Stack
- Fully responsive design
- Customizable brand colors
- Background overlay with opacity control
- Multiple button styles
- Mobile-optimized

## Installation

1. Upload the `promiosync` folder to `/wp-content/plugins/`
2. Activate the plugin through the 'Plugins' menu
3. Navigate to **PromioSync** in the admin menu
4. Choose whether this site is a Parent or Child
5. Follow the setup wizard

## Shortcodes

### Single Promo
```
[promio id="123"]
```

### Multiple Promos
```
[promio_promos layout="slider" autoplay="true"]
```

### With Overrides
```
[promio id="123" phone="555-123-4567" percentage="25" primary_color="#3366cc"]
```

## Shortcode Attributes

### Display Attributes
- `id` - Specific promo ID
- `ids` - Comma-separated promo IDs
- `count` - Number of promos to display
- `layout` - slider, grid, stack (for multiple promos)
- `style` - banner, card, minimal
- `class` - Custom CSS class

### Override Attributes
- `title` - Override promo title
- `description` - Override description
- `percentage` - Override percentage off
- `phone` - Override phone number
- `cta_text` - Override button text
- `cta_url` - Override button URL
- `logo` - Override logo URL
- `bg_image` - Override background image

### Color Overrides
- `primary_color` - Main brand color
- `secondary_color` - Secondary color
- `accent_color` - Accent color (percentages, highlights)
- `text_color` - Text color
- `button_bg_color` - Button background
- `button_text_color` - Button text

### Slider Options
- `autoplay` - true/false
- `autoplay_delay` - Milliseconds (default: 5000)
- `loop` - true/false
- `pagination` - true/false
- `navigation` - true/false

## API Endpoints

All endpoints use the `promiosync/v1` namespace.

### Connection
- `POST /connect` - Register child site
- `GET /connect/test` - Test connection
- `POST /disconnect` - Disconnect site

### Sync
- `POST /webhook/promo-update` - Receive promo updates (webhooks)
- `POST /promos/sync` - Poll for changes (fallback)
- `GET /promos` - Get all active promos

### Management
- `GET /connections` - List all connected sites (parent only)
- `GET /stats` - Get sync statistics
- `GET /logs` - Get sync logs

## Security

- API key authentication for all requests
- HMAC-SHA256 signature verification for webhooks
- Rate limiting to prevent abuse
- Timing-safe comparisons

## Requirements

- WordPress 5.0 or higher
- PHP 7.4 or higher
- MySQL 5.6 or higher

## Changelog

### 1.0.0
- Initial release

## Support

For support, please visit [WJD Designs](https://wjddesigns.com) or create an issue on GitHub.

## License

This plugin is licensed under the GPL-2.0+ license.

