permissions_helper = $permissions_helper; } /** * Adds hooks to integrate with WordPress. * * @return void */ public function register_hooks() { \add_action( 'admin_action_duplicate_post_check_changes', [ $this, 'check_changes_action_handler' ] ); } /** * Handles the action for displaying the changes between a copy and the original. * * @return void */ public function check_changes_action_handler() { global $wp_version; if ( ! ( isset( $_GET['post'] ) || isset( $_POST['post'] ) || ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] === 'duplicate_post_check_changes' ) ) ) { \wp_die( \esc_html__( 'No post has been supplied!', 'duplicate-post' ) ); return; } $id = ( isset( $_GET['post'] ) ? \intval( \wp_unslash( $_GET['post'] ) ) : \intval( \wp_unslash( $_POST['post'] ) ) ); \check_admin_referer( 'duplicate_post_check_changes_' . $id ); $this->post = \get_post( $id ); if ( ! $this->post ) { \wp_die( \esc_html( \sprintf( /* translators: %s: post ID. */ \__( 'Changes overview failed, could not find post with ID %s.', 'duplicate-post' ), $id ) ) ); return; } $this->original = Utils::get_original( $this->post ); if ( ! $this->original ) { \wp_die( \esc_html( \__( 'Changes overview failed, could not find original post.', 'duplicate-post' ) ) ); return; } $post_edit_link = \get_edit_post_link( $this->post->ID ); $this->require_wordpress_header(); ?>
| ' . \esc_html( $this->original->post_title ) . ' | ' . \esc_html( $this->post->post_title ) . ' | '; $diff .= '