<commit_before><?php

/**
 *	This extension will automatically be applied, allowing CMS searchable content tagging.
 *	@author <NAME> <<EMAIL>>
 */

class CMSMainTaggingExtension extends Extension {

	/**
	 *	Update the page filters, allowing CMS searchable content tagging.
	 */

	public function updateSearchForm($form) {

		// Instantiate a field containing existing tags.

		$form->Fields()->insertBefore(ListboxField::create(
			'q[Tagging]',
			'Tagging',
			FusionTag::get()->map()->toArray()
		)->setMultiple(true), 'q[Term]');

		// Update the page filters action, allowing tags to be parsed correctly.

		$form->setFormAction(null);
		$form->Actions()->replaceField('action_doSearch', FormAction::create(
			'updateSearchFilters',
			_t('CMSMain_left_ss.APPLY_FILTER', 'Apply Filter')
		)->addExtraClass('ss-ui-action-constructive'));
	}

	/**
	 *	Apply the page filters, allowing tags to be parsed correctly.
	 *
	 *	@parameter <{SEARCH_FORM_DATA}> array
	 */

	public function updateSearchFilters($data) {

		$link = $this->owner->Link();
		$separator = '?';

		// Determine whether page filters exist.

		if(isset($data['q']) && is_array($data['q'])) {
			foreach($data['q'] as $filter => $value) {
<commit_msg>Implementing the ability to search content tagging in the CMS.<commit_after><?php

/**
 *	This extension will automatically be applied, allowing CMS searchable content tagging.
 *	@author <NAME> <<EMAIL>>
 */

class CMSMainTaggingExtension extends Extension {

	/**
	 *	Update the page filters, allowing CMS searchable content tagging.
	 */

	public function updateSearchForm($form) {

		// Instantiate a field containing existing tags.

		$form->Fields()->insertBefore(ListboxField::create(
			'q[Tagging]',
			'Tagging',
			FusionTag::get()->map()->toArray()
		)->setMultiple(true), 'q[Term]');

		// Update the page filters action, allowing tags to be parsed correctly.

		$form->setFormAction(null);
		$form->Actions()->replaceField('action_doSearch', FormAction::create(
			'pageFilter',
			_t('CMSMain_left_ss.APPLY_FILTER', 'Apply Filter')
		)->addExtraClass('ss-ui-action-constructive'));
	}

	/**
	 *	Apply the page filters, allowing tags to be parsed correctly.
	 *
	 *	@parameter <{SEARCH_FORM_DATA}> array
	 */

	public function pageFilter($data) {

		$link = $this->owner->Link();
		$separator = '?';

		// Determine whether page filters exist.

		if(isset($data['q']) && is_array($data['q'])) {
			foreach($data['q'] as $filter => $value) {

{'fraction_non_alphanumeric': 0.15933844292053248, 'fraction_numerical': 0.0, 'mean_word_length': 4.403050108932462, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 35, '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': '241773', 'n_tokens_mistral': 833, 'n_tokens_neox': 739, 'n_words': 193}