Endophora is the use in language of a word or phrase to refer to a word or phrase in the same text or utterance. For example, in the sentence "When he saw himself in the mirror, John was surprised" he and himself are both instances of endophora.
Endophora is the hypernym or superordinate of anaphora, which refers back to previous text, and of cataphora, which refers forward to text that follows. In the example above, himself is anaphoric, referring back to he, whereas he itself is cataphoric, referring forward to John.
Textual self-reference is also a kind of endophora. The subject in this sentence, for example, taken as a phrase, refers to a word or phrase in the same text ("The subject in this sentence"), but the said phrase is neither more nor less than that to which it refers. Consequently, the phrase is endophoric without being either anaphoric or cataphoric, since it refers neither backward nor forward. Such examples of pure self-reference are rare unless contrived, but it is not uncommon for an endophor to refer to the text within which it finds itself (as "the text" just did) or, less commonly, to part of the text comprising the endophor.
A related concept to endophora is exophora. Confusingly, although the contrasting prefix exo- implies an antonymic relationship, exophora is not in any meaningful sense the opposite of endophora. Endophora is essentially the reference of a symbol to another symbol and thence to that symbol's reference. Exophora simply relies on the extra-linguistic context to link the exophoric symbol to its referent.