Index: trunk/src/bp-templates/bp-legacy/buddypress-functions.php
===================================================================
--- trunk/src/bp-templates/bp-legacy/buddypress-functions.php	(revision 11821)
+++ trunk/src/bp-templates/bp-legacy/buddypress-functions.php	(revision 11858)
@@ -780,11 +780,12 @@
  */
 function bp_legacy_theme_object_template_loader() {
-	// Bail if not a POST action.
-	if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) )
-		return;
+	if ( ! bp_is_post_request() ) {
+		return;
+	}
 
 	// Bail if no object passed.
-	if ( empty( $_POST['object'] ) )
-		return;
+	if ( empty( $_POST['object'] ) ) {
+		return;
+	}
 
 	// Sanitize the object.
@@ -792,6 +793,7 @@
 
 	// Bail if object is not an active component to prevent arbitrary file inclusion.
-	if ( ! bp_is_active( $object ) )
-		return;
+	if ( ! bp_is_active( $object ) ) {
+		return;
+	}
 
 	/**
@@ -860,7 +862,7 @@
  */
 function bp_legacy_theme_activity_template_loader() {
-	// Bail if not a POST action.
-	if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) )
-		return;
+	if ( ! bp_is_post_request() ) {
+		return;
+	}
 
 	$scope = '';
@@ -921,7 +923,7 @@
 	$bp = buddypress();
 
-	// Bail if not a POST action.
-	if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) )
-		return;
+	if ( ! bp_is_post_request() ) {
+		return;
+	}
 
 	// Check the nonce.
@@ -1010,6 +1012,5 @@
 	$bp = buddypress();
 
-	// Bail if not a POST action.
-	if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) {
+	if ( ! bp_is_post_request() ) {
 		return;
 	}
@@ -1079,7 +1080,7 @@
  */
 function bp_legacy_theme_delete_activity() {
-	// Bail if not a POST action.
-	if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) )
-		return;
+	if ( ! bp_is_post_request() ) {
+		return;
+	}
 
 	// Check the nonce.
@@ -1117,7 +1118,7 @@
  */
 function bp_legacy_theme_delete_activity_comment() {
-	// Bail if not a POST action.
-	if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) )
-		return;
+	if ( ! bp_is_post_request() ) {
+		return;
+	}
 
 	// Check the nonce.
@@ -1159,7 +1160,7 @@
 	$bp = buddypress();
 
-	// Bail if not a POST action.
-	if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) )
-		return;
+	if ( ! bp_is_post_request() ) {
+		return;
+	}
 
 	// Check that user is logged in, Activity Streams are enabled, and Akismet is present.
@@ -1204,6 +1205,7 @@
 function bp_legacy_theme_mark_activity_favorite() {
 	// Bail if not a POST action.
-	if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) )
-		return;
+	if ( ! bp_is_post_request() ) {
+		return;
+	}
 
 	if ( ! isset( $_POST['nonce'] ) ) {
@@ -1233,7 +1235,7 @@
  */
 function bp_legacy_theme_unmark_activity_favorite() {
-	// Bail if not a POST action.
-	if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) )
-		return;
+	if ( ! bp_is_post_request() ) {
+		return;
+	}
 
 	if ( ! isset( $_POST['nonce'] ) ) {
@@ -1264,7 +1266,7 @@
  */
 function bp_legacy_theme_get_single_activity_content() {
-	// Bail if not a POST action.
-	if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) )
-		return;
+	if ( ! bp_is_post_request() ) {
+		return;
+	}
 
 	$activity_array = bp_activity_get_specific( array(
@@ -1304,7 +1306,7 @@
  */
 function bp_legacy_theme_ajax_invite_user() {
-	// Bail if not a POST action.
-	if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) )
-		return;
+	if ( ! bp_is_post_request() ) {
+		return;
+	}
 
 	check_ajax_referer( 'groups_invite_uninvite_user' );
@@ -1387,8 +1389,7 @@
  */
 function bp_legacy_theme_ajax_addremove_friend() {
-
-	// Bail if not a POST action.
-	if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) )
-		return;
+	if ( ! bp_is_post_request() ) {
+		return;
+	}
 
 	// Cast fid as an integer.
@@ -1441,7 +1442,7 @@
  */
 function bp_legacy_theme_ajax_accept_friendship() {
-	// Bail if not a POST action.
-	if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) )
-		return;
+	if ( ! bp_is_post_request() ) {
+		return;
+	}
 
 	check_admin_referer( 'friends_accept_friendship' );
@@ -1461,7 +1462,7 @@
  */
 function bp_legacy_theme_ajax_reject_friendship() {
-	// Bail if not a POST action.
-	if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) )
-		return;
+	if ( ! bp_is_post_request() ) {
+		return;
+	}
 
 	check_admin_referer( 'friends_reject_friendship' );
@@ -1481,7 +1482,7 @@
  */
 function bp_legacy_theme_ajax_joinleave_group() {
-	// Bail if not a POST action.
-	if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) )
-		return;
+	if ( ! bp_is_post_request() ) {
+		return;
+	}
 
 	// Cast gid as integer.
@@ -1552,7 +1553,7 @@
  */
 function bp_legacy_theme_ajax_close_notice() {
-	// Bail if not a POST action.
-	if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) )
-		return;
+	if ( ! bp_is_post_request() ) {
+		return;
+	}
 
 	$nonce_check = isset( $_POST['nonce'] ) && wp_verify_nonce( wp_unslash( $_POST['nonce'] ), 'bp_messages_close_notice' );
@@ -1584,7 +1585,7 @@
  */
 function bp_legacy_theme_ajax_messages_send_reply() {
-	// Bail if not a POST action.
-	if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) )
-		return;
+	if ( ! bp_is_post_request() ) {
+		return;
+	}
 
 	check_ajax_referer( 'messages_send_message' );
