Skip to content

Commit

Permalink
Merge pull request #34 from GravityKit/develop
Browse files Browse the repository at this point in the history
Update text domain to fix WP translation
  • Loading branch information
zackkatz authored Oct 10, 2024
2 parents 07795ea + 9f40821 commit ac3a41e
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 47 deletions.
86 changes: 43 additions & 43 deletions gravityforms-zero-spam-form-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public function filter_gf_zero_spam_add_key_field( $add_key_field = true ) {
*/
public function add_tooltip( $tooltips ) {

$tooltips['enableGFZeroSpam'] = esc_html__( 'Enable to fight spam using a simple, effective method that is more effective than the built-in anti-spam honeypot.', 'gf-zero-spam' );
$tooltips['enableGFZeroSpam'] = esc_html__( 'Enable to fight spam using a simple, effective method that is more effective than the built-in anti-spam honeypot.', 'gravity-forms-zero-spam' );

return $tooltips;
}
Expand All @@ -119,7 +119,7 @@ function add_settings_field( $fields, $form = array() ) {
$fields['form_options']['fields'][] = array(
'name' => 'enableGFZeroSpam',
'type' => 'toggle',
'label' => esc_html__( 'Prevent spam using Gravity Forms Zero Spam', 'gf-zero-spam' ),
'label' => esc_html__( 'Prevent spam using Gravity Forms Zero Spam', 'gravity-forms-zero-spam' ),
'tooltip' => gform_tooltip( 'enableGFZeroSpam', '', true ),
'default_value' => apply_filters( 'gf_zero_spam_check_key_field', true, $form ),
);
Expand All @@ -135,50 +135,50 @@ function add_settings_field( $fields, $form = array() ) {
public function plugin_settings_fields() {

$spam_report_description = sprintf( '<h3 style="margin-top: 0">%s</h3><p>%s</p><p><strong>%s</strong></p><p>%s</p><hr style="margin: 1em 0;">',
esc_html__( 'Know when entries are flagged as spam.', 'gf-zero-spam' ),
esc_html__( 'It can be hard to know when entries are being marked as spam. When enabled, this feature will send an automated spam report, giving you a summary of recent spam entries. If no spam entries have been submitted, no report will be sent.', 'gf-zero-spam' ),
esc_html__( 'This feature works with any spam filter, including the Gravity Forms spam honeypot, Gravity Forms Zero Spam, reCAPTCHA, or others.', 'gf-zero-spam' ),
strtr( esc_html__( 'Note: Depending on site traffic, time-based reports may not always be sent at the scheduled frequency. {{link}}See how to set up a "cron" to make this more reliable{{/link}}.', 'gf-zero-spam' ), array(
esc_html__( 'Know when entries are flagged as spam.', 'gravity-forms-zero-spam' ),
esc_html__( 'It can be hard to know when entries are being marked as spam. When enabled, this feature will send an automated spam report, giving you a summary of recent spam entries. If no spam entries have been submitted, no report will be sent.', 'gravity-forms-zero-spam' ),
esc_html__( 'This feature works with any spam filter, including the Gravity Forms spam honeypot, Gravity Forms Zero Spam, reCAPTCHA, or others.', 'gravity-forms-zero-spam' ),
strtr( esc_html__( 'Note: Depending on site traffic, time-based reports may not always be sent at the scheduled frequency. {{link}}See how to set up a "cron" to make this more reliable{{/link}}.', 'gravity-forms-zero-spam' ), array(
'{{heading}}' => 'Spam Report',
'{{link}}' => '<a href="https://deliciousbrains.com/wp-offload-ses/doc/cron-setup/" rel="nofollow noopener noreferrer" target="_blank"><span class="screen-reader-text">' . esc_html__( 'Link opens in a new tab', 'gf-zero-spam' ) . '</span>',
'{{link}}' => '<a href="https://deliciousbrains.com/wp-offload-ses/doc/cron-setup/" rel="nofollow noopener noreferrer" target="_blank"><span class="screen-reader-text">' . esc_html__( 'Link opens in a new tab', 'gravity-forms-zero-spam' ) . '</span>',
'{{/link}}' => '</a>',
) )
);

// translators: Do not translate the placeholders inside the curly brackets, like this {{placeholders}}.
$email_body = '<h2>' . esc_html_x( 'Gravity Forms Spam Report', 'The heading inside the email body.', 'gf-zero-spam' ) . '</h2>';
$email_body = '<h2>' . esc_html_x( 'Gravity Forms Spam Report', 'The heading inside the email body.', 'gravity-forms-zero-spam' ) . '</h2>';
// translators: Do not translate the placeholders inside the curly brackets, like this {{placeholders}}.
$email_body .= wpautop( esc_html__( 'You have received {{total_spam_count}} spam entries from the following form(s):', 'gf-zero-spam' ) );
$email_body .= wpautop( esc_html__( 'You have received {{total_spam_count}} spam entries from the following form(s):', 'gravity-forms-zero-spam' ) );
$email_body .= '{{spam_report_list}}';
// translators: Do not translate the placeholders inside the curly brackets, like this {{placeholders}}.
$email_body .= wpautop( '<em>' . esc_html__( 'To modify or disable this email, visit {{settings_link}}the Gravity Forms Zero Spam settings page{{/settings_link}}.', 'gf-zero-spam' ) . '</em>' );
$email_body .= wpautop( '<em>' . esc_html__( 'To modify or disable this email, visit {{settings_link}}the Gravity Forms Zero Spam settings page{{/settings_link}}.', 'gravity-forms-zero-spam' ) . '</em>' );

$available_variables_message = wpautop( esc_html__( 'The following variables may be used:', 'gf-zero-spam' ) );
$available_variables_message = wpautop( esc_html__( 'The following variables may be used:', 'gravity-forms-zero-spam' ) );
$available_variables_message .= '<ul class="ul-disc" style="margin-bottom: 1em;">';
$available_variables_message .= '<li style="list-style: disc;"><code>{{site_name}}</code> - ' . esc_html__( 'The name of this website', 'gf-zero-spam' ) . '</li>';
$available_variables_message .= '<li style="list-style: disc;"><code>{{admin_email}}</code> - ' . esc_html__( 'The email of the site administrator', 'gf-zero-spam' ) . '</li>';
$available_variables_message .= '<li style="list-style: disc;"><code>{{total_spam_count}}</code> - ' . esc_html__( 'The total number of spam emails received since the last report.', 'gf-zero-spam' ) . '</li>';
$available_variables_message .= '<li style="list-style: disc;"><code>{{spam_report_list}}</code> - ' . esc_html__( 'A list of forms and the number of spam entries since the last report.', 'gf-zero-spam' ) . '</li>';
$available_variables_message .= '<li style="list-style: disc;"><code>{{settings_link}}</code> and <code>{{/settings_link}}</code> - ' . esc_html__( 'A link to the plugin settings page. Text inside the variables will be the link text. Make sure to include both the opening and closing variables.', 'gf-zero-spam' ) . '</li>';
$available_variables_message .= '<li style="list-style: disc;"><code>{{site_name}}</code> - ' . esc_html__( 'The name of this website', 'gravity-forms-zero-spam' ) . '</li>';
$available_variables_message .= '<li style="list-style: disc;"><code>{{admin_email}}</code> - ' . esc_html__( 'The email of the site administrator', 'gravity-forms-zero-spam' ) . '</li>';
$available_variables_message .= '<li style="list-style: disc;"><code>{{total_spam_count}}</code> - ' . esc_html__( 'The total number of spam emails received since the last report.', 'gravity-forms-zero-spam' ) . '</li>';
$available_variables_message .= '<li style="list-style: disc;"><code>{{spam_report_list}}</code> - ' . esc_html__( 'A list of forms and the number of spam entries since the last report.', 'gravity-forms-zero-spam' ) . '</li>';
$available_variables_message .= '<li style="list-style: disc;"><code>{{settings_link}}</code> and <code>{{/settings_link}}</code> - ' . esc_html__( 'A link to the plugin settings page. Text inside the variables will be the link text. Make sure to include both the opening and closing variables.', 'gravity-forms-zero-spam' ) . '</li>';
$available_variables_message .= '</ul>';

return array(
array(
'title' => esc_html__( 'Spam Blocking', 'gf-zero-spam' ),
'description' => esc_html__( 'Enable to fight spam using a simple, effective method that is more effective than the built-in anti-spam honeypot.', 'gf-zero-spam' ) . ' ' . esc_html__( 'It is possible to enable or disable spam blocking on a per-form basis inside each form\'s settings.', 'gf-zero-spam' ),
'title' => esc_html__( 'Spam Blocking', 'gravity-forms-zero-spam' ),
'description' => esc_html__( 'Enable to fight spam using a simple, effective method that is more effective than the built-in anti-spam honeypot.', 'gravity-forms-zero-spam' ) . ' ' . esc_html__( 'It is possible to enable or disable spam blocking on a per-form basis inside each form\'s settings.', 'gravity-forms-zero-spam' ),
'fields' => array(
array(
'label' => esc_html__( 'Enable Zero Spam by Default', 'gf-zero-spam' ),
'label' => esc_html__( 'Enable Zero Spam by Default', 'gravity-forms-zero-spam' ),
'type' => 'radio',
'name' => 'gf_zero_spam_blocking',
'default_value' => '1',
'choices' => array(
array(
'label' => __( 'Enabled: Add Zero Spam to Gravity Forms forms', 'gf-zero-spam' ),
'label' => __( 'Enabled: Add Zero Spam to Gravity Forms forms', 'gravity-forms-zero-spam' ),
'value' => '1',
),
array(
'label' => __( 'Disabled: Use Gravity Forms\' built-in spam prevention', 'gf-zero-spam' ),
'label' => __( 'Disabled: Use Gravity Forms\' built-in spam prevention', 'gravity-forms-zero-spam' ),
'value' => '0',
),
),
Expand All @@ -187,39 +187,39 @@ public function plugin_settings_fields() {
),
),
array(
'title' => esc_html__( 'Spam Report Email', 'gf-zero-spam' ),
'title' => esc_html__( 'Spam Report Email', 'gravity-forms-zero-spam' ),
'description' => $spam_report_description,
'fields' => array(
array(
'label' => esc_html__( 'Spam Report Frequency', 'gf-zero-spam' ),
'label' => esc_html__( 'Spam Report Frequency', 'gravity-forms-zero-spam' ),
// translators: Do not translate the placeholders inside the curly brackets, like this {{placeholders}}.
'description' => wpautop( esc_html__( 'How frequently should spam report emails be sent?', 'gf-zero-spam' ) ),
'description' => wpautop( esc_html__( 'How frequently should spam report emails be sent?', 'gravity-forms-zero-spam' ) ),
'type' => 'radio',
'name' => 'gf_zero_spam_email_frequency',
'value' => '',
'choices' => array(
array(
'label' => __( 'Disabled', 'gf-zero-spam' ),
'label' => __( 'Disabled', 'gravity-forms-zero-spam' ),
'value' => '',
),
array(
'label' => __( 'Threshold-Based', 'gf-zero-spam' ),
'label' => __( 'Threshold-Based', 'gravity-forms-zero-spam' ),
'value' => 'entry_limit',
),
array(
'label' => __( 'Twice Daily', 'gf-zero-spam' ),
'label' => __( 'Twice Daily', 'gravity-forms-zero-spam' ),
'value' => 'twicedaily',
),
array(
'label' => __( 'Daily', 'gf-zero-spam' ),
'label' => __( 'Daily', 'gravity-forms-zero-spam' ),
'value' => 'daily',
),
array(
'label' => __( 'Weekly', 'gf-zero-spam' ),
'label' => __( 'Weekly', 'gravity-forms-zero-spam' ),
'value' => 'weekly',
),
array(
'label' => __( 'Monthly', 'gf-zero-spam' ),
'label' => __( 'Monthly', 'gravity-forms-zero-spam' ),
'value' => 'monthly',
),
),
Expand All @@ -230,8 +230,8 @@ public function plugin_settings_fields() {
),

array(
'label' => esc_html__( 'Spam Entry Threshold', 'gf-zero-spam' ),
'description' => esc_html__( 'A spam report email will be sent when the specified number of spam entries is reached.', 'gf-zero-spam' ),
'label' => esc_html__( 'Spam Entry Threshold', 'gravity-forms-zero-spam' ),
'description' => esc_html__( 'A spam report email will be sent when the specified number of spam entries is reached.', 'gravity-forms-zero-spam' ),
'type' => 'text',
'input_type' => 'number',
'min' => 1,
Expand All @@ -249,14 +249,14 @@ public function plugin_settings_fields() {
),
'validation_callback' => function ( $field, $value ) {
if ( (int) $value < 1 ) {
$field->set_error( esc_html__( 'Entry limit has to be 1 or more.', 'gf-zero-spam' ) );
$field->set_error( esc_html__( 'Entry limit has to be 1 or more.', 'gravity-forms-zero-spam' ) );
}
},
),

array(
'label' => esc_html__( 'Email Address', 'gf-zero-spam' ),
'description' => esc_html__( 'Send spam report to this email address.', 'gf-zero-spam' ),
'label' => esc_html__( 'Email Address', 'gravity-forms-zero-spam' ),
'description' => esc_html__( 'Send spam report to this email address.', 'gravity-forms-zero-spam' ),
'type' => 'text',
'input_type' => 'email',
'value' => '{{admin_email}}',
Expand All @@ -266,7 +266,7 @@ public function plugin_settings_fields() {
if ( is_email( $value ) || '{{admin_email}}' === $value ) {
return;
}
$field->set_error( esc_html__( 'The email entered is invalid.', 'gf-zero-spam' ) );
$field->set_error( esc_html__( 'The email entered is invalid.', 'gravity-forms-zero-spam' ) );
},
'dependency' => array(
'live' => true,
Expand All @@ -280,9 +280,9 @@ public function plugin_settings_fields() {

array(
'name' => 'gf_zero_spam_subject',
'label' => esc_html__( 'Email Subject', 'gf-zero-spam' ),
'label' => esc_html__( 'Email Subject', 'gravity-forms-zero-spam' ),
'type' => 'text',
'value' => esc_html__( 'Your Gravity Forms spam report for {{site_name}}', 'gf-zero-spam' ),
'value' => esc_html__( 'Your Gravity Forms spam report for {{site_name}}', 'gravity-forms-zero-spam' ),
'required' => true,
'dependency' => array(
'live' => true,
Expand All @@ -295,7 +295,7 @@ public function plugin_settings_fields() {
),
array(
'name' => 'gf_zero_spam_message',
'label' => esc_html__( 'Email Message', 'gf-zero-spam' ),
'label' => esc_html__( 'Email Message', 'gravity-forms-zero-spam' ),
'description' => $available_variables_message,
'type' => 'textarea',
'value' => trim( $email_body ),
Expand Down Expand Up @@ -325,8 +325,8 @@ public function plugin_settings_fields() {
array(
'name' => 'gf_zero_spam_test_email_button',
'type' => 'button',
'label' => esc_html__( 'Send Test Email & Save Settings', 'gf-zero-spam' ),
'value' => esc_html__( 'Send Email & Save Settings', 'gf-zero-spam' ),
'label' => esc_html__( 'Send Test Email & Save Settings', 'gravity-forms-zero-spam' ),
'value' => esc_html__( 'Send Email & Save Settings', 'gravity-forms-zero-spam' ),
'class' => 'button',
'onclick' => 'jQuery( "#gf_zero_spam_test_email" ).val( "1" ); jQuery( "#gform-settings-save" ).click();',
),
Expand Down Expand Up @@ -415,7 +415,7 @@ public function add_cron_schedules( $schedules ) {

$schedules['monthly'] = array(
'interval' => MONTH_IN_SECONDS,
'display' => __( 'Once Monthly', 'gf-zero-spam' ),
'display' => __( 'Once Monthly', 'gravity-forms-zero-spam' ),
);

return $schedules;
Expand Down Expand Up @@ -589,7 +589,7 @@ private function get_report_list() {
$results_output[] = strtr( '{{form_link}}: {{count}} {{new_entries}}', array(
'{{form_link}}' => '<a href="' . esc_url( $link ) . '">' . esc_html( $form_info->title ) . '</a>',
'{{count}}' => $count,
'{{new_entries}}' => _n( 'spam entry', 'spam entries', $count, 'gf-zero-spam' ),
'{{new_entries}}' => _n( 'spam entry', 'spam entries', $count, 'gravity-forms-zero-spam' ),
) );
}

Expand Down
6 changes: 3 additions & 3 deletions gravityforms-zero-spam.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
* Plugin Name: Gravity Forms Zero Spam
* Plugin URI: https://www.gravitykit.com?utm_source=plugin&utm_campaign=zero-spam&utm_content=pluginuri
* Description: Enhance Gravity Forms to include effective anti-spam measures—without using a CAPTCHA.
* Version: 1.4.2
* Version: 1.4.3
* Author: GravityKit
* Author URI: https://www.gravitykit.com?utm_source=plugin&utm_campaign=zero-spam&utm_content=authoruri
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
* Text Domain: gf-zero-spam
* Text Domain: gravity-forms-zero-spam
*/

// my mother always said to use things as they're intended or not at all.
Expand Down Expand Up @@ -219,6 +219,6 @@ public function add_entry_note( $entry ) {
return;
}

GFAPI::add_note( $entry['id'], 0, 'Zero Spam', __( 'This entry has been marked as spam.', 'gf-zero-spam' ), 'gf-zero-spam', 'success' );
GFAPI::add_note( $entry['id'], 0, 'Zero Spam', __( 'This entry has been marked as spam.', 'gravity-forms-zero-spam' ), 'gf-zero-spam', 'success' );
}
}
6 changes: 5 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Contributors: gravityview
Tags: gravityforms, gravity forms, anti-spam, antispam, spam, spam-blocker, spambot, spammer, add-ons, honeypot
Requires at least: 3.0.1
Tested up to: 6.6.2
Stable tag: 1.4.2
Stable tag: 1.4.3
Requires PHP: 5.2.6
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Expand Down Expand Up @@ -114,6 +114,10 @@ You can enable a spam summary report email. This email will be sent to the email

== Changelog ==

= 1.4.3 on October 10, 2024 =

* Tweak: Changed the text domain for strings to `gravity-forms-zero-spam` to match the plugin slug

= 1.4.2 on October 10, 2024 =

* Improved: Sanitized form ID in JavaScript
Expand Down

0 comments on commit ac3a41e

Please sign in to comment.