Sure, it has two files:
first file, tagcloud.php in MyBB root:
<?php
define('IN_MYBB', 1); require "./global.php";
add_breadcrumb("Tag Cloud", "tagcloud.php");
eval("\$html = \"".$templates->get("tagcloud_cloud")."\";");
output_page($html);
?>
Second file, the plugin file:
<?php
/*
Tag Cloud v1.0
Plugin made by Aniruddh Agarwal
*/
if(!defined("IN_MYBB")) {
die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}
function tagcloud_info(){
return array (
"name" => "Tag Cloud",
"description" => "A plugin which displays threads in a list according to the criteria selected by the Admin",
"website" => "http://mybb.com",
"author" => "Aniruddh Agarwal",
"version" => "v1.0",
"compatibility" => "16*",
"guid" => ""
);
}
include 'tagcloud/tagcloud_template.php';
function tagcloud_activate() {
global $db, $mybb, $message;
$tagcloud_cloud =
array (
"tid" => NULL,
"title" => 'tagcloud_cloud',
"template" => $db->escape_string(
'
<html>
<head>
<title>Tag Cloud</title>
{$headerinclude}
</head>
<body>
{$header}
<table border="0" cellspacing="1" cellpadding="4" class="tborder">
<tr>
<td class="thead"><span class="smalltext"><strong>Tag Cloud</strong></span></td>
</tr>
<tr>
<td class="trow1">
{$message}
</td>
</tr>
</table>
{$footer}
</body>
</html>
'),
"sid" => "-1",
"dateline" => time(),
);
$db->insert_query("templates", $tagcloud_cloud);
$tagcloud_group =
array (
"gid" => "NULL",
"name" => "tagcloud",
"title" => "Tag Cloud",
"description" => "Settings for the plugin.",
"disporder" => "1",
"isdefault" => "no",
);
$db->insert_query("settinggroups", $tagcloud_group); $gid = $db->insert_id();
$tagcloud_setting_1 =
array (
"sid" => "NULL",
"name" => "tagcloud_enable",
"title" => "Enable Tag Cloud",
"description" => "Select yes if you want to enable Tag Cloud.",
"optionscode" => "yesno",
"value" => "0",
"disporder" => "1",
"gid" => intval($gid),
);
$db->insert_query("settings", $tagcloud_setting_1);
$tagcloud_setting_2 =
array (
"sid" => "NULL",
"name" => "tagcloud_latestthreads",
"title" => "Show Latest Threads",
"description" => "Select yes if you want to show the latest threads on the Tag Cloud.",
"optionscode" => "yesno",
"value" => "1",
"disporder" => "2",
"gid" => intval($gid),
);
$db->insert_query("settings", $tagcloud_setting_2);
rebuild_settings();
}
function tagcloud_deactivate() {
global $db, $mybb;
$db->delete_query("templates", "title LIKE 'tagcloud_%' AND sid='-2'");
$db->query("DELETE FROM ".TABLE_PREFIX."settinggroups WHERE name='tagcloud'");
$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='tagcloud_enable'");
$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='tagcloud_latestthreads'");
$db->query("DELETE FROM ".TABLE_PREFIX."templates WHERE title='tagcloud_cloud'");
rebuild_settings();
}
function tagcloud_run() {
global $mybb, $db;
$latestthreads = $db->query("SELECT tid,subject FROM `".TABLE_PREFIX."threads` WHERE `replies`>1 ORDER BY `lastpost` DESC LIMIT 40");
while($thread = $db->fetch_array($latestthreads)){
$sizes = array("11","14","18","22","28");
$fontsize = rand('0', '4');
$message = "<a href=\"".$mybb->settings['bburl']."/showthread.php?tid=".$thread['tid']."\"><span style=\"font-size:".$sizes[$fontsize]."px\">".$thread['subject']."</span></a> |\r\n";
}
eval('$message = "'.$templates->get('tagcloud_cloud').'";');
echo $message;
}
?>