db = $db; } /** * Render the translation editor page. * * @param int $translation_id The translation ID to edit. */ public function render( $translation_id ) { // Handle save if form was submitted. if ( isset( $_SERVER['REQUEST_METHOD'] ) && 'POST' === $_SERVER['REQUEST_METHOD'] && isset( $_POST['translatetoenglish_save_translation'] ) && isset( $_POST['translatetoenglish_editor_nonce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['translatetoenglish_editor_nonce'] ) ), 'translatetoenglish_save_translation' ) ) { $this->handle_save( $translation_id ); } // Get translation data. $translation = $this->db->get_translation_by_id( $translation_id ); if ( ! $translation ) { echo '
' . esc_html__( 'Translation not found.', '2fox4-translate-to-english' ) . '
' . esc_html__( 'Original post not found.', '2fox4-translate-to-english' ) . '