<commit_before><?php
/* =========================================================================
   Front-end-specific configuration, scripts and handlers
   ========================================================================= */

namespace fabrica;

require_once('singleton.php');
require_once('project.php');

class Front extends Singleton {

	public function __construct() {

		add_filter(Project::$varsTag, array($this, 'updateScriptVars'));

		// Front-end-specific tags, hooks and initialisations
		// add_action('action_name', array($this, 'actionHandler'));
		// add_filter('filter_name', array($this, 'filterHandler'));

	}

	// Send script variables to front end
	public function updateScriptVars($scriptVars = array()) {

		// Non-destructively merge script variables according to page or query conditions
		if (is_single()) {
			$scriptVars = array_merge($scriptVars, array(
				'nameSpaced' => array(
					'key1' => __('value one', Project::$projectNamespace),
					'key2' => __('value two', Project::$projectNamespace)
				)
			));
		}
		return $scriptVars;

	}

}

// Create a singleton instance of Front
Front::instance();
<commit_msg>exclude admin requests in `front.php`<commit_after><?php
/* =========================================================================
   Front-end-specific configuration, scripts and handlers
   ========================================================================= */

namespace fabrica;

require_once('singleton.php');
require_once('project.php');

class Front extends Singleton {

	public function __construct() {

		if (is_admin() || (defined('DOING_AJAX') && DOING_AJAX)) { return; }

		add_filter(Project::$varsTag, array($this, 'updateScriptVars'));

		// Front-end-specific tags, hooks and initialisations
		// add_action('action_name', array($this, 'actionHandler'));
		// add_filter('filter_name', array($this, 'filterHandler'));

	}

	// Send script variables to front end
	public function updateScriptVars($scriptVars = array()) {

		// Non-destructively merge script variables according to page or query conditions
		if (is_single()) {
			$scriptVars = array_merge($scriptVars, array(
				'nameSpaced' => array(
					'key1' => __('value one', Project::$projectNamespace),
					'key2' => __('value two', Project::$projectNamespace)
				)
			));
		}
		return $scriptVars;

	}

}

// Create a singleton instance of Front
Front::instance();

{'fraction_non_alphanumeric': 0.24979253112033195, 'fraction_numerical': 0.0016597510373443983, 'mean_word_length': 5.246113989637306, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '3498773', 'n_tokens_mistral': 717, 'n_tokens_neox': 639, 'n_words': 159}