- $referredby = '';
- if ( !empty($_POST['referredby']) ) {
- $referredby = preg_replace('|https?://[^/]+|i', '', $_POST['referredby']);
- $referredby = remove_query_arg('_wp_original_http_referer', $referredby);
- }
- $referer = preg_replace('|https?://[^/]+|i', '', wp_get_referer());
-
- if ( !empty($_POST['mode']) && 'bookmarklet' == $_POST['mode'] ) {
- $location = $_POST['referredby'];
- } elseif ( !empty($_POST['mode']) && 'sidebar' == $_POST['mode'] ) {
- if ( isset($_POST['saveasdraft']) )
- $location = 'sidebar.php?a=c';
- elseif ( isset($_POST['publish']) )
- $location = 'sidebar.php?a=b';
- } elseif ( ( isset($_POST['save']) || isset($_POST['publish']) ) ) {
- if ( isset( $_POST['publish'] ) ) {
- if ( 'pending' == get_post_status( $post_ID ) )
- $location = add_query_arg( 'message', 8, get_edit_post_link( $post_ID, 'url' ) );
- else
- $location = add_query_arg( 'message', 6, get_edit_post_link( $post_ID, 'url' ) );
- } else {
- $location = add_query_arg( 'message', 1, get_edit_post_link( $post_ID, 'url' ) );
- }
- } elseif (isset($_POST['addmeta']) && $_POST['addmeta']) {
- $location = add_query_arg( 'message', 2, wp_get_referer() );
- $location = explode('#', $location);
- $location = $location[0] . '#postcustom';
- } elseif (isset($_POST['deletemeta']) && $_POST['deletemeta']) {
- $location = add_query_arg( 'message', 3, wp_get_referer() );
- $location = explode('#', $location);
- $location = $location[0] . '#postcustom';
- } elseif ($action == 'editattachment') {
- $location = 'attachments.php';
- } elseif ( 'post-quickpress-save-cont' == $_POST['action'] ) {
- $location = "post.php?action=edit&post=$post_ID&message=7";
- } else {
- $location = add_query_arg( 'message', 4, get_edit_post_link( $post_ID, 'url' ) );
- }