| @@ -1,38 +1,26 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | class Error_Action extends Red_Action { |
| 4 | - function process_before( $code, $target ) { | |
| 5 | - $this->code = $code; | |
| 4 | + function can_change_code() { | |
| 5 | + return true; | |
| 6 | + } | |
| 6 | 7 | |
| 7 | - wp_reset_query(); | |
| 8 | - set_query_var( 'is_404', true ); | |
| 9 | - | |
| 10 | - add_filter( 'template_include', array( $this, 'template_include' ) ); | |
| 11 | - add_filter( 'pre_handle_404', array( $this, 'pre_handle_404' ) ); | |
| 12 | - add_action( 'wp', array( $this, 'wp' ) ); | |
| 13 | - | |
| 14 | - return true; | |
| 8 | + function can_perform_action() { | |
| 9 | + return false; | |
| 15 | 10 | } |
| 16 | 11 | |
| 17 | - public function wp() { | |
| 18 | - status_header( $this->code ); | |
| 19 | - nocache_headers(); | |
| 20 | - header( 'X-Redirect-Agent: redirection' ); | |
| 12 | + function action_codes() { | |
| 13 | + return array( | |
| 14 | + 404 => get_status_header_desc( 404 ), | |
| 15 | + 410 => get_status_header_desc( 410 ), | |
| 16 | + ); | |
| 21 | 17 | } |
| 22 | 18 | |
| 23 | - public function pre_handle_404() { | |
| 19 | + function process_after( $code, $target ) { | |
| 24 | 20 | global $wp_query; |
| 21 | + $wp_query->is_404 = true; | |
| 25 | 22 | |
| 26 | 23 | // Page comments plugin interferes with this |
| 27 | - $wp_query->posts = array(); | |
| 28 | - return false; | |
| 29 | - } | |
| 30 | - | |
| 31 | - public function template_include() { | |
| 32 | - return get_404_template(); | |
| 33 | - } | |
| 34 | - | |
| 35 | - public function needs_target() { | |
| 36 | - return false; | |
| 24 | + remove_filter( 'template_redirect', 'paged_comments_alter_source', 12 ); | |
| 37 | 25 | } |
| 38 | 26 | } |