<commit_before><?php
function wikiplugin_topfriends_help() {
	return tra("List top scoring users").":<br />~np~{TOPFRIENDS(limit=>5,public=>y)}{TOPFRIENDS}~/np~";
}

function wikiplugin_topfriends_info() {
	return array(
		'name' => tra('Top Friends'),
		'description' => tra('List top scoring users.'),
		'prefs' => array( 'feature_friends', 'wikiplugin_topfriends' ),
		'params' => array(
			'limit' => array(
				'required' => false,
				'name' => tra('Limit'),
				'description' => tra('Maximum result count.'),
			),
			'public' => array(
				'required' => false,
				'name' => tra('Public'),
				'description' => 'y|n',
			),
		),
	);
}

function wikiplugin_topfriends($data, $params) {
	global $smarty, $prefs, $tiki_p_list_users, $tikilib;
	
	/* Check we can be called */
	if($prefs['feature_friends'] != 'y') {
		return ' ';  
	}
	extract ($params, EXTR_SKIP);

	if(!(isset($limit) && $limit <> '')) {
		$limit = 5;
	}

	if((isset($public) && $public != 'y') && ($tiki_p_list_users != 'y')) {
		// Access denied
		return ' ';
	}

	$listusers = $tikilib->list_users(0 , $limit, 'score_desc', '', false);
	$smarty->assign_by_ref('listusers', $listusers["data"]);

	return $smarty->fetch('plugins/plugin-topfriends.tpl');
}

?>

<commit_msg>[FIX] ajax: fix an annoying bug with ajax that occured when going into edit mode for a wiki page (tiki-editpage.php) for the first time after login. This was due to a white space after the php closing tag of wikiplugin_topfriends.php and because the new way to list plugins executes it before smarty display. PHP closing tags must not be used, as suggested by PHP authors / Zend.<commit_after><?php
function wikiplugin_topfriends_help() {
	return tra("List top scoring users").":<br />~np~{TOPFRIENDS(limit=>5,public=>y)}{TOPFRIENDS}~/np~";
}

function wikiplugin_topfriends_info() {
	return array(
		'name' => tra('Top Friends'),
		'description' => tra('List top scoring users.'),
		'prefs' => array( 'feature_friends', 'wikiplugin_topfriends' ),
		'params' => array(
			'limit' => array(
				'required' => false,
				'name' => tra('Limit'),
				'description' => tra('Maximum result count.'),
			),
			'public' => array(
				'required' => false,
				'name' => tra('Public'),
				'description' => 'y|n',
			),
		),
	);
}

function wikiplugin_topfriends($data, $params) {
	global $smarty, $prefs, $tiki_p_list_users, $tikilib;
	
	/* Check we can be called */
	if($prefs['feature_friends'] != 'y') {
		return ' ';  
	}
	extract ($params, EXTR_SKIP);

	if(!(isset($limit) && $limit <> '')) {
		$limit = 5;
	}

	if((isset($public) && $public != 'y') && ($tiki_p_list_users != 'y')) {
		// Access denied
		return ' ';
	}

	$listusers = $tikilib->list_users(0 , $limit, 'score_desc', '', false);
	$smarty->assign_by_ref('listusers', $listusers["data"]);

	return $smarty->fetch('plugins/plugin-topfriends.tpl');
}

{'fraction_non_alphanumeric': 0.19719789842381785, 'fraction_numerical': 0.0021015761821366026, 'mean_word_length': 4.378531073446328, 'pattern_counts': {'":': 2, '<': 9, '<?xml version=': 0, '>': 42, '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': '2967616', 'n_tokens_mistral': 1117, 'n_tokens_neox': 1025, 'n_words': 235}