<commit_before><?php
/* ==========================================================================
   Project-specific code
   ========================================================================== */

// Set Google Analytics ID
// $googleAnalyticsId = '';


// Set content width value based on the theme's design
if ( ! isset( $content_width ) ) {
	$content_width = 1440;
}

// Register menus
if ( ! function_exists( 'yww_menus' ) ) {

	function yww_menus() {

		$locations = array(
			'main' => __( 'Main menu', 'yww' ),
		);
		register_nav_menus( $locations );

	}
	add_action( 'init', 'yww_menus' );

	function yww_timber_menus( $context ) {

		$context[ 'menus' ][ 'main' ] = new TimberMenu( 'main' );
		return $context;

	}
	add_filter( 'timber_context', 'yww_timber_menus' );

}


// Send script variables to front end
// TODO: Add nonce for AJAX requests
if ( ! function_exists( 'yww_update_script_vars' ) ) {

	function yww_update_script_vars( $scriptVars = array() ) {

		// Non-destructively merge script variables according to page or query conditions
		if ( is_single() ) {
			$scriptVars = array_merge( $scriptVars, array(
				'ajaxUrl' => admin_url( 'admin-ajax.php' ),
				'postNonce' => wp_create_nonce( 'yww-post-nonce' ),
				'nameSpaced' => array(
					'key1' => __( 'value one', 'yww' ),
					'key2' => __( 'value two', 'yww' )
			) ) );
		}
		return $scriptVars;

	}
	add_filter( 'yww_script_vars', 'yww_update_script_vars' );

}

// Send AJAX responses
if ( ! function_exists( 'yww_send_ajax_response' ) ) {

	function yww_send_ajax_response( $response ) {
		
		header( 'Content-Type: application/json' );
		echo json_encode( $response );
		exit;
	}

}

// Handle AJAX requests
if ( ! function_exists( 'yww_ajax_handler' ) ) {

	function yww_ajax_handler() {

		if ( isset( $_POST[ 'postNonce' ] ) ) {
			$nonce = $_POST[ 'postNonce' ];
		} else {
			send_response( array( 'success' => false, 'error' => "Couldn't retrieve nonce." ) );
		}

		if ( ! wp_verify_nonce( $nonce, 'yww-post-nonce' ) ) {
			send_response( array( 'success' => false, 'error' => 'Invalid nonce.' ) );
		}

		// Retrieve submitted parameters
		// $postID = $_POST[ 'postID' ];

		// Now do whatever we need to do

		yww_send_ajax_response( array( 'success' => true ) );

	} 
	add_action( 'wp_ajax_nopriv_ajax-ACTION', 'yww_ajax_handler' );
	add_action( 'wp_ajax_ajax-ACTION', 'yww_ajax_handler' );

}<commit_msg>fixed small bug in starter theme<commit_after><?php
/* ==========================================================================
   Project-specific code
   ========================================================================== */

// Set Google Analytics ID
// $googleAnalyticsId = '';


// Set content width value based on the theme's design
if ( ! isset( $content_width ) ) {
	$content_width = 1440;
}

// Register menus
if ( ! function_exists( 'yww_menus' ) ) {

	function yww_menus() {

		$locations = array(
			'main' => __( 'Main menu', 'yww' ),
		);
		register_nav_menus( $locations );

	}
	add_action( 'init', 'yww_menus' );

	function yww_timber_menus( $context ) {

		$context[ 'menus' ][ 'main' ] = new TimberMenu( 'main' );
		return $context;

	}
	add_filter( 'timber_context', 'yww_timber_menus' );

}


// Send script variables to front end
// TODO: Add nonce for AJAX requests
if ( ! function_exists( 'yww_update_script_vars' ) ) {

	function yww_update_script_vars( $scriptVars = array() ) {

		// Non-destructively merge script variables according to page or query conditions
		if ( is_single() ) {
			$scriptVars = array_merge( $scriptVars, array(
				'ajaxUrl' => admin_url( 'admin-ajax.php' ),
				'postNonce' => wp_create_nonce( 'yww-post-nonce' ),
				'nameSpaced' => array(
					'key1' => __( 'value one', 'yww' ),
					'key2' => __( 'value two', 'yww' )
			) ) );
		}
		return $scriptVars;

	}
	add_filter( 'yww_script_vars', 'yww_update_script_vars' );

}

// Send AJAX responses
if ( ! function_exists( 'yww_send_ajax_response' ) ) {

	function yww_send_ajax_response( $response ) {
		
		header( 'Content-Type: application/json' );
		echo json_encode( $response );
		exit;
	}

}

// Handle AJAX requests
if ( ! function_exists( 'yww_ajax_handler' ) ) {

	function yww_ajax_handler() {

		if ( isset( $_POST[ 'postNonce' ] ) ) {
			$nonce = $_POST[ 'postNonce' ];
		} else {
			yww_send_ajax_response( array( 'success' => false, 'error' => "Couldn't retrieve nonce." ) );
		}

		if ( ! wp_verify_nonce( $nonce, 'yww-post-nonce' ) ) {
			yww_send_ajax_response( array( 'success' => false, 'error' => 'Invalid nonce.' ) );
		}

		// Retrieve submitted parameters
		// $postID = $_POST[ 'postID' ];

		// Now do whatever we need to do

		yww_send_ajax_response( array( 'success' => true ) );

	} 
	add_action( 'wp_ajax_nopriv_ajax-ACTION', 'yww_ajax_handler' );
	add_action( 'wp_ajax_ajax-ACTION', 'yww_ajax_handler' );

}
{'fraction_non_alphanumeric': 0.20974706971005552, 'fraction_numerical': 0.0024676125848241827, 'mean_word_length': 3.9531568228105907, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 25, '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': '343593', 'n_tokens_mistral': 1873, 'n_tokens_neox': 1696, 'n_words': 373}