<commit_before><?php
	/**
	 * @package content
	 */
	/**
	 * The AjaxEventDocumentation returns the documentation for a particular event by invoking all fields to return their documentation. Accepts three parameters, `section`, `filters` and `name`.
	 */
	require_once(TOOLKIT . '/class.datasourcemanager.php');

	Class contentAjaxEventDocumentation extends AjaxPage {

		public function view() {
			$name = General::sanitize($_REQUEST['name']);
			$section = General::sanitize($_REQUEST['section']);
			$filters = self::processFilters($_REQUEST['filters']);
			$rootelement = Lang::createHandle($name);
			$documentation = NULL;
			$doc_parts = array();

			// Add Documentation (Success/Failure)
			$this->addEntrySuccessDoc($doc_parts, $rootelement, $section, $filters);
			$this->addEntryFailureDoc($doc_parts, $rootelement, $section, $filters);

			// Filters
			$this->addDefaultFiltersDoc($doc_parts, $rootelement, $section, $filters);

			// Frontend Markup
			$this->addFrontendMarkupDoc($doc_parts, $rootelement, $section, $filters);
			$this->addSendMailFilterDoc($doc_parts, $rootelement, $section, $filters);

			/**
			 * Allows adding documentation for new filters. A reference to the $documentation
			 * array is provided, along with selected filters
			 * @delegate AppendEventFilterDocumentation
			 * @param string $context
			 * '/blueprints/events/(edit|new|info)/'
			 * @param array $selected
			 *  An array of all the selected filters for this Event
			 * @param array $documentation
			 *  An array of all the documentation XMLElements, passed by reference
			 */
			Symphony::ExtensionManager()->notifyMembers('AppendEventFilterDocumentation', '/blueprints/events/' . $rootelement . '/', array(
				'selected' => $filters,
				'documentation' => &$doc_parts
			));

			$documentation = join(PHP_EOL, array_map(create_function('$x', 'return rtrim($x->generate(true, 4));'), $doc_parts));
			$documentation = str_replace('\'', '\\\'', $documentation);

			$documentation = '<fieldset id="event-documentation" class="settings"><legend>' . __('Documentation') . '</legend>' . $documentation . '</fieldset>';
			$this->_Result = $documentation;
		}

		public function generate($page = null) {
			header('Content-Type: text/html');
			echo $this->_Result;
			exit;
		}

		/**
		 * Utilities
		 */
		public static function hasMultipleFilter($filters) {
			if(!is_array($filters)) return false;
<commit_msg>Refactored contentAjaxEventDocumentation to use TextPage<commit_after><?php
	/**
	 * @package content
	 */
	/**
	 * The AjaxEventDocumentation returns the documentation for a particular
	 * event by invoking all fields to return their documentation.
	 * Accepts three parameters, `section`, `filters` and `name`.
	 */
	require_once(TOOLKIT . '/class.datasourcemanager.php');

	Class contentAjaxEventDocumentation extends TextPage {
		
		public function __construct() {
			parent::__construct();
			$this->addHeaderToPage('Content-Type', 'text/html');
		}

		public function view() {
			$name = General::sanitize($_REQUEST['name']);
			$section = General::sanitize($_REQUEST['section']);
			$filters = self::processFilters($_REQUEST['filters']);
			$rootelement = Lang::createHandle($name);
			$documentation = NULL;
			$doc_parts = array();

			// Add Documentation (Success/Failure)
			$this->addEntrySuccessDoc($doc_parts, $rootelement, $section, $filters);
			$this->addEntryFailureDoc($doc_parts, $rootelement, $section, $filters);

			// Filters
			$this->addDefaultFiltersDoc($doc_parts, $rootelement, $section, $filters);

			// Frontend Markup
			$this->addFrontendMarkupDoc($doc_parts, $rootelement, $section, $filters);
			$this->addSendMailFilterDoc($doc_parts, $rootelement, $section, $filters);

			/**
			 * Allows adding documentation for new filters. A reference to the $documentation
			 * array is provided, along with selected filters
			 * @delegate AppendEventFilterDocumentation
			 * @param string $context
			 * '/blueprints/events/(edit|new|info)/'
			 * @param array $selected
			 *  An array of all the selected filters for this Event
			 * @param array $documentation
			 *  An array of all the documentation XMLElements, passed by reference
			 */
			Symphony::ExtensionManager()->notifyMembers('AppendEventFilterDocumentation', '/blueprints/events/' . $rootelement . '/', array(
				'selected' => $filters,
				'documentation' => &$doc_parts
			));
			
			$documentation = join(PHP_EOL, array_map(create_function('$x', 'return rtrim($x->generate(true, 4));'), $doc_parts));
			$documentation = str_replace('\'', '\\\'', $documentation);

			$documentation = '<fieldset id="event-documentation" class="settings"><legend>' . __('Documentation') . '</legend>' . $documentation . '</fieldset>';
			$this->_Result = $documentation;
		}

		/**
		 * Utilities
		 */
		public static function hasMultipleFilter($filters) {
			if(!is_array($filters)) return false;

{'fraction_non_alphanumeric': 0.14881921824104236, 'fraction_numerical': 0.00040716612377850165, 'mean_word_length': 4.5264341957255345, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6955216', 'n_tokens_mistral': 1618, 'n_tokens_neox': 1368, 'n_words': 339}