anchor = $anchor; $this->target = $target; } public function __toString() { $post = $this->sitepress->get_wp_api()->get_post( $this->post_id ); return ! $post || ( in_array( $post->post_status, array( 'draft', 'private', 'trash' ), true ) && $post->post_author != $this->sitepress->get_wp_api() ->get_current_user_id() ) ? '' : sprintf( '%s', esc_url( $this->link_target() ), $this->target ? ' target="' . $this->target . '"' : '', esc_html( $this->anchor ) ); } protected abstract function link_target(); }