| @@ -71,22 +71,15 @@ | ||
| 71 | 71 | * @return bool Returns true if the given theme file path is the active theme, false otherwise. |
| 72 | 72 | */ |
| 73 | 73 | public function is_active_theme( $file_path ): bool { |
| 74 | 74 | $active_theme = $this->get_theme(); |
| 75 | - if ( ! is_object( $active_theme ) ) { | |
| 76 | - return false; | |
| 77 | - } | |
| 78 | - $theme_dir = $this->get_path_of_themes_dir(); | |
| 79 | - $abs_path = $theme_dir; | |
| 80 | - $abs_path = defender_replace_line( $abs_path ); | |
| 75 | + $theme_dir = $this->get_path_of_themes_dir(); | |
| 76 | + $abs_path = $theme_dir; | |
| 77 | + $abs_path = defender_replace_line( $abs_path ); | |
| 81 | 78 | // Without the first slash. |
| 82 | 79 | $rev_file = str_replace( $abs_path, '', $file_path ); |
| 83 | 80 | $theme_data = explode( '/', $rev_file ); |
| 84 | - if ( ! empty( $theme_data ) ) { | |
| 85 | - $theme_slug = $theme_data[0]; | |
| 86 | - } else { | |
| 87 | - return false; | |
| 88 | - } | |
| 81 | + $theme_slug = $theme_data[0]; | |
| 89 | 82 | // Checking if the given theme is a child theme. |
| 90 | 83 | if ( false !== stripos( $theme_slug, '-child' ) ) { |
| 91 | 84 | $theme_slug = str_replace( '-child', '', $theme_slug ); |
| 92 | 85 | } |