| 1 |
<?php |
| 2 |
namespace WordPressdotorg\Plugin_Check\Checks; |
| 3 |
use WordPressdotorg\Plugin_Check\{Error, Guideline_Violation, Message, Notice, Warning}; |
| 4 |
|
| 5 |
class Header extends Check_Base { |
| 6 |
function check_textdomain() { |
| 7 |
if ( |
| 8 |
! empty( $this->slug ) && |
| 9 |
! empty( $this->headers['TextDomain'] ) && |
| 10 |
$this->slug !== $this->headers['TextDomain'] |
| 11 |
) { |
| 12 |
return new Warning( |
| 13 |
'textdomain_mismatch', |
| 14 |
sprintf( |
| 15 |
'TextDomain header in plugin file does not match slug. Found %s, expected %s.', |
| 16 |
'<code>' . esc_html( $this->headers['TextDomain'] ) . '</code>', |
| 17 |
'<code>' . esc_html( $this->slug ) . '</code>' |
| 18 |
) |
| 19 |
); |
| 20 |
} |
| 21 |
} |
| 22 |
} |