diff options
| author | fisharebest <fisharebest@gmail.com> | 2011-01-01 16:29:12 +0000 |
|---|---|---|
| committer | fisharebest <fisharebest@gmail.com> | 2011-01-01 16:29:12 +0000 |
| commit | 525f5b4fc772d29b8d0a80f543bc5d98f4591b09 (patch) | |
| tree | 1311190b214176e09c846577c431d90885c76e30 | |
| parent | 72ce8ae82edee2abbf15cd4c0fe586d4fdc84a15 (diff) | |
| download | webtrees-525f5b4fc772d29b8d0a80f543bc5d98f4591b09.tar.gz webtrees-525f5b4fc772d29b8d0a80f543bc5d98f4591b09.tar.bz2 webtrees-525f5b4fc772d29b8d0a80f543bc5d98f4591b09.zip | |
Refactoring class names and use autoloading.
| -rw-r--r-- | includes/functions/functions_print_lists.php | 6 | ||||
| -rw-r--r-- | library/WT/Stats.php (renamed from includes/classes/class_stats.php) | 65 | ||||
| -rw-r--r-- | modules/gedcom_stats/module.php | 3 | ||||
| -rw-r--r-- | modules/googlemap/placehierarchy.php | 4 | ||||
| -rw-r--r-- | modules/html/module.php | 3 | ||||
| -rw-r--r-- | modules/top10_givnnames/module.php | 3 | ||||
| -rw-r--r-- | statistics.php | 3 | ||||
| -rw-r--r-- | statisticsplot.php | 7 |
8 files changed, 39 insertions, 55 deletions
diff --git a/includes/functions/functions_print_lists.php b/includes/functions/functions_print_lists.php index e2feacbe4d..cad9c215d7 100644 --- a/includes/functions/functions_print_lists.php +++ b/includes/functions/functions_print_lists.php @@ -55,8 +55,7 @@ function print_indi_table($datalist, $legend="", $option="") { if (count($datalist)<1) return; $tiny = (count($datalist)<=500); require_once WT_ROOT.'js/sorttable.js.htm'; - require_once WT_ROOT.'includes/classes/class_stats.php'; - $stats = new stats($GEDCOM); + $stats = new WT_Stats($GEDCOM); // Bad data can cause "longest life" to be huge, blowing memory limits $max_age = min($MAX_ALIVE_AGE, $stats->LongestLifeAge())+1; @@ -436,8 +435,7 @@ function print_fam_table($datalist, $legend="", $option="") { if (count($datalist)<1) return; $tiny = (count($datalist)<=500); require_once WT_ROOT.'js/sorttable.js.htm'; - require_once WT_ROOT.'includes/classes/class_stats.php'; - $stats = new stats($GEDCOM); + $stats = new WT_Stats($GEDCOM); $max_age = max($stats->oldestMarriageMaleAge(), $stats->oldestMarriageFemaleAge())+1; //-- init chart data for ($age=0; $age<=$max_age; $age++) $marr_by_age[$age]=""; diff --git a/includes/classes/class_stats.php b/library/WT/Stats.php index 2c1f3080a6..148e0f84dc 100644 --- a/includes/classes/class_stats.php +++ b/library/WT/Stats.php @@ -1,51 +1,44 @@ <?php -/** -* GEDCOM Statistics Class -* -* This class provides a quick & easy method for accessing statistics -* about the GEDCOM. -* -* webtrees: Web based Family History software - * Copyright (C) 2010 webtrees development team. - * - * Derived from PhpGedView -* Copyright (C) 2002 to 2010 PGV Development Team. All rights reserved. -* -* Modifications Copyright (c) 2010 Greg Roach -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -* -* @version $Id$ -* @author Patrick Kellum -* @package webtrees -* @subpackage Lists -*/ +// GEDCOM Statistics Class +// +// This class provides a quick & easy method for accessing statistics +// about the GEDCOM. +// +// webtrees: Web based Family History software +// Copyright (C) 2011 webtrees development team. +// +// Derived from PhpGedView +// Copyright (C) 2002 to 2010 PGV Development Team. All rights reserved. +// +// Modifications Copyright (c) 2010 Greg Roach +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// @version $Id$ if (!defined('WT_WEBTREES')) { header('HTTP/1.0 403 Forbidden'); exit; } -define('WT_CLASS_STATS_PHP', ''); - require_once WT_ROOT.'includes/functions/functions_print_lists.php'; // Methods not allowed to be used in a statistic define('STATS_NOT_ALLOWED', 'stats,getAllTags,getTags'); -class stats { +class WT_Stats { var $_gedcom; var $_gedcom_url; var $_ged_id; diff --git a/modules/gedcom_stats/module.php b/modules/gedcom_stats/module.php index 1405eed030..53c07250e1 100644 --- a/modules/gedcom_stats/module.php +++ b/modules/gedcom_stats/module.php @@ -83,8 +83,7 @@ class gedcom_stats_WT_Module extends WT_Module implements WT_Module_Block { } $title.=i18n::translate('GEDCOM statistics').help_link('index_stats'); - require_once WT_ROOT.'includes/classes/class_stats.php'; - $stats=new stats(WT_GEDCOM); + $stats=new WT_Stats(WT_GEDCOM); $content = "<b><a href=\"index.php?ctype=gedcom\">".PrintReady(strip_tags(get_gedcom_setting(WT_GED_ID, 'title')))."</a></b><br />"; diff --git a/modules/googlemap/placehierarchy.php b/modules/googlemap/placehierarchy.php index 44abf3abdc..d9b1108131 100644 --- a/modules/googlemap/placehierarchy.php +++ b/modules/googlemap/placehierarchy.php @@ -37,8 +37,8 @@ require WT_ROOT.'modules/googlemap/googlemap.php'; if (file_exists(WT_ROOT.'modules/googlemap/defaultconfig.php')) { require WT_ROOT.'modules/googlemap/defaultconfig.php'; } -require_once WT_ROOT.'includes/classes/class_stats.php'; -$stats = new stats($GEDCOM); + +$stats = new WT_Stats($GEDCOM); function check_exist_table() { return WT_DB::table_exists("##placelocation"); diff --git a/modules/html/module.php b/modules/html/module.php index 7422b7cf90..bede0b7fdf 100644 --- a/modules/html/module.php +++ b/modules/html/module.php @@ -31,7 +31,6 @@ if (!defined('WT_WEBTREES')) { } require_once WT_ROOT.'includes/classes/class_module.php'; -require_once WT_ROOT.'includes/classes/class_stats.php'; class html_WT_Module extends WT_Module implements WT_Module_Block { // Extend class WT_Module @@ -82,7 +81,7 @@ class html_WT_Module extends WT_Module implements WT_Module_Block { /* * Initiate the stats object. */ - $stats = new stats($GEDCOM); + $stats = new WT_Stats($GEDCOM); /* * First Pass. diff --git a/modules/top10_givnnames/module.php b/modules/top10_givnnames/module.php index 27f54a1c8e..d9f72ac1dd 100644 --- a/modules/top10_givnnames/module.php +++ b/modules/top10_givnnames/module.php @@ -59,8 +59,7 @@ class top10_givnnames_WT_Module extends WT_Module implements WT_Module_Block { } } - require_once WT_ROOT.'includes/classes/class_stats.php'; - $stats=new Stats(WT_GEDCOM); + $stats=new WT_Stats(WT_GEDCOM); $id=$this->getName().$block_id; $title=''; diff --git a/statistics.php b/statistics.php index 3242ccf1a7..c949755fe4 100644 --- a/statistics.php +++ b/statistics.php @@ -34,7 +34,6 @@ define('WT_SCRIPT_NAME', 'statistics.php'); require './includes/session.php'; -require_once WT_ROOT.'includes/classes/class_stats.php'; // check for on demand content loading if (isset($_REQUEST['tab'])) { @@ -50,7 +49,7 @@ if (isset($content) && $content==1) { /* * Initiate the stats object. */ - $stats = new stats($GEDCOM); + $stats = new WT_Stats($GEDCOM); if ($tab==0) { ?> <div id="pagetab0" class="<?php echo $TEXT_DIRECTION; ?>"> diff --git a/statisticsplot.php b/statisticsplot.php index ab2bdb0672..67df342c63 100644 --- a/statisticsplot.php +++ b/statisticsplot.php @@ -32,11 +32,8 @@ define('WT_SCRIPT_NAME', 'statisticsplot.php'); require './includes/session.php'; -require_once WT_ROOT.'includes/classes/class_stats.php'; -/* - * Initiate the stats object. - */ -$stats = new stats($GEDCOM); + +$stats = new WT_Stats($GEDCOM); // Month of birth function bimo() { |
