Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@loxK
Created February 24, 2011 04:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save loxK/841760 to your computer and use it in GitHub Desktop.
Save loxK/841760 to your computer and use it in GitHub Desktop.
Fixes contact form 7 error notice when executing wp-cron.php from command line
Index: includes/controller.php
===================================================================
--- includes/controller.php (révision 350190)
+++ includes/controller.php (copie de travail)
@@ -3,10 +3,10 @@
add_action( 'init', 'wpcf7_init_switch', 11 );
function wpcf7_init_switch() {
- if ( 'GET' == $_SERVER['REQUEST_METHOD'] && isset( $_GET['_wpcf7_is_ajax_call'] ) ) {
+ if ( isset($_SERVER['REQUEST_METHOD']) && 'GET' == $_SERVER['REQUEST_METHOD'] && isset( $_GET['_wpcf7_is_ajax_call'] ) ) {
wpcf7_ajax_onload();
exit();
- } elseif ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset( $_POST['_wpcf7_is_ajax_call'] ) ) {
+ } elseif ( isset($_SERVER['REQUEST_METHOD']) && 'POST' == $_SERVER['REQUEST_METHOD'] && isset( $_POST['_wpcf7_is_ajax_call'] ) ) {
wpcf7_ajax_json_echo();
exit();
} elseif ( isset( $_POST['_wpcf7'] ) ) {
@@ -285,4 +285,4 @@
return wp_style_is( 'contact-form-7' );
}
-?>
\ No newline at end of file
+?>
Index: modules/file.php
===================================================================
--- modules/file.php (révision 350190)
+++ modules/file.php (copie de travail)
@@ -343,7 +343,7 @@
}
}
-if ( ! is_admin() && 'GET' == $_SERVER['REQUEST_METHOD'] )
+if ( ! is_admin() && isset($_SERVER['REQUEST_METHOD']) && 'GET' == $_SERVER['REQUEST_METHOD'] )
wpcf7_cleanup_upload_files();
-?>
\ No newline at end of file
+?>
Index: modules/captcha.php
===================================================================
--- modules/captcha.php (révision 350190)
+++ modules/captcha.php (copie de travail)
@@ -416,7 +416,7 @@
}
}
-if ( ! is_admin() && 'GET' == $_SERVER['REQUEST_METHOD'] )
+if ( ! is_admin() && isset($_SERVER['REQUEST_METHOD']) && 'GET' == $_SERVER['REQUEST_METHOD'] )
wpcf7_cleanup_captcha_files();
function wpcf7_captchac_options( $options ) {
@@ -487,4 +487,4 @@
$wpcf7_captcha = null;
-?>
\ No newline at end of file
+?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment