Skip to content

Commit

Permalink
Merge pull request #352 from ernilambar/312-refine-message
Browse files Browse the repository at this point in the history
  • Loading branch information
swissspidy authored Dec 20, 2023
2 parents c95260d + 5ba79ce commit fab8950
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
24 changes: 12 additions & 12 deletions includes/Checker/Checks/Trademarks_Check.php
Original file line number Diff line number Diff line change
Expand Up @@ -348,24 +348,24 @@ private function validate_name_has_no_trademarks( $plugin_name ) {
// Trademarks that do NOT end in "-", but are within the FOR_USE_EXCEPTIONS array can be used, but only if it ends with 'for x'.
$message = sprintf(
/* translators: 1: plugin name, 2: found trademarked term */
__( 'The plugin name includes a restricted term. Your chosen plugin name - %1$s - contains the restricted term "%2$s" which cannot be used within in your plugin name, unless your plugin name ends with "for %2$s". The term must still not appear anywhere else in your name.', 'plugin-check' ),
'<code>' . esc_html( $plugin_name ) . '</code>',
__( 'The plugin name includes a restricted term. Your chosen plugin name - "%1$s" - contains the restricted term "%2$s" which cannot be used within in your plugin name, unless your plugin name ends with "for %2$s". The term must still not appear anywhere else in your name.', 'plugin-check' ),
esc_html( $plugin_name ),
esc_html( trim( $check, '-' ) )
);
} elseif ( trim( $check, '-' ) === $check ) {
// Trademarks that do NOT end in "-" indicate slug cannot contain term at all.
$message = sprintf(
/* translators: 1: plugin name, 2: found trademarked term */
__( 'The plugin name includes a restricted term. Your chosen plugin name - %1$s - contains the restricted term "%2$s" which cannot be used at all in your plugin name.', 'plugin-check' ),
'<code>' . esc_html( $plugin_name ) . '</code>',
__( 'The plugin name includes a restricted term. Your chosen plugin name - "%1$s" - contains the restricted term "%2$s" which cannot be used at all in your plugin name.', 'plugin-check' ),
esc_html( $plugin_name ),
esc_html( trim( $check, '-' ) )
);
} else {
// Trademarks ending in "-" indicate slug cannot BEGIN with that term.
$message = sprintf(
/* translators: 1: plugin name, 2: found trademarked term */
__( 'The plugin name includes a restricted term. Your chosen plugin name - %1$s - contains the restricted term "%2$s" and cannot be used to begin your plugin name. We disallow the use of certain terms in ways that are abused, or potentially infringe on and/or are misleading with regards to trademarks. You may use the term "%2$s" elsewhere in your plugin name, such as "... for %2$s".', 'plugin-check' ),
'<code>' . esc_html( $plugin_name ) . '</code>',
__( 'The plugin name includes a restricted term. Your chosen plugin name - "%1$s" - contains the restricted term "%2$s" and cannot be used to begin your plugin name. We disallow the use of certain terms in ways that are abused, or potentially infringe on and/or are misleading with regards to trademarks. You may use the term "%2$s" elsewhere in your plugin name, such as "... for %2$s".', 'plugin-check' ),
esc_html( $plugin_name ),
esc_html( trim( $check, '-' ) )
);
}
Expand Down Expand Up @@ -395,24 +395,24 @@ private function validate_slug_has_no_trademarks( $plugin_slug ) {
// Trademarks that do NOT end in "-", but are within the FOR_USE_EXCEPTIONS array can be used, but only if it ends with 'for x'.
$message = sprintf(
/* translators: 1: plugin slug, 2: found trademarked term */
__( 'The plugin slug includes a restricted term. Your plugin slug - %1$s - contains the restricted term "%2$s" which cannot be used within in your plugin slug, unless your plugin slug ends with "for %2$s". The term must still not appear anywhere else in your plugin slug.', 'plugin-check' ),
'<code>' . esc_html( $plugin_slug ) . '</code>',
__( 'The plugin slug includes a restricted term. Your plugin slug - "%1$s" - contains the restricted term "%2$s" which cannot be used within in your plugin slug, unless your plugin slug ends with "for %2$s". The term must still not appear anywhere else in your plugin slug.', 'plugin-check' ),
esc_html( $plugin_slug ),
esc_html( trim( $check, '-' ) )
);
} elseif ( trim( $check, '-' ) === $check ) {
// Trademarks that do NOT end in "-" indicate slug cannot contain term at all.
$message = sprintf(
/* translators: 1: plugin slug, 2: found trademarked term */
__( 'The plugin slug includes a restricted term. Your plugin slug - %1$s - contains the restricted term "%2$s" which cannot be used at all in your plugin slug.', 'plugin-check' ),
'<code>' . esc_html( $plugin_slug ) . '</code>',
__( 'The plugin slug includes a restricted term. Your plugin slug - "%1$s" - contains the restricted term "%2$s" which cannot be used at all in your plugin slug.', 'plugin-check' ),
esc_html( $plugin_slug ),
esc_html( trim( $check, '-' ) )
);
} else {
// Trademarks ending in "-" indicate slug cannot BEGIN with that term.
$message = sprintf(
/* translators: 1: plugin slug, 2: found trademarked term */
__( 'The plugin slug includes a restricted term. Your plugin slug - %1$s - contains the restricted term "%2$s" and cannot be used to begin your plugin slug. We disallow the use of certain terms in ways that are abused, or potentially infringe on and/or are misleading with regards to trademarks. You may use the term "%2$s" elsewhere in your plugin slug, such as "... for %2$s".', 'plugin-check' ),
'<code>' . esc_html( $plugin_slug ) . '</code>',
__( 'The plugin slug includes a restricted term. Your plugin slug - "%1$s" - contains the restricted term "%2$s" and cannot be used to begin your plugin slug. We disallow the use of certain terms in ways that are abused, or potentially infringe on and/or are misleading with regards to trademarks. You may use the term "%2$s" elsewhere in your plugin slug, such as "... for %2$s".', 'plugin-check' ),
esc_html( $plugin_slug ),
esc_html( trim( $check, '-' ) )
);
}
Expand Down
14 changes: 7 additions & 7 deletions tests/phpunit/tests/Checker/Checks/Trademarks_Check_Tests.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,43 +55,43 @@ public function data_trademarks_check() {
Trademarks_Check::TYPE_README,
'test-trademarks-plugin-readme-errors/load.php',
'readme.txt',
'The plugin name includes a restricted term. Your chosen plugin name - <code> Test Plugin with readme </code> - contains the restricted term "plugin" which cannot be used at all in your plugin name.',
'The plugin name includes a restricted term. Your chosen plugin name - " Test Plugin with readme " - contains the restricted term "plugin" which cannot be used at all in your plugin name.',
),
'Plugin header - Test Trademarks Plugin Header Name Errors' => array(
Trademarks_Check::TYPE_NAME,
'test-trademarks-plugin-header-name-errors/load.php',
'load.php',
'The plugin name includes a restricted term. Your chosen plugin name - <code>Test Trademarks Plugin Header Name Errors</code> - contains the restricted term "plugin" which cannot be used at all in your plugin name.',
'The plugin name includes a restricted term. Your chosen plugin name - "Test Trademarks Plugin Header Name Errors" - contains the restricted term "plugin" which cannot be used at all in your plugin name.',
),
'Plugin slug - test-trademarks-plugin-header-slug-errors' => array(
Trademarks_Check::TYPE_SLUG,
'test-trademarks-plugin-header-slug-errors/load.php',
'load.php',
'The plugin slug includes a restricted term. Your plugin slug - <code>test-trademarks-plugin-header-slug-errors</code> - contains the restricted term "plugin" which cannot be used at all in your plugin slug.',
'The plugin slug includes a restricted term. Your plugin slug - "test-trademarks-plugin-header-slug-errors" - contains the restricted term "plugin" which cannot be used at all in your plugin slug.',
),
'Plugin headers - WooCommerce Example String' => array(
Trademarks_Check::TYPE_NAME,
'test-trademarks-plugin-header-woocommerce-string/load.php',
'load.php',
'The plugin name includes a restricted term. Your chosen plugin name - <code>WooCommerce Example String</code> - contains the restricted term "woocommerce" which cannot be used within in your plugin name, unless your plugin name ends with "for woocommerce". The term must still not appear anywhere else in your name.',
'The plugin name includes a restricted term. Your chosen plugin name - "WooCommerce Example String" - contains the restricted term "woocommerce" which cannot be used within in your plugin name, unless your plugin name ends with "for woocommerce". The term must still not appear anywhere else in your name.',
),
'Plugin headers - WooCommerce String for WooCommerce' => array(
Trademarks_Check::TYPE_NAME,
'test-trademarks-plugin-header-woocommerce-string-for-woocommerce/load.php',
'load.php',
'The plugin name includes a restricted term. Your chosen plugin name - <code>WooCommerce String for WooCommerce</code> - contains the restricted term "woocommerce" which cannot be used within in your plugin name, unless your plugin name ends with "for woocommerce". The term must still not appear anywhere else in your name.',
'The plugin name includes a restricted term. Your chosen plugin name - "WooCommerce String for WooCommerce" - contains the restricted term "woocommerce" which cannot be used within in your plugin name, unless your plugin name ends with "for woocommerce". The term must still not appear anywhere else in your name.',
),
'Plugin headers - WordPress String for WooCommerce' => array(
Trademarks_Check::TYPE_NAME,
'test-trademarks-plugin-header-wordpress-string-for-woocommerce/load.php',
'load.php',
'The plugin name includes a restricted term. Your chosen plugin name - <code>WordPress String for WooCommerce</code> - contains the restricted term "wordpress" which cannot be used at all in your plugin name.',
'The plugin name includes a restricted term. Your chosen plugin name - "WordPress String for WooCommerce" - contains the restricted term "wordpress" which cannot be used at all in your plugin name.',
),
'Plugin headers portmanteaus' => array(
Trademarks_Check::TYPE_NAME,
'test-trademarks-plugin-header-portmanteaus/load.php',
'load.php',
'The plugin name includes a restricted term. Your chosen plugin name - <code>WooXample</code> - contains the restricted term "woo" which cannot be used at all in your plugin name.',
'The plugin name includes a restricted term. Your chosen plugin name - "WooXample" - contains the restricted term "woo" which cannot be used at all in your plugin name.',
),
);
}
Expand Down

0 comments on commit fab8950

Please sign in to comment.