=== Strimy Video ===
Contributors: strimy
Tags: video, embed, oembed, streaming, shortcode
Requires at least: 5.0
Tested up to: 6.9
Requires PHP: 8.0
Stable tag: 1.2.9
License: GPL-2.0+
License URI: http://www.gnu.org/licenses/gpl-2.0.txt

Integrate STRIMY videos into WordPress using oEmbed and custom shortcodes.

== Description ==

Strimy is a plugin that allows you to easily integrate videos from the STRIMY platform into your WordPress site. With full support for oEmbed, shortcodes, and Gutenberg blocks.

= Key Features =

* **Automatic oEmbed**: Simply paste the video URL and it will be automatically inserted
* **Customizable shortcode**: Full control over appearance and behavior
* **Gutenberg block**: Native integration with the block editor
* **Elementor widget**: Complete integration with Elementor Page Builder
* **Video importer**: Import and sync videos from your STRIMY account
* **Universal theme compatibility**: Advanced template system works with any WordPress theme
* **Modern video display**: Professional layout with metadata, categories, and responsive design
* **Template customization**: Easy theme integration with fallback system
* **Autoplay**: Optional autoplay control
* **Responsive**: Videos automatically adapt to any device

= How to Use =

**0. Video Importer**
Go to **Strimy Video > Import** to search, import and sync videos from your STRIMY account.

**1. Automatic oEmbed**
Simply paste your video URL on a separate line:
`https://strimy.pro/v/889542830943`

**2. Shortcode**
Use the [strimy] shortcode with customizable options:
`[strimy id="889542830943"]`

**3. Gutenberg Block**
Search for "Strimy Video" in the block editor and configure visually

**4. Elementor Widget**
If you have Elementor installed, you'll find the "Strimy Video" widget in the General category with advanced controls for complete customization.

= Shortcode Options =

* `id` - Video ID (required)
* `autoplay` - Automatic playback (true, false)

= Automatic Aspect Ratio =

The plugin automatically calculates the player height maintaining a 16:9 ratio when:
* You don't specify the `height` parameter
* Width is a fixed value (e.g: 800px)
* Responsive mode is enabled

Examples:
* `[strimy id="889542830943" width="800px"]` - Height calculated automatically (450px)
* `[strimy id="889542830943"]` - Fully responsive with 16:9 ratio

= Configuration =

Go to **Settings > Strimy** to configure:

* API Key (required for importing and accessing private videos)
* Autoplay configuration

= Video Importer =

The plugin includes a powerful importer that allows you to:

* Search videos in your STRIMY account
* Import videos as custom post types in WordPress
* Sync imported videos with the original source
* Manage metadata like title, description, duration and views
* Organize videos with categories and tags

= Theme Compatibility =

The plugin includes an advanced template system that ensures perfect compatibility with any WordPress theme:

* **Universal fallback system**: Works automatically with any theme without configuration
* **Theme customization**: Copy templates to your theme folder for complete control
* **Modern video layout**: Professional design with player-first approach
* **Responsive design**: Optimized for desktop, tablet, and mobile devices
* **Template path**: `wp-content/themes/your-theme/strimy/single-strimy_video.php`

The plugin will automatically use your theme's custom template if available, or fall back to the built-in responsive template.

== Installation ==

1. Upload the plugin to the `/wp-content/plugins/strimy-video/` folder
2. Activate the plugin through the 'Plugins' menu in WordPress
3. Go to **Settings > Strimy** to configure options
4. Start embedding STRIMY videos!

= Automatic Installation =

1. Go to **Plugins > Add New**
2. Search for "Strimy"
3. Install and activate the plugin
4. Configure options in **Settings > Strimy**

== Frequently Asked Questions ==

= Are videos responsive? =

Yes, all videos automatically adapt to screen size and the container where they are inserted.

= Does it work with the classic editor? =

Yes, the plugin is compatible with both the block editor (Gutenberg) and WordPress classic editor.

= Can I use multiple videos on the same page? =

Of course, you can insert as many videos as you need on a single page or post.

= Does the plugin affect my site's speed? =

No, the plugin is very lightweight and videos load asynchronously without affecting your site's performance.

= How do I customize the video display for my theme? =

The plugin includes a universal template system. To customize:

1. Create folder: `wp-content/themes/your-theme/strimy/`
2. Copy: `single-strimy_video.php` from the plugin's templates folder
3. Modify the copied file to match your theme's design
4. The plugin will automatically use your custom template

= Does it work with any WordPress theme? =

Yes! The plugin includes an advanced Template Loader system that ensures compatibility with any WordPress theme, including popular ones like Astra, OceanWP, GeneratePress, and custom themes.

== Changelog ==

= 1.2.9 =
* FIXED: Removed all inline `<style>` and `<script>` tags; moved to proper CSS/JS files using wp_enqueue_style() and wp_enqueue_script()
* FIXED: Added missing add_action('admin_enqueue_scripts') registration
* FIXED: Settings section and field titles changed to English source strings (General Settings, API Key, Autoplay)
* FIXED: Added == External Services == section to readme documenting strimy.pro API usage with links to Terms of Service and Privacy Policy
* FIXED: Admin JS refactored — removed duplicate validation, console.log debug statements cleaned up

