do not rely on WP core translation and add textdomain for all texts

This commit is contained in:
Stefan Kalscheuer 2020-05-22 11:20:26 +02:00
parent 2dd8e60bd8
commit e4fd34d036
3 changed files with 10 additions and 4 deletions

View File

@ -209,7 +209,7 @@ class StatifyBlacklist_Admin extends StatifyBlacklist {
if ( STATIFYBLACKLIST_BASE === $file && current_user_can( 'manage_options' ) ) { if ( STATIFYBLACKLIST_BASE === $file && current_user_can( 'manage_options' ) ) {
array_unshift( array_unshift(
$links, $links,
sprintf( '<a href="%s">%s</a>', esc_attr( add_query_arg( 'page', 'statify-blacklist', $base ) ), __( 'Settings' ) ) sprintf( '<a href="%s">%s</a>', esc_attr( add_query_arg( 'page', 'statify-blacklist', $base ) ), __( 'Settings', 'statify-blacklist' ) )
); );
} }
@ -226,7 +226,7 @@ class StatifyBlacklist_Admin extends StatifyBlacklist {
public static function cleanup_database() { public static function cleanup_database() {
// Check user permissions. // Check user permissions.
if ( ! current_user_can( 'manage_options' ) && ! ( defined( 'DOING_CRON' ) && DOING_CRON ) ) { if ( ! current_user_can( 'manage_options' ) && ! ( defined( 'DOING_CRON' ) && DOING_CRON ) ) {
die( esc_html__( 'Are you sure you want to do this?' ) ); die( esc_html__( 'Are you sure you want to do this?', 'statify-blacklist' ) );
} }
if ( defined( 'DOING_CRON' ) && DOING_CRON ) { if ( defined( 'DOING_CRON' ) && DOING_CRON ) {

View File

@ -18,6 +18,12 @@
<exclude name="WordPress.DB.DirectDatabaseQuery.NoCaching"/> <exclude name="WordPress.DB.DirectDatabaseQuery.NoCaching"/>
</rule> </rule>
<rule ref="WordPress.WP.I18n">
<properties>
<property name="text_domain" type="array" value="statify-blacklist"/>
</properties>
</rule>
<!-- PHP compatibility level --> <!-- PHP compatibility level -->
<config name="testVersion" value="5.5-"/> <config name="testVersion" value="5.5-"/>
<rule ref="PHPCompatibility"/> <rule ref="PHPCompatibility"/>

View File

@ -21,7 +21,7 @@ if ( ! empty( $_POST['statifyblacklist'] ) ) {
// Check user capabilities. // Check user capabilities.
if ( ! current_user_can( 'manage_options' ) ) { if ( ! current_user_can( 'manage_options' ) ) {
die( esc_html__( 'Are you sure you want to do this?' ) ); die( esc_html__( 'Are you sure you want to do this?', 'statify-blacklist' ) );
} }
if ( ! empty( $_POST['cleanUp'] ) ) { if ( ! empty( $_POST['cleanUp'] ) ) {
@ -375,7 +375,7 @@ if ( ! empty( $_POST['statifyblacklist'] ) ) {
</table> </table>
<p class="submit"> <p class="submit">
<input class="button-primary" type="submit" name="submit" value="<?php esc_html_e( 'Save Changes' ); ?>"> <input class="button-primary" type="submit" name="submit" value="<?php esc_html_e( 'Save Changes', 'statify-blacklist' ); ?>">
<hr> <hr>
<input class="button-secondary" type="submit" name="cleanUp" <input class="button-secondary" type="submit" name="cleanUp"
value="<?php esc_html_e( 'CleanUp Database', 'statify-blacklist' ); ?>" value="<?php esc_html_e( 'CleanUp Database', 'statify-blacklist' ); ?>"