Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rocklobster-in/contact-form-7
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v5.9.6
Choose a base ref
...
head repository: rocklobster-in/contact-form-7
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Loading
Showing with 10,241 additions and 8,421 deletions.
  1. +6 −4 CONTRIBUTING.md
  2. +112 −120 admin/admin.php
  3. +176 −127 admin/edit-contact-form.php
  4. +7 −7 admin/includes/class-contact-forms-list-table.php
  5. +11 −8 admin/includes/config-validator.php
  6. +15 −8 admin/{ → includes}/css/styles-rtl.css
  7. +201 −91 admin/{ → includes}/css/styles.css
  8. +57 −18 admin/includes/editor.php
  9. +9 −0 admin/includes/js/index.asset.php
  10. +1 −0 admin/includes/js/index.js
  11. +68 −0 admin/includes/js/src/before-unload.js
  12. +232 −0 admin/includes/js/src/config-errors.js
  13. +110 −0 admin/includes/js/src/index.js
  14. +91 −0 admin/includes/js/src/tabs.js
  15. +161 −0 admin/includes/js/src/tag-generator-v1.js
  16. +153 −0 admin/includes/js/src/tag-generator-v2.js
  17. +79 −0 admin/includes/js/src/tag-generator.js
  18. +34 −0 admin/includes/js/src/utils.js
  19. +59 −0 admin/includes/js/src/welcome-panel.js
  20. +458 −19 admin/includes/tag-generator.php
  21. +7 −8 admin/includes/welcome-panel.php
  22. +0 −319 admin/js/scripts.js
  23. +0 −249 admin/js/tag-generator.js
  24. +1 −1 includes/block-editor/index.asset.php
  25. +1 −1 includes/block-editor/index.js
  26. +5 −5 includes/config-validator/mail.php
  27. +2 −2 includes/contact-form-functions.php
  28. +4 −4 includes/contact-form-template.php
  29. +30 −29 includes/contact-form.php
  30. +14 −9 includes/controller.php
  31. +4 −9 includes/file.php
  32. +9 −9 includes/form-tag.php
  33. +3 −5 includes/form-tags-manager.php
  34. +50 −6 includes/formatting.php
  35. +71 −66 includes/functions.php
  36. +23 −23 includes/html-formatter.php
  37. +5 −5 includes/integration.php
  38. +3 −1 includes/js/index.asset.php
  39. +1 −1 includes/js/index.js
  40. +2 −2 includes/js/src/helpers.js
  41. +17 −0 includes/js/src/index.js
  42. +1 −1 includes/l10n.php
  43. +25 −29 includes/mail.php
  44. +2 −2 includes/pipe.php
  45. +4 −4 includes/rest-api.php
  46. +1 −1 includes/shortcodes.php
  47. +24 −1 includes/special-mail-tags.php
  48. +3 −3 includes/submission.php
  49. +1 −1 includes/swv/js/index.js
  50. +1 −0 includes/swv/php/rules/date.php
  51. +1 −0 includes/swv/php/rules/dayofweek.php
  52. +1 −0 includes/swv/php/rules/email.php
  53. +13 −1 includes/swv/php/rules/enum.php
  54. +1 −0 includes/swv/php/rules/maxdate.php
  55. +1 −0 includes/swv/php/rules/maxitems.php
  56. +1 −0 includes/swv/php/rules/maxlength.php
  57. +1 −0 includes/swv/php/rules/maxnumber.php
  58. +1 −0 includes/swv/php/rules/mindate.php
  59. +1 −0 includes/swv/php/rules/minitems.php
  60. +1 −0 includes/swv/php/rules/minlength.php
  61. +1 −0 includes/swv/php/rules/minnumber.php
  62. +1 −0 includes/swv/php/rules/number.php
  63. +1 −0 includes/swv/php/rules/required.php
  64. +50 −0 includes/swv/php/rules/stepnumber.php
  65. +1 −0 includes/swv/php/rules/tel.php
  66. +1 −0 includes/swv/php/rules/time.php
  67. +1 −0 includes/swv/php/rules/url.php
  68. +1 −1 includes/swv/script-loader.php
  69. +9 −1 includes/swv/swv.php
  70. +21 −2 includes/validation-functions.php
  71. +1 −1 includes/validation.php
  72. +1 −1 license.txt
  73. +1 −1 load.php
  74. +82 −51 modules/acceptance.php
  75. +2 −2 modules/akismet/akismet.php
  76. +1 −1 modules/akismet/service.php
  77. +94 −86 modules/checkbox.php
  78. +2 −2 modules/constant-contact/constant-contact.php
  79. +1 −0 modules/constant-contact/contact-form-properties.php
  80. +4 −4 modules/constant-contact/contact-post-request.php
  81. +21 −15 modules/constant-contact/service.php
  82. +1 −1 modules/count.php
  83. +62 −73 modules/date.php
  84. +1 −0 modules/disallowed-list.php
  85. +105 −59 modules/file.php
  86. +5 −5 modules/flamingo.php
  87. +62 −78 modules/number.php
  88. +76 −47 modules/quiz.php
  89. +17 −110 modules/really-simple-captcha.php
  90. +45 −22 modules/recaptcha/recaptcha.php
  91. +18 −12 modules/recaptcha/service.php
  92. +54 −62 modules/select.php
  93. +1 −0 modules/sendinblue/contact-form-properties.php
  94. +15 −8 modules/sendinblue/sendinblue.php
  95. +23 −17 modules/sendinblue/service.php
  96. +2 −2 modules/stripe/api.php
  97. +15 −12 modules/stripe/service.php
  98. +10 −10 modules/stripe/stripe.php
  99. +50 −36 modules/submit.php
  100. +98 −104 modules/text.php
  101. +65 −59 modules/textarea.php
  102. +6,796 −6,277 package-lock.json
  103. +9 −7 package.json
  104. +32 −49 readme.txt
  105. +2 −0 uninstall.php
  106. +4 −4 wp-contact-form-7.php
