Email::form_allowed_tags()

Description #

Source #

File: addons/email/email.php

	public function form_allowed_tags() {
		$active = ap_isset_post_value( 'template', 'new_question' );

		$tags = array(
			'site_name',
			'site_url',
			'site_description',
		);

		$type_tags = [];

		if ( in_array( $active, [ 'new_question', 'edit_question' ] ) ) {
			$type_tags = array(
				'asker',
				'question_title',
				'question_link',
				'question_content',
				'question_excerpt',
			);
		} elseif ( in_array( $active, [ 'new_answer', 'edit_answer' ] ) ) {
			$type_tags = array(
				'answerer',
				'question_title',
				'answer_link',
				'answer_content',
				'answer_excerpt',
			);
		} elseif ( 'select_answer' === $active ) {
			$type_tags = array(
				'selector',
				'question_title',
				'answer_link',
				'answer_content',
				'answer_excerpt',
			);
		} elseif ( 'new_comment' === $active ) {
			$type_tags = array(
				'commenter',
				'question_title',
				'comment_link',
				'comment_content',
			);
		}

		$tags = array_merge( $tags, $type_tags );

		$html = '';
		foreach ( $tags as $tag ) {
			$html .= '<pre>{' . esc_html( $tag ) . '}</pre>';
		}

		return $html;
	}

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment