| @@ -1,12 +1,9 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | class Hostinger_Helper { |
| 4 | 4 | public const HOSTINGER_FREE_SUBDOMAIN_URL = 'hostingersite.com'; |
| 5 | - public const HOSTINGER_PAGE = [ | |
| 6 | - '/wp-admin/admin.php?page=hostinger', | |
| 7 | - '/wp-admin/admin.php?page=hostinger&' | |
| 8 | - ]; | |
| 5 | + public const HOSTINGER_PAGE = '/wp-admin/admin.php?page=hostinger'; | |
| 9 | 6 | |
| 10 | 7 | /** |
| 11 | 8 | * |
| 12 | 9 | * Check if plugin is active |
| @@ -78,8 +75,13 @@ | ||
| 78 | 75 | return ! empty( $site_url ) && strpos( $site_url, self::HOSTINGER_FREE_SUBDOMAIN_URL ) !== false; |
| 79 | 76 | } |
| 80 | 77 | |
| 81 | 78 | public function is_hostinger_admin_page(): bool { |
| 79 | + | |
| 80 | + if( ! isset( $_SERVER['REQUEST_URI'] ) ) { | |
| 81 | + return false; | |
| 82 | + } | |
| 83 | + | |
| 82 | 84 | $current_uri = sanitize_text_field( $_SERVER['REQUEST_URI'] ); |
| 83 | 85 | |
| 84 | 86 | if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
| 85 | 87 | return false; |
| @@ -88,14 +90,13 @@ | ||
| 88 | 90 | if ( isset( $current_uri ) && strpos( $current_uri, '/wp-json/' ) !== false ) { |
| 89 | 91 | return false; |
| 90 | 92 | } |
| 91 | 93 | |
| 92 | - if ( in_array( $current_uri, self::HOSTINGER_PAGE ) ) { | |
| 94 | + if ( strpos( $current_uri, self::HOSTINGER_PAGE ) !== false ) { | |
| 93 | 95 | return true; |
| 94 | 96 | } |
| 95 | 97 | |
| 96 | 98 | return false; |
| 97 | - | |
| 98 | 99 | } |
| 99 | 100 | |
| 100 | 101 | /** |
| 101 | 102 | * |