<commit_before><?php

namespace GeminiLabs\Castor;

use GeminiLabs\Castor\Facades\Development;
use GeminiLabs\Castor\Facades\Template;
use GeminiLabs\Castor\Facades\Theme;
use GeminiLabs\Castor\Facades\Utility;
use WP_Customize_Manager;

class Controller
{
	/**
	 * @return void
	 * @action after_setup_theme
	 */
	public function afterSetupTheme()
	{
		add_editor_style( Theme::assetUri( 'css/editor.css' ));
		add_theme_support( 'customize-selective-refresh-widgets' );
		add_theme_support( 'html5', ['caption', 'comment-form', 'comment-list', 'gallery', 'search-form'] );
		add_theme_support( 'post-thumbnails' );
		add_theme_support( 'soil-clean-up' );
		add_theme_support( 'soil-jquery-cdn' );
		add_theme_support( 'soil-nav-walker' );
		add_theme_support( 'soil-nice-search' );
		add_theme_support( 'soil-relative-urls' );
		add_theme_support( 'title-tag' );
		load_theme_textdomain( 'castor', Theme::paths( 'dir.template' ) . '/languages' );

		$menus = apply_filters( 'castor/register/nav_menus', [
			'main_menu' => __( 'Main Menu', 'castor' ),
		]);

		foreach( $menus as $location => $description ) {
			register_nav_menu( $location, $description );
		}
	}

	/**
	 * @return string
	 * @filter login_headertitle
	 */
	public function filterLoginTitle()
	{
		return get_bloginfo( 'name' );
	}

	/**
	 * @return string
	 * @filter login_headerurl
	 */
	public function filterLoginUrl()
	{
		return get_bloginfo( 'url' );
	}

	/**
	 * @return string
	 * @filter template_include
	 */
	public function filterTemplate( $template )
	{
		if( is_string( $template )) {
			$template = Template::setLayout( $template );
			Development::storeTemplatePath( $template );
		}
		return $template;
	}

	/**
	 * @return array
	 * @filter {$type}_template_hierarchy
	 */
	public function filterTemplateHierarchy( array $templates )
	{
		return array_map( function( $template ) {
			return Utility::startWith( 'templates/', $template );
		}, $templates );
	}

	/**
	 * @return void
	 * @action login_head
	 */
	public function login()
	{
		if( file_exists( Theme::assetPath( 'css/login.css' ))) {
			printf( '<link rel="stylesheet" href="%s">', Theme::assetUri( 'css/login.css' ));
		}
	}

	/**
	 * @return void
	 * @action wp_enqueue_scripts
	 */
	public function registerAssets()
	{
		wp_enqueue_style( 'castor/main.css',
			Theme::assetUri( 'css/main.css' ),
			apply_filters( 'castor/enqueue/css/deps', [] ),
			null
		);
		wp_enqueue_script( 'castor/main.js',
			Theme::assetUri( 'js/main.js' ),
			apply_filters( 'castor/enqueue/js/deps', [] ),
			null,
			true
		);
	}

	/**
	 * @return void
	 * @action customize_register
	 */
	public function registerCustomizer( WP_Customize_Manager $manager )
	{
		$manager->get_setting( 'blogname' )->transport = 'postMessage';<commit_msg>filter wp_localize_script() variable name<commit_after><?php

namespace GeminiLabs\Castor;

use GeminiLabs\Castor\Facades\Development;
use GeminiLabs\Castor\Facades\Template;
use GeminiLabs\Castor\Facades\Theme;
use GeminiLabs\Castor\Facades\Utility;
use WP_Customize_Manager;

class Controller
{
	/**
	 * @return void
	 * @action after_setup_theme
	 */
	public function afterSetupTheme()
	{
		add_editor_style( Theme::assetUri( 'css/editor.css' ));
		add_theme_support( 'customize-selective-refresh-widgets' );
		add_theme_support( 'html5', ['caption', 'comment-form', 'comment-list', 'gallery', 'search-form'] );
		add_theme_support( 'post-thumbnails' );
		add_theme_support( 'soil-clean-up' );
		add_theme_support( 'soil-jquery-cdn' );
		add_theme_support( 'soil-nav-walker' );
		add_theme_support( 'soil-nice-search' );
		add_theme_support( 'soil-relative-urls' );
		add_theme_support( 'title-tag' );
		load_theme_textdomain( 'castor', Theme::paths( 'dir.template' ) . '/languages' );

		$menus = apply_filters( 'castor/register/nav_menus', [
			'main_menu' => __( 'Main Menu', 'castor' ),
		]);

		foreach( $menus as $location => $description ) {
			register_nav_menu( $location, $description );
		}
	}

	/**
	 * @return string
	 * @filter login_headertitle
	 */
	public function filterLoginTitle()
	{
		return get_bloginfo( 'name' );
	}

	/**
	 * @return string
	 * @filter login_headerurl
	 */
	public function filterLoginUrl()
	{
		return get_bloginfo( 'url' );
	}

	/**
	 * @return string
	 * @filter template_include
	 */
	public function filterTemplate( $template )
	{
		if( is_string( $template )) {
			$template = Template::setLayout( $template );
			Development::storeTemplatePath( $template );
		}
		return $template;
	}

	/**
	 * @return array
	 * @filter {$type}_template_hierarchy
	 */
	public function filterTemplateHierarchy( array $templates )
	{
		return array_map( function( $template ) {
			return Utility::startWith( 'templates/', $template );
		}, $templates );
	}

	/**
	 * @return void
	 * @action login_head
	 */
	public function login()
	{
		if( file_exists( Theme::assetPath( 'css/login.css' ))) {
			printf( '<link rel="stylesheet" href="%s">', Theme::assetUri( 'css/login.css' ));
		}
	}

	/**
	 * @return void
	 * @action wp_enqueue_scripts
	 */
	public function registerAssets()
	{
		wp_enqueue_style( 'castor/main.css',
			Theme::assetUri( 'css/main.css' ),
			apply_filters( 'castor/enqueue/css/deps', [] ),
			null
		);
		wp_enqueue_script( 'castor/main.js',
			Theme::assetUri( 'js/main.js' ),
			apply_filters( 'castor/enqueue/js/deps', [] ),
			null,
			true
		);
		wp_localize_script( 'castor/main.js', apply_filters( 'castor/enqueue/js/localize/variable', 'globals' ),
			apply_filters( 'castor/enqueue/js/localize/variables', [
				'ajax' => admin_url( 'admin-ajax.php' ),
			])
		);
	}

	/**
	 * @return void
	 * @action customize_register
	 */
	public function registerCustomizer( WP_Customize_Manager $manager )
	{
		$manager->get_setting( 'blogname' )->transport = 'postMessage';
{'fraction_non_alphanumeric': 0.15957263484404619, 'fraction_numerical': 0.0003446493193175943, 'mean_word_length': 4.1637010676156585, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2180036', 'n_tokens_mistral': 2232, 'n_tokens_neox': 2028, 'n_words': 364}