Changeset 3421924
- Timestamp:
- 12/17/2025 12:57:48 PM (3 months ago)
- Location:
- justwatch-partner-integrations
- Files:
-
- 12 added
- 16 edited
- 1 copied
-
assets/banner-1544x500.jpg (added)
-
assets/banner-772x250.jpg (added)
-
assets/icon-128x128.png (added)
-
assets/icon-256x256.png (added)
-
assets/screenshot-1.png (added)
-
assets/screenshot-2.png (added)
-
assets/screenshot-3.png (added)
-
assets/screenshot-4.png (added)
-
assets/screenshot-5.png (added)
-
assets/screenshot-6.png (added)
-
assets/screenshot-7.png (added)
-
assets/screenshot-8.png (added)
-
tags/1.0.2 (copied) (copied from justwatch-partner-integrations/trunk)
-
tags/1.0.2/justwatch-partner-integrations.php (modified) (1 diff)
-
tags/1.0.2/lib/Locale/Locale.php (modified) (2 diffs)
-
tags/1.0.2/lib/PartnerIntegrations.php (modified) (1 diff)
-
tags/1.0.2/lib/Traits/ErrorTrait.php (modified) (5 diffs)
-
tags/1.0.2/lib/Traits/SettingsTrait.php (modified) (1 diff)
-
tags/1.0.2/lib/schema.php (modified) (1 diff)
-
tags/1.0.2/package.json (modified) (1 diff)
-
tags/1.0.2/readme.txt (modified) (2 diffs)
-
trunk/justwatch-partner-integrations.php (modified) (1 diff)
-
trunk/lib/Locale/Locale.php (modified) (2 diffs)
-
trunk/lib/PartnerIntegrations.php (modified) (1 diff)
-
trunk/lib/Traits/ErrorTrait.php (modified) (5 diffs)
-
trunk/lib/Traits/SettingsTrait.php (modified) (1 diff)
-
trunk/lib/schema.php (modified) (1 diff)
-
trunk/package.json (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
justwatch-partner-integrations/tags/1.0.2/justwatch-partner-integrations.php
r3388865 r3421924 4 4 * Plugin Name: JustWatch - Partner Integrations 5 5 * Description: Connect your audience to the best streaming services worldwide. 6 * Version: 1.0. 06 * Version: 1.0.2 7 7 * Author: JustWatch 8 8 * Author URI: https://www.justwatch.com -
justwatch-partner-integrations/tags/1.0.2/lib/Locale/Locale.php
r3388865 r3421924 463 463 $preferredLocales = array_filter( 464 464 array_merge( 465 [$this->preferredLocale],466 // $this->getThirdPartyGeoIpLocales(),465 array( $this->preferredLocale ), 466 array($this->getLocaleFromIp()), 467 467 $this->getUserLocales(), 468 468 ), … … 491 491 return $this->matchLocale($preferredLocales); 492 492 } 493 494 private function getCountryCodeFromIp(): ?string 495 { 496 // Option 1: GeoIP Detection Plugin 497 if (function_exists('geoip_detect2_get_info_from_current_ip')) { 498 $info = geoip_detect2_get_info_from_current_ip(); 499 return $info && isset($info->country->isoCode) ? strtoupper($info->country->isoCode) : null; 500 } 501 502 // Option 2: Cloudflare header 503 if (!empty($_SERVER['HTTP_CF_IPCOUNTRY'])) { 504 return strtoupper(sanitize_text_field(wp_unslash($_SERVER['HTTP_CF_IPCOUNTRY']))); 505 } 506 507 // Option 3: IP2Location via their plugin or manual integration 508 if (function_exists('ip2location_get_country_short')) { 509 return strtoupper(ip2location_get_country_short()); 510 } 511 512 return null; 513 } 514 515 public function getLocaleFromIp(): ?string 516 { 517 $countryCode = $this->getCountryCodeFromIp(); 518 519 if (! $countryCode) { 520 return null; 521 } 522 523 if (isset($this->regionToLocaleMap['countries'][$countryCode])) { 524 foreach ($this->regionToLocaleMap['countries'][$countryCode] as $locale) { 525 if (in_array($locale, $this->getAvailableLocales(), true)) { 526 return $locale; 527 } 528 } 529 } 530 531 return null; 532 } 493 533 } -
justwatch-partner-integrations/tags/1.0.2/lib/PartnerIntegrations.php
r3388865 r3421924 77 77 __('Customization', 'justwatch-partner-integrations'), 78 78 __('Customize the JustWatch plugin', 'justwatch-partner-integrations') 79 ); 80 $this->addSettingsSection( 81 'error_reporting', 82 __('Error Reporting', 'justwatch-partner-integrations'), 79 83 ); 80 84 -
justwatch-partner-integrations/tags/1.0.2/lib/Traits/ErrorTrait.php
r3388865 r3421924 82 82 } 83 83 84 public function isErrorReportingEnabled(): bool 85 { 86 // Check if error reporting is enabled in the settings 87 $settings = $this->getSettings(); 88 89 if (! isset($settings['errorReportingEnabled'])) { 90 // If the setting is not defined, return false 91 return false; // Default to false if the setting is not defined 92 } 93 return (bool) $settings['errorReportingEnabled']; 94 } 95 84 96 public function handleError($errno, $errstr, $errfile, $errline): void 85 97 { 98 // If error reporting is disabled, do nothing 99 if (! $this->isErrorReportingEnabled()) { 100 return; 101 } 86 102 // Ignore errors that are not in the error reporting level 87 103 if ($errno === 0) { … … 110 126 private function shouldHandleException(Throwable $exception): bool 111 127 { 128 // If error tracking is disabled, do not log the exception 129 if (! $this->isErrorReportingEnabled()) { 130 return false; 131 } 112 132 // Get the stack trace 113 133 $stackTrace = $exception->getTrace(); … … 189 209 public function logError(Throwable $exception): void 190 210 { 211 if ($this->isErrorReportingEnabled() === false) { 212 return; // Do not log if error tracking is disabled 213 } 214 215 if (! defined('WP_CONTENT_DIR')) { 216 return; 217 } 218 191 219 // Path to the debug.log file 192 220 $debugLogPath = $this->getDebugLogPath(); … … 275 303 public function showAdminErrorNotice(): void 276 304 { 305 if (! $this->isErrorReportingEnabled()) { 306 return; // Do not render the script if error tracking is disabled 307 } 277 308 $lastErrorMessage = get_transient($this->TRANSIENT_KEY_PREFIX . 'last_error_message'); 278 279 309 if ($lastErrorMessage) { 280 310 // Create the link to the settings page … … 439 469 440 470 $envInfo = array(); 441 $envInfo[] = 'WordPress Version: ' . $wp_version; 442 $envInfo[] = 'Site URL: ' . site_url(); 443 $envInfo[] = 'Home URL: ' . home_url(); 444 $envInfo[] = 'PHP Version: ' . phpversion(); 445 $envInfo[] = 'MySQL Version: ' . $wpdb->db_version(); 446 $envInfo[] = 'Web Server Info: ' . $serverSoftware; 447 448 $theme = wp_get_theme(); 471 $envInfo[] = 'Environment:'; 472 $envInfo[] = '- Site URL: ' . site_url(); 473 $envInfo[] = '- Home URL: ' . home_url(); 474 $envInfo[] = '- Plugin Version: ' . $this->version; 475 $envInfo[] = '- WordPress Version: ' . $wp_version; 476 $envInfo[] = '- PHP Version: ' . phpversion(); 477 $envInfo[] = '- MySQL Version: ' . $wpdb->db_version(); 478 $envInfo[] = '- Web Server Info: ' . $serverSoftware; 479 480 // Collect the most common wp-config constants 481 $envInfo[] = 'Config:'; 482 $envInfo[] = '- WP_DEBUG: ' . (defined('WP_DEBUG') ? (WP_DEBUG ? 'true' : 'false') : 'Not defined'); 483 $envInfo[] = '- WP_DEBUG_LOG: ' . (defined('WP_DEBUG_LOG') ? (WP_DEBUG_LOG ? 'true' : 'false') : 'Not defined'); 484 $envInfo[] = '- WP_DEBUG_DISPLAY: ' . (defined('WP_DEBUG_DISPLAY') 485 ? (boolval(constant('WP_DEBUG_DISPLAY')) ? 'true' : 'false') : 'Not defined' // Please Psalm 486 ); 487 $envInfo[] = '- WP_MEMORY_LIMIT: ' . (defined('WP_MEMORY_LIMIT') ? WP_MEMORY_LIMIT : 'Not defined'); 488 $envInfo[] = '- WP_MAX_MEMORY_LIMIT: ' . (defined('WP_MAX_MEMORY_LIMIT') ? WP_MAX_MEMORY_LIMIT : 'Not defined'); 489 $envInfo[] = '- WP_CONTENT_DIR: ' . (defined('WP_CONTENT_DIR') ? WP_CONTENT_DIR : 'Not defined'); 490 $envInfo[] = '- WP_PLUGIN_DIR: ' . (defined('WP_PLUGIN_DIR') ? WP_PLUGIN_DIR : 'Not defined'); 491 492 // Multisite information 493 if (is_multisite()) { 494 $envInfo[] = 'Multisite: Enabled'; 495 $networkDetails = get_network(); 496 497 if ($networkDetails) { 498 $envInfo[] = '- Network ID: ' . $networkDetails->id; 499 $envInfo[] = '- Network Name: ' . $networkDetails->site_name; 500 $envInfo[] = '- Network Domain: ' . $networkDetails->domain; 501 $envInfo[] = '- Network Path: ' . $networkDetails->path; 502 } else { 503 $envInfo[] = '- Network ID: Not available'; 504 } 505 } else { 506 $envInfo[] = 'Multisite: Disabled'; 507 } 508 509 $theme = wp_get_theme(); 449 510 $envInfo[] = 450 511 'Active Theme: ' . -
justwatch-partner-integrations/tags/1.0.2/lib/Traits/SettingsTrait.php
r3388865 r3421924 381 381 esc_attr((string) ( $attrs['placeholder'] ?? '' )), 382 382 checked($value, 1, false), 383 esc_html($field['text'] ?? '')383 esc_html($field['text'] ?? ($field['label'] ?? '')) 384 384 ); 385 385 break; -
justwatch-partner-integrations/tags/1.0.2/lib/schema.php
r3388865 r3421924 184 184 ], 185 185 ], 186 'errorReportingEnabled' => [ 187 'label' => __('Error Reporting Enabled', 'justwatch-partner-integrations'), 188 'option' => 'justwatch/partner-settings/error_reporting_enabled', 189 'type' => 'checkbox', 190 'default' => false, 191 'section' => 'error_reporting', 192 'text' => __('Enable Error Reporting', 'justwatch-partner-integrations'), 193 'description' => __(" 194 Enable error reporting for the JustWatch plugin.<br/> 195 This will help us improve the service by collecting error reports 196 without the need of putting your site into debug mode. 197 ", 'justwatch-partner-integrations'), 198 'attrs' => [ 199 'rows' => 3, 200 ], 201 ], 186 202 ]; -
justwatch-partner-integrations/tags/1.0.2/package.json
r3388865 r3421924 1 1 { 2 2 "name": "wp-justwatch-partners", 3 "version": "1.0. 0",3 "version": "1.0.2", 4 4 "description": "Real-time Video-On-Demand availability for up to 250,000 movies and 60,000 TV shows in over 100 countries.", 5 5 "main": "index.js", -
justwatch-partner-integrations/tags/1.0.2/readme.txt
r3388865 r3421924 2 2 Contributors: justwatchplugin 3 3 Tags: streaming, movies, tv-shows, Video-On-Demand, content-creation 4 Stable tag: 1.0. 04 Stable tag: 1.0.2 5 5 Requires at least: 6.5 6 6 Tested up to: 6.8 … … 90 90 == Changelog == 91 91 92 = 1.0.2 - 2025-11-18 = 93 * Added: Fix geo-ip integration issue 94 * Added: Make error reporting optional 95 96 = 1.0.1 - 2025-11-18 = 97 * Maintenance release 98 92 99 = 1.0.0 - 2025-03-28 = 93 100 * Added: Add WP store requirements -
justwatch-partner-integrations/trunk/justwatch-partner-integrations.php
r3388865 r3421924 4 4 * Plugin Name: JustWatch - Partner Integrations 5 5 * Description: Connect your audience to the best streaming services worldwide. 6 * Version: 1.0. 06 * Version: 1.0.2 7 7 * Author: JustWatch 8 8 * Author URI: https://www.justwatch.com -
justwatch-partner-integrations/trunk/lib/Locale/Locale.php
r3388865 r3421924 463 463 $preferredLocales = array_filter( 464 464 array_merge( 465 [$this->preferredLocale],466 // $this->getThirdPartyGeoIpLocales(),465 array( $this->preferredLocale ), 466 array($this->getLocaleFromIp()), 467 467 $this->getUserLocales(), 468 468 ), … … 491 491 return $this->matchLocale($preferredLocales); 492 492 } 493 494 private function getCountryCodeFromIp(): ?string 495 { 496 // Option 1: GeoIP Detection Plugin 497 if (function_exists('geoip_detect2_get_info_from_current_ip')) { 498 $info = geoip_detect2_get_info_from_current_ip(); 499 return $info && isset($info->country->isoCode) ? strtoupper($info->country->isoCode) : null; 500 } 501 502 // Option 2: Cloudflare header 503 if (!empty($_SERVER['HTTP_CF_IPCOUNTRY'])) { 504 return strtoupper(sanitize_text_field(wp_unslash($_SERVER['HTTP_CF_IPCOUNTRY']))); 505 } 506 507 // Option 3: IP2Location via their plugin or manual integration 508 if (function_exists('ip2location_get_country_short')) { 509 return strtoupper(ip2location_get_country_short()); 510 } 511 512 return null; 513 } 514 515 public function getLocaleFromIp(): ?string 516 { 517 $countryCode = $this->getCountryCodeFromIp(); 518 519 if (! $countryCode) { 520 return null; 521 } 522 523 if (isset($this->regionToLocaleMap['countries'][$countryCode])) { 524 foreach ($this->regionToLocaleMap['countries'][$countryCode] as $locale) { 525 if (in_array($locale, $this->getAvailableLocales(), true)) { 526 return $locale; 527 } 528 } 529 } 530 531 return null; 532 } 493 533 } -
justwatch-partner-integrations/trunk/lib/PartnerIntegrations.php
r3388865 r3421924 77 77 __('Customization', 'justwatch-partner-integrations'), 78 78 __('Customize the JustWatch plugin', 'justwatch-partner-integrations') 79 ); 80 $this->addSettingsSection( 81 'error_reporting', 82 __('Error Reporting', 'justwatch-partner-integrations'), 79 83 ); 80 84 -
justwatch-partner-integrations/trunk/lib/Traits/ErrorTrait.php
r3388865 r3421924 82 82 } 83 83 84 public function isErrorReportingEnabled(): bool 85 { 86 // Check if error reporting is enabled in the settings 87 $settings = $this->getSettings(); 88 89 if (! isset($settings['errorReportingEnabled'])) { 90 // If the setting is not defined, return false 91 return false; // Default to false if the setting is not defined 92 } 93 return (bool) $settings['errorReportingEnabled']; 94 } 95 84 96 public function handleError($errno, $errstr, $errfile, $errline): void 85 97 { 98 // If error reporting is disabled, do nothing 99 if (! $this->isErrorReportingEnabled()) { 100 return; 101 } 86 102 // Ignore errors that are not in the error reporting level 87 103 if ($errno === 0) { … … 110 126 private function shouldHandleException(Throwable $exception): bool 111 127 { 128 // If error tracking is disabled, do not log the exception 129 if (! $this->isErrorReportingEnabled()) { 130 return false; 131 } 112 132 // Get the stack trace 113 133 $stackTrace = $exception->getTrace(); … … 189 209 public function logError(Throwable $exception): void 190 210 { 211 if ($this->isErrorReportingEnabled() === false) { 212 return; // Do not log if error tracking is disabled 213 } 214 215 if (! defined('WP_CONTENT_DIR')) { 216 return; 217 } 218 191 219 // Path to the debug.log file 192 220 $debugLogPath = $this->getDebugLogPath(); … … 275 303 public function showAdminErrorNotice(): void 276 304 { 305 if (! $this->isErrorReportingEnabled()) { 306 return; // Do not render the script if error tracking is disabled 307 } 277 308 $lastErrorMessage = get_transient($this->TRANSIENT_KEY_PREFIX . 'last_error_message'); 278 279 309 if ($lastErrorMessage) { 280 310 // Create the link to the settings page … … 439 469 440 470 $envInfo = array(); 441 $envInfo[] = 'WordPress Version: ' . $wp_version; 442 $envInfo[] = 'Site URL: ' . site_url(); 443 $envInfo[] = 'Home URL: ' . home_url(); 444 $envInfo[] = 'PHP Version: ' . phpversion(); 445 $envInfo[] = 'MySQL Version: ' . $wpdb->db_version(); 446 $envInfo[] = 'Web Server Info: ' . $serverSoftware; 447 448 $theme = wp_get_theme(); 471 $envInfo[] = 'Environment:'; 472 $envInfo[] = '- Site URL: ' . site_url(); 473 $envInfo[] = '- Home URL: ' . home_url(); 474 $envInfo[] = '- Plugin Version: ' . $this->version; 475 $envInfo[] = '- WordPress Version: ' . $wp_version; 476 $envInfo[] = '- PHP Version: ' . phpversion(); 477 $envInfo[] = '- MySQL Version: ' . $wpdb->db_version(); 478 $envInfo[] = '- Web Server Info: ' . $serverSoftware; 479 480 // Collect the most common wp-config constants 481 $envInfo[] = 'Config:'; 482 $envInfo[] = '- WP_DEBUG: ' . (defined('WP_DEBUG') ? (WP_DEBUG ? 'true' : 'false') : 'Not defined'); 483 $envInfo[] = '- WP_DEBUG_LOG: ' . (defined('WP_DEBUG_LOG') ? (WP_DEBUG_LOG ? 'true' : 'false') : 'Not defined'); 484 $envInfo[] = '- WP_DEBUG_DISPLAY: ' . (defined('WP_DEBUG_DISPLAY') 485 ? (boolval(constant('WP_DEBUG_DISPLAY')) ? 'true' : 'false') : 'Not defined' // Please Psalm 486 ); 487 $envInfo[] = '- WP_MEMORY_LIMIT: ' . (defined('WP_MEMORY_LIMIT') ? WP_MEMORY_LIMIT : 'Not defined'); 488 $envInfo[] = '- WP_MAX_MEMORY_LIMIT: ' . (defined('WP_MAX_MEMORY_LIMIT') ? WP_MAX_MEMORY_LIMIT : 'Not defined'); 489 $envInfo[] = '- WP_CONTENT_DIR: ' . (defined('WP_CONTENT_DIR') ? WP_CONTENT_DIR : 'Not defined'); 490 $envInfo[] = '- WP_PLUGIN_DIR: ' . (defined('WP_PLUGIN_DIR') ? WP_PLUGIN_DIR : 'Not defined'); 491 492 // Multisite information 493 if (is_multisite()) { 494 $envInfo[] = 'Multisite: Enabled'; 495 $networkDetails = get_network(); 496 497 if ($networkDetails) { 498 $envInfo[] = '- Network ID: ' . $networkDetails->id; 499 $envInfo[] = '- Network Name: ' . $networkDetails->site_name; 500 $envInfo[] = '- Network Domain: ' . $networkDetails->domain; 501 $envInfo[] = '- Network Path: ' . $networkDetails->path; 502 } else { 503 $envInfo[] = '- Network ID: Not available'; 504 } 505 } else { 506 $envInfo[] = 'Multisite: Disabled'; 507 } 508 509 $theme = wp_get_theme(); 449 510 $envInfo[] = 450 511 'Active Theme: ' . -
justwatch-partner-integrations/trunk/lib/Traits/SettingsTrait.php
r3388865 r3421924 381 381 esc_attr((string) ( $attrs['placeholder'] ?? '' )), 382 382 checked($value, 1, false), 383 esc_html($field['text'] ?? '')383 esc_html($field['text'] ?? ($field['label'] ?? '')) 384 384 ); 385 385 break; -
justwatch-partner-integrations/trunk/lib/schema.php
r3388865 r3421924 184 184 ], 185 185 ], 186 'errorReportingEnabled' => [ 187 'label' => __('Error Reporting Enabled', 'justwatch-partner-integrations'), 188 'option' => 'justwatch/partner-settings/error_reporting_enabled', 189 'type' => 'checkbox', 190 'default' => false, 191 'section' => 'error_reporting', 192 'text' => __('Enable Error Reporting', 'justwatch-partner-integrations'), 193 'description' => __(" 194 Enable error reporting for the JustWatch plugin.<br/> 195 This will help us improve the service by collecting error reports 196 without the need of putting your site into debug mode. 197 ", 'justwatch-partner-integrations'), 198 'attrs' => [ 199 'rows' => 3, 200 ], 201 ], 186 202 ]; -
justwatch-partner-integrations/trunk/package.json
r3388865 r3421924 1 1 { 2 2 "name": "wp-justwatch-partners", 3 "version": "1.0. 0",3 "version": "1.0.2", 4 4 "description": "Real-time Video-On-Demand availability for up to 250,000 movies and 60,000 TV shows in over 100 countries.", 5 5 "main": "index.js", -
justwatch-partner-integrations/trunk/readme.txt
r3388865 r3421924 2 2 Contributors: justwatchplugin 3 3 Tags: streaming, movies, tv-shows, Video-On-Demand, content-creation 4 Stable tag: 1.0. 04 Stable tag: 1.0.2 5 5 Requires at least: 6.5 6 6 Tested up to: 6.8 … … 90 90 == Changelog == 91 91 92 = 1.0.2 - 2025-11-18 = 93 * Added: Fix geo-ip integration issue 94 * Added: Make error reporting optional 95 96 = 1.0.1 - 2025-11-18 = 97 * Maintenance release 98 92 99 = 1.0.0 - 2025-03-28 = 93 100 * Added: Add WP store requirements
Note: See TracChangeset
for help on using the changeset viewer.