summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Roach <fisharebest@gmail.com>2015-03-29 15:59:42 +0100
committerGreg Roach <fisharebest@gmail.com>2015-03-29 20:49:35 +0100
commite2a378d30d9bd3fff591da7a11c7cb5ead502323 (patch)
tree3c4469c2e08eb9059efd61c40a931ada3dbc0e2c
parent06fa22107d3ca09d8b7a2c724decbc30c44d4548 (diff)
downloadwebtrees-e2a378d30d9bd3fff591da7a11c7cb5ead502323.tar.gz
webtrees-e2a378d30d9bd3fff591da7a11c7cb5ead502323.tar.bz2
webtrees-e2a378d30d9bd3fff591da7a11c7cb5ead502323.zip
Split class Module into static and abstract parts
-rw-r--r--admin_module_blocks.php2
-rw-r--r--admin_module_menus.php2
-rw-r--r--admin_module_reports.php2
-rw-r--r--admin_module_sidebar.php2
-rw-r--r--admin_module_tabs.php2
-rw-r--r--admin_modules.php2
-rw-r--r--app/Module.php280
-rw-r--r--app/Module/AbstractModule.php221
-rw-r--r--app/Module/AhnentafelReportModule.php2
-rw-r--r--app/Module/AlbumModule.php2
-rw-r--r--app/Module/BatchUpdate/BirthDeathMarriageReportModule.php2
-rw-r--r--app/Module/BatchUpdateModule.php2
-rw-r--r--app/Module/BirthReportModule.php2
-rw-r--r--app/Module/CemeteryReportModule.php2
-rw-r--r--app/Module/ChangeReportModule.php2
-rw-r--r--app/Module/ChartsBlockModule.php22
-rw-r--r--app/Module/ClippingsCartModule.php2
-rw-r--r--app/Module/DeathReportModule.php2
-rw-r--r--app/Module/DescendancyModule.php2
-rw-r--r--app/Module/DescendancyReportModule.php2
-rw-r--r--app/Module/ExtraInformationModule.php2
-rw-r--r--app/Module/FactSourcesReportModule.php2
-rw-r--r--app/Module/FamiliesSidebarSidebarModule.php2
-rw-r--r--app/Module/FamilyGroupReportModule.php2
-rw-r--r--app/Module/FamilyNavigatorModule.php2
-rw-r--r--app/Module/FamilyTreeFavoritesModule.php8
-rw-r--r--app/Module/FamilyTreeNewsModule.php14
-rw-r--r--app/Module/FamilyTreeStatisticsModule.php112
-rw-r--r--app/Module/FrequentlyAskedQuestionsModule.php14
-rw-r--r--app/Module/GoogleMapsModule.php2
-rw-r--r--app/Module/HtmlBlockModule.php36
-rw-r--r--app/Module/IndividualFactsTabModule.php2
-rw-r--r--app/Module/IndividualFamiliesReportModule.php2
-rw-r--r--app/Module/IndividualReportModule.php2
-rw-r--r--app/Module/IndividualSidebarModule.php2
-rw-r--r--app/Module/InteractiveTreeModule.php2
-rw-r--r--app/Module/LoggedInUsersModule.php2
-rw-r--r--app/Module/LoginBlockModule.php (renamed from modules_v3/login_block/LoginBlockModule.php)6
-rw-r--r--app/Module/MarriageReportModule.php2
-rw-r--r--app/Module/MediaTabModule.php2
-rw-r--r--app/Module/MissingFactsReportModule.php2
-rw-r--r--app/Module/NotesTabModule.php2
-rw-r--r--app/Module/OccupationReportModule.php2
-rw-r--r--app/Module/OnThisDayModule.php32
-rw-r--r--app/Module/PageMenuModule.php2
-rw-r--r--app/Module/PedigreeReportModule.php2
-rw-r--r--app/Module/RecentChangesModule.php32
-rw-r--r--app/Module/RelatedIndividualsReportModule.php2
-rw-r--r--app/Module/RelativesTabModule.php2
-rw-r--r--app/Module/ResearchTaskModule.php26
-rw-r--r--app/Module/ReviewChangesModule.php20
-rw-r--r--app/Module/SiteMapModule.php2
-rw-r--r--app/Module/SlideShowModule.php196
-rw-r--r--app/Module/SourcesTabModule.php2
-rw-r--r--app/Module/StoriesModule.php26
-rw-r--r--app/Module/ThemeSelectModule.php2
-rw-r--r--app/Module/TopGivenNamesModule.php20
-rw-r--r--app/Module/TopPageViewsModule.php20
-rw-r--r--app/Module/TopSurnamesModule.php20
-rw-r--r--app/Module/UpcomingAnniversariesModule.php38
-rw-r--r--app/Module/UserJournalModule.php4
-rw-r--r--app/Module/UserMessagesModule.php8
-rw-r--r--app/Module/UserWelcomeModule.php2
-rw-r--r--app/Module/WelcomeBlockModule.php2
-rw-r--r--app/Module/YahrzeitModule.php26
-rw-r--r--includes/functions/functions_db.php34
-rw-r--r--tests/includes/functions/FunctionsDbTest.php18
-rw-r--r--vendor/composer/autoload_classmap.php3
68 files changed, 669 insertions, 653 deletions
diff --git a/admin_module_blocks.php b/admin_module_blocks.php
index 0754c97258..0cfc5c7566 100644
--- a/admin_module_blocks.php
+++ b/admin_module_blocks.php
@@ -33,7 +33,7 @@ $controller
$action = Filter::post('action');
$modules = Module::getInstalledModules('disabled');
-$modules = array_filter($modules, function(Module $x) { return $x instanceof ModuleBlockInterface; });
+$modules = array_filter($modules, function(AbstractModule $x) { return $x instanceof ModuleBlockInterface; });
if ($action === 'update_mods' && Filter::checkCsrf()) {
foreach ($modules as $module) {
diff --git a/admin_module_menus.php b/admin_module_menus.php
index 37d75b42ad..5039269a4a 100644
--- a/admin_module_menus.php
+++ b/admin_module_menus.php
@@ -26,7 +26,7 @@ $controller
$action = Filter::post('action');
$modules = Module::getInstalledModules('disabled');
-$modules = array_filter($modules, function(Module $x) { return $x instanceof ModuleMenuInterface; });
+$modules = array_filter($modules, function(AbstractModule $x) { return $x instanceof ModuleMenuInterface; });
if ($action === 'update_mods' && Filter::checkCsrf()) {
foreach ($modules as $module) {
diff --git a/admin_module_reports.php b/admin_module_reports.php
index 08084ee780..30ebc93115 100644
--- a/admin_module_reports.php
+++ b/admin_module_reports.php
@@ -26,7 +26,7 @@ $controller
$action = Filter::post('action');
$modules = Module::getInstalledModules('disabled');
-$modules = array_filter($modules, function(Module $x) { return $x instanceof ModuleReportInterface; });
+$modules = array_filter($modules, function(AbstractModule $x) { return $x instanceof ModuleReportInterface; });
if ($action === 'update_mods' && Filter::checkCsrf()) {
foreach ($modules as $module) {
diff --git a/admin_module_sidebar.php b/admin_module_sidebar.php
index a59114b477..34d37af22b 100644
--- a/admin_module_sidebar.php
+++ b/admin_module_sidebar.php
@@ -26,7 +26,7 @@ $controller
$action = Filter::post('action');
$modules = Module::getInstalledModules('disabled');
-$modules = array_filter($modules, function(Module $x) { return $x instanceof ModuleSidebarInterface; });
+$modules = array_filter($modules, function(AbstractModule $x) { return $x instanceof ModuleSidebarInterface; });
if ($action === 'update_mods' && Filter::checkCsrf()) {
foreach ($modules as $module) {
diff --git a/admin_module_tabs.php b/admin_module_tabs.php
index 89a3c54fdc..82f8cabad7 100644
--- a/admin_module_tabs.php
+++ b/admin_module_tabs.php
@@ -26,7 +26,7 @@ $controller
$action = Filter::post('action');
$modules = Module::getInstalledModules('disabled');
-$modules = array_filter($modules, function(Module $x) { return $x instanceof ModuleTabInterface; });
+$modules = array_filter($modules, function(AbstractModule $x) { return $x instanceof ModuleTabInterface; });
if ($action === 'update_mods' && Filter::checkCsrf()) {
foreach ($modules as $module) {
diff --git a/admin_modules.php b/admin_modules.php
index 47407cf96f..ed43db12cb 100644
--- a/admin_modules.php
+++ b/admin_modules.php
@@ -75,7 +75,7 @@ if (Filter::post('action') === 'delete' && Filter::checkCsrf()) {
return;
}
-// Module can’t be found on disk?
+// The module can’t be found on disk?
// Don't delete it automatically. It may be temporarily missing, after a re-installation, etc.
foreach ($module_status as $module_name => $status) {
if (!array_key_exists($module_name, $modules)) {
diff --git a/app/Module.php b/app/Module.php
index 3e484903d8..b901648b62 100644
--- a/app/Module.php
+++ b/app/Module.php
@@ -17,170 +17,16 @@ namespace Fisharebest\Webtrees;
*/
/**
- * Class Module - base class for modules, and static functions for managing
- * and maintaining modules.
+ * Class Module - Static functions for managing and maintaining modules.
*/
-abstract class Module {
- /** @var string A user-friendly, localized name for this module */
- private $title;
-
- /** @var string The directory where the module is installed */
- private $directory;
-
- /** @var string[] A cached copy of the module settings */
- private $settings;
-
- /**
- * Create a new module.
- *
- * @param string $directory Where is this module installed
- */
- public function __construct($directory) {
- $this->directory = $directory;
- $this->title = $this->getTitle();
- }
-
- /**
- * How should this module be labelled on tabs, menus, etc.?
- *
- * @return string
- */
- abstract public function getTitle();
-
- /**
- * A sentence describing what this module does.
- *
- * @return string
- */
- abstract public function getDescription();
-
- /**
- * What is the default access level for this module?
- *
- * Some modules are aimed at admins or managers, and are not generally shown to users.
- *
- * @return integer
- */
- public function defaultAccessLevel() {
- // Returns one of: Auth::PRIV_HIDE, Auth::PRIV_PRIVATE, Auth::PRIV_USER, WT_PRIV_ADMIN
- return Auth::PRIV_PRIVATE;
- }
-
- /**
- * Provide a unique internal name for this module
- *
- * @return string
- */
- public function getName() {
- return basename($this->directory);
- }
-
- /**
- * Load all the settings for the module into a cache.
- *
- * Since modules may have many settings, and will probably want to use
- * lots of them, load them all at once and cache them.
- *
- * @return void
- */
- private function loadAllSettings() {
- if ($this->settings === null) {
- $this->settings = Database::prepare(
- "SELECT SQL_CACHE setting_name, setting_value FROM `##module_setting` WHERE module_name = ?"
- )->execute(array($this->getName()))->fetchAssoc();
- }
- }
-
- /**
- * Get a module setting. Return a default if the setting is not set.
- *
- * @param string $setting_name
- * @param string $default
- *
- * @return string|null
- */
- public function getSetting($setting_name, $default = null) {
- $this->loadAllSettings();
-
- if (array_key_exists($setting_name, $this->settings)) {
- return $this->settings[$setting_name];
- } else {
- return $default;
- }
- }
-
- /**
- * Set a module setting.
- *
- * Since module settings are NOT NULL, setting a value to NULL will cause
- * it to be deleted.
- *
- * @param string $setting_name
- * @param string $setting_value
- */
- public function setSetting($setting_name, $setting_value) {
- $this->loadAllSettings();
-
- if ($setting_value === null) {
- Database::prepare(
- "DELETE FROM `##module_setting` WHERE module_name = ? AND setting_name = ?"
- )->execute(array($this->getName(), $setting_name));
- unset($this->settings[$setting_name]);
- } elseif (!array_key_exists($setting_name, $this->settings)) {
- Database::prepare(
- "INSERT INTO `##module_setting` (module_name, setting_name, setting_value) VALUES (?, ?, ?)"
- )->execute(array($this->getName(), $setting_name, $setting_value));
- $this->settings[$setting_name] = $setting_value;
- } elseif ($setting_value != $this->settings[$setting_name]) {
- Database::prepare(
- "UPDATE `##module_setting` SET setting_value = ? WHERE module_name = ? AND setting_name = ?"
- )->execute(array($setting_value, $this->getName(), $setting_name));
- $this->settings[$setting_name] = $setting_value;
- } else {
- // Setting already exists, but with the same value - do nothing.
- }
- }
-
- /**
- * This is a general purpose hook, allowing modules to respond to routes
- * of the form module.php?mod=FOO&mod_action=BAR
- *
- * @param string $mod_action
- */
- public function modAction($mod_action) {
- }
-
- /**
- * Get a the current access level for a module
- *
- * @param Tree $tree
- * @param string $component - tab, block, menu, etc
- *
- * @return integer
- */
- public function getAccessLevel(Tree $tree, $component) {
- $access_level = Database::prepare(
- "SELECT access_level FROM `##module_privacy` WHERE gedcom_id = :gedcom_id AND module_name = :module_name AND component = :component"
- )->execute(array(
- 'gedcom_id' => $tree->getTreeId(),
- 'module_name' => $this->getName(),
- 'component' => $component,
- ))->fetchOne();
-
- if ($access_level === null) {
- return $this->defaultAccessLevel();
- } else {
- return (int) $access_level;
- }
- }
-
+class Module {
/**
* Get a list of all active (enabled) modules.
*
- * @return Module[]
+ * @return AbstractModule[]
*/
private static function getActiveModules() {
- /** @var Module[] - Only query the database once. */
+ /** @var AbstractModule[] - Only query the database once. */
static $modules;
if ($modules === null) {
@@ -192,13 +38,13 @@ abstract class Module {
foreach ($module_names as $module_name) {
try {
$module = include WT_ROOT . WT_MODULES_DIR . $module_name . '/module.php';
- if ($module instanceof Module) {
+ if ($module instanceof AbstractModule) {
$modules[$module->getName()] = $module;
} else {
throw new \Exception;
}
} catch (\Exception $ex) {
- // Module has been deleted or is broken? Disable it.
+ // The module has been deleted or is broken? Disable it.
Log::addConfigurationLog("Module {$module_name} is missing or broken - disabling it");
Database::prepare(
"UPDATE `##module` SET status = 'disabled' WHERE module_name = :module_name"
@@ -221,7 +67,7 @@ abstract class Module {
* @param Tree $tree
* @param string $component The type of module, such as "tab", "report" or "menu"
*
- * @return Module[]
+ * @return AbstractModule[]
*/
private static function getActiveModulesByComponent(Tree $tree, $component) {
$module_names = Database::prepare(
@@ -247,7 +93,7 @@ abstract class Module {
// The order of menus/sidebars/tabs is defined in the database. Others are sorted by name.
if ($component !== 'menu' && $component !== 'sidebar' && $component !== 'tab') {
- uasort($array, function(Module $x, Module $y) {
+ uasort($array, function(AbstractModule $x, AbstractModule $y) {
return I18N::strcasecmp($x->getTitle(), $y->getTitle());
});
}
@@ -337,7 +183,7 @@ abstract class Module {
*
* @param string $module_name
*
- * @return Module|null
+ * @return AbstractModule|null
*/
public static function getModuleByName($module_name) {
$modules = self::getActiveModules();
@@ -356,7 +202,7 @@ abstract class Module {
*
* @param string $default_status
*
- * @return Module[]
+ * @return AbstractModule[]
*/
public static function getInstalledModules($default_status) {
$modules = array();
@@ -364,7 +210,7 @@ abstract class Module {
foreach (glob(WT_ROOT . WT_MODULES_DIR . '*/module.php') as $file) {
try {
$module = include $file;
- if ($module instanceof Module) {
+ if ($module instanceof AbstractModule) {
$modules[$module->getName()] = $module;
Database::prepare("INSERT IGNORE INTO `##module` (module_name, status, menu_order, sidebar_order, tab_order) VALUES (?, ?, ?, ?, ?)")->execute(array(
$module->getName(),
@@ -373,64 +219,64 @@ abstract class Module {
$module instanceof ModuleSidebarInterface ? $module->defaultSidebarOrder() : null,
$module instanceof ModuleTabInterface ? $module->defaultTabOrder() : null,
));
- }
- // Set the default privcy for this module. Note that this also sets it for the
- // default family tree, with a gedcom_id of -1
- if ($module instanceof ModuleMenuInterface) {
- Database::prepare(
- "INSERT IGNORE INTO `##module_privacy` (module_name, gedcom_id, component, access_level)" .
- " SELECT ?, gedcom_id, 'menu', ?" .
- " FROM `##gedcom`"
- )->execute(array($module->getName(), $module->defaultAccessLevel()));
- }
- if ($module instanceof ModuleSidebarInterface) {
- Database::prepare(
- "INSERT IGNORE INTO `##module_privacy` (module_name, gedcom_id, component, access_level)" .
- " SELECT ?, gedcom_id, 'sidebar', ?" .
- " FROM `##gedcom`"
- )->execute(array($module->getName(), $module->defaultAccessLevel()));
- }
- if ($module instanceof ModuleTabInterface) {
- Database::prepare(
- "INSERT IGNORE INTO `##module_privacy` (module_name, gedcom_id, component, access_level)" .
- " SELECT ?, gedcom_id, 'tab', ?" .
- " FROM `##gedcom`"
- )->execute(array($module->getName(), $module->defaultAccessLevel()));
- }
- if ($module instanceof ModuleBlockInterface) {
- Database::prepare(
- "INSERT IGNORE INTO `##module_privacy` (module_name, gedcom_id, component, access_level)" .
- " SELECT ?, gedcom_id, 'block', ?" .
- " FROM `##gedcom`"
- )->execute(array($module->getName(), $module->defaultAccessLevel()));
- }
- if ($module instanceof ModuleChartInterface) {
- Database::prepare(
- "INSERT IGNORE INTO `##module_privacy` (module_name, gedcom_id, component, access_level)" .
- " SELECT ?, gedcom_id, 'chart', ?" .
- " FROM `##gedcom`"
- )->execute(array($module->getName(), $module->defaultAccessLevel()));
- }
- if ($module instanceof ModuleReportInterface) {
- Database::prepare(
- "INSERT IGNORE INTO `##module_privacy` (module_name, gedcom_id, component, access_level)" .
- " SELECT ?, gedcom_id, 'report', ?" .
- " FROM `##gedcom`"
- )->execute(array($module->getName(), $module->defaultAccessLevel()));
- }
- if ($module instanceof ModuleThemeInterface) {
- Database::prepare(
- "INSERT IGNORE INTO `##module_privacy` (module_name, gedcom_id, component, access_level)" .
- " SELECT ?, gedcom_id, 'theme', ?" .
- " FROM `##gedcom`"
- )->execute(array($module->getName(), $module->defaultAccessLevel()));
+ // Set the default privcy for this module. Note that this also sets it for the
+ // default family tree, with a gedcom_id of -1
+ if ($module instanceof ModuleMenuInterface) {
+ Database::prepare(
+ "INSERT IGNORE INTO `##module_privacy` (module_name, gedcom_id, component, access_level)" .
+ " SELECT ?, gedcom_id, 'menu', ?" .
+ " FROM `##gedcom`"
+ )->execute(array($module->getName(), $module->defaultAccessLevel()));
+ }
+ if ($module instanceof ModuleSidebarInterface) {
+ Database::prepare(
+ "INSERT IGNORE INTO `##module_privacy` (module_name, gedcom_id, component, access_level)" .
+ " SELECT ?, gedcom_id, 'sidebar', ?" .
+ " FROM `##gedcom`"
+ )->execute(array($module->getName(), $module->defaultAccessLevel()));
+ }
+ if ($module instanceof ModuleTabInterface) {
+ Database::prepare(
+ "INSERT IGNORE INTO `##module_privacy` (module_name, gedcom_id, component, access_level)" .
+ " SELECT ?, gedcom_id, 'tab', ?" .
+ " FROM `##gedcom`"
+ )->execute(array($module->getName(), $module->defaultAccessLevel()));
+ }
+ if ($module instanceof ModuleBlockInterface) {
+ Database::prepare(
+ "INSERT IGNORE INTO `##module_privacy` (module_name, gedcom_id, component, access_level)" .
+ " SELECT ?, gedcom_id, 'block', ?" .
+ " FROM `##gedcom`"
+ )->execute(array($module->getName(), $module->defaultAccessLevel()));
+ }
+ if ($module instanceof ModuleChartInterface) {
+ Database::prepare(
+ "INSERT IGNORE INTO `##module_privacy` (module_name, gedcom_id, component, access_level)" .
+ " SELECT ?, gedcom_id, 'chart', ?" .
+ " FROM `##gedcom`"
+ )->execute(array($module->getName(), $module->defaultAccessLevel()));
+ }
+ if ($module instanceof ModuleReportInterface) {
+ Database::prepare(
+ "INSERT IGNORE INTO `##module_privacy` (module_name, gedcom_id, component, access_level)" .
+ " SELECT ?, gedcom_id, 'report', ?" .
+ " FROM `##gedcom`"
+ )->execute(array($module->getName(), $module->defaultAccessLevel()));
+ }
+ if ($module instanceof ModuleThemeInterface) {
+ Database::prepare(
+ "INSERT IGNORE INTO `##module_privacy` (module_name, gedcom_id, component, access_level)" .
+ " SELECT ?, gedcom_id, 'theme', ?" .
+ " FROM `##gedcom`"
+ )->execute(array($module->getName(), $module->defaultAccessLevel()));
+ }
}
} catch (\Exception $ex) {
// Old or invalid module?
}
}
- uasort($modules, function(Module $x, Module $y) {
+ uasort($modules, function(AbstractModule $x, AbstractModule $y) {
return I18N::strcasecmp($x->getTitle(), $y->getTitle());
});
diff --git a/app/Module/AbstractModule.php b/app/Module/AbstractModule.php
new file mode 100644
index 0000000000..9f6d617a1e
--- /dev/null
+++ b/app/Module/AbstractModule.php
@@ -0,0 +1,221 @@
+<?php
+namespace Fisharebest\Webtrees;
+
+/**
+ * webtrees: online genealogy
+ * Copyright (C) 2015 webtrees development team
+ * 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 3 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, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * Class AbstractModule - common functions for blocks
+ */
+abstract class AbstractModule {
+ /** @var string A user-friendly, localized name for this module */
+ private $title;
+
+ /** @var string The directory where the module is installed */
+ private $directory;
+
+ /** @var string[] A cached copy of the module settings */
+ private $settings;
+
+ /**
+ * Create a new module.
+ *
+ * @param string $directory Where is this module installed
+ */
+ public function __construct($directory) {
+ $this->directory = $directory;
+ $this->title = $this->getTitle();
+ }
+
+ /**
+ * @param integer $block_id
+ * @param string $setting_name
+ * @param string|null $default_value
+ *
+ * @return null|string
+ */
+ public function getBlockSetting($block_id, $setting_name, $default_value = null) {
+ $setting_value = Database::prepare(
+ "SELECT SQL_CACHE setting_value FROM `##block_setting` WHERE block_id = :block_id AND setting_name = :setting_name"
+ )->execute(array(
+ 'block_id' => $block_id,
+ 'setting_name' => $setting_name,
+ ))->fetchOne();
+
+ return $setting_value === null ? $default_value : $setting_value;
+ }
+
+ /**
+ * @param integer $block_id
+ * @param string $setting_name
+ * @param string|null $setting_value
+ *
+ * @return $this
+ */
+ public function setBlockSetting($block_id, $setting_name, $setting_value) {
+ if ($setting_value === null) {
+ Database::prepare(
+ "DELETE FROM `##block_setting` WHERE block_id = :block_id AND setting_name = :setting_name"
+ )->execute(array(
+ 'block_id' => $block_id,
+ 'setting_name' => $setting_name,
+ ));
+ } else {
+ Database::prepare(
+ "REPLACE INTO `##block_setting` (block_id, setting_name, setting_value) VALUES (:block_id, :setting_name, :setting_value)"
+ )->execute(array(
+ 'block_id' => $block_id,
+ 'setting_name' => $setting_name,
+ 'setting_value' => $setting_value,
+ ));
+ }
+
+ return $this;
+ }
+
+ /**
+ * How should this module be labelled on tabs, menus, etc.?
+ *
+ * @return string
+ */
+ abstract public function getTitle();
+
+ /**
+ * A sentence describing what this module does.
+ *
+ * @return string
+ */
+ abstract public function getDescription();
+
+ /**
+ * What is the default access level for this module?
+ *
+ * Some modules are aimed at admins or managers, and are not generally shown to users.
+ *
+ * @return integer
+ */
+ public function defaultAccessLevel() {
+ // Returns one of: Auth::PRIV_HIDE, Auth::PRIV_PRIVATE, Auth::PRIV_USER, WT_PRIV_ADMIN
+ return Auth::PRIV_PRIVATE;
+ }
+
+ /**
+ * Provide a unique internal name for this module
+ *
+ * @return string
+ */
+ public function getName() {
+ return basename($this->directory);
+ }
+
+ /**
+ * Load all the settings for the module into a cache.
+ *
+ * Since modules may have many settings, and will probably want to use
+ * lots of them, load them all at once and cache them.
+ *
+ * @return void
+ */
+ private function loadAllSettings() {
+ if ($this->settings === null) {
+ $this->settings = Database::prepare(
+ "SELECT SQL_CACHE setting_name, setting_value FROM `##module_setting` WHERE module_name = ?"
+ )->execute(array($this->getName()))->fetchAssoc();
+ }
+ }
+
+ /**
+ * Get a module setting. Return a default if the setting is not set.
+ *
+ * @param string $setting_name
+ * @param string $default
+ *
+ * @return string|null
+ */
+ public function getSetting($setting_name, $default = null) {
+ $this->loadAllSettings();
+
+ if (array_key_exists($setting_name, $this->settings)) {
+ return $this->settings[$setting_name];
+ } else {
+ return $default;
+ }
+ }
+
+ /**
+ * Set a module setting.
+ *
+ * Since module settings are NOT NULL, setting a value to NULL will cause
+ * it to be deleted.
+ *
+ * @param string $setting_name
+ * @param string $setting_value
+ */
+ public function setSetting($setting_name, $setting_value) {
+ $this->loadAllSettings();
+
+ if ($setting_value === null) {
+ Database::prepare(
+ "DELETE FROM `##module_setting` WHERE module_name = ? AND setting_name = ?"
+ )->execute(array($this->getName(), $setting_name));
+ unset($this->settings[$setting_name]);
+ } elseif (!array_key_exists($setting_name, $this->settings)) {
+ Database::prepare(
+ "INSERT INTO `##module_setting` (module_name, setting_name, setting_value) VALUES (?, ?, ?)"
+ )->execute(array($this->getName(), $setting_name, $setting_value));
+ $this->settings[$setting_name] = $setting_value;
+ } elseif ($setting_value != $this->settings[$setting_name]) {
+ Database::prepare(
+ "UPDATE `##module_setting` SET setting_value = ? WHERE module_name = ? AND setting_name = ?"
+ )->execute(array($setting_value, $this->getName(), $setting_name));
+ $this->settings[$setting_name] = $setting_value;
+ } else {
+ // Setting already exists, but with the same value - do nothing.
+ }
+ }
+
+ /**
+ * This is a general purpose hook, allowing modules to respond to routes
+ * of the form module.php?mod=FOO&mod_action=BAR
+ *
+ * @param string $mod_action
+ */
+ public function modAction($mod_action) {
+ }
+
+ /**
+ * Get a the current access level for a module
+ *
+ * @param Tree $tree
+ * @param string $component - tab, block, menu, etc
+ *
+ * @return integer
+ */
+ public function getAccessLevel(Tree $tree, $component) {
+ $access_level = Database::prepare(
+ "SELECT access_level FROM `##module_privacy` WHERE gedcom_id = :gedcom_id AND module_name = :module_name AND component = :component"
+ )->execute(array(
+ 'gedcom_id' => $tree->getTreeId(),
+ 'module_name' => $this->getName(),
+ 'component' => $component,
+ ))->fetchOne();
+
+ if ($access_level === null) {
+ return $this->defaultAccessLevel();
+ } else {
+ return (int) $access_level;
+ }
+ }
+}
diff --git a/app/Module/AhnentafelReportModule.php b/app/Module/AhnentafelReportModule.php
index a931e8b1d9..384b240d41 100644
--- a/app/Module/AhnentafelReportModule.php
+++ b/app/Module/AhnentafelReportModule.php
@@ -19,7 +19,7 @@ namespace Fisharebest\Webtrees;
/**
* Class AhnentafelReportModule
*/
-class AhnentafelReportModule extends Module implements ModuleReportInterface {
+class AhnentafelReportModule extends AbstractModule implements ModuleReportInterface {
/** {@inheritdoc} */
public function getTitle() {
// This text also appears in the .XML file - update both together
diff --git a/app/Module/AlbumModule.php b/app/Module/AlbumModule.php
index 0e57e24cf8..f9cae7a09c 100644
--- a/app/Module/AlbumModule.php
+++ b/app/Module/AlbumModule.php
@@ -19,7 +19,7 @@ namespace Fisharebest\Webtrees;
/**
* Class AlbumModule
*/
-class AlbumModule extends Module implements ModuleTabInterface {
+class AlbumModule extends AbstractModule implements ModuleTabInterface {
private $media_list;
/** {@inheritdoc} */
diff --git a/app/Module/BatchUpdate/BirthDeathMarriageReportModule.php b/app/Module/BatchUpdate/BirthDeathMarriageReportModule.php
index 27e0b6c946..ca6f82b9a0 100644
--- a/app/Module/BatchUpdate/BirthDeathMarriageReportModule.php
+++ b/app/Module/BatchUpdate/BirthDeathMarriageReportModule.php
@@ -19,7 +19,7 @@ namespace Fisharebest\Webtrees;
/**
* Class BirthDeathMarriageReportModule
*/
-class BirthDeathMarriageReportModule extends Module implements ModuleReportInterface {
+class BirthDeathMarriageReportModule extends AbstractModule implements ModuleReportInterface {
/** {@inheritdoc} */
public function getTitle() {
// This text also appears in the .XML file - update both together
diff --git a/app/Module/BatchUpdateModule.php b/app/Module/BatchUpdateModule.php
index 6866678793..571c8708f2 100644
--- a/app/Module/BatchUpdateModule.php
+++ b/app/Module/BatchUpdateModule.php
@@ -19,7 +19,7 @@ namespace Fisharebest\Webtrees;
/**
* Class BatchUpdateModule
*/
-class BatchUpdateModule extends Module implements ModuleConfigInterface {
+class BatchUpdateModule extends AbstractModule implements ModuleConfigInterface {
/** @var string Form parameter: chosen plugin*/
private $plugin;
diff --git a/app/Module/BirthReportModule.php b/app/Module/BirthReportModule.php
index c7253d19e6..7c7bea4ebe 100644
--- a/app/Module/BirthReportModule.php
+++ b/app/Module/BirthReportModule.php
@@ -19,7 +19,7 @@ namespace Fisharebest\Webtrees;
/**
* Class BirthReportModule
*/
-class BirthReportModule extends Module implements ModuleReportInterface {
+class BirthReportModule extends AbstractModule implements ModuleReportInterface {
/** {@inheritdoc} */
public function getTitle() {
// This text also appears in the .XML file - update both together
diff --git a/app/Module/CemeteryReportModule.php b/app/Module/CemeteryReportModule.php
index 69ad22dbdf..c26bcf70a2 100644
--- a/app/Module/CemeteryReportModule.php
+++ b/app/Module/CemeteryReportModule.php
@@ -19,7 +19,7 @@ namespace Fisharebest\Webtrees;
/**
* Class CemeteryReportModule
*/
-class CemeteryReportModule extends Module implements ModuleReportInterface {
+class CemeteryReportModule extends AbstractModule implements ModuleReportInterface {
/** {@inheritdoc} */
public function getTitle() {
// This text also appears in the .XML file - update both together
diff --git a/app/Module/ChangeReportModule.php b/app/Module/ChangeReportModule.php
index 8b84fc5faf..f4f570b232 100644
--- a/app/Module/ChangeReportModule.php
+++ b/app/Module/ChangeReportModule.php
@@ -19,7 +19,7 @@ namespace Fisharebest\Webtrees;
/**
* Class ChangeReportModule
*/
-class ChangeReportModule extends Module implements ModuleReportInterface {
+class ChangeReportModule extends AbstractModule implements ModuleReportInterface {
/** {@inheritdoc} */
public function getTitle() {
// This text also appears in the .XML file - update both together
diff --git a/app/Module/ChartsBlockModule.php b/app/Module/ChartsBlockModule.php
index e7db563108..61e7a15263 100644
--- a/app/Module/ChartsBlockModule.php
+++ b/app/Module/ChartsBlockModule.php
@@ -19,7 +19,7 @@ namespace Fisharebest\Webtrees;
/**
* Class ChartsBlockModule
*/
-class ChartsBlockModule extends Module implements ModuleBlockInterface {
+class ChartsBlockModule extends AbstractModule implements ModuleBlockInterface {
/** {@inheritdoc} */
public function getTitle() {
return /* I18N: Name of a module/block */ I18N::translate('Charts');
@@ -37,9 +37,9 @@ class ChartsBlockModule extends Module implements ModuleBlockInterface {
$PEDIGREE_ROOT_ID = $WT_TREE->getPreference('PEDIGREE_ROOT_ID');
$gedcomid = $WT_TREE->getUserPreference(Auth::user(), 'gedcomid');
- $details = get_block_setting($block_id, 'details', '0');
- $type = get_block_setting($block_id, 'type', 'pedigree');
- $pid = get_block_setting($block_id, 'pid', Auth::check() ? ($gedcomid ? $gedcomid : $PEDIGREE_ROOT_ID) : $PEDIGREE_ROOT_ID);
+ $details = $this->getBlockSetting($block_id, 'details', '0');
+ $type = $this->getBlockSetting($block_id, 'type', 'pedigree');
+ $pid = $this->getBlockSetting($block_id, 'pid', Auth::check() ? ($gedcomid ? $gedcomid : $PEDIGREE_ROOT_ID) : $PEDIGREE_ROOT_ID);
if ($cfg) {
foreach (array('details', 'type', 'pid', 'block') as $name) {
@@ -52,7 +52,7 @@ class ChartsBlockModule extends Module implements ModuleBlockInterface {
$person = Individual::getInstance($pid, $WT_TREE);
if (!$person) {
$pid = $PEDIGREE_ROOT_ID;
- set_block_setting($block_id, 'pid', $pid);
+ $this->setBlockSetting($block_id, 'pid', $pid);
$person = Individual::getInstance($pid, $WT_TREE);
}
@@ -154,14 +154,14 @@ class ChartsBlockModule extends Module implements ModuleBlockInterface {
$gedcomid = $WT_TREE->getUserPreference(Auth::user(), 'gedcomid');
if (Filter::postBool('save') && Filter::checkCsrf()) {
- set_block_setting($block_id, 'details', Filter::postBool('details'));
- set_block_setting($block_id, 'type', Filter::post('type', 'pedigree|descendants|hourglass|treenav', 'pedigree'));
- set_block_setting($block_id, 'pid', Filter::post('pid', WT_REGEX_XREF));
+ $this->setBlockSetting($block_id, 'details', Filter::postBool('details'));
+ $this->setBlockSetting($block_id, 'type', Filter::post('type', 'pedigree|descendants|hourglass|treenav', 'pedigree'));
+ $this->setBlockSetting($block_id, 'pid', Filter::post('pid', WT_REGEX_XREF));
}
- $details = get_block_setting($block_id, 'details', '0');
- $type = get_block_setting($block_id, 'type', 'pedigree');
- $pid = get_block_setting($block_id, 'pid', Auth::check() ? ($gedcomid ? $gedcomid : $PEDIGREE_ROOT_ID) : $PEDIGREE_ROOT_ID);
+ $details = $this->getBlockSetting($block_id, 'details', '0');
+ $type = $this->getBlockSetting($block_id, 'type', 'pedigree');
+ $pid = $this->getBlockSetting($block_id, 'pid', Auth::check() ? ($gedcomid ? $gedcomid : $PEDIGREE_ROOT_ID) : $PEDIGREE_ROOT_ID);
$controller
->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)
diff --git a/app/Module/ClippingsCartModule.php b/app/Module/ClippingsCartModule.php
index 9226314e66..2959e40dea 100644
--- a/app/Module/ClippingsCartModule.php
+++ b/app/Module/ClippingsCartModule.php
@@ -21,7 +21,7 @@ use Zend_Session;
/**
* Class ClippingsCartModule
*/
-class ClippingsCartModule extends Module implements ModuleMenuInterface, ModuleSidebarInterface {
+class ClippingsCartModule extends AbstractModule implements ModuleMenuInterface, ModuleSidebarInterface {
/** {@inheritdoc} */
public function getTitle() {
diff --git a/app/Module/DeathReportModule.php b/app/Module/DeathReportModule.php
index 2123796a68..84bc6f4079 100644
--- a/app/Module/DeathReportModule.php
+++ b/app/Module/DeathReportModule.php
@@ -19,7 +19,7 @@ namespace Fisharebest\Webtrees;
/**
* Class DeathReportModule
*/
-class DeathReportModule extends Module implements ModuleReportInterface {
+class DeathReportModule extends AbstractModule implements ModuleReportInterface {
/** {@inheritdoc} */
public function getTitle() {
// This text also appears in the .XML file - update both together
diff --git a/app/Module/DescendancyModule.php b/app/Module/DescendancyModule.php
index 8439920d3c..27a3ac277e 100644
--- a/app/Module/DescendancyModule.php
+++ b/app/Module/DescendancyModule.php
@@ -21,7 +21,7 @@ use Zend_Session;
/**
* Class DescendancyModule
*/
-class DescendancyModule extends Module implements ModuleSidebarInterface {
+class DescendancyModule extends AbstractModule implements ModuleSidebarInterface {
/** {@inheritdoc} */
public function getTitle() {
return /* I18N: Name of a module/sidebar */
diff --git a/app/Module/DescendancyReportModule.php b/app/Module/DescendancyReportModule.php
index f3e0086ddb..82b4b2c558 100644
--- a/app/Module/DescendancyReportModule.php
+++ b/app/Module/DescendancyReportModule.php
@@ -19,7 +19,7 @@ namespace Fisharebest\Webtrees;
/**
* Class DescendancyReportModule
*/
-class DescendancyReportModule extends Module implements ModuleReportInterface {
+class DescendancyReportModule extends AbstractModule implements ModuleReportInterface {
/** {@inheritdoc} */
public function getTitle() {
// This text also appears in the .XML file - update both together
diff --git a/app/Module/ExtraInformationModule.php b/app/Module/ExtraInformationModule.php
index 8641aae33f..44d1cab5ee 100644
--- a/app/Module/ExtraInformationModule.php
+++ b/app/Module/ExtraInformationModule.php
@@ -20,7 +20,7 @@ namespace Fisharebest\Webtrees;
* Class ExtraInformationModule
* A sidebar to show non-genealogy information about an individual
*/
-class ExtraInformationModule extends Module implements ModuleSidebarInterface {
+class ExtraInformationModule extends AbstractModule implements ModuleSidebarInterface {
/** {@inheritdoc} */
public function getTitle() {
return /* I18N: Name of a module/sidebar */ I18N::translate('Extra information');
diff --git a/app/Module/FactSourcesReportModule.php b/app/Module/FactSourcesReportModule.php
index 24c9200ea0..2fdfe299d0 100644
--- a/app/Module/FactSourcesReportModule.php
+++ b/app/Module/FactSourcesReportModule.php
@@ -19,7 +19,7 @@ namespace Fisharebest\Webtrees;
/**
* Class FactSourcesReportModule
*/
-class FactSourcesReportModule extends Module implements ModuleReportInterface {
+class FactSourcesReportModule extends AbstractModule implements ModuleReportInterface {
/** {@inheritdoc} */
public function getTitle() {
// This text also appears in the .XML file - update both together
diff --git a/app/Module/FamiliesSidebarSidebarModule.php b/app/Module/FamiliesSidebarSidebarModule.php
index b1cb342e8c..3f678b9b93 100644
--- a/app/Module/FamiliesSidebarSidebarModule.php
+++ b/app/Module/FamiliesSidebarSidebarModule.php
@@ -21,7 +21,7 @@ use Zend_Session;
/**
* Class FamiliesSidebarModule
*/
-class FamiliesSidebarModule extends Module implements ModuleSidebarInterface {
+class FamiliesSidebarModule extends AbstractModule implements ModuleSidebarInterface {
/** {@inheritdoc} */
public function getTitle() {
return /* I18N: Name of a module/sidebar */ I18N::translate('Family list');
diff --git a/app/Module/FamilyGroupReportModule.php b/app/Module/FamilyGroupReportModule.php
index e8ea1c79d3..8c3194d381 100644
--- a/app/Module/FamilyGroupReportModule.php
+++ b/app/Module/FamilyGroupReportModule.php
@@ -19,7 +19,7 @@ namespace Fisharebest\Webtrees;
/**
* Class FamilyGroupReportModule
*/
-class FamilyGroupReportModule extends Module implements ModuleReportInterface {
+class FamilyGroupReportModule extends AbstractModule implements ModuleReportInterface {
/** {@inheritdoc} */
public function getTitle() {
// This text also appears in the .XML file - update both together
diff --git a/app/Module/FamilyNavigatorModule.php b/app/Module/FamilyNavigatorModule.php
index 379ca216da..a707c2d82d 100644
--- a/app/Module/FamilyNavigatorModule.php
+++ b/app/Module/FamilyNavigatorModule.php
@@ -19,7 +19,7 @@ namespace Fisharebest\Webtrees;
/**
* Class FamilyNavigatorModule
*/
-class FamilyNavigatorModule extends Module implements ModuleSidebarInterface {
+class FamilyNavigatorModule extends AbstractModule implements ModuleSidebarInterface {
const TTL = "<div class='flyout2'>%s</div>";
const LNK = "<div class='flyout3' data-href='%s'>%s</div>";
diff --git a/app/Module/FamilyTreeFavoritesModule.php b/app/Module/FamilyTreeFavoritesModule.php
index d3f3fc1baa..870864fc5e 100644
--- a/app/Module/FamilyTreeFavoritesModule.php
+++ b/app/Module/FamilyTreeFavoritesModule.php
@@ -26,7 +26,7 @@ use Rhumsaa\Uuid\Uuid;
* Note that the user favorites module simply extends this module, so ensure that the
* logic works for both.
*/
-class FamilyTreeFavoritesModule extends Module implements ModuleBlockInterface {
+class FamilyTreeFavoritesModule extends AbstractModule implements ModuleBlockInterface {
/** {@inheritdoc} */
public function getTitle() {
return /* I18N: Name of a module */ I18N::translate('Favorites');
@@ -84,7 +84,7 @@ class FamilyTreeFavoritesModule extends Module implements ModuleBlockInterface {
break;
}
- $block = get_block_setting($block_id, 'block', '0');
+ $block = $this->getBlockSetting($block_id, 'block', '0');
if ($cfg) {
foreach (array('block') as $name) {
@@ -219,10 +219,10 @@ class FamilyTreeFavoritesModule extends Module implements ModuleBlockInterface {
/** {@inheritdoc} */
public function configureBlock($block_id) {
if (Filter::postBool('save') && Filter::checkCsrf()) {
- set_block_setting($block_id, 'block', Filter::postBool('block'));
+ $this->setBlockSetting($block_id, 'block', Filter::postBool('block'));
}
- $block = get_block_setting($block_id, 'block', '0');
+ $block = $this->getBlockSetting($block_id, 'block', '0');
echo '<tr><td class="descriptionbox wrap width33">';
echo /* I18N: label for a yes/no option */ I18N::translate('Add a scrollbar when block contents grow');
diff --git a/app/Module/FamilyTreeNewsModule.php b/app/Module/FamilyTreeNewsModule.php
index 27429d6a7a..9aac7039a1 100644
--- a/app/Module/FamilyTreeNewsModule.php
+++ b/app/Module/FamilyTreeNewsModule.php
@@ -19,7 +19,7 @@ namespace Fisharebest\Webtrees;
/**
* Class FamilyTreeNewsModule
*/
-class FamilyTreeNewsModule extends Module implements ModuleBlockInterface {
+class FamilyTreeNewsModule extends AbstractModule implements ModuleBlockInterface {
/** {@inheritdoc} */
public function getTitle() {
return /* I18N: Name of a module */ I18N::translate('News');
@@ -47,11 +47,11 @@ class FamilyTreeNewsModule extends Module implements ModuleBlockInterface {
$limit = 'nolimit';
$flag = '0';
} else {
- $flag = get_block_setting($block_id, 'flag', 0);
+ $flag = $this->getBlockSetting($block_id, 'flag', 0);
if ($flag === '0') {
$limit = 'nolimit';
} else {
- $limit = get_block_setting($block_id, 'limit', 'nolimit');
+ $limit = $this->getBlockSetting($block_id, 'limit', 'nolimit');
}
}
if ($cfg) {
@@ -142,12 +142,12 @@ class FamilyTreeNewsModule extends Module implements ModuleBlockInterface {
/** {@inheritdoc} */
public function configureBlock($block_id) {
if (Filter::postBool('save') && Filter::checkCsrf()) {
- set_block_setting($block_id, 'limit', Filter::post('limit'));
- set_block_setting($block_id, 'flag', Filter::post('flag'));
+ $this->setBlockSetting($block_id, 'limit', Filter::post('limit'));
+ $this->setBlockSetting($block_id, 'flag', Filter::post('flag'));
}
- $limit = get_block_setting($block_id, 'limit', 'nolimit');
- $flag = get_block_setting($block_id, 'flag', 0);
+ $limit = $this->getBlockSetting($block_id, 'limit', 'nolimit');
+ $flag = $this->getBlockSetting($block_id, 'flag', 0);
echo
'<tr><td class="descriptionbox wrap width33">',
diff --git a/app/Module/FamilyTreeStatisticsModule.php b/app/Module/FamilyTreeStatisticsModule.php
index 7572990da5..c9e360d6f9 100644
--- a/app/Module/FamilyTreeStatisticsModule.php
+++ b/app/Module/FamilyTreeStatisticsModule.php
@@ -19,7 +19,7 @@ namespace Fisharebest\Webtrees;
/**
* Class FamilyTreeStatisticsModule
*/
-class FamilyTreeStatisticsModule extends Module implements ModuleBlockInterface {
+class FamilyTreeStatisticsModule extends AbstractModule implements ModuleBlockInterface {
/** {@inheritdoc} */
public function getTitle() {
return /* I18N: Name of a module */ I18N::translate('Statistics');
@@ -34,24 +34,24 @@ class FamilyTreeStatisticsModule extends Module implements ModuleBlockInterface
public function getBlock($block_id, $template = true, $cfg = null) {
global $WT_TREE, $ctype;
- $show_last_update = get_block_setting($block_id, 'show_last_update', '1');
- $show_common_surnames = get_block_setting($block_id, 'show_common_surnames', '1');
- $stat_indi = get_block_setting($block_id, 'stat_indi', '1');
- $stat_fam = get_block_setting($block_id, 'stat_fam', '1');
- $stat_sour = get_block_setting($block_id, 'stat_sour', '1');
- $stat_media = get_block_setting($block_id, 'stat_media', '1');
- $stat_repo = get_block_setting($block_id, 'stat_repo', '1');
- $stat_surname = get_block_setting($block_id, 'stat_surname', '1');
- $stat_events = get_block_setting($block_id, 'stat_events', '1');
- $stat_users = get_block_setting($block_id, 'stat_users', '1');
- $stat_first_birth = get_block_setting($block_id, 'stat_first_birth', '1');
- $stat_last_birth = get_block_setting($block_id, 'stat_last_birth', '1');
- $stat_first_death = get_block_setting($block_id, 'stat_first_death', '1');
- $stat_last_death = get_block_setting($block_id, 'stat_last_death', '1');
- $stat_long_life = get_block_setting($block_id, 'stat_long_life', '1');
- $stat_avg_life = get_block_setting($block_id, 'stat_avg_life', '1');
- $stat_most_chil = get_block_setting($block_id, 'stat_most_chil', '1');
- $stat_avg_chil = get_block_setting($block_id, 'stat_avg_chil', '1');
+ $show_last_update = $this->getBlockSetting($block_id, 'show_last_update', '1');
+ $show_common_surnames = $this->getBlockSetting($block_id, 'show_common_surnames', '1');
+ $stat_indi = $this->getBlockSetting($block_id, 'stat_indi', '1');
+ $stat_fam = $this->getBlockSetting($block_id, 'stat_fam', '1');
+ $stat_sour = $this->getBlockSetting($block_id, 'stat_sour', '1');
+ $stat_media = $this->getBlockSetting($block_id, 'stat_media', '1');
+ $stat_repo = $this->getBlockSetting($block_id, 'stat_repo', '1');
+ $stat_surname = $this->getBlockSetting($block_id, 'stat_surname', '1');
+ $stat_events = $this->getBlockSetting($block_id, 'stat_events', '1');
+ $stat_users = $this->getBlockSetting($block_id, 'stat_users', '1');
+ $stat_first_birth = $this->getBlockSetting($block_id, 'stat_first_birth', '1');
+ $stat_last_birth = $this->getBlockSetting($block_id, 'stat_last_birth', '1');
+ $stat_first_death = $this->getBlockSetting($block_id, 'stat_first_death', '1');
+ $stat_last_death = $this->getBlockSetting($block_id, 'stat_last_death', '1');
+ $stat_long_life = $this->getBlockSetting($block_id, 'stat_long_life', '1');
+ $stat_avg_life = $this->getBlockSetting($block_id, 'stat_avg_life', '1');
+ $stat_most_chil = $this->getBlockSetting($block_id, 'stat_most_chil', '1');
+ $stat_avg_chil = $this->getBlockSetting($block_id, 'stat_avg_chil', '1');
// This can be overriden when embedding in an HTML block
$block = '0';
@@ -224,45 +224,45 @@ class FamilyTreeStatisticsModule extends Module implements ModuleBlockInterface
/** {@inheritdoc} */
public function configureBlock($block_id) {
if (Filter::postBool('save') && Filter::checkCsrf()) {
- set_block_setting($block_id, 'show_last_update', Filter::postBool('show_last_update'));
- set_block_setting($block_id, 'show_common_surnames', Filter::postBool('show_common_surnames'));
- set_block_setting($block_id, 'stat_indi', Filter::postBool('stat_indi'));
- set_block_setting($block_id, 'stat_fam', Filter::postBool('stat_fam'));
- set_block_setting($block_id, 'stat_sour', Filter::postBool('stat_sour'));
- set_block_setting($block_id, 'stat_other', Filter::postBool('stat_other'));
- set_block_setting($block_id, 'stat_media', Filter::postBool('stat_media'));
- set_block_setting($block_id, 'stat_repo', Filter::postBool('stat_repo'));
- set_block_setting($block_id, 'stat_surname', Filter::postBool('stat_surname'));
- set_block_setting($block_id, 'stat_events', Filter::postBool('stat_events'));
- set_block_setting($block_id, 'stat_users', Filter::postBool('stat_users'));
- set_block_setting($block_id, 'stat_first_birth', Filter::postBool('stat_first_birth'));
- set_block_setting($block_id, 'stat_last_birth', Filter::postBool('stat_last_birth'));
- set_block_setting($block_id, 'stat_first_death', Filter::postBool('stat_first_death'));
- set_block_setting($block_id, 'stat_last_death', Filter::postBool('stat_last_death'));
- set_block_setting($block_id, 'stat_long_life', Filter::postBool('stat_long_life'));
- set_block_setting($block_id, 'stat_avg_life', Filter::postBool('stat_avg_life'));
- set_block_setting($block_id, 'stat_most_chil', Filter::postBool('stat_most_chil'));
- set_block_setting($block_id, 'stat_avg_chil', Filter::postBool('stat_avg_chil'));
+ $this->setBlockSetting($block_id, 'show_last_update', Filter::postBool('show_last_update'));
+ $this->setBlockSetting($block_id, 'show_common_surnames', Filter::postBool('show_common_surnames'));
+ $this->setBlockSetting($block_id, 'stat_indi', Filter::postBool('stat_indi'));
+ $this->setBlockSetting($block_id, 'stat_fam', Filter::postBool('stat_fam'));
+ $this->setBlockSetting($block_id, 'stat_sour', Filter::postBool('stat_sour'));
+ $this->setBlockSetting($block_id, 'stat_other', Filter::postBool('stat_other'));
+ $this->setBlockSetting($block_id, 'stat_media', Filter::postBool('stat_media'));
+ $this->setBlockSetting($block_id, 'stat_repo', Filter::postBool('stat_repo'));
+ $this->setBlockSetting($block_id, 'stat_surname', Filter::postBool('stat_surname'));
+ $this->setBlockSetting($block_id, 'stat_events', Filter::postBool('stat_events'));
+ $this->setBlockSetting($block_id, 'stat_users', Filter::postBool('stat_users'));
+ $this->setBlockSetting($block_id, 'stat_first_birth', Filter::postBool('stat_first_birth'));
+ $this->setBlockSetting($block_id, 'stat_last_birth', Filter::postBool('stat_last_birth'));
+ $this->setBlockSetting($block_id, 'stat_first_death', Filter::postBool('stat_first_death'));
+ $this->setBlockSetting($block_id, 'stat_last_death', Filter::postBool('stat_last_death'));
+ $this->setBlockSetting($block_id, 'stat_long_life', Filter::postBool('stat_long_life'));
+ $this->setBlockSetting($block_id, 'stat_avg_life', Filter::postBool('stat_avg_life'));
+ $this->setBlockSetting($block_id, 'stat_most_chil', Filter::postBool('stat_most_chil'));
+ $this->setBlockSetting($block_id, 'stat_avg_chil', Filter::postBool('stat_avg_chil'));
}
- $show_last_update = get_block_setting($block_id, 'show_last_update', '1');
- $show_common_surnames = get_block_setting($block_id, 'show_common_surnames', '1');
- $stat_indi = get_block_setting($block_id, 'stat_indi', '1');
- $stat_fam = get_block_setting($block_id, 'stat_fam', '1');
- $stat_sour = get_block_setting($block_id, 'stat_sour', '1');
- $stat_media = get_block_setting($block_id, 'stat_media', '1');
- $stat_repo = get_block_setting($block_id, 'stat_repo', '1');
- $stat_surname = get_block_setting($block_id, 'stat_surname', '1');
- $stat_events = get_block_setting($block_id, 'stat_events', '1');
- $stat_users = get_block_setting($block_id, 'stat_users', '1');
- $stat_first_birth = get_block_setting($block_id, 'stat_first_birth', '1');
- $stat_last_birth = get_block_setting($block_id, 'stat_last_birth', '1');
- $stat_first_death = get_block_setting($block_id, 'stat_first_death', '1');
- $stat_last_death = get_block_setting($block_id, 'stat_last_death', '1');
- $stat_long_life = get_block_setting($block_id, 'stat_long_life', '1');
- $stat_avg_life = get_block_setting($block_id, 'stat_avg_life', '1');
- $stat_most_chil = get_block_setting($block_id, 'stat_most_chil', '1');
- $stat_avg_chil = get_block_setting($block_id, 'stat_avg_chil', '1');
+ $show_last_update = $this->getBlockSetting($block_id, 'show_last_update', '1');
+ $show_common_surnames = $this->getBlockSetting($block_id, 'show_common_surnames', '1');
+ $stat_indi = $this->getBlockSetting($block_id, 'stat_indi', '1');
+ $stat_fam = $this->getBlockSetting($block_id, 'stat_fam', '1');
+ $stat_sour = $this->getBlockSetting($block_id, 'stat_sour', '1');
+ $stat_media = $this->getBlockSetting($block_id, 'stat_media', '1');
+ $stat_repo = $this->getBlockSetting($block_id, 'stat_repo', '1');
+ $stat_surname = $this->getBlockSetting($block_id, 'stat_surname', '1');
+ $stat_events = $this->getBlockSetting($block_id, 'stat_events', '1');
+ $stat_users = $this->getBlockSetting($block_id, 'stat_users', '1');
+ $stat_first_birth = $this->getBlockSetting($block_id, 'stat_first_birth', '1');
+ $stat_last_birth = $this->getBlockSetting($block_id, 'stat_last_birth', '1');
+ $stat_first_death = $this->getBlockSetting($block_id, 'stat_first_death', '1');
+ $stat_last_death = $this->getBlockSetting($block_id, 'stat_last_death', '1');
+ $stat_long_life = $this->getBlockSetting($block_id, 'stat_long_life', '1');
+ $stat_avg_life = $this->getBlockSetting($block_id, 'stat_avg_life', '1');
+ $stat_most_chil = $this->getBlockSetting($block_id, 'stat_most_chil', '1');
+ $stat_avg_chil = $this->getBlockSetting($block_id, 'stat_avg_chil', '1');
echo '<tr><td class="descriptionbox wrap width33">';
echo /* I18N: label for yes/no option */ I18N::translate('Show date of last update?');
diff --git a/app/Module/FrequentlyAskedQuestionsModule.php b/app/Module/FrequentlyAskedQuestionsModule.php
index d9c106f109..f1e107cfd9 100644
--- a/app/Module/FrequentlyAskedQuestionsModule.php
+++ b/app/Module/FrequentlyAskedQuestionsModule.php
@@ -19,7 +19,7 @@ namespace Fisharebest\Webtrees;
/**
* Class FrequentlyAskedQuestionsModule
*/
-class FrequentlyAskedQuestionsModule extends Module implements ModuleMenuInterface, ModuleConfigInterface {
+class FrequentlyAskedQuestionsModule extends AbstractModule implements ModuleMenuInterface, ModuleConfigInterface {
/** {@inheritdoc} */
public function getTitle() {
return /* I18N: Name of a module. Abbreviation for “Frequently Asked Questions” */ I18N::translate('FAQ');
@@ -90,19 +90,19 @@ class FrequentlyAskedQuestionsModule extends Module implements ModuleMenuInterfa
));
$block_id = Database::getInstance()->lastInsertId();
}
- set_block_setting($block_id, 'header', Filter::post('header'));
- set_block_setting($block_id, 'faqbody', Filter::post('faqbody'));
+ $this->setBlockSetting($block_id, 'header', Filter::post('header'));
+ $this->setBlockSetting($block_id, 'faqbody', Filter::post('faqbody'));
$languages = Filter::postArray('lang');
- set_block_setting($block_id, 'languages', implode(',', $languages));
+ $this->setBlockSetting($block_id, 'languages', implode(',', $languages));
$this->config();
} else {
$block_id = Filter::getInteger('block_id');
$controller = new PageController;
if ($block_id) {
$controller->setPageTitle(I18N::translate('Edit FAQ item'));
- $header = get_block_setting($block_id, 'header');
- $faqbody = get_block_setting($block_id, 'faqbody');
+ $header = $this->getBlockSetting($block_id, 'header');
+ $faqbody = $this->getBlockSetting($block_id, 'faqbody');
$block_order = Database::prepare(
"SELECT block_order FROM `##block` WHERE block_id = :block_id"
)->execute(array('block_id' => $block_id))->fetchOne();
@@ -153,7 +153,7 @@ class FrequentlyAskedQuestionsModule extends Module implements ModuleMenuInterfa
echo '<th>', I18N::translate('FAQ visibility'), '<br><small>', I18N::translate('A FAQ item can be displayed on just one of the family trees, or on all the family trees.'), '</small></th>';
echo '</tr><tr>';
echo '<td>';
- $languages = explode(',', get_block_setting($block_id, 'languages'));
+ $languages = explode(',', $this->getBlockSetting($block_id, 'languages'));
echo edit_language_checkboxes('lang', $languages);
echo '</td><td>';
echo '<input type="text" name="block_order" size="3" tabindex="3" value="', $block_order, '"></td>';
diff --git a/app/Module/GoogleMapsModule.php b/app/Module/GoogleMapsModule.php
index f9059710ee..346eac60b9 100644
--- a/app/Module/GoogleMapsModule.php
+++ b/app/Module/GoogleMapsModule.php
@@ -37,7 +37,7 @@ use Zend_Session;
*
* Hence, use "Google Maps™ mapping service" where appropriate.
*/
-class GoogleMapsModule extends Module implements ModuleConfigInterface, ModuleTabInterface {
+class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, ModuleTabInterface {
/** @var array of ancestors of root person */
private $ancestors = array();
diff --git a/app/Module/HtmlBlockModule.php b/app/Module/HtmlBlockModule.php
index bf87413fdc..4c0592e933 100644
--- a/app/Module/HtmlBlockModule.php
+++ b/app/Module/HtmlBlockModule.php
@@ -19,7 +19,7 @@ namespace Fisharebest\Webtrees;
/**
* Class HtmlBlockModule
*/
-class HtmlBlockModule extends Module implements ModuleBlockInterface {
+class HtmlBlockModule extends AbstractModule implements ModuleBlockInterface {
/** {@inheritdoc} */
public function getTitle() {
return /* I18N: Name of a module */ I18N::translate('HTML');
@@ -34,11 +34,11 @@ class HtmlBlockModule extends Module implements ModuleBlockInterface {
public function getBlock($block_id, $template = true, $cfg = null) {
global $ctype, $WT_TREE;
- $title = get_block_setting($block_id, 'title');
- $html = get_block_setting($block_id, 'html');
- $gedcom = get_block_setting($block_id, 'gedcom');
- $show_timestamp = get_block_setting($block_id, 'show_timestamp', '0');
- $languages = get_block_setting($block_id, 'languages');
+ $title = $this->getBlockSetting($block_id, 'title');
+ $html = $this->getBlockSetting($block_id, 'html');
+ $gedcom = $this->getBlockSetting($block_id, 'gedcom');
+ $show_timestamp = $this->getBlockSetting($block_id, 'show_timestamp', '0');
+ $languages = $this->getBlockSetting($block_id, 'languages');
// Only show this block for certain languages
if ($languages && !in_array(WT_LOCALE, explode(',', $languages))) {
@@ -90,7 +90,7 @@ class HtmlBlockModule extends Module implements ModuleBlockInterface {
$content = $html;
if ($show_timestamp) {
- $content .= '<br>' . format_timestamp(get_block_setting($block_id, 'timestamp', WT_TIMESTAMP));
+ $content .= '<br>' . format_timestamp($this->getBlockSetting($block_id, 'timestamp', WT_TIMESTAMP));
}
if ($template) {
@@ -120,13 +120,13 @@ class HtmlBlockModule extends Module implements ModuleBlockInterface {
global $WT_TREE;
if (Filter::postBool('save') && Filter::checkCsrf()) {
- set_block_setting($block_id, 'gedcom', Filter::post('gedcom'));
- set_block_setting($block_id, 'title', Filter::post('title'));
- set_block_setting($block_id, 'html', Filter::post('html'));
- set_block_setting($block_id, 'show_timestamp', Filter::postBool('show_timestamp'));
- set_block_setting($block_id, 'timestamp', Filter::post('timestamp'));
$languages = Filter::postArray('lang');
- set_block_setting($block_id, 'languages', implode(',', $languages));
+ $this->setBlockSetting($block_id, 'gedcom', Filter::post('gedcom'));
+ $this->setBlockSetting($block_id, 'title', Filter::post('title'));
+ $this->setBlockSetting($block_id, 'html', Filter::post('html'));
+ $this->setBlockSetting($block_id, 'show_timestamp', Filter::postBool('show_timestamp'));
+ $this->setBlockSetting($block_id, 'timestamp', Filter::post('timestamp'));
+ $this->setBlockSetting($block_id, 'languages', implode(',', $languages));
}
$templates = array(
@@ -238,11 +238,11 @@ class HtmlBlockModule extends Module implements ModuleBlockInterface {
</div>'
);
- $title = get_block_setting($block_id, 'title');
- $html = get_block_setting($block_id, 'html');
- $gedcom = get_block_setting($block_id, 'gedcom');
- $show_timestamp = get_block_setting($block_id, 'show_timestamp', '0');
- $languages = explode(',', get_block_setting($block_id, 'languages'));
+ $title = $this->getBlockSetting($block_id, 'title');
+ $html = $this->getBlockSetting($block_id, 'html');
+ $gedcom = $this->getBlockSetting($block_id, 'gedcom');
+ $show_timestamp = $this->getBlockSetting($block_id, 'show_timestamp', '0');
+ $languages = explode(',', $this->getBlockSetting($block_id, 'languages'));
echo '<tr><td class="descriptionbox wrap">',
GedcomTag::getLabel('TITL'),
diff --git a/app/Module/IndividualFactsTabModule.php b/app/Module/IndividualFactsTabModule.php
index 00c8df867e..0e12f19e45 100644
--- a/app/Module/IndividualFactsTabModule.php
+++ b/app/Module/IndividualFactsTabModule.php
@@ -19,7 +19,7 @@ namespace Fisharebest\Webtrees;
/**
* Class IndividualFactsTabModule
*/
-class IndividualFactsTabModule extends Module implements ModuleTabInterface {
+class IndividualFactsTabModule extends AbstractModule implements ModuleTabInterface {
/** {@inheritdoc} */
public function getTitle() {
return /* I18N: Name of a module/tab on the individual page. */ I18N::translate('Facts and events');
diff --git a/app/Module/IndividualFamiliesReportModule.php b/app/Module/IndividualFamiliesReportModule.php
index 70088554c5..a106176855 100644
--- a/app/Module/IndividualFamiliesReportModule.php
+++ b/app/Module/IndividualFamiliesReportModule.php
@@ -19,7 +19,7 @@ namespace Fisharebest\Webtrees;
/**
* Class IndividualFamiliesReportModule
*/
-class IndividualFamiliesReportModule extends Module implements ModuleReportInterface {
+class IndividualFamiliesReportModule extends AbstractModule implements ModuleReportInterface {
/** {@inheritdoc} */
public function getTitle() {
// This text also appears in the .XML file - update both together
diff --git a/app/Module/IndividualReportModule.php b/app/Module/IndividualReportModule.php
index 31833b2bf5..877118d2d5 100644
--- a/app/Module/IndividualReportModule.php
+++ b/app/Module/IndividualReportModule.php
@@ -19,7 +19,7 @@ namespace Fisharebest\Webtrees;
/**
* Class IndividualReportModule
*/
-class IndividualReportModule extends Module implements ModuleReportInterface {
+class IndividualReportModule extends AbstractModule implements ModuleReportInterface {
/** {@inheritdoc} */
public function getTitle() {
// This text also appears in the .XML file - update both together
diff --git a/app/Module/IndividualSidebarModule.php b/app/Module/IndividualSidebarModule.php
index c6982f9d2a..55a16a5823 100644
--- a/app/Module/IndividualSidebarModule.php
+++ b/app/Module/IndividualSidebarModule.php
@@ -21,7 +21,7 @@ use Zend_Session;
/**
* Class IndividualSidebarModule
*/
-class IndividualSidebarModule extends Module implements ModuleSidebarInterface {
+class IndividualSidebarModule extends AbstractModule implements ModuleSidebarInterface {
/** {@inheritdoc} */
public function getTitle() {
return /* I18N: Name of a module */ I18N::translate('Individual list');
diff --git a/app/Module/InteractiveTreeModule.php b/app/Module/InteractiveTreeModule.php
index c509d9b977..ea7134cb25 100644
--- a/app/Module/InteractiveTreeModule.php
+++ b/app/Module/InteractiveTreeModule.php
@@ -22,7 +22,7 @@ use Zend_Session;
* Class InteractiveTreeModule
* Tip : you could change the number of generations loaded before ajax calls both in individual page and in treeview page to optimize speed and server load
*/
-class InteractiveTreeModule extends Module implements ModuleTabInterface {
+class InteractiveTreeModule extends AbstractModule implements ModuleTabInterface {
var $headers; // CSS and script to include in the top of <head> section, before theme’s CSS
var $js; // the TreeViewHandler javascript
diff --git a/app/Module/LoggedInUsersModule.php b/app/Module/LoggedInUsersModule.php
index 4f4a8f4474..4dd97b67a6 100644
--- a/app/Module/LoggedInUsersModule.php
+++ b/app/Module/LoggedInUsersModule.php
@@ -19,7 +19,7 @@ namespace Fisharebest\Webtrees;
/**
* Class LoggedInUsersModule
*/
-class LoggedInUsersModule extends Module implements ModuleBlockInterface {
+class LoggedInUsersModule extends AbstractModule implements ModuleBlockInterface {
/** {@inheritdoc} */
public function getTitle() {
return /* I18N: Name of a module. (A list of users who are online now) */ I18N::translate('Who is online');
diff --git a/modules_v3/login_block/LoginBlockModule.php b/app/Module/LoginBlockModule.php
index 3564dd7e5f..dd2380f0ec 100644
--- a/modules_v3/login_block/LoginBlockModule.php
+++ b/app/Module/LoginBlockModule.php
@@ -19,7 +19,7 @@ namespace Fisharebest\Webtrees;
/**
* Class LoginBlockModule
*/
-class LoginBlockModule extends Module implements ModuleBlockInterface {
+class LoginBlockModule extends AbstractModule implements ModuleBlockInterface {
/** {@inheritdoc} */
public function getTitle() {
return /* I18N: Name of a module */ I18N::translate('Login');
@@ -47,8 +47,8 @@ class LoginBlockModule extends Module implements ModuleBlockInterface {
if (Auth::check()) {
$title = I18N::translate('Logout');
- $content = '<div class="center"><form method="post" action="logout.php" name="logoutform" onsubmit="return true;">';
- $content .= '<br><a href="edituser.php" class="name2">' . I18N::translate('Logged in as ') . ' ' . Auth::user()->getRealNameHtml() . '</a><br><br>';
+ $content = '<div class="center"><form method="post" action="../../logout.php" name="logoutform" onsubmit="return true;">';
+ $content .= '<br><a href="../../edituser.php" class="name2">' . I18N::translate('Logged in as ') . ' ' . Auth::user()->getRealNameHtml() . '</a><br><br>';
$content .= '<input type="submit" value="' . I18N::translate('Logout') . '">';
$content .= '<br><br></form></div>';
diff --git a/app/Module/MarriageReportModule.php b/app/Module/MarriageReportModule.php
index 3217509a7b..e675366a9f 100644
--- a/app/Module/MarriageReportModule.php
+++ b/app/Module/MarriageReportModule.php
@@ -19,7 +19,7 @@ namespace Fisharebest\Webtrees;
/**
* Class MarriageReportModule
*/
-class MarriageReportModule extends Module implements ModuleReportInterface {
+class MarriageReportModule extends AbstractModule implements ModuleReportInterface {
/** {@inheritdoc} */
public function getTitle() {
// This text also appears in the .XML file - update both together
diff --git a/app/Module/MediaTabModule.php b/app/Module/MediaTabModule.php
index a98e852ef2..c5805e443d 100644
--- a/app/Module/MediaTabModule.php
+++ b/app/Module/MediaTabModule.php
@@ -19,7 +19,7 @@ namespace Fisharebest\Webtrees;
/**
* Class MediaTabModule
*/
-class MediaTabModule extends Module implements ModuleTabInterface {
+class MediaTabModule extends AbstractModule implements ModuleTabInterface {
private $facts;
/** {@inheritdoc} */
diff --git a/app/Module/MissingFactsReportModule.php b/app/Module/MissingFactsReportModule.php
index 144b2d9438..cfc187b7b0 100644
--- a/app/Module/MissingFactsReportModule.php
+++ b/app/Module/MissingFactsReportModule.php
@@ -19,7 +19,7 @@ namespace Fisharebest\Webtrees;
/**
* Class MissingFactsReportModule
*/
-class MissingFactsReportModule extends Module implements ModuleReportInterface {
+class MissingFactsReportModule extends AbstractModule implements ModuleReportInterface {
/** {@inheritdoc} */
public function getTitle() {
// This text also appears in the .XML file - update both together
diff --git a/app/Module/NotesTabModule.php b/app/Module/NotesTabModule.php
index 13df84f60e..a920ba6cdc 100644
--- a/app/Module/NotesTabModule.php
+++ b/app/Module/NotesTabModule.php
@@ -19,7 +19,7 @@ namespace Fisharebest\Webtrees;
/**
* Class NotesTabModule
*/
-class NotesTabModule extends Module implements ModuleTabInterface {
+class NotesTabModule extends AbstractModule implements ModuleTabInterface {
private $facts;
/** {@inheritdoc} */
diff --git a/app/Module/OccupationReportModule.php b/app/Module/OccupationReportModule.php
index ecf63f1e69..590355dc6c 100644
--- a/app/Module/OccupationReportModule.php
+++ b/app/Module/OccupationReportModule.php
@@ -19,7 +19,7 @@ namespace Fisharebest\Webtrees;
/**
* Class OccupationReportModule
*/
-class OccupationReportModule extends Module implements ModuleReportInterface {
+class OccupationReportModule extends AbstractModule implements ModuleReportInterface {
/** {@inheritdoc} */
public function getTitle() {
// This text also appears in the .XML file - update both together
diff --git a/app/Module/OnThisDayModule.php b/app/Module/OnThisDayModule.php
index c9460d903c..389736282d 100644
--- a/app/Module/OnThisDayModule.php
+++ b/app/Module/OnThisDayModule.php
@@ -19,7 +19,7 @@ namespace Fisharebest\Webtrees;
/**
* Class OnThisDayModule
*/
-class OnThisDayModule extends Module implements ModuleBlockInterface {
+class OnThisDayModule extends AbstractModule implements ModuleBlockInterface {
/** {@inheritdoc} */
public function getTitle() {
return /* I18N: Name of a module */ I18N::translate('On this day');
@@ -34,11 +34,11 @@ class OnThisDayModule extends Module implements ModuleBlockInterface {
public function getBlock($block_id, $template = true, $cfg = null) {
global $ctype, $WT_TREE;
- $filter = get_block_setting($block_id, 'filter', '1');
- $onlyBDM = get_block_setting($block_id, 'onlyBDM', '1');
- $infoStyle = get_block_setting($block_id, 'infoStyle', 'table');
- $sortStyle = get_block_setting($block_id, 'sortStyle', 'alpha');
- $block = get_block_setting($block_id, 'block', '1');
+ $filter = $this->getBlockSetting($block_id, 'filter', '1');
+ $onlyBDM = $this->getBlockSetting($block_id, 'onlyBDM', '1');
+ $infoStyle = $this->getBlockSetting($block_id, 'infoStyle', 'table');
+ $sortStyle = $this->getBlockSetting($block_id, 'sortStyle', 'alpha');
+ $block = $this->getBlockSetting($block_id, 'block', '1');
if ($cfg) {
foreach (array('filter', 'onlyBDM', 'infoStyle', 'sortStyle', 'block') as $name) {
@@ -101,18 +101,18 @@ class OnThisDayModule extends Module implements ModuleBlockInterface {
/** {@inheritdoc} */
public function configureBlock($block_id) {
if (Filter::postBool('save') && Filter::checkCsrf()) {
- set_block_setting($block_id, 'filter', Filter::postBool('filter'));
- set_block_setting($block_id, 'onlyBDM', Filter::postBool('onlyBDM'));
- set_block_setting($block_id, 'infoStyle', Filter::post('infoStyle', 'list|table', 'table'));
- set_block_setting($block_id, 'sortStyle', Filter::post('sortStyle', 'alpha|anniv', 'alpha'));
- set_block_setting($block_id, 'block', Filter::postBool('block'));
+ $this->setBlockSetting($block_id, 'filter', Filter::postBool('filter'));
+ $this->setBlockSetting($block_id, 'onlyBDM', Filter::postBool('onlyBDM'));
+ $this->setBlockSetting($block_id, 'infoStyle', Filter::post('infoStyle', 'list|table', 'table'));
+ $this->setBlockSetting($block_id, 'sortStyle', Filter::post('sortStyle', 'alpha|anniv', 'alpha'));
+ $this->setBlockSetting($block_id, 'block', Filter::postBool('block'));
}
- $filter = get_block_setting($block_id, 'filter', '1');
- $onlyBDM = get_block_setting($block_id, 'onlyBDM', '1');
- $infoStyle = get_block_setting($block_id, 'infoStyle', 'table');
- $sortStyle = get_block_setting($block_id, 'sortStyle', 'alpha');
- $block = get_block_setting($block_id, 'block', '1');
+ $filter = $this->getBlockSetting($block_id, 'filter', '1');
+ $onlyBDM = $this->getBlockSetting($block_id, 'onlyBDM', '1');
+ $infoStyle = $this->getBlockSetting($block_id, 'infoStyle', 'table');
+ $sortStyle = $this->getBlockSetting($block_id, 'sortStyle', 'alpha');
+ $block = $this->getBlockSetting($block_id, 'block', '1');
echo '<tr><td class="descriptionbox wrap width33">';
echo I18N::translate('Show only events of living individuals?');
diff --git a/app/Module/PageMenuModule.php b/app/Module/PageMenuModule.php
index fe793d4b90..99c28af01f 100644
--- a/app/Module/PageMenuModule.php
+++ b/app/Module/PageMenuModule.php
@@ -19,7 +19,7 @@ namespace Fisharebest\Webtrees;
/**
* Class PageMenuModule
*/
-class PageMenuModule extends Module implements ModuleMenuInterface {
+class PageMenuModule extends AbstractModule implements ModuleMenuInterface {
/** {@inheritdoc} */
public function getTitle() {
return /* I18N: Name of a module/menu */ I18N::translate('Edit');
diff --git a/app/Module/PedigreeReportModule.php b/app/Module/PedigreeReportModule.php
index a968c4d1d8..d71ddf5151 100644
--- a/app/Module/PedigreeReportModule.php
+++ b/app/Module/PedigreeReportModule.php
@@ -19,7 +19,7 @@ namespace Fisharebest\Webtrees;
/**
* Class PedigreeReportModule
*/
-class PedigreeReportModule extends Module implements ModuleReportInterface {
+class PedigreeReportModule extends AbstractModule implements ModuleReportInterface {
/** {@inheritdoc} */
public function getTitle() {
// This text also appears in the .XML file - update both together
diff --git a/app/Module/RecentChangesModule.php b/app/Module/RecentChangesModule.php
index 12d5ab5db1..0d493ffcf0 100644
--- a/app/Module/RecentChangesModule.php
+++ b/app/Module/RecentChangesModule.php
@@ -19,7 +19,7 @@ namespace Fisharebest\Webtrees;
/**
* Class RecentChangesModule
*/
-class RecentChangesModule extends Module implements ModuleBlockInterface {
+class RecentChangesModule extends AbstractModule implements ModuleBlockInterface {
const DEFAULT_DAYS = 7;
const MAX_DAYS = 90;
@@ -37,11 +37,11 @@ class RecentChangesModule extends Module implements ModuleBlockInterface {
public function getBlock($block_id, $template = true, $cfg = null) {
global $ctype, $WT_TREE;
- $days = get_block_setting($block_id, 'days', self::DEFAULT_DAYS);
- $infoStyle = get_block_setting($block_id, 'infoStyle', 'table');
- $sortStyle = get_block_setting($block_id, 'sortStyle', 'date_desc');
- $block = get_block_setting($block_id, 'block', '1');
- $hide_empty = get_block_setting($block_id, 'hide_empty', '0');
+ $days = $this->getBlockSetting($block_id, 'days', self::DEFAULT_DAYS);
+ $infoStyle = $this->getBlockSetting($block_id, 'infoStyle', 'table');
+ $sortStyle = $this->getBlockSetting($block_id, 'sortStyle', 'date_desc');
+ $block = $this->getBlockSetting($block_id, 'block', '1');
+ $hide_empty = $this->getBlockSetting($block_id, 'hide_empty', '0');
if ($cfg) {
@@ -113,18 +113,18 @@ class RecentChangesModule extends Module implements ModuleBlockInterface {
/** {@inheritdoc} */
public function configureBlock($block_id) {
if (Filter::postBool('save') && Filter::checkCsrf()) {
- set_block_setting($block_id, 'days', Filter::postInteger('days', 1, self::MAX_DAYS, self::DEFAULT_DAYS));
- set_block_setting($block_id, 'infoStyle', Filter::post('infoStyle', 'list|table', 'table'));
- set_block_setting($block_id, 'sortStyle', Filter::post('sortStyle', 'name|date_asc|date_desc', 'date_desc'));
- set_block_setting($block_id, 'hide_empty', Filter::postBool('hide_empty'));
- set_block_setting($block_id, 'block', Filter::postBool('block'));
+ $this->setBlockSetting($block_id, 'days', Filter::postInteger('days', 1, self::MAX_DAYS, self::DEFAULT_DAYS));
+ $this->setBlockSetting($block_id, 'infoStyle', Filter::post('infoStyle', 'list|table', 'table'));
+ $this->setBlockSetting($block_id, 'sortStyle', Filter::post('sortStyle', 'name|date_asc|date_desc', 'date_desc'));
+ $this->setBlockSetting($block_id, 'hide_empty', Filter::postBool('hide_empty'));
+ $this->setBlockSetting($block_id, 'block', Filter::postBool('block'));
}
- $days = get_block_setting($block_id, 'days', self::DEFAULT_DAYS);
- $infoStyle = get_block_setting($block_id, 'infoStyle', 'table');
- $sortStyle = get_block_setting($block_id, 'sortStyle', 'date_desc');
- $block = get_block_setting($block_id, 'block', '1');
- $hide_empty = get_block_setting($block_id, 'hide_empty', '0');
+ $days = $this->getBlockSetting($block_id, 'days', self::DEFAULT_DAYS);
+ $infoStyle = $this->getBlockSetting($block_id, 'infoStyle', 'table');
+ $sortStyle = $this->getBlockSetting($block_id, 'sortStyle', 'date_desc');
+ $block = $this->getBlockSetting($block_id, 'block', '1');
+ $hide_empty = $this->getBlockSetting($block_id, 'hide_empty', '0');
echo '<tr><td class="descriptionbox wrap width33">';
echo I18N::translate('Number of days to show');
diff --git a/app/Module/RelatedIndividualsReportModule.php b/app/Module/RelatedIndividualsReportModule.php
index 1f3a52cb44..8b106db6de 100644
--- a/app/Module/RelatedIndividualsReportModule.php
+++ b/app/Module/RelatedIndividualsReportModule.php
@@ -19,7 +19,7 @@ namespace Fisharebest\Webtrees;
/**
* Class RelatedIndividualsReportModule
*/
-class RelatedIndividualsReportModule extends Module implements ModuleReportInterface {
+class RelatedIndividualsReportModule extends AbstractModule implements ModuleReportInterface {
/** {@inheritdoc} */
public function getTitle() {
// This text also appears in the .XML file - update both together
diff --git a/app/Module/RelativesTabModule.php b/app/Module/RelativesTabModule.php
index 6e6f3ec19c..c2c5675bcd 100644
--- a/app/Module/RelativesTabModule.php
+++ b/app/Module/RelativesTabModule.php
@@ -19,7 +19,7 @@ namespace Fisharebest\Webtrees;
/**
* Class RelativesTabModule
*/
-class RelativesTabModule extends Module implements ModuleTabInterface {
+class RelativesTabModule extends AbstractModule implements ModuleTabInterface {
/** {@inheritdoc} */
public function getTitle() {
return /* I18N: Name of a module */ I18N::translate('Families');
diff --git a/app/Module/ResearchTaskModule.php b/app/Module/ResearchTaskModule.php
index e4b9a7c4a2..6168d78083 100644
--- a/app/Module/ResearchTaskModule.php
+++ b/app/Module/ResearchTaskModule.php
@@ -21,7 +21,7 @@ use Rhumsaa\Uuid\Uuid;
/**
* Class ResearchTaskModule
*/
-class ResearchTaskModule extends Module implements ModuleBlockInterface {
+class ResearchTaskModule extends AbstractModule implements ModuleBlockInterface {
/** {@inheritdoc} */
public function getTitle() {
return /* I18N: Name of a module. Tasks that need further research. */ I18N::translate('Research tasks');
@@ -36,10 +36,10 @@ class ResearchTaskModule extends Module implements ModuleBlockInterface {
public function getBlock($block_id, $template = true, $cfg = null) {
global $ctype, $controller, $WT_TREE;
- $show_other = get_block_setting($block_id, 'show_other', '1');
- $show_unassigned = get_block_setting($block_id, 'show_unassigned', '1');
- $show_future = get_block_setting($block_id, 'show_future', '1');
- $block = get_block_setting($block_id, 'block', '1');
+ $show_other = $this->getBlockSetting($block_id, 'show_other', '1');
+ $show_unassigned = $this->getBlockSetting($block_id, 'show_unassigned', '1');
+ $show_future = $this->getBlockSetting($block_id, 'show_future', '1');
+ $block = $this->getBlockSetting($block_id, 'block', '1');
if ($cfg) {
foreach (array('show_unassigned', 'show_other', 'show_future', 'block') as $name) {
@@ -153,16 +153,16 @@ class ResearchTaskModule extends Module implements ModuleBlockInterface {
/** {@inheritdoc} */
public function configureBlock($block_id) {
if (Filter::postBool('save') && Filter::checkCsrf()) {
- set_block_setting($block_id, 'show_other', Filter::postBool('show_other'));
- set_block_setting($block_id, 'show_unassigned', Filter::postBool('show_unassigned'));
- set_block_setting($block_id, 'show_future', Filter::postBool('show_future'));
- set_block_setting($block_id, 'block', Filter::postBool('block'));
+ $this->setBlockSetting($block_id, 'show_other', Filter::postBool('show_other'));
+ $this->setBlockSetting($block_id, 'show_unassigned', Filter::postBool('show_unassigned'));
+ $this->setBlockSetting($block_id, 'show_future', Filter::postBool('show_future'));
+ $this->setBlockSetting($block_id, 'block', Filter::postBool('block'));
}
- $show_other = get_block_setting($block_id, 'show_other', '1');
- $show_unassigned = get_block_setting($block_id, 'show_unassigned', '1');
- $show_future = get_block_setting($block_id, 'show_future', '1');
- $block = get_block_setting($block_id, 'block', '1');
+ $show_other = $this->getBlockSetting($block_id, 'show_other', '1');
+ $show_unassigned = $this->getBlockSetting($block_id, 'show_unassigned', '1');
+ $show_future = $this->getBlockSetting($block_id, 'show_future', '1');
+ $block = $this->getBlockSetting($block_id, 'block', '1');
?>
<tr>
diff --git a/app/Module/ReviewChangesModule.php b/app/Module/ReviewChangesModule.php
index f1759e110b..6627ea1ae4 100644
--- a/app/Module/ReviewChangesModule.php
+++ b/app/Module/ReviewChangesModule.php
@@ -19,7 +19,7 @@ namespace Fisharebest\Webtrees;
/**
* Class ReviewChangesModule
*/
-class ReviewChangesModule extends Module implements ModuleBlockInterface {
+class ReviewChangesModule extends AbstractModule implements ModuleBlockInterface {
/** {@inheritdoc} */
public function getTitle() {
return /* I18N: Name of a module */ I18N::translate('Pending changes');
@@ -34,9 +34,9 @@ class ReviewChangesModule extends Module implements ModuleBlockInterface {
public function getBlock($block_id, $template = true, $cfg = null) {
global $ctype, $WT_TREE;
- $sendmail = get_block_setting($block_id, 'sendmail', '1');
- $days = get_block_setting($block_id, 'days', '1');
- $block = get_block_setting($block_id, 'block', '1');
+ $sendmail = $this->getBlockSetting($block_id, 'sendmail', '1');
+ $days = $this->getBlockSetting($block_id, 'days', '1');
+ $block = $this->getBlockSetting($block_id, 'block', '1');
if ($cfg) {
foreach (array('days', 'sendmail', 'block') as $name) {
@@ -141,14 +141,14 @@ class ReviewChangesModule extends Module implements ModuleBlockInterface {
/** {@inheritdoc} */
public function configureBlock($block_id) {
if (Filter::postBool('save') && Filter::checkCsrf()) {
- set_block_setting($block_id, 'days', Filter::postInteger('num', 1, 180, 1));
- set_block_setting($block_id, 'sendmail', Filter::postBool('sendmail'));
- set_block_setting($block_id, 'block', Filter::postBool('block'));
+ $this->setBlockSetting($block_id, 'days', Filter::postInteger('num', 1, 180, 1));
+ $this->setBlockSetting($block_id, 'sendmail', Filter::postBool('sendmail'));
+ $this->setBlockSetting($block_id, 'block', Filter::postBool('block'));
}
- $sendmail = get_block_setting($block_id, 'sendmail', '1');
- $days = get_block_setting($block_id, 'days', '1');
- $block = get_block_setting($block_id, 'block', '1');
+ $sendmail = $this->getBlockSetting($block_id, 'sendmail', '1');
+ $days = $this->getBlockSetting($block_id, 'days', '1');
+ $block = $this->getBlockSetting($block_id, 'block', '1');
?>
<tr>
diff --git a/app/Module/SiteMapModule.php b/app/Module/SiteMapModule.php
index c58efcd9d4..6fbbeb8d2f 100644
--- a/app/Module/SiteMapModule.php
+++ b/app/Module/SiteMapModule.php
@@ -21,7 +21,7 @@ use Zend_Session;
/**
* Class SiteMapModule
*/
-class SiteMapModule extends Module implements ModuleConfigInterface {
+class SiteMapModule extends AbstractModule implements ModuleConfigInterface {
const RECORDS_PER_VOLUME = 500; // Keep sitemap files small, for memory, CPU and max_allowed_packet limits.
const CACHE_LIFE = 1209600; // Two weeks
diff --git a/app/Module/SlideShowModule.php b/app/Module/SlideShowModule.php
index c6429cf46e..282006b5a1 100644
--- a/app/Module/SlideShowModule.php
+++ b/app/Module/SlideShowModule.php
@@ -19,7 +19,7 @@ namespace Fisharebest\Webtrees;
/**
* Class SlideShowModule
*/
-class SlideShowModule extends Module implements ModuleBlockInterface {
+class SlideShowModule extends AbstractModule implements ModuleBlockInterface {
/** {@inheritdoc} */
public function getTitle() {
return /* I18N: Name of a module */ I18N::translate('Slide show');
@@ -34,9 +34,9 @@ class SlideShowModule extends Module implements ModuleBlockInterface {
public function getBlock($block_id, $template = true, $cfg = null) {
global $ctype, $WT_TREE;
- $filter = get_block_setting($block_id, 'filter', 'all');
- $controls = get_block_setting($block_id, 'controls', '1');
- $start = get_block_setting($block_id, 'start', '0') || Filter::getBool('start');
+ $filter = $this->getBlockSetting($block_id, 'filter', 'all');
+ $controls = $this->getBlockSetting($block_id, 'controls', '1');
+ $start = $this->getBlockSetting($block_id, 'start', '0') || Filter::getBool('start');
// We can apply the filters using SQL
// Do not use "ORDER BY RAND()" - it is very slow on large tables. Use PHP::array_rand() instead.
@@ -47,36 +47,36 @@ class SlideShowModule extends Module implements ModuleBlockInterface {
" AND m_type IN (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, '')"
)->execute(array(
$WT_TREE->getTreeId(),
- get_block_setting($block_id, 'filter_avi', '0') ? 'avi' : null,
- get_block_setting($block_id, 'filter_bmp', '1') ? 'bmp' : null,
- get_block_setting($block_id, 'filter_gif', '1') ? 'gif' : null,
- get_block_setting($block_id, 'filter_jpeg', '1') ? 'jpg' : null,
- get_block_setting($block_id, 'filter_jpeg', '1') ? 'jpeg' : null,
- get_block_setting($block_id, 'filter_mp3', '0') ? 'mp3' : null,
- get_block_setting($block_id, 'filter_ole', '1') ? 'ole' : null,
- get_block_setting($block_id, 'filter_pcx', '1') ? 'pcx' : null,
- get_block_setting($block_id, 'filter_pdf', '0') ? 'pdf' : null,
- get_block_setting($block_id, 'filter_png', '1') ? 'png' : null,
- get_block_setting($block_id, 'filter_tiff', '1') ? 'tiff' : null,
- get_block_setting($block_id, 'filter_wav', '0') ? 'wav' : null,
- get_block_setting($block_id, 'filter_audio', '0') ? 'audio' : null,
- get_block_setting($block_id, 'filter_book', '1') ? 'book' : null,
- get_block_setting($block_id, 'filter_card', '1') ? 'card' : null,
- get_block_setting($block_id, 'filter_certificate', '1') ? 'certificate' : null,
- get_block_setting($block_id, 'filter_coat', '1') ? 'coat' : null,
- get_block_setting($block_id, 'filter_document', '1') ? 'document' : null,
- get_block_setting($block_id, 'filter_electronic', '1') ? 'electronic' : null,
- get_block_setting($block_id, 'filter_fiche', '1') ? 'fiche' : null,
- get_block_setting($block_id, 'filter_film', '1') ? 'film' : null,
- get_block_setting($block_id, 'filter_magazine', '1') ? 'magazine' : null,
- get_block_setting($block_id, 'filter_manuscript', '1') ? 'manuscript' : null,
- get_block_setting($block_id, 'filter_map', '1') ? 'map' : null,
- get_block_setting($block_id, 'filter_newspaper', '1') ? 'newspaper' : null,
- get_block_setting($block_id, 'filter_other', '1') ? 'other' : null,
- get_block_setting($block_id, 'filter_painting', '1') ? 'painting' : null,
- get_block_setting($block_id, 'filter_photo', '1') ? 'photo' : null,
- get_block_setting($block_id, 'filter_tombstone', '1') ? 'tombstone' : null,
- get_block_setting($block_id, 'filter_video', '0') ? 'video' : null,
+ $this->getBlockSetting($block_id, 'filter_avi', '0') ? 'avi' : null,
+ $this->getBlockSetting($block_id, 'filter_bmp', '1') ? 'bmp' : null,
+ $this->getBlockSetting($block_id, 'filter_gif', '1') ? 'gif' : null,
+ $this->getBlockSetting($block_id, 'filter_jpeg', '1') ? 'jpg' : null,
+ $this->getBlockSetting($block_id, 'filter_jpeg', '1') ? 'jpeg' : null,
+ $this->getBlockSetting($block_id, 'filter_mp3', '0') ? 'mp3' : null,
+ $this->getBlockSetting($block_id, 'filter_ole', '1') ? 'ole' : null,
+ $this->getBlockSetting($block_id, 'filter_pcx', '1') ? 'pcx' : null,
+ $this->getBlockSetting($block_id, 'filter_pdf', '0') ? 'pdf' : null,
+ $this->getBlockSetting($block_id, 'filter_png', '1') ? 'png' : null,
+ $this->getBlockSetting($block_id, 'filter_tiff', '1') ? 'tiff' : null,
+ $this->getBlockSetting($block_id, 'filter_wav', '0') ? 'wav' : null,
+ $this->getBlockSetting($block_id, 'filter_audio', '0') ? 'audio' : null,
+ $this->getBlockSetting($block_id, 'filter_book', '1') ? 'book' : null,
+ $this->getBlockSetting($block_id, 'filter_card', '1') ? 'card' : null,
+ $this->getBlockSetting($block_id, 'filter_certificate', '1') ? 'certificate' : null,
+ $this->getBlockSetting($block_id, 'filter_coat', '1') ? 'coat' : null,
+ $this->getBlockSetting($block_id, 'filter_document', '1') ? 'document' : null,
+ $this->getBlockSetting($block_id, 'filter_electronic', '1') ? 'electronic' : null,
+ $this->getBlockSetting($block_id, 'filter_fiche', '1') ? 'fiche' : null,
+ $this->getBlockSetting($block_id, 'filter_film', '1') ? 'film' : null,
+ $this->getBlockSetting($block_id, 'filter_magazine', '1') ? 'magazine' : null,
+ $this->getBlockSetting($block_id, 'filter_manuscript', '1') ? 'manuscript' : null,
+ $this->getBlockSetting($block_id, 'filter_map', '1') ? 'map' : null,
+ $this->getBlockSetting($block_id, 'filter_newspaper', '1') ? 'newspaper' : null,
+ $this->getBlockSetting($block_id, 'filter_other', '1') ? 'other' : null,
+ $this->getBlockSetting($block_id, 'filter_painting', '1') ? 'painting' : null,
+ $this->getBlockSetting($block_id, 'filter_photo', '1') ? 'photo' : null,
+ $this->getBlockSetting($block_id, 'filter_tombstone', '1') ? 'tombstone' : null,
+ $this->getBlockSetting($block_id, 'filter_video', '0') ? 'video' : null,
))->fetchOneColumn();
// Keep looking through the media until a suitable one is found.
@@ -199,43 +199,43 @@ class SlideShowModule extends Module implements ModuleBlockInterface {
/** {@inheritdoc} */
public function configureBlock($block_id) {
if (Filter::postBool('save') && Filter::checkCsrf()) {
- set_block_setting($block_id, 'filter', Filter::post('filter', 'indi|event|all', 'all'));
- set_block_setting($block_id, 'controls', Filter::postBool('controls'));
- set_block_setting($block_id, 'start', Filter::postBool('start'));
- set_block_setting($block_id, 'filter_avi', Filter::postBool('filter_avi'));
- set_block_setting($block_id, 'filter_bmp', Filter::postBool('filter_bmp'));
- set_block_setting($block_id, 'filter_gif', Filter::postBool('filter_gif'));
- set_block_setting($block_id, 'filter_jpeg', Filter::postBool('filter_jpeg'));
- set_block_setting($block_id, 'filter_mp3', Filter::postBool('filter_mp3'));
- set_block_setting($block_id, 'filter_ole', Filter::postBool('filter_ole'));
- set_block_setting($block_id, 'filter_pcx', Filter::postBool('filter_pcx'));
- set_block_setting($block_id, 'filter_pdf', Filter::postBool('filter_pdf'));
- set_block_setting($block_id, 'filter_png', Filter::postBool('filter_png'));
- set_block_setting($block_id, 'filter_tiff', Filter::postBool('filter_tiff'));
- set_block_setting($block_id, 'filter_wav', Filter::postBool('filter_wav'));
- set_block_setting($block_id, 'filter_audio', Filter::postBool('filter_audio'));
- set_block_setting($block_id, 'filter_book', Filter::postBool('filter_book'));
- set_block_setting($block_id, 'filter_card', Filter::postBool('filter_card'));
- set_block_setting($block_id, 'filter_certificate', Filter::postBool('filter_certificate'));
- set_block_setting($block_id, 'filter_coat', Filter::postBool('filter_coat'));
- set_block_setting($block_id, 'filter_document', Filter::postBool('filter_document'));
- set_block_setting($block_id, 'filter_electronic', Filter::postBool('filter_electronic'));
- set_block_setting($block_id, 'filter_fiche', Filter::postBool('filter_fiche'));
- set_block_setting($block_id, 'filter_film', Filter::postBool('filter_film'));
- set_block_setting($block_id, 'filter_magazine', Filter::postBool('filter_magazine'));
- set_block_setting($block_id, 'filter_manuscript', Filter::postBool('filter_manuscript'));
- set_block_setting($block_id, 'filter_map', Filter::postBool('filter_map'));
- set_block_setting($block_id, 'filter_newspaper', Filter::postBool('filter_newspaper'));
- set_block_setting($block_id, 'filter_other', Filter::postBool('filter_other'));
- set_block_setting($block_id, 'filter_painting', Filter::postBool('filter_painting'));
- set_block_setting($block_id, 'filter_photo', Filter::postBool('filter_photo'));
- set_block_setting($block_id, 'filter_tombstone', Filter::postBool('filter_tombstone'));
- set_block_setting($block_id, 'filter_video', Filter::postBool('filter_video'));
+ $this->setBlockSetting($block_id, 'filter', Filter::post('filter', 'indi|event|all', 'all'));
+ $this->setBlockSetting($block_id, 'controls', Filter::postBool('controls'));
+ $this->setBlockSetting($block_id, 'start', Filter::postBool('start'));
+ $this->setBlockSetting($block_id, 'filter_avi', Filter::postBool('filter_avi'));
+ $this->setBlockSetting($block_id, 'filter_bmp', Filter::postBool('filter_bmp'));
+ $this->setBlockSetting($block_id, 'filter_gif', Filter::postBool('filter_gif'));
+ $this->setBlockSetting($block_id, 'filter_jpeg', Filter::postBool('filter_jpeg'));
+ $this->setBlockSetting($block_id, 'filter_mp3', Filter::postBool('filter_mp3'));
+ $this->setBlockSetting($block_id, 'filter_ole', Filter::postBool('filter_ole'));
+ $this->setBlockSetting($block_id, 'filter_pcx', Filter::postBool('filter_pcx'));
+ $this->setBlockSetting($block_id, 'filter_pdf', Filter::postBool('filter_pdf'));
+ $this->setBlockSetting($block_id, 'filter_png', Filter::postBool('filter_png'));
+ $this->setBlockSetting($block_id, 'filter_tiff', Filter::postBool('filter_tiff'));
+ $this->setBlockSetting($block_id, 'filter_wav', Filter::postBool('filter_wav'));
+ $this->setBlockSetting($block_id, 'filter_audio', Filter::postBool('filter_audio'));
+ $this->setBlockSetting($block_id, 'filter_book', Filter::postBool('filter_book'));
+ $this->setBlockSetting($block_id, 'filter_card', Filter::postBool('filter_card'));
+ $this->setBlockSetting($block_id, 'filter_certificate', Filter::postBool('filter_certificate'));
+ $this->setBlockSetting($block_id, 'filter_coat', Filter::postBool('filter_coat'));
+ $this->setBlockSetting($block_id, 'filter_document', Filter::postBool('filter_document'));
+ $this->setBlockSetting($block_id, 'filter_electronic', Filter::postBool('filter_electronic'));
+ $this->setBlockSetting($block_id, 'filter_fiche', Filter::postBool('filter_fiche'));
+ $this->setBlockSetting($block_id, 'filter_film', Filter::postBool('filter_film'));
+ $this->setBlockSetting($block_id, 'filter_magazine', Filter::postBool('filter_magazine'));
+ $this->setBlockSetting($block_id, 'filter_manuscript', Filter::postBool('filter_manuscript'));
+ $this->setBlockSetting($block_id, 'filter_map', Filter::postBool('filter_map'));
+ $this->setBlockSetting($block_id, 'filter_newspaper', Filter::postBool('filter_newspaper'));
+ $this->setBlockSetting($block_id, 'filter_other', Filter::postBool('filter_other'));
+ $this->setBlockSetting($block_id, 'filter_painting', Filter::postBool('filter_painting'));
+ $this->setBlockSetting($block_id, 'filter_photo', Filter::postBool('filter_photo'));
+ $this->setBlockSetting($block_id, 'filter_tombstone', Filter::postBool('filter_tombstone'));
+ $this->setBlockSetting($block_id, 'filter_video', Filter::postBool('filter_video'));
}
- $filter = get_block_setting($block_id, 'filter', 'all');
- $controls = get_block_setting($block_id, 'controls', '1');
- $start = get_block_setting($block_id, 'start', '0') || Filter::getBool('start');
+ $filter = $this->getBlockSetting($block_id, 'filter', 'all');
+ $controls = $this->getBlockSetting($block_id, 'controls', '1');
+ $start = $this->getBlockSetting($block_id, 'start', '0') || Filter::getBool('start');
echo '<tr><td class="descriptionbox wrap width33">';
echo I18N::translate('Show only individuals, events, or all?');
@@ -244,35 +244,35 @@ class SlideShowModule extends Module implements ModuleBlockInterface {
echo '</td></tr>';
$filters = array(
- 'avi' =>get_block_setting($block_id, 'filter_avi', '0'),
- 'bmp' =>get_block_setting($block_id, 'filter_bmp', '1'),
- 'gif' =>get_block_setting($block_id, 'filter_gif', '1'),
- 'jpeg' =>get_block_setting($block_id, 'filter_jpeg', '1'),
- 'mp3' =>get_block_setting($block_id, 'filter_mp3', '0'),
- 'ole' =>get_block_setting($block_id, 'filter_ole', '1'),
- 'pcx' =>get_block_setting($block_id, 'filter_pcx', '1'),
- 'pdf' =>get_block_setting($block_id, 'filter_pdf', '0'),
- 'png' =>get_block_setting($block_id, 'filter_png', '1'),
- 'tiff' =>get_block_setting($block_id, 'filter_tiff', '1'),
- 'wav' =>get_block_setting($block_id, 'filter_wav', '0'),
- 'audio' =>get_block_setting($block_id, 'filter_audio', '0'),
- 'book' =>get_block_setting($block_id, 'filter_book', '1'),
- 'card' =>get_block_setting($block_id, 'filter_card', '1'),
- 'certificate'=>get_block_setting($block_id, 'filter_certificate', '1'),
- 'coat' =>get_block_setting($block_id, 'filter_coat', '1'),
- 'document' =>get_block_setting($block_id, 'filter_document', '1'),
- 'electronic' =>get_block_setting($block_id, 'filter_electronic', '1'),
- 'fiche' =>get_block_setting($block_id, 'filter_fiche', '1'),
- 'film' =>get_block_setting($block_id, 'filter_film', '1'),
- 'magazine' =>get_block_setting($block_id, 'filter_magazine', '1'),
- 'manuscript' =>get_block_setting($block_id, 'filter_manuscript', '1'),
- 'map' =>get_block_setting($block_id, 'filter_map', '1'),
- 'newspaper' =>get_block_setting($block_id, 'filter_newspaper', '1'),
- 'other' =>get_block_setting($block_id, 'filter_other', '1'),
- 'painting' =>get_block_setting($block_id, 'filter_painting', '1'),
- 'photo' =>get_block_setting($block_id, 'filter_photo', '1'),
- 'tombstone' =>get_block_setting($block_id, 'filter_tombstone', '1'),
- 'video' =>get_block_setting($block_id, 'filter_video', '0'),
+ 'avi' =>$this->getBlockSetting($block_id, 'filter_avi', '0'),
+ 'bmp' =>$this->getBlockSetting($block_id, 'filter_bmp', '1'),
+ 'gif' =>$this->getBlockSetting($block_id, 'filter_gif', '1'),
+ 'jpeg' =>$this->getBlockSetting($block_id, 'filter_jpeg', '1'),
+ 'mp3' =>$this->getBlockSetting($block_id, 'filter_mp3', '0'),
+ 'ole' =>$this->getBlockSetting($block_id, 'filter_ole', '1'),
+ 'pcx' =>$this->getBlockSetting($block_id, 'filter_pcx', '1'),
+ 'pdf' =>$this->getBlockSetting($block_id, 'filter_pdf', '0'),
+ 'png' =>$this->getBlockSetting($block_id, 'filter_png', '1'),
+ 'tiff' =>$this->getBlockSetting($block_id, 'filter_tiff', '1'),
+ 'wav' =>$this->getBlockSetting($block_id, 'filter_wav', '0'),
+ 'audio' =>$this->getBlockSetting($block_id, 'filter_audio', '0'),
+ 'book' =>$this->getBlockSetting($block_id, 'filter_book', '1'),
+ 'card' =>$this->getBlockSetting($block_id, 'filter_card', '1'),
+ 'certificate'=>$this->getBlockSetting($block_id, 'filter_certificate', '1'),
+ 'coat' =>$this->getBlockSetting($block_id, 'filter_coat', '1'),
+ 'document' =>$this->getBlockSetting($block_id, 'filter_document', '1'),
+ 'electronic' =>$this->getBlockSetting($block_id, 'filter_electronic', '1'),
+ 'fiche' =>$this->getBlockSetting($block_id, 'filter_fiche', '1'),
+ 'film' =>$this->getBlockSetting($block_id, 'filter_film', '1'),
+ 'magazine' =>$this->getBlockSetting($block_id, 'filter_magazine', '1'),
+ 'manuscript' =>$this->getBlockSetting($block_id, 'filter_manuscript', '1'),
+ 'map' =>$this->getBlockSetting($block_id, 'filter_map', '1'),
+ 'newspaper' =>$this->getBlockSetting($block_id, 'filter_newspaper', '1'),
+ 'other' =>$this->getBlockSetting($block_id, 'filter_other', '1'),
+ 'painting' =>$this->getBlockSetting($block_id, 'filter_painting', '1'),
+ 'photo' =>$this->getBlockSetting($block_id, 'filter_photo', '1'),
+ 'tombstone' =>$this->getBlockSetting($block_id, 'filter_tombstone', '1'),
+ 'video' =>$this->getBlockSetting($block_id, 'filter_video', '0'),
);
echo '<tr><td class="descriptionbox wrap width33">';
diff --git a/app/Module/SourcesTabModule.php b/app/Module/SourcesTabModule.php
index e531a47e7f..59985b43d3 100644
--- a/app/Module/SourcesTabModule.php
+++ b/app/Module/SourcesTabModule.php
@@ -19,7 +19,7 @@ namespace Fisharebest\Webtrees;
/**
* Class SourcesTabModule
*/
-class SourcesTabModule extends Module implements ModuleTabInterface {
+class SourcesTabModule extends AbstractModule implements ModuleTabInterface {
private $facts;
/** {@inheritdoc} */
diff --git a/app/Module/StoriesModule.php b/app/Module/StoriesModule.php
index 4da85365f5..87dbaab267 100644
--- a/app/Module/StoriesModule.php
+++ b/app/Module/StoriesModule.php
@@ -19,7 +19,7 @@ namespace Fisharebest\Webtrees;
/**
* Class StoriesModule
*/
-class StoriesModule extends Module implements ModuleTabInterface, ModuleConfigInterface, ModuleMenuInterface {
+class StoriesModule extends AbstractModule implements ModuleTabInterface, ModuleConfigInterface, ModuleMenuInterface {
/** {@inheritdoc} */
public function getTitle() {
return /* I18N: Name of a module */ I18N::translate('Stories');
@@ -81,10 +81,10 @@ class StoriesModule extends Module implements ModuleTabInterface, ModuleConfigIn
$html = '';
foreach ($block_ids as $block_id) {
// Only show this block for certain languages
- $languages = get_block_setting($block_id, 'languages');
+ $languages = $this->getBlockSetting($block_id, 'languages');
if (!$languages || in_array(WT_LOCALE, explode(',', $languages))) {
- $html .= '<div class="story_title descriptionbox center rela">' . get_block_setting($block_id, 'title') . '</div>';
- $html .= '<div class="story_body optionbox">' . get_block_setting($block_id, 'story_body') . '</div>';
+ $html .= '<div class="story_title descriptionbox center rela">' . $this->getBlockSetting($block_id, 'title') . '</div>';
+ $html .= '<div class="story_body optionbox">' . $this->getBlockSetting($block_id, 'story_body') . '</div>';
if (Auth::isEditor($WT_TREE)) {
$html .= '<div class="story_edit"><a href="module.php?mod=' . $this->getName() . '&amp;mod_action=admin_edit&amp;block_id=' . $block_id . '">';
$html .= I18N::translate('Edit story') . '</a></div>';
@@ -159,10 +159,10 @@ class StoriesModule extends Module implements ModuleTabInterface, ModuleConfigIn
));
$block_id = Database::getInstance()->lastInsertId();
}
- set_block_setting($block_id, 'title', Filter::post('title'));
- set_block_setting($block_id, 'story_body', Filter::post('story_body'));
+ $this->setBlockSetting($block_id, 'title', Filter::post('title'));
+ $this->setBlockSetting($block_id, 'story_body', Filter::post('story_body'));
$languages = Filter::postArray('lang');
- set_block_setting($block_id, 'languages', implode(',', $languages));
+ $this->setBlockSetting($block_id, 'languages', implode(',', $languages));
$this->config();
} else {
$block_id = Filter::getInteger('block_id');
@@ -170,8 +170,8 @@ class StoriesModule extends Module implements ModuleTabInterface, ModuleConfigIn
$controller = new PageController;
if ($block_id) {
$controller->setPageTitle(I18N::translate('Edit story'));
- $title = get_block_setting($block_id, 'title');
- $story_body = get_block_setting($block_id, 'story_body');
+ $title = $this->getBlockSetting($block_id, 'title');
+ $story_body = $this->getBlockSetting($block_id, 'story_body');
$xref = Database::prepare(
"SELECT xref FROM `##block` WHERE block_id=?"
)->execute(array($block_id))->fetchOne();
@@ -230,7 +230,7 @@ class StoriesModule extends Module implements ModuleTabInterface, ModuleConfigIn
}
}
echo '</td>';
- $languages = explode(',', get_block_setting($block_id, 'languages'));
+ $languages = explode(',', $this->getBlockSetting($block_id, 'languages'));
echo '<td class="optionbox">';
echo edit_language_checkboxes('lang', $languages);
echo '</td></tr></table>';
@@ -344,7 +344,7 @@ class StoriesModule extends Module implements ModuleTabInterface, ModuleConfigIn
<?php foreach ($stories as $story): ?>
<tr>
<td>
- <?php echo Filter::escapeHtml(get_block_setting($story->block_id, 'title')); ?>
+ <?php echo Filter::escapeHtml($this->getBlockSetting($story->block_id, 'title')); ?>
</td>
<td>
<?php if ($indi = Individual::getInstance($story->xref, $WT_TREE)): ?>
@@ -423,8 +423,8 @@ class StoriesModule extends Module implements ModuleTabInterface, ModuleConfigIn
<tbody>';
foreach ($stories as $story) {
$indi = Individual::getInstance($story->xref, $WT_TREE);
- $story_title = get_block_setting($story->block_id, 'title');
- $languages = get_block_setting($story->block_id, 'languages');
+ $story_title = $this->getBlockSetting($story->block_id, 'title');
+ $languages = $this->getBlockSetting($story->block_id, 'languages');
if (!$languages || in_array(WT_LOCALE, explode(',', $languages))) {
if ($indi) {
if ($indi->canShow()) {
diff --git a/app/Module/ThemeSelectModule.php b/app/Module/ThemeSelectModule.php
index b8780e7f87..7cc142613b 100644
--- a/app/Module/ThemeSelectModule.php
+++ b/app/Module/ThemeSelectModule.php
@@ -19,7 +19,7 @@ namespace Fisharebest\Webtrees;
/**
* Class ThemeSelectModule
*/
-class ThemeSelectModule extends Module implements ModuleBlockInterface {
+class ThemeSelectModule extends AbstractModule implements ModuleBlockInterface {
/** {@inheritdoc} */
public function getTitle() {
return /* I18N: Name of a module */ I18N::translate('Theme change');
diff --git a/app/Module/TopGivenNamesModule.php b/app/Module/TopGivenNamesModule.php
index c4bc8bf4de..64a0fec569 100644
--- a/app/Module/TopGivenNamesModule.php
+++ b/app/Module/TopGivenNamesModule.php
@@ -19,7 +19,7 @@ namespace Fisharebest\Webtrees;
/**
* Class TopGivenNamesModule
*/
-class TopGivenNamesModule extends Module implements ModuleBlockInterface {
+class TopGivenNamesModule extends AbstractModule implements ModuleBlockInterface {
/** {@inheritdoc} */
public function getTitle() {
return /* I18N: Name of a module. Top=Most common */ I18N::translate('Top given names');
@@ -34,9 +34,9 @@ class TopGivenNamesModule extends Module implements ModuleBlockInterface {
public function getBlock($block_id, $template = true, $cfg = null) {
global $ctype, $WT_TREE;
- $num = get_block_setting($block_id, 'num', '10');
- $infoStyle = get_block_setting($block_id, 'infoStyle', 'table');
- $block = get_block_setting($block_id, 'block', '0');
+ $num = $this->getBlockSetting($block_id, 'num', '10');
+ $infoStyle = $this->getBlockSetting($block_id, 'infoStyle', 'table');
+ $block = $this->getBlockSetting($block_id, 'block', '0');
if ($cfg) {
foreach (array('num', 'infoStyle', 'block') as $name) {
@@ -123,14 +123,14 @@ class TopGivenNamesModule extends Module implements ModuleBlockInterface {
/** {@inheritdoc} */
public function configureBlock($block_id) {
if (Filter::postBool('save') && Filter::checkCsrf()) {
- set_block_setting($block_id, 'num', Filter::postInteger('num', 1, 10000, 10));
- set_block_setting($block_id, 'infoStyle', Filter::post('infoStyle', 'list|table', 'table'));
- set_block_setting($block_id, 'block', Filter::postBool('block'));
+ $this->setBlockSetting($block_id, 'num', Filter::postInteger('num', 1, 10000, 10));
+ $this->setBlockSetting($block_id, 'infoStyle', Filter::post('infoStyle', 'list|table', 'table'));
+ $this->setBlockSetting($block_id, 'block', Filter::postBool('block'));
}
- $num = get_block_setting($block_id, 'num', '10');
- $infoStyle = get_block_setting($block_id, 'infoStyle', 'table');
- $block = get_block_setting($block_id, 'block', '0');
+ $num = $this->getBlockSetting($block_id, 'num', '10');
+ $infoStyle = $this->getBlockSetting($block_id, 'infoStyle', 'table');
+ $block = $this->getBlockSetting($block_id, 'block', '0');
echo '<tr><td class="descriptionbox wrap width33">';
echo I18N::translate('Number of items to show');
diff --git a/app/Module/TopPageViewsModule.php b/app/Module/TopPageViewsModule.php
index 6cbb8fe493..9f90839721 100644
--- a/app/Module/TopPageViewsModule.php
+++ b/app/Module/TopPageViewsModule.php
@@ -19,7 +19,7 @@ namespace Fisharebest\Webtrees;
/**
* Class TopPageViewsModule
*/
-class TopPageViewsModule extends Module implements ModuleBlockInterface {
+class TopPageViewsModule extends AbstractModule implements ModuleBlockInterface {
/** {@inheritdoc} */
public function getTitle() {
return /* I18N: Name of a module */ I18N::translate('Most viewed pages');
@@ -34,9 +34,9 @@ class TopPageViewsModule extends Module implements ModuleBlockInterface {
public function getBlock($block_id, $template = true, $cfg = null) {
global $ctype, $WT_TREE;
- $num = get_block_setting($block_id, 'num', '10');
- $count_placement = get_block_setting($block_id, 'count_placement', 'before');
- $block = get_block_setting($block_id, 'block', '0');
+ $num = $this->getBlockSetting($block_id, 'num', '10');
+ $count_placement = $this->getBlockSetting($block_id, 'count_placement', 'before');
+ $block = $this->getBlockSetting($block_id, 'block', '0');
if ($cfg) {
foreach (array('count_placement', 'num', 'block') as $name) {
@@ -117,14 +117,14 @@ class TopPageViewsModule extends Module implements ModuleBlockInterface {
/** {@inheritdoc} */
public function configureBlock($block_id) {
if (Filter::postBool('save') && Filter::checkCsrf()) {
- set_block_setting($block_id, 'num', Filter::postInteger('num', 1, 10000, 10));
- set_block_setting($block_id, 'count_placement', Filter::post('count_placement', 'before|after', 'before'));
- set_block_setting($block_id, 'block', Filter::postBool('block'));
+ $this->setBlockSetting($block_id, 'num', Filter::postInteger('num', 1, 10000, 10));
+ $this->setBlockSetting($block_id, 'count_placement', Filter::post('count_placement', 'before|after', 'before'));
+ $this->setBlockSetting($block_id, 'block', Filter::postBool('block'));
}
- $num = get_block_setting($block_id, 'num', '10');
- $count_placement = get_block_setting($block_id, 'count_placement', 'before');
- $block = get_block_setting($block_id, 'block', '0');
+ $num = $this->getBlockSetting($block_id, 'num', '10');
+ $count_placement = $this->getBlockSetting($block_id, 'count_placement', 'before');
+ $block = $this->getBlockSetting($block_id, 'block', '0');
echo '<tr><td class="descriptionbox wrap width33">';
echo I18N::translate('Number of items to show');
diff --git a/app/Module/TopSurnamesModule.php b/app/Module/TopSurnamesModule.php
index deb891bb3c..d0ddd39e03 100644
--- a/app/Module/TopSurnamesModule.php
+++ b/app/Module/TopSurnamesModule.php
@@ -19,7 +19,7 @@ namespace Fisharebest\Webtrees;
/**
* Class TopSurnamesModule
*/
-class TopSurnamesModule extends Module implements ModuleBlockInterface {
+class TopSurnamesModule extends AbstractModule implements ModuleBlockInterface {
/** {@inheritdoc} */
public function getTitle() {
return /* I18N: Name of a module. Top=Most common */ I18N::translate('Top surnames');
@@ -37,9 +37,9 @@ class TopSurnamesModule extends Module implements ModuleBlockInterface {
$COMMON_NAMES_REMOVE = $WT_TREE->getPreference('COMMON_NAMES_REMOVE');
$COMMON_NAMES_THRESHOLD = $WT_TREE->getPreference('COMMON_NAMES_THRESHOLD');
- $num = get_block_setting($block_id, 'num', '10');
- $infoStyle = get_block_setting($block_id, 'infoStyle', 'table');
- $block = get_block_setting($block_id, 'block', '0');
+ $num = $this->getBlockSetting($block_id, 'num', '10');
+ $infoStyle = $this->getBlockSetting($block_id, 'infoStyle', 'table');
+ $block = $this->getBlockSetting($block_id, 'block', '0');
if ($cfg) {
foreach (array('num', 'infoStyle', 'block') as $name) {
@@ -136,14 +136,14 @@ class TopSurnamesModule extends Module implements ModuleBlockInterface {
/** {@inheritdoc} */
public function configureBlock($block_id) {
if (Filter::postBool('save') && Filter::checkCsrf()) {
- set_block_setting($block_id, 'num', Filter::postInteger('num', 1, 10000, 10));
- set_block_setting($block_id, 'infoStyle', Filter::post('infoStyle', 'list|array|table|tagcloud', 'table'));
- set_block_setting($block_id, 'block', Filter::postBool('block'));
+ $this->setBlockSetting($block_id, 'num', Filter::postInteger('num', 1, 10000, 10));
+ $this->setBlockSetting($block_id, 'infoStyle', Filter::post('infoStyle', 'list|array|table|tagcloud', 'table'));
+ $this->setBlockSetting($block_id, 'block', Filter::postBool('block'));
}
- $num = get_block_setting($block_id, 'num', '10');
- $infoStyle = get_block_setting($block_id, 'infoStyle', 'table');
- $block = get_block_setting($block_id, 'block', '0');
+ $num = $this->getBlockSetting($block_id, 'num', '10');
+ $infoStyle = $this->getBlockSetting($block_id, 'infoStyle', 'table');
+ $block = $this->getBlockSetting($block_id, 'block', '0');
echo '<tr><td class="descriptionbox wrap width33">';
echo I18N::translate('Number of items to show');
diff --git a/app/Module/UpcomingAnniversariesModule.php b/app/Module/UpcomingAnniversariesModule.php
index 36b09faf51..49fc19b4e4 100644
--- a/app/Module/UpcomingAnniversariesModule.php
+++ b/app/Module/UpcomingAnniversariesModule.php
@@ -19,7 +19,7 @@ namespace Fisharebest\Webtrees;
/**
* Class UpcomingAnniversariesModule
*/
-class UpcomingAnniversariesModule extends Module implements ModuleBlockInterface {
+class UpcomingAnniversariesModule extends AbstractModule implements ModuleBlockInterface {
/** {@inheritdoc} */
public function getTitle() {
return /* I18N: Name of a module */ I18N::translate('Upcoming events');
@@ -34,12 +34,12 @@ class UpcomingAnniversariesModule extends Module implements ModuleBlockInterface
public function getBlock($block_id, $template = true, $cfg = null) {
global $ctype, $WT_TREE;
- $days = get_block_setting($block_id, 'days', '7');
- $filter = get_block_setting($block_id, 'filter', '1');
- $onlyBDM = get_block_setting($block_id, 'onlyBDM', '0');
- $infoStyle = get_block_setting($block_id, 'infoStyle', 'table');
- $sortStyle = get_block_setting($block_id, 'sortStyle', 'alpha');
- $block = get_block_setting($block_id, 'block', '1');
+ $days = $this->getBlockSetting($block_id, 'days', '7');
+ $filter = $this->getBlockSetting($block_id, 'filter', '1');
+ $onlyBDM = $this->getBlockSetting($block_id, 'onlyBDM', '0');
+ $infoStyle = $this->getBlockSetting($block_id, 'infoStyle', 'table');
+ $sortStyle = $this->getBlockSetting($block_id, 'sortStyle', 'alpha');
+ $block = $this->getBlockSetting($block_id, 'block', '1');
if ($cfg) {
foreach (array('days', 'filter', 'onlyBDM', 'infoStyle', 'sortStyle', 'block') as $name) {
@@ -103,20 +103,20 @@ class UpcomingAnniversariesModule extends Module implements ModuleBlockInterface
/** {@inheritdoc} */
public function configureBlock($block_id) {
if (Filter::postBool('save') && Filter::checkCsrf()) {
- set_block_setting($block_id, 'days', Filter::postInteger('days', 1, 30, 7));
- set_block_setting($block_id, 'filter', Filter::postBool('filter'));
- set_block_setting($block_id, 'onlyBDM', Filter::postBool('onlyBDM'));
- set_block_setting($block_id, 'infoStyle', Filter::post('infoStyle', 'list|table', 'table'));
- set_block_setting($block_id, 'sortStyle', Filter::post('sortStyle', 'alpha|anniv', 'alpha'));
- set_block_setting($block_id, 'block', Filter::postBool('block'));
+ $this->setBlockSetting($block_id, 'days', Filter::postInteger('days', 1, 30, 7));
+ $this->setBlockSetting($block_id, 'filter', Filter::postBool('filter'));
+ $this->setBlockSetting($block_id, 'onlyBDM', Filter::postBool('onlyBDM'));
+ $this->setBlockSetting($block_id, 'infoStyle', Filter::post('infoStyle', 'list|table', 'table'));
+ $this->setBlockSetting($block_id, 'sortStyle', Filter::post('sortStyle', 'alpha|anniv', 'alpha'));
+ $this->setBlockSetting($block_id, 'block', Filter::postBool('block'));
}
- $days = get_block_setting($block_id, 'days', '7');
- $filter = get_block_setting($block_id, 'filter', '1');
- $onlyBDM = get_block_setting($block_id, 'onlyBDM', '0');
- $infoStyle = get_block_setting($block_id, 'infoStyle', 'table');
- $sortStyle = get_block_setting($block_id, 'sortStyle', 'alpha');
- $block = get_block_setting($block_id, 'block', '1');
+ $days = $this->getBlockSetting($block_id, 'days', '7');
+ $filter = $this->getBlockSetting($block_id, 'filter', '1');
+ $onlyBDM = $this->getBlockSetting($block_id, 'onlyBDM', '0');
+ $infoStyle = $this->getBlockSetting($block_id, 'infoStyle', 'table');
+ $sortStyle = $this->getBlockSetting($block_id, 'sortStyle', 'alpha');
+ $block = $this->getBlockSetting($block_id, 'block', '1');
echo '<tr><td class="descriptionbox wrap width33">';
echo I18N::translate('Number of days to show');
diff --git a/app/Module/UserJournalModule.php b/app/Module/UserJournalModule.php
index 009d7e09da..95a4ddc988 100644
--- a/app/Module/UserJournalModule.php
+++ b/app/Module/UserJournalModule.php
@@ -19,7 +19,7 @@ namespace Fisharebest\Webtrees;
/**
* Class UserJournalModule
*/
-class UserJournalModule extends Module implements ModuleBlockInterface {
+class UserJournalModule extends AbstractModule implements ModuleBlockInterface {
/** {@inheritdoc} */
public function getTitle() {
return /* I18N: Name of a module */ I18N::translate('Journal');
@@ -42,7 +42,7 @@ class UserJournalModule extends Module implements ModuleBlockInterface {
}
break;
}
- $block = get_block_setting($block_id, 'block', '1');
+ $block = $this->getBlockSetting($block_id, 'block', '1');
if ($cfg) {
foreach (array('block') as $name) {
if (array_key_exists($name, $cfg)) {
diff --git a/app/Module/UserMessagesModule.php b/app/Module/UserMessagesModule.php
index a65c064425..c484b13e2b 100644
--- a/app/Module/UserMessagesModule.php
+++ b/app/Module/UserMessagesModule.php
@@ -19,7 +19,7 @@ namespace Fisharebest\Webtrees;
/**
* Class UserMessagesModule
*/
-class UserMessagesModule extends Module implements ModuleBlockInterface {
+class UserMessagesModule extends AbstractModule implements ModuleBlockInterface {
/** {@inheritdoc} */
public function getTitle() {
return /* I18N: Name of a module */ I18N::translate('Messages');
@@ -40,7 +40,7 @@ class UserMessagesModule extends Module implements ModuleBlockInterface {
Database::prepare("DELETE FROM `##message` WHERE message_id=?")->execute(array($message_id));
}
}
- $block = get_block_setting($block_id, 'block', '1');
+ $block = $this->getBlockSetting($block_id, 'block', '1');
if ($cfg) {
foreach (array('block') as $name) {
if (array_key_exists($name, $cfg)) {
@@ -137,10 +137,10 @@ class UserMessagesModule extends Module implements ModuleBlockInterface {
/** {@inheritdoc} */
public function configureBlock($block_id) {
if (Filter::postBool('save') && Filter::checkCsrf()) {
- set_block_setting($block_id, 'block', Filter::postBool('block'));
+ $this->setBlockSetting($block_id, 'block', Filter::postBool('block'));
}
- $block = get_block_setting($block_id, 'block', '1');
+ $block = $this->getBlockSetting($block_id, 'block', '1');
echo '<tr><td class="descriptionbox wrap width33">';
echo /* I18N: label for a yes/no option */ I18N::translate('Add a scrollbar when block contents grow');
echo '</td><td class="optionbox">';
diff --git a/app/Module/UserWelcomeModule.php b/app/Module/UserWelcomeModule.php
index a7fc42bf66..3168bd8d67 100644
--- a/app/Module/UserWelcomeModule.php
+++ b/app/Module/UserWelcomeModule.php
@@ -19,7 +19,7 @@ namespace Fisharebest\Webtrees;
/**
* Class UserWelcomeModule
*/
-class UserWelcomeModule extends Module implements ModuleBlockInterface {
+class UserWelcomeModule extends AbstractModule implements ModuleBlockInterface {
/** {@inheritdoc} */
public function getTitle() {
return /* I18N: Name of a module */ I18N::translate('My page');
diff --git a/app/Module/WelcomeBlockModule.php b/app/Module/WelcomeBlockModule.php
index f0e36d5ec7..c405befcf1 100644
--- a/app/Module/WelcomeBlockModule.php
+++ b/app/Module/WelcomeBlockModule.php
@@ -19,7 +19,7 @@ namespace Fisharebest\Webtrees;
/**
* Class WelcomeBlockModule
*/
-class WelcomeBlockModule extends Module implements ModuleBlockInterface {
+class WelcomeBlockModule extends AbstractModule implements ModuleBlockInterface {
/** {@inheritdoc} */
public function getTitle() {
return /* I18N: Name of a module */ I18N::translate('Home page');
diff --git a/app/Module/YahrzeitModule.php b/app/Module/YahrzeitModule.php
index 415d7edd9a..00a4820daf 100644
--- a/app/Module/YahrzeitModule.php
+++ b/app/Module/YahrzeitModule.php
@@ -22,7 +22,7 @@ use Rhumsaa\Uuid\Uuid;
/**
* Class YahrzeitModule
*/
-class YahrzeitModule extends Module implements ModuleBlockInterface {
+class YahrzeitModule extends AbstractModule implements ModuleBlockInterface {
/** {@inheritdoc} */
public function getTitle() {
return /* I18N: Name of a module. Yahrzeiten (the plural of Yahrzeit) are special anniversaries of deaths in the Hebrew faith/calendar. */ I18N::translate('Yahrzeiten');
@@ -37,10 +37,10 @@ class YahrzeitModule extends Module implements ModuleBlockInterface {
public function getBlock($block_id, $template = true, $cfg = null) {
global $ctype, $controller, $WT_TREE;
- $days = get_block_setting($block_id, 'days', '7');
- $infoStyle = get_block_setting($block_id, 'infoStyle', 'table');
- $calendar = get_block_setting($block_id, 'calendar', 'jewish');
- $block = get_block_setting($block_id, 'block', '1');
+ $days = $this->getBlockSetting($block_id, 'days', '7');
+ $infoStyle = $this->getBlockSetting($block_id, 'infoStyle', 'table');
+ $calendar = $this->getBlockSetting($block_id, 'calendar', 'jewish');
+ $block = $this->getBlockSetting($block_id, 'block', '1');
if ($cfg) {
foreach (array('days', 'infoStyle', 'block') as $name) {
@@ -232,16 +232,16 @@ class YahrzeitModule extends Module implements ModuleBlockInterface {
/** {@inheritdoc} */
public function configureBlock($block_id) {
if (Filter::postBool('save') && Filter::checkCsrf()) {
- set_block_setting($block_id, 'days', Filter::postInteger('days', 1, 30, 7));
- set_block_setting($block_id, 'infoStyle', Filter::post('infoStyle', 'list|table', 'table'));
- set_block_setting($block_id, 'calendar', Filter::post('calendar', 'jewish|gregorian', 'jewish'));
- set_block_setting($block_id, 'block', Filter::postBool('block'));
+ $this->setBlockSetting($block_id, 'days', Filter::postInteger('days', 1, 30, 7));
+ $this->setBlockSetting($block_id, 'infoStyle', Filter::post('infoStyle', 'list|table', 'table'));
+ $this->setBlockSetting($block_id, 'calendar', Filter::post('calendar', 'jewish|gregorian', 'jewish'));
+ $this->setBlockSetting($block_id, 'block', Filter::postBool('block'));
}
- $days = get_block_setting($block_id, 'days', '7');
- $infoStyle = get_block_setting($block_id, 'infoStyle', 'table');
- $calendar = get_block_setting($block_id, 'calendar', 'jewish');
- $block = get_block_setting($block_id, 'block', '1');
+ $days = $this->getBlockSetting($block_id, 'days', '7');
+ $infoStyle = $this->getBlockSetting($block_id, 'infoStyle', 'table');
+ $calendar = $this->getBlockSetting($block_id, 'calendar', 'jewish');
+ $block = $this->getBlockSetting($block_id, 'block', '1');
echo '<tr><td class="descriptionbox wrap width33">';
echo I18N::translate('Number of days to show');
diff --git a/includes/functions/functions_db.php b/includes/functions/functions_db.php
index dbe2e70e04..94bfa3fcbf 100644
--- a/includes/functions/functions_db.php
+++ b/includes/functions/functions_db.php
@@ -1045,40 +1045,6 @@ function get_gedcom_blocks($gedcom_id) {
}
/**
- * @param integer $block_id
- * @param string $setting_name
- * @param string|null $default_value
- *
- * @return null|string
- */
-function get_block_setting($block_id, $setting_name, $default_value = null) {
- static $statement;
- if ($statement === null) {
- $statement = Database::prepare(
- "SELECT SQL_CACHE setting_value FROM `##block_setting` WHERE block_id=? AND setting_name=?"
- );
- }
- $setting_value = $statement->execute(array($block_id, $setting_name))->fetchOne();
-
- return $setting_value === null ? $default_value : $setting_value;
-}
-
-/**
- * @param integer $block_id
- * @param string $setting_name
- * @param string|null $setting_value
- */
-function set_block_setting($block_id, $setting_name, $setting_value) {
- if ($setting_value === null) {
- Database::prepare("DELETE FROM `##block_setting` WHERE block_id=? AND setting_name=?")
- ->execute(array($block_id, $setting_name));
- } else {
- Database::prepare("REPLACE INTO `##block_setting` (block_id, setting_name, setting_value) VALUES (?, ?, ?)")
- ->execute(array($block_id, $setting_name, $setting_value));
- }
-}
-
-/**
* Update favorites after merging records.
*
* @param string $xref_from
diff --git a/tests/includes/functions/FunctionsDbTest.php b/tests/includes/functions/FunctionsDbTest.php
index ebc7314a1e..54468023bf 100644
--- a/tests/includes/functions/FunctionsDbTest.php
+++ b/tests/includes/functions/FunctionsDbTest.php
@@ -220,24 +220,6 @@ class FunctionsDbTest extends PHPUnit_Framework_TestCase {
}
/**
- * Test that function get_block_setting() exists in the correct namespace.
- *
- * @return void
- */
- public function testFunctionGetBlockSettingExists() {
- $this->assertEquals(function_exists(__NAMESPACE__ . '\\get_block_setting'), true);
- }
-
- /**
- * Test that function set_block_setting() exists in the correct namespace.
- *
- * @return void
- */
- public function testFunctionSetBlockSettingExists() {
- $this->assertEquals(function_exists(__NAMESPACE__ . '\\set_block_setting'), true);
- }
-
- /**
* Test that function update_favorites() exists in the correct namespace.
*
* @return void
diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php
index 76c96a7691..5be91d3d93 100644
--- a/vendor/composer/autoload_classmap.php
+++ b/vendor/composer/autoload_classmap.php
@@ -1439,6 +1439,7 @@ return array(
'Fisharebest\\Localization\\Variant\\VariantInterface' => $vendorDir . '/fisharebest/localization/src/Variant/VariantInterface.php',
'Fisharebest\\Localization\\Variant\\VariantPosix' => $vendorDir . '/fisharebest/localization/src/Variant/VariantPosix.php',
'Fisharebest\\Localization\\Variant\\VariantValencia' => $vendorDir . '/fisharebest/localization/src/Variant/VariantValencia.php',
+ 'Fisharebest\\Webtrees\\AbstractModule' => $baseDir . '/app/Module/AbstractModule.php',
'Fisharebest\\Webtrees\\AdministrationTheme' => $baseDir . '/app/Theme/AdministrationTheme.php',
'Fisharebest\\Webtrees\\AdvancedSearchController' => $baseDir . '/app/Controller/AdvancedSearchController.php',
'Fisharebest\\Webtrees\\AhnentafelReportModule' => $baseDir . '/app/Module/AhnentafelReportModule.php',
@@ -1526,7 +1527,7 @@ return array(
'Fisharebest\\Webtrees\\LifespanController' => $baseDir . '/app/Controller/LifespanController.php',
'Fisharebest\\Webtrees\\Log' => $baseDir . '/app/Log.php',
'Fisharebest\\Webtrees\\LoggedInUsersModule' => $baseDir . '/app/Module/LoggedInUsersModule.php',
- 'Fisharebest\\Webtrees\\LoginBlockModule' => $baseDir . '/modules_v3/login_block/LoginBlockModule.php',
+ 'Fisharebest\\Webtrees\\LoginBlockModule' => $baseDir . '/app/Module/LoginBlockModule.php',
'Fisharebest\\Webtrees\\Mail' => $baseDir . '/app/Mail.php',
'Fisharebest\\Webtrees\\MarriageReportModule' => $baseDir . '/app/Module/MarriageReportModule.php',
'Fisharebest\\Webtrees\\Media' => $baseDir . '/app/Media.php',