/trunk/jfx-private/modules/core/actions/dev-stats.php
PHP | 106 lines | 49 code | 37 blank | 20 comment | 27 complexity | 769eff33b78f44ca5d246b98a129763a MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1
- <?php
- ############### COPYLEFT GPLv3 LICENSE ###############
- ##
- ## JFX Version 0.2.9
- ## Website Management Software
- ## www.jfxcms.com
- ##
- ## Copyright 2009 GPLv3 - http://www.opensource.org/licenses/gpl-3.0.html
- ##
- ## Anthony Gallon
- ## oi_antz@hotmail.com
- ##
- ## Permission is hereby granted to any person having a copy of this software
- ## to freely use and modify as required so long as the copyright notices
- ## and branding remain intact.
- ##
- ## Full license details available at http://www.jfxcms.com/license
- ##
- ############### COPYLEFT GPLv3 LICENSE ###############
- $THEME->addBreadcrumb($this->adminUrl.'/dev-stats/', $this->lang('ap_title_dev-stats'));
- $dir = $CONFIG->publicDir;
- $numFiles = countFiles($dir, 'php');
- echo $numFiles.' files in the website <br />';
- $numLines = countLines($dir, 'php');
- echo $numLines.' lines in the website<br />';
- function countLines($dir, $ext=''){
- $num = 0;
- $dh = opendir($dir);
- while($file = readdir($dh)){
- if($file == '.' || $file == '..') continue;
- if($ext != '' && !is_dir($dir.'/'.$file)){
- $pathInfo = pathinfo($dir.'/'.$file);
- if(array_key_exists('extension', $pathInfo) && $pathInfo['extension']==$ext){
- // bingo!
- $fc = file_get_contents($dir.'/'.$file);
- $lines = explode("\n", $fc);
- $num += count($lines);
- }
- }else if($ext == '' && is_file($dir.'/'.$file)){
- $fc = file_get_contents($dir.'/'.$file);
- $lines = explode("\n", $fc);
- $num += count($lines);
- };
-
- if(is_dir($dir.'/'.$file)){
- $num += countLines($dir.'/'.$file, $ext);
- }
- };
- return $num;
- }
- function countFiles($dir, $ext=''){
- $num = 0;
- $dh = opendir($dir);
- while($file = readdir($dh)){
- if($file == '.' || $file == '..') continue;
- if($ext != '' && !is_dir($dir.'/'.$file)){
- $pathInfo = pathinfo($dir.'/'.$file);
- if(array_key_exists('extension', $pathInfo) && $pathInfo['extension']==$ext){
- // bingo!
- $num ++;
- }
- }else if($ext == '' && file_exists($dir.'/'.$file) && !is_dir($dir.'/'.$file)){
- $num++;
- };
- if(is_dir($dir.'/'.$file)){
- $num += countFiles($dir.'/'.$file, $ext);
- }
- };
- return $num;
- }