Changeset 3373838
- Timestamp:
- 10/06/2025 04:03:17 PM (6 months ago)
- Location:
- open-video/trunk
- Files:
-
- 3 edited
-
OpenVideoNamespace/Channels.php (modified) (4 diffs)
-
README.txt (modified) (2 diffs)
-
open-video.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
open-video/trunk/OpenVideoNamespace/Channels.php
r3366601 r3373838 16 16 const OPENVIDEOPLUGIN_DEFAULT_CHANNEL_PATH = 'openvideo'; 17 17 const OPENVIDEOPLUGIN_CHANNEL_PATH_OPTION = 'openvideoplugin_channel_path'; 18 // Any JS files we need to load from middleton should be added here 19 const OPENVIDEOPLUGIN_JS_FILES = [ 20 '/beardeddragon/anole.js', 21 '/beardeddragon/drake.js', 22 '/beardeddragon/wyrm.js', 23 '/beardeddragon/wyvern.js', 24 '/beardeddragon/axolotl.js', 25 '/beardeddragon/gilamonster.js', 26 '/beardeddragon/iguana.js', 27 ]; 18 28 19 29 const OPENVIDEOPLUGIN_ALLOWED_COOKIES = array( … … 63 73 // Add early handler specifically for video-sitemap.xml to prevent conflicts with Yoast SEO 64 74 add_action('template_redirect', array(self::class, 'openvideoplugin_early_video_sitemap_handler'), -999); 75 76 // Add early handler for JS files to prevent other plugins from interfering 77 add_action('template_redirect', array(self::class, 'openvideoplugin_early_js_handler'), -999); 65 78 } 66 79 … … 243 256 // Remove the early video sitemap handler 244 257 remove_action('template_redirect', array(self::class, 'openvideoplugin_early_video_sitemap_handler'), -999); 258 259 // Remove the early JS handler 260 remove_action('template_redirect', array(self::class, 'openvideoplugin_early_js_handler'), -999); 245 261 } 246 262 … … 355 371 } 356 372 373 /** 374 * Very early handler specifically for JS file requests 375 * This runs before most other plugins to prevent them from interfering 376 */ 377 public static function openvideoplugin_early_js_handler() 378 { 379 // Get the request URI 380 $request_uri = isset($_SERVER['REQUEST_URI']) ? sanitize_text_field($_SERVER['REQUEST_URI']) : ''; 381 382 // Parse to get just the path without query parameters 383 $parsed = parse_url($request_uri); 384 $path = isset($parsed['path']) ? trim($parsed['path'], '/') : ''; 385 386 // Check if this request matches any of our JS files 387 foreach (self::OPENVIDEOPLUGIN_JS_FILES as $js_file) { 388 if ($path === $js_file) { 389 // Directly handle the JS file request 390 $response = OpenVideoPlugin_RequestUtils::openvideoplugin_get_middleton_request($js_file); 391 392 if (is_wp_error($response)) { 393 \error_log("Open Video Plugin Error: Failed to load JS file {$js_file} from middleton: " . $response->get_error_message()); 394 // Let WordPress handle it normally (will likely 404) 395 return; 396 } 397 398 $headers = wp_remote_retrieve_headers($response); 399 $status_code = wp_remote_retrieve_response_code($response); 400 $output = wp_remote_retrieve_body($response); 401 402 // Set appropriate headers for JavaScript 403 if (isset($headers['content-type'])) { 404 header('Content-Type: ' . $headers['content-type'], true); 405 } else { 406 header('Content-Type: application/javascript; charset=utf-8', true); 407 } 408 409 // Forward other relevant headers 410 if ($headers && is_iterable($headers)) { 411 $skip_headers = array('set-cookie', 'transfer-encoding', 'connection', 'content-encoding', 'content-length'); 412 413 foreach ($headers as $header_name => $header_values) { 414 $header_name_lower = strtolower($header_name); 415 416 if (in_array($header_name_lower, $skip_headers)) { 417 continue; 418 } 419 420 if (is_array($header_values)) { 421 foreach ($header_values as $header_value) { 422 header("$header_name: $header_value", false); 423 } 424 } else { 425 header("$header_name: $header_values", false); 426 } 427 } 428 } 429 430 // Set status code 431 http_response_code($status_code); 432 433 // Output the JS content and exit 434 echo $output; 435 exit; 436 } 437 } 438 } 439 357 440 } 358 441 -
open-video/trunk/README.txt
r3366601 r3373838 6 6 Tested up to: 6.8 7 7 Requires PHP: 7.0 8 Stable tag: 1.2. 28 Stable tag: 1.2.3 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 27 27 28 28 == Changelog == 29 = 1.2.3 = 30 * Fix bug with loading js files 31 29 32 = 1.2.2 = 30 33 * Fix /video-sitemap.xml path being bypassed -
open-video/trunk/open-video.php
r3366601 r3373838 16 16 * 17 17 * @link https://open.video/ 18 * @since 1.2. 218 * @since 1.2.3 19 19 * @package Open.Video 20 20 * … … 23 23 * Plugin URI: https://wordpress.org/plugins/open-video 24 24 * Description: Open.Video allows you to easily embed videos to your site from the Open.Video Network. 25 * Version: 1.2. 225 * Version: 1.2.3 26 26 * Requires at least: 6.1 27 27 * Requires PHP: 7.0 … … 41 41 * Rename this for your plugin and update it as you release new versions. 42 42 */ 43 define('OPENVIDEOPLUGIN_VERSION', '1.2. 2');43 define('OPENVIDEOPLUGIN_VERSION', '1.2.3'); 44 44 45 45 global $openvideoplugin_regex;
Note: See TracChangeset
for help on using the changeset viewer.