<commit_before><?php
include 'tiki-setup.php';

if( !isset( $_GET['plugin'] ) )
	exit;

$plugin = basename( $_GET['plugin'] );
$file = 'lib/wiki-plugins/wikiplugin_' . $plugin . '.php';
$info = "wikiplugin_{$plugin}_info";

if( ! file_exists( $file ) )
	exit;

include $file;

if( ! function_exists( $info ) )
	exit;

?>

if( ! tiki_plugins )
	var tiki_plugins = {};

tiki_plugins[<?php echo json_encode( $plugin ) ?>] = <?php echo json_encode( $info() ) ?>;
<commit_msg>[FIX] WYSIWYG load timing issue, adding cache in wikiplugin js to solve it<commit_after><?php

if( !isset( $_GET['plugin'] ) )
	exit;

$plugin = basename( $_GET['plugin'] );
$file = 'lib/wiki-plugins/wikiplugin_' . $plugin . '.php';
$info = "wikiplugin_{$plugin}_info";

if( file_exists( "temp/cache/wikiplugin_$plugin" ) )
{
	readfile( "temp/cache/wikiplugin_$plugin" );
	exit;
}

if( ! file_exists( $file ) )
	exit;

include 'tiki-setup.php';
include $file;

if( ! function_exists( $info ) )
	exit;

ob_start();

?>

if( ! tiki_plugins )
	var tiki_plugins = {};

tiki_plugins[<?php echo json_encode( $plugin ) ?>] = <?php echo json_encode( $info() ) ?>;

<?php

$content = ob_get_contents();
file_put_contents( "temp/cache/wikiplugin_$plugin", $content );
ob_end_flush();
	
?>
{'fraction_non_alphanumeric': 0.1953562850280224, 'fraction_numerical': 0.0, 'mean_word_length': 4.89622641509434, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 10, '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': '6673116', 'n_tokens_mistral': 485, 'n_tokens_neox': 492, 'n_words': 102}