= 1.2.8 =
* FIXED: WordPress coding standards compliance (escaping, sanitization, i18n)
* FIXED: Replaced parse_url() with wp_parse_url()
* FIXED: Added wp_unslash() before sanitizing $_POST variables
* FIXED: Unsafe printing functions replaced with esc_html_e() and esc_html__()
* FIXED: Added missing translators comments for placeholder strings
* FIXED: Direct database queries marked with phpcs:ignore comments
* FIXED: SQL IN clause now uses $wpdb->prepare() with placeholders
* FIXED: Added ABSPATH check to template files
* FIXED: Prefixed global variables in template files
* FIXED: Replaced unlink() with wp_delete_file() and rmdir() with WP_Filesystem
* FIXED: Added wp_kses_post() escaping for HTML output in admin notices

= 1.2.4 =
* FIX: Fixed critical JavaScript error in Elementor widget handler (this.onElementChange is not a function)
* FIX: Fixed compatibility with Elementor 3.35.6+ using modern handler registration API
* FIX: Fixed video ID extraction regex to handle URLs with /embed suffix correctly
* FIX: Prevented 'embed' from being captured as a valid video ID causing 404 errors
* IMPROVED: Added fallback chain for Elementor handler registration (attachHandler > addHandler > direct)

= 1.2.3 =
* FIX: Fixed broken HTML structure in importer page causing WordPress footer to render inside the video grid
* FIX: Pagination buttons (Previous/Next) now work correctly in the video importer
* FIX: Pagination state updates after each page load showing "Page X of Y"
* FIX: "Select All" now correctly skips already imported (disabled) videos
* IMPROVED: Removed all console.log debug statements from importer JavaScript

= 1.2.2 =
* SECURITY: Added capability checks (current_user_can) to all AJAX handlers
* SECURITY: Sanitized all $_POST nonce values with sanitize_text_field() and wp_unslash()
* SECURITY: Added sanitize_callback to all register_setting() calls
* SECURITY: Removed debug AJAX endpoint (ajax_debug_import) from production code
* SECURITY: Sanitized $_POST superglobals in options page cache clearing
* FIX: Removed development domain (strimy.test) references from production code
* FIX: Removed duplicate embed handler registrations
* FIX: Removed reference to non-existent strimy-elementor-register.php file
* FIX: Fixed _e() usage inside JavaScript strings (now uses esc_js with __())
* FIX: Fixed cache busting using time() replaced with filemtime() for proper browser caching
* FIX: Corrected embed handler regex match indices after pattern simplification
* IMPROVED: Moved inline JavaScript from metabox to separate enqueued file (strimy-metabox-sync.js)
* IMPROVED: Added ABSPATH protection to class-strimy-shortcodes.php
* IMPROVED: Removed extract() usage in template loader for WordPress coding standards compliance
* IMPROVED: Removed print_r() from error_log calls to prevent sensitive data leakage
* NEW: Added LICENSE file (GPL v2) for WordPress.org repository compliance
* NEW: Added .gitignore file

= 1.2.1 =
* FIX: Gutenberg block transform used wrong block name (`strimy/video-block` instead of `strimy/video`)
* FIX: oEmbed now respects server aspect ratio instead of forcing 16:9 for all videos
* FIX: Removed CSS rules that forced `aspect-ratio: 16/9` on Gutenberg embeds, breaking 21:9, 9:16, etc.
* FIX: Shortcode now fetches aspect ratio from STRIMY oEmbed endpoint when video is not imported as CPT
* FIX: oEmbed cache cleanup now correctly targets `meta_value` instead of `meta_key`
* NEW: oEmbed cache automatically clears on plugin version update
* NEW: Aspect ratio from oEmbed endpoint cached via transients (24h) for performance
* IMPROVED: Vertical video (9:16) support with max-width and centering in Elementor, shortcode and templates

= 1.2.0 =
* COMPATIBILITY: Updated for WordPress 6.9 and Elementor 3.28+
* COMPATIBILITY: Minimum PHP version raised to 8.0
* COMPATIBILITY: Minimum Elementor version raised to 3.5.0
* FIX: Removed deprecated `current_time('timestamp')` calls (deprecated since WP 5.3)
* FIX: Removed duplicate shortcode registration that could cause conflicts
* FIX: Removed `sslverify => false` from API calls for improved security
* PERFORMANCE: Cleaned up excessive `error_log()` calls in production (now only active with WP_DEBUG)
* FIX: Frontend CSS version now uses dynamic plugin version instead of hardcoded value
* SECURITY: All debug logging now properly guarded behind WP_DEBUG constant

= 1.1.6 =
* NEW: Full support for dynamic aspect ratios from STRIMY API
* NEW: Plugin now automatically detects and applies each video's aspect ratio (16:9, 21:9, 9:16, 1:1, etc.)
* NEW: Aspect_ratio saved when importing videos from API
* IMPROVED: Elementor widget automatically adapts to video aspect ratio
* IMPROVED: [strimy] shortcode uses dynamic aspect ratio from imported video
* IMPROVED: single-strimy_video.php template with support for variable aspect ratios
* IMPROVED: Embedded Plyr player rescales according to video aspect ratio
* IMPROVED: Compatibility with vertical (9:16), square (1:1), and ultra-wide (21:9) formats

