Changeset 5658
- Timestamp:
- 03/24/2015 01:32:20 PM (11 years ago)
- Location:
- trunk/src/includes
- Files:
-
- 12 edited
-
admin/forums.php (modified) (2 diffs)
-
admin/functions.php (modified) (2 diffs)
-
admin/replies.php (modified) (2 diffs)
-
admin/topics.php (modified) (2 diffs)
-
core/functions.php (modified) (1 diff)
-
extend/buddypress/notifications.php (modified) (1 diff)
-
forums/functions.php (modified) (6 diffs)
-
replies/functions.php (modified) (10 diffs)
-
search/functions.php (modified) (1 diff)
-
topics/functions.php (modified) (16 diffs)
-
users/functions.php (modified) (13 diffs)
-
users/template.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/admin/forums.php
r5637 r5658 428 428 * data, action and message 429 429 * @uses add_query_arg() To add custom args to the url 430 * @uses wp_safe_redirect() Redirect the page to custom url430 * @uses bbp_redirect() Redirect the page to custom url 431 431 */ 432 432 public function toggle_forum() { … … 480 480 // Redirect back to the forum 481 481 $redirect = add_query_arg( $message, remove_query_arg( array( 'action', 'forum_id' ) ) ); 482 wp_safe_redirect( $redirect ); 483 484 // For good measure 485 exit(); 482 bbp_redirect( $redirect ); 486 483 } 487 484 } -
trunk/src/includes/admin/functions.php
r5466 r5658 200 200 * @uses delete_transient() To delete the transient if it exists 201 201 * @uses is_network_admin() To bail if being network activated 202 * @uses wp_safe_redirect() To redirect202 * @uses bbp_redirect() To redirect 203 203 * @uses add_query_arg() To help build the URL to redirect to 204 204 * @uses admin_url() To get the admin URL to index.php … … 227 227 228 228 // Redirect to bbPress about page 229 wp_safe_redirect( add_query_arg( array( 'page' => 'bbp-about' ), admin_url( 'index.php' ) ) );229 bbp_redirect( add_query_arg( array( 'page' => 'bbp-about' ), admin_url( 'index.php' ) ) ); 230 230 } 231 231 -
trunk/src/includes/admin/replies.php
r5637 r5658 465 465 * data, action and message 466 466 * @uses add_query_arg() To add custom args to the url 467 * @uses wp_safe_redirect() Redirect the page to custom url467 * @uses bbp_redirect() Redirect the page to custom url 468 468 */ 469 469 public function toggle_reply() { … … 522 522 // Redirect back to the reply 523 523 $redirect = add_query_arg( $message, remove_query_arg( array( 'action', 'reply_id' ) ) ); 524 wp_safe_redirect( $redirect ); 525 526 // For good measure 527 exit(); 524 bbp_redirect( $redirect ); 528 525 } 529 526 } -
trunk/src/includes/admin/topics.php
r5637 r5658 488 488 * data, action and message 489 489 * @uses add_query_arg() To add custom args to the url 490 * @uses wp_safe_redirect() Redirect the page to custom url490 * @uses bbp_redirect() Redirect the page to custom url 491 491 */ 492 492 public function toggle_topic() { … … 585 585 // Redirect back to the topic 586 586 $redirect = add_query_arg( $message, remove_query_arg( array( 'action', 'topic_id' ) ) ); 587 wp_safe_redirect( $redirect ); 588 589 // For good measure 590 exit(); 587 bbp_redirect( $redirect ); 591 588 } 592 589 } -
trunk/src/includes/core/functions.php
r5481 r5658 584 584 } 585 585 586 /** Redirection ***************************************************************/ 587 588 /** 589 * Perform a safe, local redirect somewhere inside the current site 590 * 591 * On some setups, passing the value of wp_get_referer() may result in an empty 592 * value for $location, which results in an error on redirection. If $location 593 * is empty, we can safely redirect back to the forum root. This might change 594 * in a future version, possibly to the site root. 595 * 596 * @since bbPress (r5658) 597 * 598 * @uses wp_safe_redirect() 599 * 600 * @param string $location The URL to redirect the user to. 601 * @param int $status Optional. The numeric code to give in the redirect 602 * headers. Default: 302. 603 */ 604 function bbp_redirect( $location = '', $status = 302 ) { 605 606 // Prevent errors from empty $location 607 if ( empty( $location ) ) { 608 $location = bbp_get_forums_url(); 609 } 610 611 // Setup the safe redirect 612 wp_safe_redirect( $location, $status ); 613 614 // Exit so the redirect takes place immediately 615 exit(); 616 } -
trunk/src/includes/extend/buddypress/notifications.php
r5512 r5658 183 183 184 184 // Redirect 185 wp_safe_redirect( $redirect ); 186 187 // For good measure 188 exit(); 185 bbp_redirect( $redirect ); 189 186 } 190 187 add_action( 'bbp_get_request', 'bbp_buddypress_mark_notifications', 1 ); -
trunk/src/includes/forums/functions.php
r5655 r5658 104 104 * @uses bbp_unstick_forum() To unstick the forum 105 105 * @uses bbp_get_forum_permalink() To get the forum permalink 106 * @uses wp_safe_redirect() To redirect to the forum link106 * @uses bbp_redirect() To redirect to the forum link 107 107 * @uses bbPress::errors::get_error_messages() To get the {@link WP_Error} error 108 108 * messages … … 332 332 333 333 // Redirect back to new forum 334 wp_safe_redirect( $redirect_url ); 335 336 // For good measure 337 exit(); 334 bbp_redirect( $redirect_url ); 338 335 339 336 // Errors … … 373 370 * to another 374 371 * @uses bbp_get_forum_permalink() To get the forum permalink 375 * @uses wp_safe_redirect() To redirect to the forum link372 * @uses bbp_redirect() To redirect to the forum link 376 373 * @uses bbPress::errors::get_error_messages() To get the {@link WP_Error} error 377 374 * messages … … 587 584 588 585 // Redirect back to new forum 589 wp_safe_redirect( $forum_url ); 590 591 // For good measure 592 exit(); 586 bbp_redirect( $forum_url ); 593 587 594 588 /** Errors ****************************************************************/ … … 2127 2121 * @uses current_user_can() 2128 2122 * @uses bbp_get_forum_id() 2129 * @uses wp_safe_redirect()2123 * @uses bbp_redirect() 2130 2124 * @uses bbp_get_forum_permalink() 2131 2125 */ … … 2133 2127 2134 2128 // Bail if not editing a topic 2135 if ( ! bbp_is_forum_edit() ) {2129 if ( ! bbp_is_forum_edit() ) { 2136 2130 return; 2137 2131 } 2138 2132 2139 2133 // User cannot edit topic, so redirect back to reply 2140 if ( !current_user_can( 'edit_forum', bbp_get_forum_id() ) ) { 2141 wp_safe_redirect( bbp_get_forum_permalink() ); 2142 exit(); 2134 if ( ! current_user_can( 'edit_forum', bbp_get_forum_id() ) ) { 2135 bbp_redirect( bbp_get_forum_permalink() ); 2143 2136 } 2144 2137 } -
trunk/src/includes/replies/functions.php
r5651 r5658 102 102 * the reply to id 103 103 * @uses bbp_get_reply_url() To get the paginated url to the reply 104 * @uses wp_safe_redirect() To redirect to the reply url104 * @uses bbp_redirect() To redirect to the reply url 105 105 * @uses bbPress::errors::get_error_message() To get the {@link WP_Error} error 106 106 * message … … 450 450 451 451 // Redirect back to new reply 452 wp_safe_redirect( $reply_url ); 453 454 // For good measure 455 exit(); 452 bbp_redirect( $reply_url ); 456 453 457 454 /** Errors ****************************************************************/ … … 492 489 * and the reply to id 493 490 * @uses bbp_get_reply_url() To get the paginated url to the reply 494 * @uses wp_safe_redirect() To redirect to the reply url491 * @uses bbp_redirect() To redirect to the reply url 495 492 * @uses bbPress::errors::get_error_message() To get the {@link WP_Error} error 496 493 * message … … 762 759 763 760 // Redirect back to new reply 764 wp_safe_redirect( $reply_url ); 765 766 // For good measure 767 exit(); 761 bbp_redirect( $reply_url ); 768 762 769 763 /** Errors ****************************************************************/ … … 1274 1268 * source topic ids and source topic's forum id 1275 1269 * @uses bbp_get_topic_permalink() To get the topic permalink 1276 * @uses wp_safe_redirect() To redirect to the topic link1270 * @uses bbp_redirect() To redirect to the topic link 1277 1271 */ 1278 1272 function bbp_move_reply_handler( $action = '' ) { … … 1497 1491 1498 1492 // Redirect back to the topic 1499 wp_safe_redirect( bbp_get_topic_permalink( $destination_topic->ID ) ); 1500 1501 // For good measure 1502 exit(); 1493 bbp_redirect( bbp_get_topic_permalink( $destination_topic->ID ) ); 1503 1494 } 1504 1495 … … 1570 1561 * @uses bbp_get_reply_url() To get the reply url 1571 1562 * @uses add_query_arg() To add custom args to the reply url 1572 * @uses wp_safe_redirect() To redirect to the reply1563 * @uses bbp_redirect() To redirect to the reply 1573 1564 * @uses bbPress::errors:add() To log the error messages 1574 1565 */ … … 1694 1685 1695 1686 // Redirect back to reply 1696 wp_safe_redirect( $reply_url ); 1697 1698 // For good measure 1699 exit(); 1687 bbp_redirect( $reply_url ); 1700 1688 1701 1689 // Handle errors … … 2311 2299 * @uses current_user_can() 2312 2300 * @uses bbp_get_topic_id() 2313 * @uses wp_safe_redirect()2301 * @uses bbp_redirect() 2314 2302 * @uses bbp_get_topic_permalink() 2315 2303 */ … … 2317 2305 2318 2306 // Bail if not editing a topic 2319 if ( ! bbp_is_reply_edit() ) {2307 if ( ! bbp_is_reply_edit() ) { 2320 2308 return; 2321 2309 } 2322 2310 2323 2311 // User cannot edit topic, so redirect back to reply 2324 if ( !current_user_can( 'edit_reply', bbp_get_reply_id() ) ) { 2325 wp_safe_redirect( bbp_get_reply_url() ); 2326 exit(); 2312 if ( ! current_user_can( 'edit_reply', bbp_get_reply_id() ) ) { 2313 bbp_redirect( bbp_get_reply_url() ); 2327 2314 } 2328 2315 } -
trunk/src/includes/search/functions.php
r5466 r5658 81 81 82 82 // Redirect and bail 83 wp_safe_redirect( $redirect_to ); 84 exit(); 83 bbp_redirect( $redirect_to ); 85 84 } -
trunk/src/includes/topics/functions.php
r5656 r5658 109 109 * @uses bbp_unstick_topic() To unstick the topic 110 110 * @uses bbp_get_topic_permalink() To get the topic permalink 111 * @uses wp_safe_redirect() To redirect to the topic link111 * @uses bbp_redirect() To redirect to the topic link 112 112 * @uses bbPress::errors::get_error_messages() To get the {@link WP_Error} error 113 113 * messages … … 428 428 429 429 // Redirect back to new topic 430 wp_safe_redirect( $redirect_url ); 431 432 // For good measure 433 exit(); 430 bbp_redirect( $redirect_url ); 434 431 435 432 // Errors … … 471 468 * to another 472 469 * @uses bbp_get_topic_permalink() To get the topic permalink 473 * @uses wp_safe_redirect() To redirect to the topic link470 * @uses bbp_redirect() To redirect to the topic link 474 471 * @uses bbPress::errors::get_error_messages() To get the {@link WP_Error} error 475 472 * messages … … 792 789 793 790 // Redirect back to new topic 794 wp_safe_redirect( $topic_url ); 795 796 // For good measure 797 exit(); 791 bbp_redirect( $topic_url ); 798 792 799 793 /** Errors ****************************************************************/ … … 1149 1143 * topic ids and source topic's forum id 1150 1144 * @uses bbp_get_topic_permalink() To get the topic permalink 1151 * @uses wp_safe_redirect() To redirect to the topic link1145 * @uses bbp_redirect() To redirect to the topic link 1152 1146 */ 1153 1147 function bbp_merge_topic_handler( $action = '' ) { … … 1362 1356 1363 1357 // Redirect back to new topic 1364 wp_safe_redirect( bbp_get_topic_permalink( $destination_topic->ID ) ); 1365 1366 // For good measure 1367 exit(); 1358 bbp_redirect( bbp_get_topic_permalink( $destination_topic->ID ) ); 1368 1359 } 1369 1360 … … 1449 1440 * source topic ids and source topic's forum id 1450 1441 * @uses bbp_get_topic_permalink() To get the topic permalink 1451 * @uses wp_safe_redirect() To redirect to the topic link1442 * @uses bbp_redirect() To redirect to the topic link 1452 1443 */ 1453 1444 function bbp_split_topic_handler( $action = '' ) { … … 1745 1736 1746 1737 // Redirect back to the topic 1747 wp_safe_redirect( bbp_get_topic_permalink( $destination_topic->ID ) ); 1748 1749 // For good measure 1750 exit(); 1738 bbp_redirect( bbp_get_topic_permalink( $destination_topic->ID ) ); 1751 1739 } 1752 1740 … … 1811 1799 * @uses do_action() Calls actions based on the actions with associated args 1812 1800 * @uses is_wp_error() To check if the value retrieved is a {@link WP_Error} 1813 * @uses wp_safe_redirect() To redirect to the url1801 * @uses bbp_redirect() To redirect to the url 1814 1802 */ 1815 1803 function bbp_edit_topic_tag_handler( $action = '' ) { … … 1980 1968 // Redirect back 1981 1969 $redirect = ( ! empty( $redirect ) && ! is_wp_error( $redirect ) ) ? $redirect : home_url(); 1982 wp_safe_redirect( $redirect ); 1983 1984 // For good measure 1985 exit(); 1970 bbp_redirect( $redirect ); 1986 1971 } 1987 1972 … … 2087 2072 * @uses bbp_get_topic_permalink() To get the topic link 2088 2073 * @uses add_query_arg() To add args to the url 2089 * @uses wp_safe_redirect() To redirect to the topic2074 * @uses bbp_redirect() To redirect to the topic 2090 2075 * @uses bbPress::errors:add() To log the error messages 2091 2076 */ … … 2232 2217 } 2233 2218 2234 wp_safe_redirect( $redirect ); 2235 2236 // For good measure 2237 exit(); 2219 bbp_redirect( $redirect ); 2238 2220 2239 2221 // Handle errors … … 3786 3768 * @uses current_user_can() 3787 3769 * @uses bbp_get_topic_id() 3788 * @uses wp_safe_redirect()3770 * @uses bbp_redirect() 3789 3771 * @uses bbp_get_topic_permalink() 3790 3772 */ … … 3798 3780 // User cannot edit topic, so redirect back to topic 3799 3781 if ( ! current_user_can( 'edit_topic', bbp_get_topic_id() ) ) { 3800 wp_safe_redirect( bbp_get_topic_permalink() ); 3801 exit(); 3782 bbp_redirect( bbp_get_topic_permalink() ); 3802 3783 } 3803 3784 } … … 3811 3792 * @uses current_user_can() 3812 3793 * @uses bbp_get_topic_tag_id() 3813 * @uses wp_safe_redirect()3794 * @uses bbp_redirect() 3814 3795 * @uses bbp_get_topic_tag_link() 3815 3796 */ … … 3823 3804 // Bail if current user cannot edit topic tags 3824 3805 if ( ! current_user_can( 'edit_topic_tags', bbp_get_topic_tag_id() ) ) { 3825 wp_safe_redirect( bbp_get_topic_tag_link() ); 3826 exit(); 3827 } 3828 } 3806 bbp_redirect( bbp_get_topic_tag_link() ); 3807 } 3808 } -
trunk/src/includes/users/functions.php
r5657 r5658 23 23 * @uses home_url() To get the home url 24 24 * @uses esc_url() To escape the url 25 * @uses wp_safe_redirect() To redirect25 * @uses bbp_redirect() To redirect 26 26 */ 27 27 function bbp_redirect_login( $url = '', $raw_url = '', $user = '' ) { … … 395 395 * @uses bbp_get_favorites_link() To get the favorites page link 396 396 * @uses bbp_get_topic_permalink() To get the topic permalink 397 * @uses wp_safe_redirect() To redirect to the url397 * @uses bbp_redirect() To redirect to the url 398 398 */ 399 399 function bbp_favorites_handler( $action = '' ) { … … 471 471 } 472 472 473 wp_safe_redirect( $redirect ); 474 475 // For good measure 476 exit(); 473 bbp_redirect( $redirect ); 477 474 478 475 // Fail! Handle errors … … 1116 1113 * @uses bbp_is_subscription() To check if it's the subscription page 1117 1114 * @uses bbp_get_forum_permalink() To get the forum permalink 1118 * @uses wp_safe_redirect() To redirect to the url1115 * @uses bbp_redirect() To redirect to the url 1119 1116 */ 1120 1117 function bbp_forum_subscriptions_handler( $action = '' ) { … … 1192 1189 } 1193 1190 1194 wp_safe_redirect( $redirect ); 1195 1196 // For good measure 1197 exit(); 1191 bbp_redirect( $redirect ); 1198 1192 1199 1193 // Fail! Handle errors … … 1222 1216 * @uses bbp_is_subscription() To check if it's the subscription page 1223 1217 * @uses bbp_get_topic_permalink() To get the topic permalink 1224 * @uses wp_safe_redirect() To redirect to the url1218 * @uses bbp_redirect() To redirect to the url 1225 1219 */ 1226 1220 function bbp_subscriptions_handler( $action = '' ) { … … 1298 1292 } 1299 1293 1300 wp_safe_redirect( $redirect ); 1301 1302 // For good measure 1303 exit(); 1294 bbp_redirect( $redirect ); 1304 1295 1305 1296 // Fail! Handle errors … … 1327 1318 * @uses delete_option() To delete the displayed user's email id option 1328 1319 * @uses bbp_get_user_profile_edit_url() To get the edit profile url 1329 * @uses wp_safe_redirect() To redirect to the url1320 * @uses bbp_redirect() To redirect to the url 1330 1321 * @uses bbp_verify_nonce_request() To verify the nonce and check the request 1331 1322 * @uses current_user_can() To check if the current user can edit the user … … 1371 1362 delete_option( $user_id . '_new_email' ); 1372 1363 1373 wp_safe_redirect( add_query_arg( array( 'updated' => 'true' ), bbp_get_user_profile_edit_url( $user_id ) ) ); 1374 exit(); 1364 bbp_redirect( add_query_arg( array( 'updated' => 'true' ), bbp_get_user_profile_edit_url( $user_id ) ) ); 1375 1365 } 1376 1366 … … 1378 1368 } elseif ( is_multisite() && bbp_is_user_home_edit() && ! empty( $_GET['dismiss'] ) && ( $user_id . '_new_email' === $_GET['dismiss'] ) ) { 1379 1369 delete_option( $user_id . '_new_email' ); 1380 wp_safe_redirect( add_query_arg( array( 'updated' => 'true' ), bbp_get_user_profile_edit_url( $user_id ) ) ); 1381 exit(); 1370 bbp_redirect( add_query_arg( array( 'updated' => 'true' ), bbp_get_user_profile_edit_url( $user_id ) ) ); 1382 1371 } 1383 1372 … … 1420 1409 $redirect = add_query_arg( array( 'updated' => 'true' ), bbp_get_user_profile_edit_url( $edit_user ) ); 1421 1410 1422 wp_safe_redirect( $redirect ); 1423 exit; 1411 bbp_redirect( $redirect ); 1424 1412 } 1425 1413 } … … 1704 1692 * @uses current_user_can() 1705 1693 * @uses bbp_get_displayed_user_id() 1706 * @uses wp_safe_redirect()1694 * @uses bbp_redirect() 1707 1695 * @uses bbp_get_user_profile_url() 1708 1696 */ … … 1744 1732 1745 1733 // Redirect 1746 wp_safe_redirect( $redirect_to ); 1747 exit(); 1734 bbp_redirect( $redirect_to ); 1748 1735 } 1749 1736 -
trunk/src/includes/users/template.php
r5563 r5658 1519 1519 * @param string $url The URL to redirect to 1520 1520 * @uses is_user_logged_in() Check if user is logged in 1521 * @uses wp_safe_redirect() To safely redirect1521 * @uses bbp_redirect() To safely redirect 1522 1522 * @uses bbp_get_user_profile_url() To get the profile url of the user 1523 1523 * @uses bbp_get_current_user_id() To get the current user id … … 1533 1533 $redirect_to = ! empty( $url ) ? $url : bbp_get_user_profile_url( bbp_get_current_user_id() ); 1534 1534 1535 // Do a safe redirect and exit 1536 wp_safe_redirect( $redirect_to ); 1537 exit; 1535 // Do a safe redirect 1536 bbp_redirect( $redirect_to ); 1538 1537 } 1539 1538
Note: See TracChangeset
for help on using the changeset viewer.