<commit_before><?php
// (c) Copyright 2002-2012 by authors of the Tiki Wiki CMS Groupware Project
// 
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id$

function wikiplugin_js_info()
{
	return array(
		'name' => tra('JavaScript'),
		'documentation' => 'PluginJS',
		'description' => tra('Add JavaScript code'),
		'prefs' => array( 'wikiplugin_js' ),
		'body' => tra('JavaScript code'),
		'validate' => 'all',
		'filter' => 'rawhtml_unsafe',
		'icon' => 'img/icons/script_code_red.png',
		'tags' => array( 'basic' ),
		'params' => array(
			'file' => array(
				'required' => false,
				'name' => tra('File'),
				'description' => tra('JavaScript filename'),
				'filter' => 'url',
				'default' => '',
			),
		),
	);
}
function wikiplugin_js($data, $params)
{
	extract($params, EXTR_SKIP);
	if (isset($file)) {
		$ret =  "~np~<script type=\"text/javascript\" src=\"$file\"></script> ~/np~";
	} else {
		$ret = '';
	}
	if ($data) {
		$ret .= "~np~<script type=\"text/javascript\">".$data."</script>~/np~"; 
	}
	return $ret;
}<commit_msg>[fp/43528][FIX] Sort of an enhancement, allow js to be loaded through header, so that some jQuery can be inserted into pages<commit_after><?php
// (c) Copyright 2002-2012 by authors of the Tiki Wiki CMS Groupware Project
// 
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id$

function wikiplugin_js_info()
{
	return array(
		'name' => tra('JavaScript'),
		'documentation' => 'PluginJS',
		'description' => tra('Add JavaScript code'),
		'prefs' => array( 'wikiplugin_js' ),
		'body' => tra('JavaScript code'),
		'validate' => 'all',
		'filter' => 'rawhtml_unsafe',
		'icon' => 'img/icons/script_code_red.png',
		'tags' => array( 'basic' ),
		'params' => array(
			'file' => array(
				'required' => false,
				'name' => tra('File'),
				'description' => tra('JavaScript filename'),
				'filter' => 'url',
				'default' => '',
			),
			'lateload' => array(
				'required' => false,
				'name' => tra('Late Load'),
				'description' => tra('Late load, use headerlib'),
				'options' => array(
					array('text' => '', 'value' => ''),
					array('text' => tra('Yes'), 'value' => 'y'),
					array('text' => tra('No'), 'value' => 'n'),
				),
				'default' => '',
				'advanced' => true,
			),
		),
	);
}
function wikiplugin_js($data, $params)
{
	global $headerlib;
	extract($params, EXTR_SKIP);

	if (isset($lateload) && $lateload == 'y') {
		if (isset($file)) {
			$headerlib->add_jsfile($file);
		} else if ($data) {
			$headerlib->add_js($data);
		}
		return '';
	}

	if (isset($file)) {
		$ret =  "~np~<script type=\"text/javascript\" src=\"$file\"></script> ~/np~";
	} else {
		$ret = '';
	}
	if ($data) {
		$ret .= "~np~<script type=\"text/javascript\">".$data."</script>~/np~"; 
	}
	return $ret;
}
{'fraction_non_alphanumeric': 0.21636060100166946, 'fraction_numerical': 0.007011686143572621, 'mean_word_length': 3.637770897832817, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 58, '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': '7130517', 'n_tokens_mistral': 1200, 'n_tokens_neox': 1058, 'n_words': 263}