<?
/* 
    Install:
     copy to Plugins directory, and install through nucleus Admin area.
 
    Usage:
	 <%blogStats%> to display all statistics
     <%blogStats(blogs)%> to display total number of Blogs
	 <%blogStats(items)%> to display total number of Items
	 <%blogStats(comments)%> to display total number of Comments
 
    Joseph McDermott
    http://www.faceh.com  */
 
class NP_blogStats extends NucleusPlugin {
 
 function getEventList() { return array(); }
 function getName() { return 'blogStats';    }
 function getAuthor() { return 'faceh';    }
 function getURL() { return 'http://faceh.com'; }
 function getVersion() { return '1.0'; }
 function getDescription() { return 'Displays statistics of active Blogs. Usage: <%blogStats%> / <%blogStats(blogs)%> / <%blogStats(items)%> / <%blogStats(comments)%>'; }
 
 function install() {
		$this->createOption('option1','Text for blog (eg. Number of Blogs: )','text','Blogs: ');
		$this->createOption('option2','Text Word for items (eg. Number of Items: )','text','Items: ');
		$this->createOption('option3','Text Word for comments (eg. Number of Comments: )','text','Comments: ');
 }
 
 function doSkinVar($skinType, $param) {
 
   switch($param) {
 
	 case "blogs":
	 $query = mysql_query("SELECT bnumber FROM ".sql_table('blog'));
	 $blogInfo = mysql_num_rows($query);
	 echo $this->getOption('option1').$blogInfo;
	 break;
 
	 case "items":
	 $query = mysql_query("SELECT inumber FROM ".sql_table('item'));
	 $itemInfo = mysql_num_rows($query);
	 echo $this->getOption('option2').$itemInfo;
	 break;
 
	 case "comments":
	 $query = mysql_query("SELECT cnumber FROM ".sql_table('comment'));
	 $commentInfo = mysql_num_rows($query);
	 echo $this->getOption('option3').$commentInfo;
	 break;
 
	 default:
	 $query = mysql_query("SELECT bnumber FROM ".sql_table('blog'));
	 $blogInfo = mysql_num_rows($query);
	 $query = mysql_query("SELECT inumber FROM ".sql_table('item'));
	 $itemInfo = mysql_num_rows($query);
	 $query = mysql_query("SELECT cnumber FROM ".sql_table('comment'));
	 $commentInfo = mysql_num_rows($query);
 
	 echo $this->getOption('option1').$blogInfo."<br>";
	 echo $this->getOption('option2').$itemInfo."<br>";
	 echo $this->getOption('option3').$commentInfo."<br>";
	 break;
 
   }
 
 }  
}
?>
blogstats_code.txt · Last modified: 2006/07/05 13:03 (external edit)
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki