<commit_before><?php
/*
Author: <NAME>
Author URI: http://www.kintassa.com
Copyright: Copyright (c) 2011 Kintassa.
License: All rights reserved.  Contact Kintassa should you wish to license this product.
*/

require_once(kintassa_core('kin_applet.php'));
require_once('kgal_config.php');
require_once('kgal_image_finder.php');

$GLOBALS['registered_kintassa_gallery_applets'] = array();

abstract class KintassaGalleryApplet extends KintassaApplet {
	static function register($applet_class, $name, $pretty_name) {
		if (array_key_exists($applet_class, $GLOBALS['registered_kintassa_gallery_applets'])) return;
		$GLOBALS['registered_kintassa_gallery_applets'][$name] = array(
			'class'			=> $applet_class,
			'pretty_name'	=> $pretty_name,
		);
	}

	static function available_applets() {
		return array_keys($GLOBALS['registered_kintassa_gallery_applets']);
	}

	static function is_valid_applet($applet_name) {
		return array_key_exists($applet_name, $GLOBALS['registered_kintassa_gallery_applets']);
	}

	static function applet_info($applet_name) {
		return $GLOBALS['registered_kintassa_gallery_applets'][$applet_name];
	}<commit_msg>Realise template_path method for gallery applets<commit_after><?php
/*
Author: <NAME>
Author URI: http://www.kintassa.com
Copyright: Copyright (c) 2011 Kintassa.
License: All rights reserved.  Contact Kintassa should you wish to license this product.
*/

require_once(kintassa_core('kin_applet.php'));
require_once('kgal_config.php');
require_once('kgal_image_finder.php');

$GLOBALS['registered_kintassa_gallery_applets'] = array();

abstract class KintassaGalleryApplet extends KintassaApplet {
	static function register($applet_class, $name, $pretty_name) {
		if (array_key_exists($applet_class, $GLOBALS['registered_kintassa_gallery_applets'])) return;
		$GLOBALS['registered_kintassa_gallery_applets'][$name] = array(
			'class'			=> $applet_class,
			'pretty_name'	=> $pretty_name,
		);
	}

	function template_path($applet_name, $template_name) {
		$template_dir = dirname(dirname(__file__)) . DIRECTORY_SEPARATOR . "templates";
		$fname = basename("applet_" . $applet_name . "__" . $template_name . ".php");
		$template = $template_dir . DIRECTORY_SEPARATOR . $fname;
		return $template;
	}

	static function available_applets() {
		return array_keys($GLOBALS['registered_kintassa_gallery_applets']);
	}

	static function is_valid_applet($applet_name) {
		return array_key_exists($applet_name, $GLOBALS['registered_kintassa_gallery_applets']);
	}

	static function applet_info($applet_name) {
		return $GLOBALS['registered_kintassa_gallery_applets'][$applet_name];
	}
{'fraction_non_alphanumeric': 0.12523937188816545, 'fraction_numerical': 0.003063960168517809, 'mean_word_length': 7.371794871794871, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '787220', 'n_tokens_mistral': 974, 'n_tokens_neox': 877, 'n_words': 153}