10 changes: 6 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -7,13 +7,15 @@ Thank you for considering contributing to Contact Form 7. This document explains
Contributing by reporting issues
--------------------------------

If you find a bug, please report it to our GitHub repository by creating an issue. For minor issues like correction of a typo, you can start by creating a pull request instead of an issue.
If you find a bug, please report it to our GitHub repository unless it is about a security vulnerability. Creating an issue is always recommended, but for minor issues like correction of a typo, you can create a pull request instead of an issue.

If you can fix an issue, create a pull request that links to the target issue. We have our own [coding standards](https://contactform7.com/coding-standards/) for the plugin's development, and we ask that you respect the standards in your coding, too.
If you can fix an issue, create a pull request that links to the target issue. For WordPress plugin development, we have our own [coding standards](https://contactform7.com/coding-standards/). We ask you to respect the standards in your coding as well.

Security issues should not be discussed publicly, so when an issue is about a security vulnerability, please use the [contact form](https://contactform7.com/contact/) to inform the developers privately.
Security issues should not be discussed publicly, so please don't publish it through GitHub or other channels when the issue is about a security vulnerability. For security vulnerabilities, it is recommended you use the [Wordfence vulnerability submission form](https://www.wordfence.com/threat-intel/vulnerabilities/submit).

In any case, before reporting an issue, please double-check if the issue was caused purely due to a bug seen in the latest version of Contact Form 7. Reporting issues that have little to do with this plugin negatively impacts the motivation of the developers. If you are uncertain, posting it to the [support forum](https://wordpress.org/support/plugin/contact-form-7/) is advised.
In any case, prior to reporting an issue, please double-check if the issue is caused purely due to a bug of the plugin's latest version. Confirm that the problem occurs even in a vanilla environment where only the WordPress core, the default theme, and the plugin itself are activated.

Receiving reports of issues that have little to do with the plugin negatively impacts the motivation of the developers. If you are uncertain, posting to the [support forum](https://wordpress.org/support/plugin/contact-form-7/) is advised.


Contributing by helping other users
232 changes: 112 additions & 120 deletions admin/admin.php
Original file line number Diff line number Diff line change
@@ -116,67 +116,92 @@ function wpcf7_admin_enqueue_scripts( $hook_suffix ) {
}

wp_enqueue_style( 'contact-form-7-admin',
wpcf7_plugin_url( 'admin/css/styles.css' ),
wpcf7_plugin_url( 'admin/includes/css/styles.css' ),
array(), WPCF7_VERSION, 'all'
);

if ( wpcf7_is_rtl() ) {
wp_enqueue_style( 'contact-form-7-admin-rtl',
wpcf7_plugin_url( 'admin/css/styles-rtl.css' ),
wpcf7_plugin_url( 'admin/includes/css/styles-rtl.css' ),
array(), WPCF7_VERSION, 'all'
);
}

$assets = include wpcf7_plugin_path( 'admin/includes/js/index.asset.php' );

$assets = wp_parse_args( $assets, array(
'dependencies' => array(),
'version' => WPCF7_VERSION,
) );

wp_enqueue_script( 'wpcf7-admin',
wpcf7_plugin_url( 'admin/js/scripts.js' ),
array( 'jquery', 'jquery-ui-tabs' ),
WPCF7_VERSION,
wpcf7_plugin_url( 'admin/includes/js/index.js' ),
$assets['dependencies'],
$assets['version'],
array( 'in_footer' => true )
);

$l10n = array(
wp_set_script_translations( 'wpcf7-admin', 'contact-form-7' );

$wpcf7_obj = array(
'apiSettings' => array(
'root' => sanitize_url( rest_url( 'contact-form-7/v1' ) ),
'namespace' => 'contact-form-7/v1',
'nonce' => ( wp_installing() && ! is_multisite() )
? '' : wp_create_nonce( 'wp_rest' ),
),
'pluginUrl' => wpcf7_plugin_url(),
'saveAlert' => __(
"The changes you made will be lost if you navigate away from this page.",
'contact-form-7' ),
'activeTab' => (int) ( $_GET['active-tab'] ?? 0 ),
'configValidator' => array(
'errors' => array(),
'howToCorrect' => __( "How to resolve?", 'contact-form-7' ),
'oneError' => __( '1 configuration error detected', 'contact-form-7' ),
'manyErrors' => __( '%d configuration errors detected', 'contact-form-7' ),
'oneErrorInTab' => __( '1 configuration error detected in this tab panel', 'contact-form-7' ),
'manyErrorsInTab' => __( '%d configuration errors detected in this tab panel', 'contact-form-7' ),
'docUrl' => WPCF7_ConfigValidator::get_doc_link(),
/* translators: screen reader text */
'iconAlt' => __( '(configuration error)', 'contact-form-7' ),
),
);

if ( $post = wpcf7_get_current_contact_form()
and current_user_can( 'wpcf7_edit_contact_form', $post->id() )
and wpcf7_validate_configuration() ) {
$config_validator = new WPCF7_ConfigValidator( $post );
$config_validator->restore();
$l10n['configValidator']['errors'] =
$config_validator->collect_error_messages();
}
$post = wpcf7_get_current_contact_form();

wp_localize_script( 'wpcf7-admin', 'wpcf7', $l10n );
if ( $post ) {
$wpcf7_obj = array_merge( $wpcf7_obj, array(
'nonce' => array(
'save' => wp_create_nonce(
sprintf(
'wpcf7-save-contact-form_%s',
$post->initial() ? -1 : $post->id()
)
),
'copy' => wp_create_nonce(
sprintf(
'wpcf7-copy-contact-form_%s',
$post->initial() ? -1 : $post->id()
)
),
'delete' => wp_create_nonce(
sprintf(
'wpcf7-delete-contact-form_%s',
$post->initial() ? -1 : $post->id()
)
),
),
'configValidator' => array(
'errors' => array(),
'docUrl' => WPCF7_ConfigValidator::get_doc_link(),
),
) );

add_thickbox();
if (
current_user_can( 'wpcf7_edit_contact_form', $post->id() ) and
wpcf7_validate_configuration()
) {
$config_validator = new WPCF7_ConfigValidator( $post );
$config_validator->restore();

wp_enqueue_script( 'wpcf7-admin-taggenerator',
wpcf7_plugin_url( 'admin/js/tag-generator.js' ),
array( 'jquery', 'thickbox', 'wpcf7-admin' ),
WPCF7_VERSION,
array( 'in_footer' => true )
$wpcf7_obj['configValidator'] = array_merge(
$wpcf7_obj['configValidator'],
array(
'errors' => $config_validator->collect_error_messages(),
)
);
}
}

wp_add_inline_script( 'wpcf7-admin',
sprintf(
'var wpcf7 = %s;',
wp_json_encode( $wpcf7_obj, JSON_PRETTY_PRINT )
),
'before'
);
}

@@ -188,7 +213,7 @@ static function ( $result, $option, $value ) {
'wpcf7_contact_forms_per_page',
);

if ( in_array( $option, $wpcf7_screens ) ) {
if ( in_array( $option, $wpcf7_screens, true ) ) {
$result = $value;
}

@@ -243,12 +268,12 @@ function wpcf7_load_contact_form_admin() {

$query = array(
'post' => $contact_form ? $contact_form->id() : 0,
'active-tab' => (int) ( $_POST['active-tab'] ?? 0 ),
'active-tab' => wpcf7_canonicalize_name( $_POST['active-tab'] ?? '' ),
);

if ( ! $contact_form ) {
$query['message'] = 'failed';
} elseif ( -1 == $id ) {
} elseif ( -1 === (int) $id ) {
$query['message'] = 'created';
} else {
$query['message'] = 'saved';
@@ -378,7 +403,7 @@ function wpcf7_admin_management_page() {
return;
}

if ( 'validate' == wpcf7_current_action()
if ( 'validate' === wpcf7_current_action()
and wpcf7_validate_configuration()
and current_user_can( 'wpcf7_edit_contact_forms' ) ) {
wpcf7_admin_bulk_validate_page();
@@ -525,7 +550,7 @@ function wpcf7_admin_integration_page() {
add_action( 'wpcf7_admin_notices', 'wpcf7_admin_updated_message', 10, 3 );

function wpcf7_admin_updated_message( $page, $action, $object ) {
if ( ! in_array( $page, array( 'wpcf7', 'wpcf7-new' ) ) ) {
if ( ! in_array( $page, array( 'wpcf7', 'wpcf7-new' ), true ) ) {
return;
}

@@ -534,72 +559,53 @@ function wpcf7_admin_updated_message( $page, $action, $object ) {
}

if ( 'created' === $_REQUEST['message'] ) {
$updated_message = __( "Contact form created.", 'contact-form-7' );
$message = __( "Contact form created.", 'contact-form-7' );
} elseif ( 'saved' === $_REQUEST['message'] ) {
$updated_message = __( "Contact form saved.", 'contact-form-7' );
$message = __( "Contact form saved.", 'contact-form-7' );
} elseif ( 'deleted' === $_REQUEST['message'] ) {
$updated_message = __( "Contact form deleted.", 'contact-form-7' );
$message = __( "Contact form deleted.", 'contact-form-7' );
}

if ( ! empty( $updated_message ) ) {
echo sprintf(
'<div id="message" class="notice notice-success"><p>%s</p></div>',
esc_html( $updated_message )
);

return;
if ( ! empty( $message ) ) {
wp_admin_notice( esc_html( $message ), array( 'type' => 'success' ) );
}

if ( 'failed' === $_REQUEST['message'] ) {
$updated_message =
$message =
__( "There was an error saving the contact form.", 'contact-form-7' );

echo sprintf(
'<div id="message" class="notice notice-error"><p>%s</p></div>',
esc_html( $updated_message )
);

return;
wp_admin_notice( esc_html( $message ), array( 'type' => 'error' ) );
}

if ( 'validated' === $_REQUEST['message'] ) {
$bulk_validate = WPCF7::get_option( 'bulk_validate', array() );
$count_invalid = isset( $bulk_validate['count_invalid'] )
? absint( $bulk_validate['count_invalid'] ) : 0;
$count_invalid = absint( $bulk_validate['count_invalid'] ?? 0 );

if ( $count_invalid ) {
$updated_message = sprintf(
$message = sprintf(
/* translators: %s: number of contact forms */
_n(
/* translators: %s: number of contact forms */
"Configuration validation completed. %s invalid contact form was found.",
"Configuration validation completed. %s invalid contact forms were found.",
$count_invalid, 'contact-form-7'
),
number_format_i18n( $count_invalid )
);

echo sprintf(
'<div id="message" class="notice notice-warning"><p>%s</p></div>',
esc_html( $updated_message )
);
wp_admin_notice( esc_html( $message ), array( 'type' => 'warning' ) );
} else {
$updated_message = __( "Configuration validation completed. No invalid contact form was found.", 'contact-form-7' );
$message = __( "Configuration validation completed. No invalid contact form was found.", 'contact-form-7' );

echo sprintf(
'<div id="message" class="notice notice-success"><p>%s</p></div>',
esc_html( $updated_message )
);
wp_admin_notice( esc_html( $message ), array( 'type' => 'success' ) );
}

return;
}
}


add_filter( 'plugin_action_links', 'wpcf7_plugin_action_links', 10, 2 );

function wpcf7_plugin_action_links( $links, $file ) {
if ( $file != WPCF7_PLUGIN_BASENAME ) {
if ( WPCF7_PLUGIN_BASENAME !== $file ) {
return $links;
}

@@ -623,23 +629,17 @@ function wpcf7_plugin_action_links( $links, $file ) {
function wpcf7_old_wp_version_error( $page, $action, $object ) {
$wp_version = get_bloginfo( 'version' );

if ( ! version_compare( $wp_version, WPCF7_REQUIRED_WP_VERSION, '<' ) ) {
return;
}
if ( version_compare( $wp_version, WPCF7_REQUIRED_WP_VERSION, '<' ) ) {
$message = sprintf(
/* translators: 1: version of Contact Form 7, 2: version of WordPress, 3: URL */
__( '<strong>Contact Form 7 %1$s requires WordPress %2$s or higher.</strong> Please <a href="%3$s">update WordPress</a> first.', 'contact-form-7' ),
WPCF7_VERSION,
WPCF7_REQUIRED_WP_VERSION,
admin_url( 'update-core.php' )
);

?>
<div class="notice notice-warning">
<p><?php
echo sprintf(
/* translators: 1: version of Contact Form 7, 2: version of WordPress, 3: URL */
__( '<strong>Contact Form 7 %1$s requires WordPress %2$s or higher.</strong> Please <a href="%3$s">update WordPress</a> first.', 'contact-form-7' ),
WPCF7_VERSION,
WPCF7_REQUIRED_WP_VERSION,
admin_url( 'update-core.php' )
);
?></p>
</div>
<?php
wp_admin_notice( $message, array( 'type' => 'warning' ) );
}
}


@@ -652,32 +652,22 @@ function wpcf7_not_allowed_to_edit( $page, $action, $object ) {
return;
}

if ( current_user_can( 'wpcf7_edit_contact_form', $contact_form->id() ) ) {
return;
}

$message = __( "You are not allowed to edit this contact form.", 'contact-form-7' );
if ( ! current_user_can( 'wpcf7_edit_contact_form', $contact_form->id() ) ) {
$message = __( "You are not allowed to edit this contact form.", 'contact-form-7' );

echo sprintf(
'<div class="notice notice-warning"><p>%s</p></div>',
esc_html( $message )
);
wp_admin_notice( esc_html( $message ), array( 'type' => 'warning' ) );
}
}


add_action( 'wpcf7_admin_warnings', 'wpcf7_outdated_php_warning', 10, 3 );

function wpcf7_outdated_php_warning( $page, $action, $object ) {
if ( ! version_compare( PHP_VERSION, '7.4', '<' ) ) {
return;
}
if ( version_compare( PHP_VERSION, '7.4', '<' ) ) {
$message = __( "The next major release of Contact Form 7 will discontinue support for outdated PHP versions. If you don't upgrade PHP, you will not be able to upgrade the plugin.", 'contact-form-7' );

$message = __( "The next major release of Contact Form 7 will discontinue support for outdated PHP versions. If you don't upgrade PHP, you will not be able to upgrade the plugin.", 'contact-form-7' );

echo sprintf(
'<div class="notice notice-warning"><p>%s</p></div>',
esc_html( $message )
);
wp_admin_notice( esc_html( $message ), array( 'type' => 'warning' ) );
}
}


@@ -686,14 +676,16 @@ function wpcf7_outdated_php_warning( $page, $action, $object ) {
function wpcf7_ctct_deprecated_warning( $page, $action, $object ) {
$service = WPCF7_ConstantContact::get_instance();

if ( ! $service->is_active() ) {
return;
}

$message = __( "The Constant Contact integration is deprecated. It is not recommended to continue using the feature.", 'contact-form-7' );
if ( $service->is_active() ) {
$message = wp_kses(
__( 'The Constant Contact integration is deprecated and planned to be <a href="https://contactform7.com/2025/01/08/complete-removal-of-constant-contact-integration/">completely removed</a> anytime soon. Contact Form 7 recommends <a href="https://contactform7.com/sendinblue-integration/">Brevo</a> as an alternative.', 'contact-form-7' ),
array(
'a' => array( 'href' => true ),
'strong' => array(),
),
array( 'http', 'https' )
);

echo sprintf(
'<div class="notice notice-warning"><p>%s</p></div>',
esc_html( $message )
);
wp_admin_notice( $message, array( 'type' => 'warning' ) );
}
}
Loading