= 1.1.5 =
* FIXED: Elementor widget overflow on mobile devices when placed in containers with other elements
* FIXED: Applied official Elementor solution with overflow: hidden at all widget levels
* IMPROVED: Enhanced responsive design for small mobile devices (480px and below)
* IMPROVED: Compatibility with Elementor Flexbox and Grid containers
* IMPROVED: Fallback support for browsers without CSS :has() support

= 1.1.4 =
* FIXED: Unable to change Elementor templates in STRIMY videos
* NEW: Full support for Elementor Canvas and Full Width templates
* NEW: Added 'page-attributes' support to video Custom Post Type
* IMPROVED: Complete integration with Elementor document system
* IMPROVED: STRIMY videos now behave like pages in Elementor

= 1.1.3 =
* FIXED: Elementor widget not appearing in elements panel
* FIXED: Widget category changed from 'media' (non-existent) to 'basic'
* IMPROVED: Detailed debugging system for Elementor integration
* IMPROVED: Admin notifications to confirm successful widget registration
* UPDATED: Documentation according to current Elementor 2024 standards

= 1.1.2 =
* FIXED: Video importer layout issues with postbox width
* FIXED: CSS conflicts in importer interface
* IMPROVED: Cache busting for CSS files using file modification time
* IMPROVED: Inline CSS injection for critical importer styles
* IMPROVED: Responsive design for importer controls

= 1.1.1 =
* NEW: Universal Template Loader system for theme compatibility
* NEW: Modern video display layout with player-first design
* NEW: Professional metadata display with icons and statistics
* NEW: Advanced theme customization system with fallback
* NEW: Responsive design optimized for all devices
* IMPROVED: Template structure with semantic HTML5 and accessibility
* IMPROVED: CSS styling with modern design patterns
* IMPROVED: Theme integration documentation and examples

= 1.1.0 =
* Added video importer from STRIMY
* New custom post type for videos
* Video synchronization functionality
* Metaboxes for video management
* Taxonomies for video categories and tags
* Elementor integration for imported videos
* Performance and stability improvements

= 1.0.0 =
* Initial release
* Full oEmbed support
* [strimy] shortcode with customizable options
* Native Gutenberg block
* Admin configuration panel
* Light and dark theme support
* Optional STRIMY API integration
* Fully responsive design

== Upgrade Notice ==

= 1.1.1 =
Major update with universal theme compatibility and modern video display. Recommended update for better theme integration and user experience.

= 1.1.0 =
New version with video importer and custom post type. Update to access these new features.

= 1.0.0 =
First version of Strimy plugin. Install to start integrating STRIMY videos into your WordPress site.

== Developer Notes ==

= Available Hooks =

The plugin provides several hooks for developers:

**Filters:**
* `strimy_oembed_default_width` - Modify default width
* `strimy_oembed_default_height` - Modify default height
* `strimy_oembed_iframe_attributes` - Customize iframe attributes
* `strimy_oembed_container_class` - Add CSS classes to container

**Actions:**
* `strimy_oembed_before_render` - Before rendering the video
* `strimy_oembed_after_render` - After rendering the video

== Support ==

For technical support, visit:
* [STRIMY Support Center](https://strimy.pro/support)
* [Plugin Documentation](https://strimy.pro/oembed-wordpress)

== External Services ==

This plugin connects to the STRIMY platform (strimy.pro) to provide video embedding and management functionality.

= STRIMY oEmbed API =

**What it is:** The STRIMY oEmbed endpoint converts video URLs into embeddable player HTML.
**What is sent:** The video URL (e.g. `https://strimy.pro/v/VIDEO_ID`) is sent to `https://strimy.pro/oembed` to retrieve embed code. No personal user data is transmitted.
**When it is sent:** Each time a STRIMY video URL is processed by WordPress (oEmbed lookup), or when the [strimy] shortcode renders a video.
**Service provider:** STRIMY — [Terms of Service](https://strimy.pro/terms) | [Privacy Policy](https://strimy.pro/privacy)

= STRIMY Videos API =

**What it is:** The STRIMY REST API allows importing and syncing videos from your STRIMY account into WordPress.
**What is sent:** Your STRIMY API key is sent as an authorization header to `https://strimy.pro/api/v1/videos`. No visitor data is transmitted.
**When it is sent:** Only when a site administrator uses the Strimy Video > Import page or saves settings that trigger an API key verification.
**Service provider:** STRIMY — [Terms of Service](https://strimy.pro/terms) | [Privacy Policy](https://strimy.pro/privacy)

== Privacy Policy ==

This plugin does not collect or store personal user data. Videos are loaded directly from STRIMY servers and are subject to STRIMY's privacy policy.

== Credits ==

Developed by the STRIMY team.
Icons by [Dashicons](https://developer.wordpress.org/resource/dashicons/).
