Completed
Push — feature/code-analysis ( 1158f1...5e4834 )
by Jonathan
03:51
created
src/Webtrees/Module/PatronymicLineage/LineageController.php 3 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -92,14 +92,14 @@  discard block
 block discarded – undo
92 92
             $this->show     = 'lineage'; // SURN list makes no sense here
93 93
         } elseif ($this->alpha) {
94 94
             $this->show_all = 'no';
95
-            $this->legend   = Filter::escapeHtml($this->alpha) . '…';
95
+            $this->legend   = Filter::escapeHtml($this->alpha).'…';
96 96
             $this->show     = Filter::get('show', 'surn|lineage', 'surn');
97 97
         } else {
98 98
             $this->show_all = 'no';
99 99
             $this->legend   = '…';
100 100
             $this->show     = 'none'; // Don't show lists until something is chosen
101 101
         }
102
-        $this->legend = '<span dir="auto">' . $this->legend . '</span>';
102
+        $this->legend = '<span dir="auto">'.$this->legend.'</span>';
103 103
           
104 104
     }
105 105
     
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
         global $WT_TREE;
153 153
         
154 154
         $controller = new PageController();
155
-        $controller->setPageTitle(I18N::translate('Patronymic Lineages') . ' : ' . $this->legend);
155
+        $controller->setPageTitle(I18N::translate('Patronymic Lineages').' : '.$this->legend);
156 156
         
157 157
         $view_bag = new ViewBag();
158 158
         $view_bag->set('title', $controller->getPageTitle());
@@ -161,15 +161,15 @@  discard block
 block discarded – undo
161 161
         $view_bag->set('surname', $this->surname);
162 162
         $view_bag->set('legend', $this->legend);
163 163
         $view_bag->set('show_all', $this->show_all);
164
-        if($this->isShowingSurnames()) {
164
+        if ($this->isShowingSurnames()) {
165 165
             $view_bag->set('issurnames', true);
166 166
             $view_bag->set('surnameslist', $this->getSurnamesList());
167 167
         }
168
-        if($this->isShowingLineages()) {
168
+        if ($this->isShowingLineages()) {
169 169
             $view_bag->set('islineages', true);
170 170
             $view_bag->set('lineages', $this->getLineages());
171 171
 
172
-            if ($this->show_all==='no') {
172
+            if ($this->show_all === 'no') {
173 173
             	$view_bag->set('table_title', I18N::translate('Individuals in %s lineages', $this->legend));
174 174
             }
175 175
             else {
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -171,8 +171,7 @@
 block discarded – undo
171 171
 
172 172
             if ($this->show_all==='no') {
173 173
             	$view_bag->set('table_title', I18N::translate('Individuals in %s lineages', $this->legend));
174
-            }
175
-            else {
174
+            } else {
176 175
             	$view_bag->set('table_title', I18N::translate('All lineages'));
177 176
             }
178 177
         }
Please login to merge, or discard this patch.
Indentation   +136 added lines, -136 removed lines patch added patch discarded remove patch
@@ -26,166 +26,166 @@
 block discarded – undo
26 26
 class LineageController extends MvcController
27 27
 {   
28 28
     
29
-    /**
30
-     * Generate the patronymic lineage for this surname
31
-     * @var string $surname Reference surname
32
-     */
33
-    private $surname;   
29
+	/**
30
+	 * Generate the patronymic lineage for this surname
31
+	 * @var string $surname Reference surname
32
+	 */
33
+	private $surname;   
34 34
     
35
-    /**
36
-     * Initial letter
37
-     * @var string $alpha
38
-     */
39
-    private $alpha;
35
+	/**
36
+	 * Initial letter
37
+	 * @var string $alpha
38
+	 */
39
+	private $alpha;
40 40
     
41
-    /**
42
-     * Show all names (values: yes|no)
43
-     * @var bool $show
44
-     */
45
-    private $show_all;
41
+	/**
42
+	 * Show all names (values: yes|no)
43
+	 * @var bool $show
44
+	 */
45
+	private $show_all;
46 46
     
47
-    /**
48
-     * Page to display (values: surn|lineage)
49
-     * @var unknown $show
50
-     */
51
-    private $show;
47
+	/**
48
+	 * Page to display (values: surn|lineage)
49
+	 * @var unknown $show
50
+	 */
51
+	private $show;
52 52
     
53
-    /**
54
-     * Page title
55
-     * @var string $legend
56
-     */
57
-    private $legend;
53
+	/**
54
+	 * Page title
55
+	 * @var string $legend
56
+	 */
57
+	private $legend;
58 58
     
59
-    /**
60
-     * {@inheritDoc}
61
-     * @see \MyArtJaub\Webtrees\Mvc\Controller\MvcController::__construct(AbstractModule $module)
62
-     */
63
-    public function __construct(AbstractModule $module) {
64
-        global $WT_TREE;
59
+	/**
60
+	 * {@inheritDoc}
61
+	 * @see \MyArtJaub\Webtrees\Mvc\Controller\MvcController::__construct(AbstractModule $module)
62
+	 */
63
+	public function __construct(AbstractModule $module) {
64
+		global $WT_TREE;
65 65
         
66
-        parent::__construct($module);
66
+		parent::__construct($module);
67 67
         
68
-        $this->surname     = Filter::get('surname');
69
-        $this->alpha       = Filter::get('alpha'); // All surnames beginning with this letter where "@"=unknown and ","=none
70
-        $this->show_all    = Filter::get('show_all', 'no|yes', 'no'); // All indis
71
-        // Make sure selections are consistent.
72
-        // i.e. can’t specify show_all and surname at the same time.
73
-        if ($this->show_all === 'yes') {
74
-            $this->alpha   = '';
75
-            $this->surname = '';
76
-            $this->legend  = I18N::translate('All');
77
-            $this->show    = Filter::get('show', 'surn|lineage', 'surn');
78
-        } elseif ($this->surname) {
79
-            $this->alpha    = QueryName::initialLetter($this->surname); // so we can highlight the initial letter
80
-            $this->show_all = 'no';
81
-            if ($this->surname === '@N.N.') {
82
-                $this->legend = I18N::translateContext('Unknown surname', '…');
83
-            } else {
84
-                $this->legend = Filter::escapeHtml($this->surname);
85
-                // The surname parameter is a root/canonical form.
86
-                // Display it as the actual surname
87
-                foreach (QueryName::surnames($WT_TREE, $this->surname, $this->alpha, false, false) as $details) {
88
-                    $this->legend = implode('/', array_keys($details));
89
-                }                
90
-            }
91
-            $this->show = 'lineage'; // SURN list makes no sense here
92
-        } elseif ($this->alpha === '@') {
93
-            $this->show_all = 'no';
94
-            $this->legend   = I18N::translateContext('Unknown surname', '…');
95
-            $this->show     = 'lineage'; // SURN list makes no sense here
96
-        } elseif ($this->alpha === ',') {
97
-            $this->show_all = 'no';
98
-            $this->legend   = I18N::translate('None');
99
-            $this->show     = 'lineage'; // SURN list makes no sense here
100
-        } elseif ($this->alpha) {
101
-            $this->show_all = 'no';
102
-            $this->legend   = Filter::escapeHtml($this->alpha) . '…';
103
-            $this->show     = Filter::get('show', 'surn|lineage', 'surn');
104
-        } else {
105
-            $this->show_all = 'no';
106
-            $this->legend   = '…';
107
-            $this->show     = 'none'; // Don't show lists until something is chosen
108
-        }
109
-        $this->legend = '<span dir="auto">' . $this->legend . '</span>';
68
+		$this->surname     = Filter::get('surname');
69
+		$this->alpha       = Filter::get('alpha'); // All surnames beginning with this letter where "@"=unknown and ","=none
70
+		$this->show_all    = Filter::get('show_all', 'no|yes', 'no'); // All indis
71
+		// Make sure selections are consistent.
72
+		// i.e. can’t specify show_all and surname at the same time.
73
+		if ($this->show_all === 'yes') {
74
+			$this->alpha   = '';
75
+			$this->surname = '';
76
+			$this->legend  = I18N::translate('All');
77
+			$this->show    = Filter::get('show', 'surn|lineage', 'surn');
78
+		} elseif ($this->surname) {
79
+			$this->alpha    = QueryName::initialLetter($this->surname); // so we can highlight the initial letter
80
+			$this->show_all = 'no';
81
+			if ($this->surname === '@N.N.') {
82
+				$this->legend = I18N::translateContext('Unknown surname', '…');
83
+			} else {
84
+				$this->legend = Filter::escapeHtml($this->surname);
85
+				// The surname parameter is a root/canonical form.
86
+				// Display it as the actual surname
87
+				foreach (QueryName::surnames($WT_TREE, $this->surname, $this->alpha, false, false) as $details) {
88
+					$this->legend = implode('/', array_keys($details));
89
+				}                
90
+			}
91
+			$this->show = 'lineage'; // SURN list makes no sense here
92
+		} elseif ($this->alpha === '@') {
93
+			$this->show_all = 'no';
94
+			$this->legend   = I18N::translateContext('Unknown surname', '…');
95
+			$this->show     = 'lineage'; // SURN list makes no sense here
96
+		} elseif ($this->alpha === ',') {
97
+			$this->show_all = 'no';
98
+			$this->legend   = I18N::translate('None');
99
+			$this->show     = 'lineage'; // SURN list makes no sense here
100
+		} elseif ($this->alpha) {
101
+			$this->show_all = 'no';
102
+			$this->legend   = Filter::escapeHtml($this->alpha) . '…';
103
+			$this->show     = Filter::get('show', 'surn|lineage', 'surn');
104
+		} else {
105
+			$this->show_all = 'no';
106
+			$this->legend   = '…';
107
+			$this->show     = 'none'; // Don't show lists until something is chosen
108
+		}
109
+		$this->legend = '<span dir="auto">' . $this->legend . '</span>';
110 110
           
111
-    }
111
+	}
112 112
     
113
-    /**
114
-     * Indicates whether the list of surname should be displayed
115
-     * @return bool
116
-     */
117
-    protected function isShowingSurnames() {
118
-        return $this->show === 'surn';
119
-    }
113
+	/**
114
+	 * Indicates whether the list of surname should be displayed
115
+	 * @return bool
116
+	 */
117
+	protected function isShowingSurnames() {
118
+		return $this->show === 'surn';
119
+	}
120 120
     
121
-    /**
122
-     * Indicates whether the lineages should be displayed
123
-     * @return bool
124
-     */
125
-    protected function isShowingLineages() {
126
-        return $this->show === 'lineage';
127
-    } 
121
+	/**
122
+	 * Indicates whether the lineages should be displayed
123
+	 * @return bool
124
+	 */
125
+	protected function isShowingLineages() {
126
+		return $this->show === 'lineage';
127
+	} 
128 128
     
129
-    /**
130
-     * Get list of surnames, starting with the specified initial
131
-     * @return array
132
-     */
133
-    protected function getSurnamesList() {
134
-        global $WT_TREE;
129
+	/**
130
+	 * Get list of surnames, starting with the specified initial
131
+	 * @return array
132
+	 */
133
+	protected function getSurnamesList() {
134
+		global $WT_TREE;
135 135
         
136
-        return QueryName::surnames($WT_TREE, $this->surname, $this->alpha, false, false);
137
-    }
136
+		return QueryName::surnames($WT_TREE, $this->surname, $this->alpha, false, false);
137
+	}
138 138
     
139
-    /**
140
-     * Get the lineages for the controller's specified surname
141
-     */
142
-    protected function getLineages() {
139
+	/**
140
+	 * Get the lineages for the controller's specified surname
141
+	 */
142
+	protected function getLineages() {
143 143
 		global $WT_TREE;
144 144
 		
145 145
 		$builder = new LineageBuilder($this->surname, $WT_TREE);
146 146
 		$lineages = $builder->buildLineages();
147 147
 		
148
-    	return $lineages;
149
-    }    
148
+		return $lineages;
149
+	}    
150 150
     
151
-    /**
152
-     * Pages
153
-     */
151
+	/**
152
+	 * Pages
153
+	 */
154 154
     
155
-    /**
156
-     * Lineage@index
157
-     */
158
-    public function index() {
159
-        global $WT_TREE;
155
+	/**
156
+	 * Lineage@index
157
+	 */
158
+	public function index() {
159
+		global $WT_TREE;
160 160
         
161
-        $controller = new PageController();
162
-        $controller->setPageTitle(I18N::translate('Patronymic Lineages') . ' : ' . $this->legend);
161
+		$controller = new PageController();
162
+		$controller->setPageTitle(I18N::translate('Patronymic Lineages') . ' : ' . $this->legend);
163 163
         
164
-        $view_bag = new ViewBag();
165
-        $view_bag->set('title', $controller->getPageTitle());
166
-        $view_bag->set('tree', $WT_TREE);
167
-        $view_bag->set('alpha', $this->alpha);
168
-        $view_bag->set('surname', $this->surname);
169
-        $view_bag->set('legend', $this->legend);
170
-        $view_bag->set('show_all', $this->show_all);
171
-        if($this->isShowingSurnames()) {
172
-            $view_bag->set('issurnames', true);
173
-            $view_bag->set('surnameslist', $this->getSurnamesList());
174
-        }
175
-        if($this->isShowingLineages()) {
176
-            $view_bag->set('islineages', true);
177
-            $view_bag->set('lineages', $this->getLineages());
164
+		$view_bag = new ViewBag();
165
+		$view_bag->set('title', $controller->getPageTitle());
166
+		$view_bag->set('tree', $WT_TREE);
167
+		$view_bag->set('alpha', $this->alpha);
168
+		$view_bag->set('surname', $this->surname);
169
+		$view_bag->set('legend', $this->legend);
170
+		$view_bag->set('show_all', $this->show_all);
171
+		if($this->isShowingSurnames()) {
172
+			$view_bag->set('issurnames', true);
173
+			$view_bag->set('surnameslist', $this->getSurnamesList());
174
+		}
175
+		if($this->isShowingLineages()) {
176
+			$view_bag->set('islineages', true);
177
+			$view_bag->set('lineages', $this->getLineages());
178 178
 
179
-            if ($this->show_all==='no') {
180
-            	$view_bag->set('table_title', I18N::translate('Individuals in %s lineages', $this->legend));
181
-            }
182
-            else {
183
-            	$view_bag->set('table_title', I18N::translate('All lineages'));
184
-            }
185
-        }
179
+			if ($this->show_all==='no') {
180
+				$view_bag->set('table_title', I18N::translate('Individuals in %s lineages', $this->legend));
181
+			}
182
+			else {
183
+				$view_bag->set('table_title', I18N::translate('All lineages'));
184
+			}
185
+		}
186 186
         
187
-        ViewFactory::make('Lineage', $this, $controller, $view_bag)->render();   
188
-    }
187
+		ViewFactory::make('Lineage', $this, $controller, $view_bag)->render();   
188
+	}
189 189
     
190 190
     
191 191
     
Please login to merge, or discard this patch.
src/Webtrees/Module/SosaModule.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
     public function getConfigLink() {
78 78
         Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION);
79 79
         
80
-        return 'module.php?mod=' . $this->getName() . '&amp;mod_action=SosaConfig';
80
+        return 'module.php?mod='.$this->getName().'&amp;mod_action=SosaConfig';
81 81
     }
82 82
     
83 83
     /**********
@@ -100,17 +100,17 @@  discard block
 block discarded – undo
100 100
         global $WT_TREE, $controller;
101 101
         
102 102
         $menu = null;
103
-        if(ModuleManager::getInstance()->isOperational($this->getName())) {
103
+        if (ModuleManager::getInstance()->isOperational($this->getName())) {
104 104
             
105
-            $root_url = 'module.php?mod=' . $this->getName() . '&ged=' . $WT_TREE->getNameUrl() . '&';
106
-            $sosa_stat_menu = new Menu(I18N::translate('Sosa Statistics'), $root_url . 'mod_action=SosaStats', 'menu-maj-sosa-stats');
105
+            $root_url = 'module.php?mod='.$this->getName().'&ged='.$WT_TREE->getNameUrl().'&';
106
+            $sosa_stat_menu = new Menu(I18N::translate('Sosa Statistics'), $root_url.'mod_action=SosaStats', 'menu-maj-sosa-stats');
107 107
             
108 108
             $menu = clone $sosa_stat_menu;
109 109
             $menu->setClass('menu-maj-sosa');
110 110
             
111 111
             $submenus = array_filter(array(
112
-                new Menu(I18N::translate('Sosa Ancestors'), $root_url . 'mod_action=SosaList', 'menu-maj-sosa-list', array('rel' => 'nofollow')),
113
-                new Menu(I18N::translate('Missing Ancestors'), $root_url . 'mod_action=SosaList@missing', 'menu-maj-sosa-missing', array('rel' => 'nofollow')),
112
+                new Menu(I18N::translate('Sosa Ancestors'), $root_url.'mod_action=SosaList', 'menu-maj-sosa-list', array('rel' => 'nofollow')),
113
+                new Menu(I18N::translate('Missing Ancestors'), $root_url.'mod_action=SosaList@missing', 'menu-maj-sosa-missing', array('rel' => 'nofollow')),
114 114
                 $sosa_stat_menu                
115 115
             ));
116 116
             
@@ -119,12 +119,12 @@  discard block
 block discarded – undo
119 119
                 && $ga_list = Module::getModuleByName(Constants::MODULE_MAJ_GEODISP_NAME)->getProvider()->getGeoAnalysisList()
120 120
                 )
121 121
             {
122
-                if(count($ga_list) > 0) {
123
-                    $submenus[] = new Menu(I18N::translate('Geographical Dispersion'), 'module.php?mod=' . Constants::MODULE_MAJ_GEODISP_NAME . '&ged=' . $WT_TREE->getNameUrl() . '&mod_action=GeoAnalysis@listAll', 'menu-maj-sosa-geodispersion');
122
+                if (count($ga_list) > 0) {
123
+                    $submenus[] = new Menu(I18N::translate('Geographical Dispersion'), 'module.php?mod='.Constants::MODULE_MAJ_GEODISP_NAME.'&ged='.$WT_TREE->getNameUrl().'&mod_action=GeoAnalysis@listAll', 'menu-maj-sosa-geodispersion');
124 124
                 }
125 125
             }
126 126
             
127
-            if(Auth::check()) {
127
+            if (Auth::check()) {
128 128
                 $submenus[] = new Menu(
129 129
                     I18N::translate('Sosa Configuration'),
130 130
                     $this->getConfigLink(),
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
                     ->addInlineJavascript('
141 141
                         function majComputeSosaFromIndi(){
142 142
                             if($("#computesosadlg").length == 0) {
143
-                                $("body").append("<div id=\"computesosadlg\" title=\"'. I18N::translate('Sosas computation') .'\"><div id=\"sosaloadingarea\"></div></div>");
143
+                                $("body").append("<div id=\"computesosadlg\" title=\"'. I18N::translate('Sosas computation').'\"><div id=\"sosaloadingarea\"></div></div>");
144 144
                             }
145 145
 	                        $("#computesosadlg").dialog({
146 146
                                 modal: true,
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 		                        open: function(event, ui) {
150 150
 			                        $("button.ui-dialog-titlebar-close").hide();
151 151
                                     $("#sosaloadingarea").empty().html("<i class=\"icon-loading-small\"></i>");
152
-			                        $("#sosaloadingarea").load("module.php?mod=' . $this->getName() . '&mod_action=SosaConfig@computePartial&ged='. $WT_TREE->getNameUrl() .'&userid='.Auth::user()->getUserId().'&pid=' . $controller->getSignificantIndividual()->getXref() . '", 
152
+			                        $("#sosaloadingarea").load("module.php?mod=' . $this->getName().'&mod_action=SosaConfig@computePartial&ged='.$WT_TREE->getNameUrl().'&userid='.Auth::user()->getUserId().'&pid='.$controller->getSignificantIndividual()->getXref().'", 
153 153
 					                   function(){
154 154
 						                  $("button.ui-dialog-titlebar-close").show();
155 155
                                           setTimeout(function(){
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
      * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\IndividualHeaderExtender::hExtendIndiHeaderIcons()
200 200
      */
201 201
     public function hExtendIndiHeaderIcons(IndividualController $ctrlIndi) {
202
-        if($ctrlIndi){
202
+        if ($ctrlIndi) {
203 203
             $dindi = new Individual($ctrlIndi->getSignificantIndividual());
204 204
             return FunctionsPrint::formatSosaNumbers($dindi->getSosaNumbers(), 1, 'large');
205 205
         }
@@ -217,9 +217,9 @@  discard block
 block discarded – undo
217 217
      * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\IndividualHeaderExtender::hExtendIndiHeaderRight()
218 218
      */
219 219
     public function hExtendIndiHeaderRight(IndividualController $ctrlIndi) {
220
-        if($ctrlIndi){
220
+        if ($ctrlIndi) {
221 221
             $dindi = new Individual($ctrlIndi->getSignificantIndividual());
222
-            return array('indi-header-sosa',  FunctionsPrint::formatSosaNumbers($dindi->getSosaNumbers(), 2, 'normal'));
222
+            return array('indi-header-sosa', FunctionsPrint::formatSosaNumbers($dindi->getSosaNumbers(), 2, 'normal'));
223 223
         }
224 224
         return '';
225 225
     }
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
      * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\RecordNameTextExtender::hRecordNameAppend()
230 230
      */
231 231
     public function hRecordNameAppend(GedcomRecord $grec) {
232
-        if($grec instanceof \Fisharebest\Webtrees\Individual){ // Only apply to individuals
232
+        if ($grec instanceof \Fisharebest\Webtrees\Individual) { // Only apply to individuals
233 233
             $dindi = new Individual($grec);
234 234
             return FunctionsPrint::formatSosaNumbers($dindi->getSosaNumbers(), 1, 'small');
235 235
         }
Please login to merge, or discard this patch.
Indentation   +163 added lines, -163 removed lines patch added patch discarded remove patch
@@ -31,116 +31,116 @@  discard block
 block discarded – undo
31 31
  * Sosa Module.
32 32
  */
33 33
 class SosaModule 
34
-    extends AbstractModule 
35
-    implements  ModuleMenuInterface, 
36
-                ModuleConfigInterface,
37
-                HookSubscriberInterface,
38
-                IndividualHeaderExtenderInterface,
39
-                RecordNameTextExtenderInterface
34
+	extends AbstractModule 
35
+	implements  ModuleMenuInterface, 
36
+				ModuleConfigInterface,
37
+				HookSubscriberInterface,
38
+				IndividualHeaderExtenderInterface,
39
+				RecordNameTextExtenderInterface
40 40
 {
41
-    // How to update the database schema for this module
42
-    const SCHEMA_TARGET_VERSION   = 1;
43
-    const SCHEMA_SETTING_NAME     = 'MAJ_SOSA_SCHEMA_VERSION';
44
-    const SCHEMA_MIGRATION_PREFIX = '\MyArtJaub\Webtrees\Module\Sosa\Schema';
41
+	// How to update the database schema for this module
42
+	const SCHEMA_TARGET_VERSION   = 1;
43
+	const SCHEMA_SETTING_NAME     = 'MAJ_SOSA_SCHEMA_VERSION';
44
+	const SCHEMA_MIGRATION_PREFIX = '\MyArtJaub\Webtrees\Module\Sosa\Schema';
45 45
 
46
-    /** @var string For custom modules - link for support, upgrades, etc. */
47
-    const CUSTOM_WEBSITE = 'https://github.com/jon48/webtrees-lib';
48
-    
49
-    /**
50
-     * {@inhericDoc}
51
-     */
52
-    public function getTitle() {
53
-        return /* I18N: Name of the “Hooks” module */ I18N::translate('Sosa');
54
-    }
55
-    
56
-    /**
57
-     * {@inhericDoc}
58
-     */
59
-    public function getDescription() {
60
-        return /* I18N: Description of the “Hooks” module */ I18N::translate('Calculate and display Sosa ancestors of the root person.');
61
-    }
62
-    
63
-    /**
64
-     * {@inhericDoc}
65
-     */
66
-    public function modAction($mod_action) {
67
-        Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION);
46
+	/** @var string For custom modules - link for support, upgrades, etc. */
47
+	const CUSTOM_WEBSITE = 'https://github.com/jon48/webtrees-lib';
48
+    
49
+	/**
50
+	 * {@inhericDoc}
51
+	 */
52
+	public function getTitle() {
53
+		return /* I18N: Name of the “Hooks” module */ I18N::translate('Sosa');
54
+	}
55
+    
56
+	/**
57
+	 * {@inhericDoc}
58
+	 */
59
+	public function getDescription() {
60
+		return /* I18N: Description of the “Hooks” module */ I18N::translate('Calculate and display Sosa ancestors of the root person.');
61
+	}
62
+    
63
+	/**
64
+	 * {@inhericDoc}
65
+	 */
66
+	public function modAction($mod_action) {
67
+		Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION);
68 68
         
69
-        \MyArtJaub\Webtrees\Mvc\Dispatcher::getInstance()->handle($this, $mod_action);
70
-    }
69
+		\MyArtJaub\Webtrees\Mvc\Dispatcher::getInstance()->handle($this, $mod_action);
70
+	}
71 71
     
72
-    /**********
72
+	/**********
73 73
      * ModuleConfigInterface
74 74
      **********/
75 75
     
76
-    /**
77
-     * {@inhericDoc}
78
-     * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink()
79
-     */
80
-    public function getConfigLink() {
81
-        Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION);
76
+	/**
77
+	 * {@inhericDoc}
78
+	 * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink()
79
+	 */
80
+	public function getConfigLink() {
81
+		Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION);
82 82
         
83
-        return 'module.php?mod=' . $this->getName() . '&amp;mod_action=SosaConfig';
84
-    }
83
+		return 'module.php?mod=' . $this->getName() . '&amp;mod_action=SosaConfig';
84
+	}
85 85
     
86
-    /**********
86
+	/**********
87 87
      * ModuleMenuInterface
88 88
      **********/
89 89
     
90
-    /**
91
-     * {@inhericDoc}
92
-     * @see \Fisharebest\Webtrees\Module\ModuleMenuInterface::defaultMenuOrder()
93
-     */
94
-    public function defaultMenuOrder() {
95
-        return 5;
96
-    }
97
-    
98
-    /**
99
-     * {@inhericDoc}
100
-     * @see \Fisharebest\Webtrees\Module\ModuleMenuInterface::getMenu()
101
-     */
102
-    public function getMenu() { 
103
-        global $WT_TREE, $controller;
90
+	/**
91
+	 * {@inhericDoc}
92
+	 * @see \Fisharebest\Webtrees\Module\ModuleMenuInterface::defaultMenuOrder()
93
+	 */
94
+	public function defaultMenuOrder() {
95
+		return 5;
96
+	}
97
+    
98
+	/**
99
+	 * {@inhericDoc}
100
+	 * @see \Fisharebest\Webtrees\Module\ModuleMenuInterface::getMenu()
101
+	 */
102
+	public function getMenu() { 
103
+		global $WT_TREE, $controller;
104 104
         
105
-        $menu = null;
106
-        if(ModuleManager::getInstance()->isOperational($this->getName())) {
105
+		$menu = null;
106
+		if(ModuleManager::getInstance()->isOperational($this->getName())) {
107 107
             
108
-            $root_url = 'module.php?mod=' . $this->getName() . '&ged=' . $WT_TREE->getNameUrl() . '&';
109
-            $sosa_stat_menu = new Menu(I18N::translate('Sosa Statistics'), $root_url . 'mod_action=SosaStats', 'menu-maj-sosa-stats');
108
+			$root_url = 'module.php?mod=' . $this->getName() . '&ged=' . $WT_TREE->getNameUrl() . '&';
109
+			$sosa_stat_menu = new Menu(I18N::translate('Sosa Statistics'), $root_url . 'mod_action=SosaStats', 'menu-maj-sosa-stats');
110 110
             
111
-            $menu = clone $sosa_stat_menu;
112
-            $menu->setClass('menu-maj-sosa');
111
+			$menu = clone $sosa_stat_menu;
112
+			$menu->setClass('menu-maj-sosa');
113 113
             
114
-            $submenus = array_filter(array(
115
-                new Menu(I18N::translate('Sosa Ancestors'), $root_url . 'mod_action=SosaList', 'menu-maj-sosa-list', array('rel' => 'nofollow')),
116
-                new Menu(I18N::translate('Missing Ancestors'), $root_url . 'mod_action=SosaList@missing', 'menu-maj-sosa-missing', array('rel' => 'nofollow')),
117
-                $sosa_stat_menu                
118
-            ));
114
+			$submenus = array_filter(array(
115
+				new Menu(I18N::translate('Sosa Ancestors'), $root_url . 'mod_action=SosaList', 'menu-maj-sosa-list', array('rel' => 'nofollow')),
116
+				new Menu(I18N::translate('Missing Ancestors'), $root_url . 'mod_action=SosaList@missing', 'menu-maj-sosa-missing', array('rel' => 'nofollow')),
117
+				$sosa_stat_menu                
118
+			));
119 119
             
120 120
 
121
-            if (ModuleManager::getInstance()->isOperational(Constants::MODULE_MAJ_GEODISP_NAME)
122
-                && $ga_list = Module::getModuleByName(Constants::MODULE_MAJ_GEODISP_NAME)->getProvider()->getGeoAnalysisList()
123
-                )
124
-            {
125
-                if(count($ga_list) > 0) {
126
-                    $submenus[] = new Menu(I18N::translate('Geographical Dispersion'), 'module.php?mod=' . Constants::MODULE_MAJ_GEODISP_NAME . '&ged=' . $WT_TREE->getNameUrl() . '&mod_action=GeoAnalysis@listAll', 'menu-maj-sosa-geodispersion');
127
-                }
128
-            }
121
+			if (ModuleManager::getInstance()->isOperational(Constants::MODULE_MAJ_GEODISP_NAME)
122
+				&& $ga_list = Module::getModuleByName(Constants::MODULE_MAJ_GEODISP_NAME)->getProvider()->getGeoAnalysisList()
123
+				)
124
+			{
125
+				if(count($ga_list) > 0) {
126
+					$submenus[] = new Menu(I18N::translate('Geographical Dispersion'), 'module.php?mod=' . Constants::MODULE_MAJ_GEODISP_NAME . '&ged=' . $WT_TREE->getNameUrl() . '&mod_action=GeoAnalysis@listAll', 'menu-maj-sosa-geodispersion');
127
+				}
128
+			}
129 129
             
130
-            if(Auth::check()) {
131
-                $submenus[] = new Menu(
132
-                    I18N::translate('Sosa Configuration'),
133
-                    $this->getConfigLink(),
134
-                    'menu-maj-sosa-configuration',
135
-                    array('rel' => 'nofollow'));
136
-            }
130
+			if(Auth::check()) {
131
+				$submenus[] = new Menu(
132
+					I18N::translate('Sosa Configuration'),
133
+					$this->getConfigLink(),
134
+					'menu-maj-sosa-configuration',
135
+					array('rel' => 'nofollow'));
136
+			}
137 137
                         
138
-            //-- recompute Sosa submenu
139
-            if (!empty($controller) && $controller instanceof IndividualController 
140
-                && Auth::check() && $WT_TREE->getUserPreference(Auth::user(), 'MAJ_SOSA_ROOT_ID')
141
-                ) {
142
-                $controller
143
-                    ->addInlineJavascript('
138
+			//-- recompute Sosa submenu
139
+			if (!empty($controller) && $controller instanceof IndividualController 
140
+				&& Auth::check() && $WT_TREE->getUserPreference(Auth::user(), 'MAJ_SOSA_ROOT_ID')
141
+				) {
142
+				$controller
143
+					->addInlineJavascript('
144 144
                         function majComputeSosaFromIndi(){
145 145
                             if($("#computesosadlg").length == 0) {
146 146
                                 $("body").append("<div id=\"computesosadlg\" title=\"'. I18N::translate('Sosas computation') .'\"><div id=\"sosaloadingarea\"></div></div>");
@@ -163,87 +163,87 @@  discard block
 block discarded – undo
163 163
 	                         });	
164 164
                         }');
165 165
                 	
166
-                $submenus[] = new Menu(
167
-                    I18N::translate('Complete Sosas'), 
168
-                    '#', 
169
-                    'menu-maj-sosa-recompute', 
170
-                    array(
171
-                        'rel' => 'nofollow',
172
-                        'onclick' => 'return majComputeSosaFromIndi();'
173
-                    ));
174
-            }
166
+				$submenus[] = new Menu(
167
+					I18N::translate('Complete Sosas'), 
168
+					'#', 
169
+					'menu-maj-sosa-recompute', 
170
+					array(
171
+						'rel' => 'nofollow',
172
+						'onclick' => 'return majComputeSosaFromIndi();'
173
+					));
174
+			}
175 175
             
176
-        }
176
+		}
177 177
         
178
-        $menu->setSubmenus($submenus);
178
+		$menu->setSubmenus($submenus);
179 179
         
180
-        return $menu;
180
+		return $menu;
181 181
         
182
-    }
182
+	}
183 183
     
184
-    /**********
184
+	/**********
185 185
      * Hooks
186 186
      **********/
187 187
     
188
-    /**
189
-     * {@inhericDoc}
190
-     * @see \MyArtJaub\Webtrees\Hook\HookSubscriberInterface::getSubscribedHooks()
191
-     */    
192
-    public function getSubscribedHooks() {
193
-        return array(
194
-            'hExtendIndiHeaderIcons' => 20,
195
-            'hExtendIndiHeaderRight' => 20,
196
-            'hRecordNameAppend' => 20
197
-        );
198
-    }
199
-    
200
-    /**
201
-     * {@inhericDoc}
202
-     * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\IndividualHeaderExtenderInterface::hExtendIndiHeaderIcons()
203
-     */
204
-    public function hExtendIndiHeaderIcons(IndividualController $ctrlIndi) {
205
-        if($ctrlIndi){
206
-            $dindi = new Individual($ctrlIndi->getSignificantIndividual());
207
-            return FunctionsPrint::formatSosaNumbers($dindi->getSosaNumbers(), 1, 'large');
208
-        }
209
-        return '';
210
-    }
211
-    
212
-    /**
213
-     * {@inhericDoc}
214
-     * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\IndividualHeaderExtenderInterface::hExtendIndiHeaderLeft()
215
-     */
216
-    public function hExtendIndiHeaderLeft(IndividualController $ctrlIndi) { }
217
-    
218
-    /**
219
-     * {@inhericDoc}
220
-     * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\IndividualHeaderExtenderInterface::hExtendIndiHeaderRight()
221
-     */
222
-    public function hExtendIndiHeaderRight(IndividualController $ctrlIndi) {
223
-        if($ctrlIndi){
224
-            $dindi = new Individual($ctrlIndi->getSignificantIndividual());
225
-            return array('indi-header-sosa',  FunctionsPrint::formatSosaNumbers($dindi->getSosaNumbers(), 2, 'normal'));
226
-        }
227
-        return '';
228
-    }
229
-    
230
-    /**
231
-     * {@inhericDoc}
232
-     * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\RecordNameTextExtenderInterface::hRecordNameAppend()
233
-     */
234
-    public function hRecordNameAppend(GedcomRecord $grec) {
235
-        if($grec instanceof \Fisharebest\Webtrees\Individual){ // Only apply to individuals
236
-            $dindi = new Individual($grec);
237
-            return FunctionsPrint::formatSosaNumbers($dindi->getSosaNumbers(), 1, 'small');
238
-        }
239
-        return '';
240
-    }
241
-    
242
-    /**
243
-     * {@inhericDoc}
244
-     * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\RecordNameTextExtenderInterface::hRecordNamePrepend()
245
-     */
246
-    public function hRecordNamePrepend(GedcomRecord $grec) {}
188
+	/**
189
+	 * {@inhericDoc}
190
+	 * @see \MyArtJaub\Webtrees\Hook\HookSubscriberInterface::getSubscribedHooks()
191
+	 */    
192
+	public function getSubscribedHooks() {
193
+		return array(
194
+			'hExtendIndiHeaderIcons' => 20,
195
+			'hExtendIndiHeaderRight' => 20,
196
+			'hRecordNameAppend' => 20
197
+		);
198
+	}
199
+    
200
+	/**
201
+	 * {@inhericDoc}
202
+	 * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\IndividualHeaderExtenderInterface::hExtendIndiHeaderIcons()
203
+	 */
204
+	public function hExtendIndiHeaderIcons(IndividualController $ctrlIndi) {
205
+		if($ctrlIndi){
206
+			$dindi = new Individual($ctrlIndi->getSignificantIndividual());
207
+			return FunctionsPrint::formatSosaNumbers($dindi->getSosaNumbers(), 1, 'large');
208
+		}
209
+		return '';
210
+	}
211
+    
212
+	/**
213
+	 * {@inhericDoc}
214
+	 * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\IndividualHeaderExtenderInterface::hExtendIndiHeaderLeft()
215
+	 */
216
+	public function hExtendIndiHeaderLeft(IndividualController $ctrlIndi) { }
217
+    
218
+	/**
219
+	 * {@inhericDoc}
220
+	 * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\IndividualHeaderExtenderInterface::hExtendIndiHeaderRight()
221
+	 */
222
+	public function hExtendIndiHeaderRight(IndividualController $ctrlIndi) {
223
+		if($ctrlIndi){
224
+			$dindi = new Individual($ctrlIndi->getSignificantIndividual());
225
+			return array('indi-header-sosa',  FunctionsPrint::formatSosaNumbers($dindi->getSosaNumbers(), 2, 'normal'));
226
+		}
227
+		return '';
228
+	}
229
+    
230
+	/**
231
+	 * {@inhericDoc}
232
+	 * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\RecordNameTextExtenderInterface::hRecordNameAppend()
233
+	 */
234
+	public function hRecordNameAppend(GedcomRecord $grec) {
235
+		if($grec instanceof \Fisharebest\Webtrees\Individual){ // Only apply to individuals
236
+			$dindi = new Individual($grec);
237
+			return FunctionsPrint::formatSosaNumbers($dindi->getSosaNumbers(), 1, 'small');
238
+		}
239
+		return '';
240
+	}
241
+    
242
+	/**
243
+	 * {@inhericDoc}
244
+	 * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\RecordNameTextExtenderInterface::hRecordNamePrepend()
245
+	 */
246
+	public function hRecordNamePrepend(GedcomRecord $grec) {}
247 247
     
248 248
     
249 249
     
Please login to merge, or discard this patch.
src/Webtrees/Module/Hooks/Schema/Migration0.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -23,17 +23,17 @@
 block discarded – undo
23 23
 
24 24
 		Database::exec(
25 25
 		   "CREATE TABLE IF NOT EXISTS `##maj_hooks` (".
26
-	       " majh_id       			INTEGER AUTO_INCREMENT NOT NULL,".
27
-	       " majh_hook_function		VARCHAR(32)            NOT NULL,".
26
+		   " majh_id       			INTEGER AUTO_INCREMENT NOT NULL,".
27
+		   " majh_hook_function		VARCHAR(32)            NOT NULL,".
28 28
 		   " majh_hook_context      VARCHAR(32)            NOT NULL DEFAULT 'all',".
29
-	       " majh_module_name		VARCHAR(32)            NOT NULL,".
30
-	       " majh_module_priority	INTEGER            	   NOT NULL DEFAULT 99,".
31
-	       " majh_status      		ENUM('enabled', 'disabled') NOT NULL DEFAULT 'enabled',".		   
32
-	       " PRIMARY KEY (majh_id),".
33
-	       " UNIQUE KEY `##maj_hooks_uk` (majh_hook_function, majh_hook_context, majh_module_name),".
34
-	       " FOREIGN KEY `##module_name_fk1` (majh_module_name)".
29
+		   " majh_module_name		VARCHAR(32)            NOT NULL,".
30
+		   " majh_module_priority	INTEGER            	   NOT NULL DEFAULT 99,".
31
+		   " majh_status      		ENUM('enabled', 'disabled') NOT NULL DEFAULT 'enabled',".		   
32
+		   " PRIMARY KEY (majh_id),".
33
+		   " UNIQUE KEY `##maj_hooks_uk` (majh_hook_function, majh_hook_context, majh_module_name),".
34
+		   " FOREIGN KEY `##module_name_fk1` (majh_module_name)".
35 35
 		   " REFERENCES `##module` (module_name) ON DELETE CASCADE ON UPDATE CASCADE".
36
-	       ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
36
+		   ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
37 37
 		);
38 38
 	}
39 39
 }
Please login to merge, or discard this patch.
src/Webtrees/Module/Hooks/AdminConfigController.php 3 patches
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -47,7 +47,9 @@  discard block
 block discarded – undo
47 47
                         $array_hook = explode('#', $ihook);
48 48
                         //Update status
49 49
                         $new_status= Filter::postBool('status-' . $params['id']);
50
-                        if(in_array($array_hook[0], $module_names)) $new_status = false;
50
+                        if(in_array($array_hook[0], $module_names)) {
51
+                        	$new_status = false;
52
+                        }
51 53
                         $previous_status = $params['status'];
52 54
                         if ($new_status !== null) {
53 55
                             $new_status= $new_status ? 'enabled' : 'disabled';
@@ -94,7 +96,9 @@  discard block
 block discarded – undo
94 96
         HookProvider::updateHooks();
95 97
         
96 98
         $action = Filter::post('action');        
97
-        if($action == 'update' && Filter::checkCsrf()) $this->update();
99
+        if($action == 'update' && Filter::checkCsrf()) {
100
+        	$this->update();
101
+        }
98 102
         
99 103
         Theme::theme(new AdministrationTheme)->init($WT_TREE);        
100 104
         $ctrl = new PageController();
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -33,26 +33,26 @@  discard block
 block discarded – undo
33 33
      * Manage updates sent from the AdminConfig@index form.
34 34
      */
35 35
     protected function update() {
36
-        if(Auth::isAdmin()){
36
+        if (Auth::isAdmin()) {
37 37
             $ihooks = HookProvider::getInstalledHooks();
38 38
             	
39
-            $module_names= Database::prepare(
39
+            $module_names = Database::prepare(
40 40
                 "SELECT module_name FROM `##module` WHERE status='disabled'"
41 41
             )->fetchOneColumn();
42 42
             	
43
-            if($ihooks !== null){
43
+            if ($ihooks !== null) {
44 44
                 foreach ($ihooks as $ihook => $params) {
45
-                    if(Filter::post('hook-' . $params['id']) === 'yes') {                    
45
+                    if (Filter::post('hook-'.$params['id']) === 'yes') {                    
46 46
                         $array_hook = explode('#', $ihook);
47 47
                         //Update status
48
-                        $new_status= Filter::postBool('status-' . $params['id']);
49
-                        if(in_array($array_hook[0], $module_names)) $new_status = false;
48
+                        $new_status = Filter::postBool('status-'.$params['id']);
49
+                        if (in_array($array_hook[0], $module_names)) $new_status = false;
50 50
                         $previous_status = $params['status'];
51 51
                         if ($new_status !== null) {
52
-                            $new_status= $new_status ? 'enabled' : 'disabled';
53
-                            if($new_status != $previous_status){
52
+                            $new_status = $new_status ? 'enabled' : 'disabled';
53
+                            if ($new_status != $previous_status) {
54 54
                                 $chook = new Hook($array_hook[1], $array_hook[2]);
55
-                                switch($new_status){
55
+                                switch ($new_status) {
56 56
                                     case 'enabled':
57 57
                                         $chook->enable($array_hook[0]);
58 58
                                         break;
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
                         $new_priority = Filter::postInteger("moduleorder-{$params['id']}");
70 70
                         $previous_priority = $params['priority'];
71 71
                         if ($new_priority !== null) {
72
-                            if($new_priority != $previous_priority){
72
+                            if ($new_priority != $previous_priority) {
73 73
                                 $chook = new Hook($array_hook[1], $array_hook[2]);
74 74
                                 $chook->setPriority($array_hook[0], $new_priority);
75 75
                             }
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
         HookProvider::updateHooks();
94 94
         
95 95
         $action = Filter::post('action');        
96
-        if($action == 'update' && Filter::checkCsrf()) $this->update();
96
+        if ($action == 'update' && Filter::checkCsrf()) $this->update();
97 97
         
98 98
         Theme::theme(new AdministrationTheme)->init($WT_TREE);        
99 99
         $ctrl = new PageController();
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
             ->restrictAccess(Auth::isAdmin())
102 102
             ->setPageTitle($this->module->getTitle());
103 103
         
104
-        $table_id = 'table-installedhooks-' . Uuid::uuid4();
104
+        $table_id = 'table-installedhooks-'.Uuid::uuid4();
105 105
 
106 106
         $view_bag = new ViewBag();
107 107
         $view_bag->set('title', $ctrl->getPageTitle());
Please login to merge, or discard this patch.
Indentation   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -29,89 +29,89 @@  discard block
 block discarded – undo
29 29
  */
30 30
 class AdminConfigController extends MvcController
31 31
 {
32
-    /**
33
-     * Manage updates sent from the AdminConfig@index form.
34
-     */
35
-    protected function update() {
36
-        if(Auth::isAdmin()){
37
-            $ihooks = HookProvider::getInstance()->getInstalledHooks();
32
+	/**
33
+	 * Manage updates sent from the AdminConfig@index form.
34
+	 */
35
+	protected function update() {
36
+		if(Auth::isAdmin()){
37
+			$ihooks = HookProvider::getInstance()->getInstalledHooks();
38 38
             	
39
-            $module_names= Database::prepare(
40
-                "SELECT module_name FROM `##module` WHERE status='disabled'"
41
-            )->fetchOneColumn();
39
+			$module_names= Database::prepare(
40
+				"SELECT module_name FROM `##module` WHERE status='disabled'"
41
+			)->fetchOneColumn();
42 42
             	
43
-            if($ihooks !== null){
44
-                foreach ($ihooks as $ihook => $params) {
45
-                    if(Filter::post('hook-' . $params['id']) === 'yes') {                    
46
-                        $array_hook = explode('#', $ihook);
47
-                        //Update status
48
-                        $new_status= Filter::postBool('status-' . $params['id']);
49
-                        if(in_array($array_hook[0], $module_names)) $new_status = false;
50
-                        $previous_status = $params['status'];
51
-                        if ($new_status !== null) {
52
-                            $new_status= $new_status ? 'enabled' : 'disabled';
53
-                            if($new_status != $previous_status){
54
-                                $chook = new Hook($array_hook[1], $array_hook[2]);
55
-                                switch($new_status){
56
-                                    case 'enabled':
57
-                                        $chook->enable($array_hook[0]);
58
-                                        break;
59
-                                    case 'disabled':
60
-                                        $chook->disable($array_hook[0]);
61
-                                        break;
62
-                                    default:
63
-                                        break;
64
-                                }
65
-                            }
66
-                        }
43
+			if($ihooks !== null){
44
+				foreach ($ihooks as $ihook => $params) {
45
+					if(Filter::post('hook-' . $params['id']) === 'yes') {                    
46
+						$array_hook = explode('#', $ihook);
47
+						//Update status
48
+						$new_status= Filter::postBool('status-' . $params['id']);
49
+						if(in_array($array_hook[0], $module_names)) $new_status = false;
50
+						$previous_status = $params['status'];
51
+						if ($new_status !== null) {
52
+							$new_status= $new_status ? 'enabled' : 'disabled';
53
+							if($new_status != $previous_status){
54
+								$chook = new Hook($array_hook[1], $array_hook[2]);
55
+								switch($new_status){
56
+									case 'enabled':
57
+										$chook->enable($array_hook[0]);
58
+										break;
59
+									case 'disabled':
60
+										$chook->disable($array_hook[0]);
61
+										break;
62
+									default:
63
+										break;
64
+								}
65
+							}
66
+						}
67 67
                         
68
-                        //Update priority
69
-                        $new_priority = Filter::postInteger("moduleorder-{$params['id']}");
70
-                        $previous_priority = $params['priority'];
71
-                        if ($new_priority !== null) {
72
-                            if($new_priority != $previous_priority){
73
-                                $chook = new Hook($array_hook[1], $array_hook[2]);
74
-                                $chook->setPriority($array_hook[0], $new_priority);
75
-                            }
76
-                        }
77
-                    }
78
-                }
79
-            }
80
-        }
81
-    }
68
+						//Update priority
69
+						$new_priority = Filter::postInteger("moduleorder-{$params['id']}");
70
+						$previous_priority = $params['priority'];
71
+						if ($new_priority !== null) {
72
+							if($new_priority != $previous_priority){
73
+								$chook = new Hook($array_hook[1], $array_hook[2]);
74
+								$chook->setPriority($array_hook[0], $new_priority);
75
+							}
76
+						}
77
+					}
78
+				}
79
+			}
80
+		}
81
+	}
82 82
     
83
-    /**
84
-     * Pages
85
-     */
83
+	/**
84
+	 * Pages
85
+	 */
86 86
         
87
-    /**
88
-     * AdminConfig@index
89
-     */
90
-    public function index() {      
91
-        global $WT_TREE;
87
+	/**
88
+	 * AdminConfig@index
89
+	 */
90
+	public function index() {      
91
+		global $WT_TREE;
92 92
         
93
-        HookProvider::getInstance()->updateHooks();
93
+		HookProvider::getInstance()->updateHooks();
94 94
         
95
-        $action = Filter::post('action');        
96
-        if($action == 'update' && Filter::checkCsrf()) $this->update();
95
+		$action = Filter::post('action');        
96
+		if($action == 'update' && Filter::checkCsrf()) $this->update();
97 97
         
98
-        Theme::theme(new AdministrationTheme)->init($WT_TREE);        
99
-        $ctrl = new PageController();
100
-        $ctrl
101
-            ->restrictAccess(Auth::isAdmin())
102
-            ->setPageTitle($this->module->getTitle());
98
+		Theme::theme(new AdministrationTheme)->init($WT_TREE);        
99
+		$ctrl = new PageController();
100
+		$ctrl
101
+			->restrictAccess(Auth::isAdmin())
102
+			->setPageTitle($this->module->getTitle());
103 103
         
104
-        $table_id = 'table-installedhooks-' . Uuid::uuid4();
104
+		$table_id = 'table-installedhooks-' . Uuid::uuid4();
105 105
 
106
-        $view_bag = new ViewBag();
107
-        $view_bag->set('title', $ctrl->getPageTitle());
108
-        $view_bag->set('table_id', $table_id);
109
-        $view_bag->set('hook_list', HookProvider::getInstance()->getRawInstalledHooks());
106
+		$view_bag = new ViewBag();
107
+		$view_bag->set('title', $ctrl->getPageTitle());
108
+		$view_bag->set('table_id', $table_id);
109
+		$view_bag->set('hook_list', HookProvider::getInstance()->getRawInstalledHooks());
110 110
         
111
-        $ctrl
112
-        ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)
113
-        ->addExternalJavascript(WT_DATATABLES_BOOTSTRAP_JS_URL)
114
-        ->addInlineJavascript('
111
+		$ctrl
112
+		->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)
113
+		->addExternalJavascript(WT_DATATABLES_BOOTSTRAP_JS_URL)
114
+		->addInlineJavascript('
115 115
 		  	jQuery(document).ready(function() {
116 116
 				jQuery("#'.$table_id.'").dataTable( {
117 117
 					'.I18N::datatablesI18N().',		
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 			});
132 132
 		');
133 133
         
134
-        ViewFactory::make('AdminConfig', $this, $ctrl, $view_bag)->render();
135
-    }
134
+		ViewFactory::make('AdminConfig', $this, $ctrl, $view_bag)->render();
135
+	}
136 136
         
137 137
 }
138 138
\ No newline at end of file
Please login to merge, or discard this patch.
src/Webtrees/Module/Hooks/Views/AdminConfigView.php 3 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -25,11 +25,11 @@  discard block
 block discarded – undo
25 25
 	 * {@inhericDoc}
26 26
 	 * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent()
27 27
 	 */
28
-    protected function renderContent() {
28
+	protected function renderContent() {
29 29
         
30
-        $table_id = $this->data->get('table_id');
30
+		$table_id = $this->data->get('table_id');
31 31
         
32
-        ?>        
32
+		?>        
33 33
         <ol class="breadcrumb small">
34 34
         	<li><a href="admin.php"><?php echo I18N::translate('Control panel'); ?></a></li>
35 35
 			<li><a href="admin_modules.php"><?php echo I18N::translate('Module administration'); ?></a></li>
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 		</div>	
80 80
 		
81 81
 		<?php        
82
-    }
82
+	}
83 83
     
84 84
 }
85 85
  
86 86
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -60,13 +60,13 @@
 block discarded – undo
60 60
 							?>
61 61
 							<tr>
62 62
 								<td>
63
-									<input type="hidden" name="hook-<?php echo $hook->id;?>" value="yes" >
64
-									<?php echo FunctionsEdit::twoStateCheckbox('status-'.($hook->id), ($hook->status)=='enabled'); ?>
63
+									<input type="hidden" name="hook-<?php echo $hook->id; ?>" value="yes" >
64
+									<?php echo FunctionsEdit::twoStateCheckbox('status-'.($hook->id), ($hook->status) == 'enabled'); ?>
65 65
 								</td>
66
-								<td><?php echo (($hook->status)=='enabled'); ?></td>
66
+								<td><?php echo (($hook->status) == 'enabled'); ?></td>
67 67
 								<td><?php echo $hook->hook; ?></td>
68 68
 								<td><?php echo $hook->context; ?></td>
69
-								<td><?php if($mod = Module::getModuleByName($hook->module)) echo $mod->getTitle(); ?></td>
69
+								<td><?php if ($mod = Module::getModuleByName($hook->module)) echo $mod->getTitle(); ?></td>
70 70
 								<td><input type="text" class="center" size="2" value="<?php echo $hook->priority; ?>" name="moduleorder-<?php echo $hook->id; ?>" /></td>
71 71
 								<td><?php echo $hook->priority; ?></td>
72 72
 							</tr>
Please login to merge, or discard this patch.
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -66,7 +66,10 @@
 block discarded – undo
66 66
 								<td><?php echo (($hook->status)=='enabled'); ?></td>
67 67
 								<td><?php echo $hook->hook; ?></td>
68 68
 								<td><?php echo $hook->context; ?></td>
69
-								<td><?php if($mod = Module::getModuleByName($hook->module)) echo $mod->getTitle(); ?></td>
69
+								<td><?php if($mod = Module::getModuleByName($hook->module)) {
70
+	echo $mod->getTitle();
71
+}
72
+?></td>
70 73
 								<td><input type="text" class="center" size="2" value="<?php echo $hook->priority; ?>" name="moduleorder-<?php echo $hook->id; ?>" /></td>
71 74
 								<td><?php echo $hook->priority; ?></td>
72 75
 							</tr>
Please login to merge, or discard this patch.
src/Webtrees/Module/MiscExtensionsModule.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
      * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink()
60 60
      */
61 61
     public function getConfigLink() {
62
-        return 'module.php?mod=' . $this->getName() . '&amp;mod_action=AdminConfig';
62
+        return 'module.php?mod='.$this->getName().'&amp;mod_action=AdminConfig';
63 63
     }
64 64
     
65 65
     /**
@@ -88,19 +88,19 @@  discard block
 block discarded – undo
88 88
 	    $res = '';
89 89
 	    $dindi = new Individual($ctrlIndi->getSignificantIndividual());
90 90
 	    $titles = $dindi->getTitles();
91
-	    if(count($titles)>0){
91
+	    if (count($titles) > 0) {
92 92
 	        $res = '
93 93
 	            <dl>
94 94
 	               <dt class="label">'.I18N::translate('Titles').'</dt>';
95
-            foreach($titles as $title=>$props){
95
+            foreach ($titles as $title=>$props) {
96 96
                 $res .= 
97
-                    '<dd class="field">' . $title. ' ' .
98
-                    FunctionsPrint::getListFromArray($props) .
97
+                    '<dd class="field">'.$title.' '.
98
+                    FunctionsPrint::getListFromArray($props).
99 99
                     '</dd>';
100 100
             }
101
-            $res .=  '</dl>';
101
+            $res .= '</dl>';
102 102
         }
103
-	    return array( 'indi-header-titles' , $res);	    
103
+	    return array('indi-header-titles', $res);	    
104 104
 	}
105 105
 	
106 106
 	/**
@@ -117,8 +117,8 @@  discard block
 block discarded – undo
117 117
 	    global $WT_TREE;
118 118
 	    
119 119
 	    $html = '';
120
-	    if($this->getSetting('MAJ_ADD_HTML_HEADER', 0) == 1){
121
-	        if(Auth::accessLevel($WT_TREE) >= $this->getSetting('MAJ_SHOW_HTML_HEADER', Auth::PRIV_HIDE)  && !Filter::getBool('noheader')){
120
+	    if ($this->getSetting('MAJ_ADD_HTML_HEADER', 0) == 1) {
121
+	        if (Auth::accessLevel($WT_TREE) >= $this->getSetting('MAJ_SHOW_HTML_HEADER', Auth::PRIV_HIDE) && !Filter::getBool('noheader')) {
122 122
 	            $html .= $this->getSetting('MAJ_HTML_HEADER', '');
123 123
 	        }
124 124
 	    }	
@@ -133,19 +133,19 @@  discard block
 block discarded – undo
133 133
 	    global $WT_TREE;
134 134
 	     
135 135
 	    $html = '';
136
-	    if($this->getSetting('MAJ_DISPLAY_CNIL', 0) == 1){
136
+	    if ($this->getSetting('MAJ_DISPLAY_CNIL', 0) == 1) {
137 137
 	        $html .= '<br/>';
138 138
 	        $html .= '<div class="center">';
139 139
 	        $cnil_ref = $this->getSetting('MAJ_CNIL_REFERENCE', '');
140
-	        if($cnil_ref != ''){
140
+	        if ($cnil_ref != '') {
141 141
 	            $html .= I18N::translate('This site has been notified to the French National Commission for Data protection (CNIL) and registered under number %s. ', $cnil_ref);
142 142
 	        }
143 143
 	        $html .= I18N::translate('In accordance with the French Data protection Act (<em>Loi Informatique et Libertés</em>) of January 6th, 1978, you have the right to access, modify, rectify and delete personal information that pertains to you. To exercice this right, please contact %s, and provide your name, address and a proof of your identity.', Theme::theme()->contactLink(User::find($WT_TREE->getPreference('WEBMASTER_USER_ID'))));
144 144
 	        $html .= '</div>';
145 145
 	    }
146 146
 	    
147
-	    if($this->getSetting('MAJ_ADD_HTML_FOOTER', 0) == 1){
148
-	        if(Auth::accessLevel($WT_TREE) >= $this->getSetting('MAJ_SHOW_HTML_FOOTER', Auth::PRIV_HIDE)  && !Filter::getBool('nofooter')){
147
+	    if ($this->getSetting('MAJ_ADD_HTML_FOOTER', 0) == 1) {
148
+	        if (Auth::accessLevel($WT_TREE) >= $this->getSetting('MAJ_SHOW_HTML_FOOTER', Auth::PRIV_HIDE) && !Filter::getBool('nofooter')) {
149 149
 	            $html .= $this->getSetting('MAJ_HTML_FOOTER', '');
150 150
 	        }
151 151
 	    }
Please login to merge, or discard this patch.
Indentation   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -30,49 +30,49 @@  discard block
 block discarded – undo
30 30
 class MiscExtensionsModule extends AbstractModule 
31 31
 implements HookSubscriberInterface, IndividualHeaderExtenderInterface, PageHeaderExtenderInterface, PageFooterExtenderInterface, ModuleConfigInterface
32 32
 {    
33
-    /** @var string For custom modules - link for support, upgrades, etc. */
34
-    const CUSTOM_WEBSITE = 'https://github.com/jon48/webtrees-lib';
33
+	/** @var string For custom modules - link for support, upgrades, etc. */
34
+	const CUSTOM_WEBSITE = 'https://github.com/jon48/webtrees-lib';
35 35
     
36
-    /**
37
-     * {@inheritDoc}
38
-     * @see \Fisharebest\Webtrees\Module\AbstractModule::getTitle()
39
-     */
40
-    public function getTitle() {
41
-        return I18N::translate('Miscellaneous extensions');
42
-    }
36
+	/**
37
+	 * {@inheritDoc}
38
+	 * @see \Fisharebest\Webtrees\Module\AbstractModule::getTitle()
39
+	 */
40
+	public function getTitle() {
41
+		return I18N::translate('Miscellaneous extensions');
42
+	}
43 43
     
44 44
    /**
45 45
     * {@inheritDoc}
46 46
     * @see \Fisharebest\Webtrees\Module\AbstractModule::getDescription()
47 47
     */
48
-    public function getDescription() {
49
-        return I18N::translate('Miscellaneous extensions for <strong>webtrees</strong>.');
50
-    }
48
+	public function getDescription() {
49
+		return I18N::translate('Miscellaneous extensions for <strong>webtrees</strong>.');
50
+	}
51 51
     
52
-    /**
53
-     * {@inhericDoc}
54
-     */
55
-    public function modAction($mod_action) {
56
-        \MyArtJaub\Webtrees\Mvc\Dispatcher::getInstance()->handle($this, $mod_action);
57
-    }
52
+	/**
53
+	 * {@inhericDoc}
54
+	 */
55
+	public function modAction($mod_action) {
56
+		\MyArtJaub\Webtrees\Mvc\Dispatcher::getInstance()->handle($this, $mod_action);
57
+	}
58 58
     
59
-    /**
60
-     * {@inhericDoc}
61
-     * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink()
62
-     */
63
-    public function getConfigLink() {
64
-        return 'module.php?mod=' . $this->getName() . '&amp;mod_action=AdminConfig';
65
-    }
59
+	/**
60
+	 * {@inhericDoc}
61
+	 * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink()
62
+	 */
63
+	public function getConfigLink() {
64
+		return 'module.php?mod=' . $this->getName() . '&amp;mod_action=AdminConfig';
65
+	}
66 66
     
67
-    /**
68
-     * {@inheritDoc}
69
-     * @see \MyArtJaub\Webtrees\Hook\HookSubscriberInterface::getSubscribedHooks()
70
-     */
67
+	/**
68
+	 * {@inheritDoc}
69
+	 * @see \MyArtJaub\Webtrees\Hook\HookSubscriberInterface::getSubscribedHooks()
70
+	 */
71 71
 	public function getSubscribedHooks() {
72 72
 		return array(
73
-		    'hExtendIndiHeaderLeft' => 20,
74
-		    'hPrintHeader' => 20,
75
-		    'hPrintFooter' => 20
73
+			'hExtendIndiHeaderLeft' => 20,
74
+			'hPrintHeader' => 20,
75
+			'hPrintFooter' => 20
76 76
 		);
77 77
 	}
78 78
 	
@@ -87,22 +87,22 @@  discard block
 block discarded – undo
87 87
 	 * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\IndividualHeaderExtenderInterface::hExtendIndiHeaderLeft()
88 88
 	 */
89 89
 	public function hExtendIndiHeaderLeft(IndividualController $ctrlIndi) { 
90
-	    $res = '';
91
-	    $dindi = new Individual($ctrlIndi->getSignificantIndividual());
92
-	    $titles = $dindi->getTitles();
93
-	    if(count($titles)>0){
94
-	        $res = '
90
+		$res = '';
91
+		$dindi = new Individual($ctrlIndi->getSignificantIndividual());
92
+		$titles = $dindi->getTitles();
93
+		if(count($titles)>0){
94
+			$res = '
95 95
 	            <dl>
96 96
 	               <dt class="label">'.I18N::translate('Titles').'</dt>';
97
-            foreach($titles as $title=>$props){
98
-                $res .= 
99
-                    '<dd class="field">' . $title. ' ' .
100
-                    FunctionsPrint::getListFromArray($props) .
101
-                    '</dd>';
102
-            }
103
-            $res .=  '</dl>';
104
-        }
105
-	    return array( 'indi-header-titles' , $res);	    
97
+			foreach($titles as $title=>$props){
98
+				$res .= 
99
+					'<dd class="field">' . $title. ' ' .
100
+					FunctionsPrint::getListFromArray($props) .
101
+					'</dd>';
102
+			}
103
+			$res .=  '</dl>';
104
+		}
105
+		return array( 'indi-header-titles' , $res);	    
106 106
 	}
107 107
 	
108 108
 	/**
@@ -116,15 +116,15 @@  discard block
 block discarded – undo
116 116
 	 * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\PageHeaderExtenderInterface::hPrintHeader()
117 117
 	 */
118 118
 	public function hPrintHeader() {	 
119
-	    global $WT_TREE;
119
+		global $WT_TREE;
120 120
 	    
121
-	    $html = '';
122
-	    if($this->getSetting('MAJ_ADD_HTML_HEADER', 0) == 1){
123
-	        if(Auth::accessLevel($WT_TREE) >= $this->getSetting('MAJ_SHOW_HTML_HEADER', Auth::PRIV_HIDE)  && !Filter::getBool('noheader')){
124
-	            $html .= $this->getSetting('MAJ_HTML_HEADER', '');
125
-	        }
126
-	    }	
127
-	    return $html;
121
+		$html = '';
122
+		if($this->getSetting('MAJ_ADD_HTML_HEADER', 0) == 1){
123
+			if(Auth::accessLevel($WT_TREE) >= $this->getSetting('MAJ_SHOW_HTML_HEADER', Auth::PRIV_HIDE)  && !Filter::getBool('noheader')){
124
+				$html .= $this->getSetting('MAJ_HTML_HEADER', '');
125
+			}
126
+		}	
127
+		return $html;
128 128
 	}
129 129
 	
130 130
 	/**
@@ -132,26 +132,26 @@  discard block
 block discarded – undo
132 132
 	 * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\PageFooterExtenderInterface::hPrintFooter()
133 133
 	 */
134 134
 	public function hPrintFooter() {
135
-	    global $WT_TREE;
135
+		global $WT_TREE;
136 136
 	     
137
-	    $html = '';
138
-	    if($this->getSetting('MAJ_DISPLAY_CNIL', 0) == 1){
139
-	        $html .= '<br/>';
140
-	        $html .= '<div class="center">';
141
-	        $cnil_ref = $this->getSetting('MAJ_CNIL_REFERENCE', '');
142
-	        if($cnil_ref != ''){
143
-	            $html .= I18N::translate('This site has been notified to the French National Commission for Data protection (CNIL) and registered under number %s. ', $cnil_ref);
144
-	        }
145
-	        $html .= I18N::translate('In accordance with the French Data protection Act (<em>Loi Informatique et Libertés</em>) of January 6th, 1978, you have the right to access, modify, rectify and delete personal information that pertains to you. To exercice this right, please contact %s, and provide your name, address and a proof of your identity.', Theme::theme()->contactLink(User::find($WT_TREE->getPreference('WEBMASTER_USER_ID'))));
146
-	        $html .= '</div>';
147
-	    }
137
+		$html = '';
138
+		if($this->getSetting('MAJ_DISPLAY_CNIL', 0) == 1){
139
+			$html .= '<br/>';
140
+			$html .= '<div class="center">';
141
+			$cnil_ref = $this->getSetting('MAJ_CNIL_REFERENCE', '');
142
+			if($cnil_ref != ''){
143
+				$html .= I18N::translate('This site has been notified to the French National Commission for Data protection (CNIL) and registered under number %s. ', $cnil_ref);
144
+			}
145
+			$html .= I18N::translate('In accordance with the French Data protection Act (<em>Loi Informatique et Libertés</em>) of January 6th, 1978, you have the right to access, modify, rectify and delete personal information that pertains to you. To exercice this right, please contact %s, and provide your name, address and a proof of your identity.', Theme::theme()->contactLink(User::find($WT_TREE->getPreference('WEBMASTER_USER_ID'))));
146
+			$html .= '</div>';
147
+		}
148 148
 	    
149
-	    if($this->getSetting('MAJ_ADD_HTML_FOOTER', 0) == 1){
150
-	        if(Auth::accessLevel($WT_TREE) >= $this->getSetting('MAJ_SHOW_HTML_FOOTER', Auth::PRIV_HIDE)  && !Filter::getBool('nofooter')){
151
-	            $html .= $this->getSetting('MAJ_HTML_FOOTER', '');
152
-	        }
153
-	    }
154
-	    return $html;
149
+		if($this->getSetting('MAJ_ADD_HTML_FOOTER', 0) == 1){
150
+			if(Auth::accessLevel($WT_TREE) >= $this->getSetting('MAJ_SHOW_HTML_FOOTER', Auth::PRIV_HIDE)  && !Filter::getBool('nofooter')){
151
+				$html .= $this->getSetting('MAJ_HTML_FOOTER', '');
152
+			}
153
+		}
154
+		return $html;
155 155
 	}
156 156
 	
157 157
 }
Please login to merge, or discard this patch.
src/Webtrees/Module/HooksModule.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@
 block discarded – undo
54 54
     public function getConfigLink() {
55 55
         Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION);
56 56
         
57
-        return 'module.php?mod=' . $this->getName() . '&amp;mod_action=AdminConfig';
57
+        return 'module.php?mod='.$this->getName().'&amp;mod_action=AdminConfig';
58 58
     }
59 59
     
60 60
 
Please login to merge, or discard this patch.
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -19,46 +19,46 @@
 block discarded – undo
19 19
  * Hooks Module.
20 20
  */
21 21
 class HooksModule extends AbstractModule implements ModuleConfigInterface {
22
-    // How to update the database schema for this module
23
-    const SCHEMA_TARGET_VERSION   = 1;
24
-    const SCHEMA_SETTING_NAME     = 'MAJ_HOOKS_SCHEMA_VERSION';
25
-    const SCHEMA_MIGRATION_PREFIX = '\MyArtJaub\Webtrees\Module\Hooks\Schema';
22
+	// How to update the database schema for this module
23
+	const SCHEMA_TARGET_VERSION   = 1;
24
+	const SCHEMA_SETTING_NAME     = 'MAJ_HOOKS_SCHEMA_VERSION';
25
+	const SCHEMA_MIGRATION_PREFIX = '\MyArtJaub\Webtrees\Module\Hooks\Schema';
26 26
     
27
-    /** @var string For custom modules - link for support, upgrades, etc. */
28
-    const CUSTOM_WEBSITE = 'https://github.com/jon48/webtrees-lib';
27
+	/** @var string For custom modules - link for support, upgrades, etc. */
28
+	const CUSTOM_WEBSITE = 'https://github.com/jon48/webtrees-lib';
29 29
     
30
-    /**
31
-     * {@inhericDoc}
32
-     */
33
-    public function getTitle() {
34
-        return /* I18N: Name of the “Hooks” module */ I18N::translate('Hooks');
35
-    }
30
+	/**
31
+	 * {@inhericDoc}
32
+	 */
33
+	public function getTitle() {
34
+		return /* I18N: Name of the “Hooks” module */ I18N::translate('Hooks');
35
+	}
36 36
     
37
-    /**
38
-     * {@inhericDoc}
39
-     */
40
-    public function getDescription() {
41
-        return /* I18N: Description of the “Hooks” module */ I18N::translate('Implements hooks management.');
42
-    }
37
+	/**
38
+	 * {@inhericDoc}
39
+	 */
40
+	public function getDescription() {
41
+		return /* I18N: Description of the “Hooks” module */ I18N::translate('Implements hooks management.');
42
+	}
43 43
     
44
-    /**
45
-     * {@inhericDoc}
46
-     */
47
-    public function modAction($mod_action) {
48
-        Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION);
44
+	/**
45
+	 * {@inhericDoc}
46
+	 */
47
+	public function modAction($mod_action) {
48
+		Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION);
49 49
         
50
-        \MyArtJaub\Webtrees\Mvc\Dispatcher::getInstance()->handle($this, $mod_action);
51
-    }
50
+		\MyArtJaub\Webtrees\Mvc\Dispatcher::getInstance()->handle($this, $mod_action);
51
+	}
52 52
     
53
-    /**
54
-     * {@inhericDoc}
55
-     * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink()
56
-     */
57
-    public function getConfigLink() {
58
-        Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION);
53
+	/**
54
+	 * {@inhericDoc}
55
+	 * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink()
56
+	 */
57
+	public function getConfigLink() {
58
+		Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION);
59 59
         
60
-        return 'module.php?mod=' . $this->getName() . '&amp;mod_action=AdminConfig';
61
-    }
60
+		return 'module.php?mod=' . $this->getName() . '&amp;mod_action=AdminConfig';
61
+	}
62 62
     
63 63
 
64 64
 }
Please login to merge, or discard this patch.
src/Webtrees/Module/ModuleManager.php 3 patches
Indentation   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -49,62 +49,62 @@
 block discarded – undo
49 49
 	}
50 50
 	
51 51
 	/**
52
-     * Protected constructor.
53
-     */
54
-    protected function __construct()
55
-    {
56
-    	$this->modules_list = array();
57
-    }
52
+	 * Protected constructor.
53
+	 */
54
+	protected function __construct()
55
+	{
56
+		$this->modules_list = array();
57
+	}
58 58
     
59
-    /**
60
-     * {@inheritDoc}
61
-     * @see \MyArtJaub\Webtrees\Module\ModuleManagerInterface::isOperational()
62
-     */
63
-    public function isOperational($moduleName) {
64
-    	if(!array_key_exists($moduleName, $this->modules_list)) {
65
-    		if($module = fw\Module::getModuleByName($moduleName)) {
66
-    			if($module instanceof DependentInterface) {
67
-    				if($module->validatePrerequisites()) {
68
-    					$this->modules_list[$moduleName] = TRUE;
69
-    					return true;
70
-    				} else {
71
-    					// Do not cache the result,
72
-    					// as they could change by the next call to the method
73
-    					return false;
74
-    				}
75
-    			}
76
-    			else {
77
-    				$this->modules_list[$moduleName] = TRUE;
78
-    				return true;
79
-    			}
80
-    		}
81
-    		else {
82
-    			$this->modules_list[$moduleName] = FALSE;
83
-    		}
84
-    	}
85
-    	return $this->modules_list[$moduleName];
59
+	/**
60
+	 * {@inheritDoc}
61
+	 * @see \MyArtJaub\Webtrees\Module\ModuleManagerInterface::isOperational()
62
+	 */
63
+	public function isOperational($moduleName) {
64
+		if(!array_key_exists($moduleName, $this->modules_list)) {
65
+			if($module = fw\Module::getModuleByName($moduleName)) {
66
+				if($module instanceof DependentInterface) {
67
+					if($module->validatePrerequisites()) {
68
+						$this->modules_list[$moduleName] = TRUE;
69
+						return true;
70
+					} else {
71
+						// Do not cache the result,
72
+						// as they could change by the next call to the method
73
+						return false;
74
+					}
75
+				}
76
+				else {
77
+					$this->modules_list[$moduleName] = TRUE;
78
+					return true;
79
+				}
80
+			}
81
+			else {
82
+				$this->modules_list[$moduleName] = FALSE;
83
+			}
84
+		}
85
+		return $this->modules_list[$moduleName];
86 86
     	
87
-    }
87
+	}
88 88
     
89 89
 
90
-    /**
91
-     * Private clone method to prevent cloning of the instance of the
92
-     * *ModuleManager* instance.
93
-     *
94
-     * @return void
95
-     */
96
-    private function __clone()
97
-    {
98
-    }
90
+	/**
91
+	 * Private clone method to prevent cloning of the instance of the
92
+	 * *ModuleManager* instance.
93
+	 *
94
+	 * @return void
95
+	 */
96
+	private function __clone()
97
+	{
98
+	}
99 99
 
100
-    /**
101
-     * Private unserialize method to prevent unserializing of the *ModuleManager*
102
-     * instance.
103
-     *
104
-     * @return void
105
-     */
106
-    private function __wakeup()
107
-    {
108
-    }
100
+	/**
101
+	 * Private unserialize method to prevent unserializing of the *ModuleManager*
102
+	 * instance.
103
+	 *
104
+	 * @return void
105
+	 */
106
+	private function __wakeup()
107
+	{
108
+	}
109 109
     
110 110
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -61,10 +61,10 @@
 block discarded – undo
61 61
      * @see \MyArtJaub\Webtrees\Module\ModuleManagerInterface::isOperational()
62 62
      */
63 63
     public function isOperational($moduleName) {
64
-    	if(!array_key_exists($moduleName, $this->modules_list)) {
65
-    		if($module = fw\Module::getModuleByName($moduleName)) {
66
-    			if($module instanceof DependentInterface) {
67
-    				if($module->validatePrerequisites()) {
64
+    	if (!array_key_exists($moduleName, $this->modules_list)) {
65
+    		if ($module = fw\Module::getModuleByName($moduleName)) {
66
+    			if ($module instanceof DependentInterface) {
67
+    				if ($module->validatePrerequisites()) {
68 68
     					$this->modules_list[$moduleName] = TRUE;
69 69
     					return true;
70 70
     				} else {
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -72,13 +72,11 @@
 block discarded – undo
72 72
     					// as they could change by the next call to the method
73 73
     					return false;
74 74
     				}
75
-    			}
76
-    			else {
75
+    			} else {
77 76
     				$this->modules_list[$moduleName] = TRUE;
78 77
     				return true;
79 78
     			}
80
-    		}
81
-    		else {
79
+    		} else {
82 80
     			$this->modules_list[$moduleName] = FALSE;
83 81
     		}
84 82
     	}
Please login to merge, or discard this patch.
src/Webtrees/Module/MiscExtensions/AdminConfigController.php 3 patches
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -28,56 +28,56 @@
 block discarded – undo
28 28
  */
29 29
 class AdminConfigController extends MvcController
30 30
 {    
31
-    /**
32
-     * Manage updates sent from the AdminConfig@index form.
33
-     */
34
-    protected function update() {
35
-        global $WT_TREE;
31
+	/**
32
+	 * Manage updates sent from the AdminConfig@index form.
33
+	 */
34
+	protected function update() {
35
+		global $WT_TREE;
36 36
     
37
-        if(Auth::isAdmin()){
37
+		if(Auth::isAdmin()){
38 38
     
39
-            $this->module->setSetting('MAJ_TITLE_PREFIX', Filter::post('MAJ_TITLE_PREFIX'));
39
+			$this->module->setSetting('MAJ_TITLE_PREFIX', Filter::post('MAJ_TITLE_PREFIX'));
40 40
             
41
-            $this->module->setSetting('MAJ_ADD_HTML_HEADER', Filter::postInteger('MAJ_ADD_HTML_HEADER', 0, 1));
42
-            $this->module->setSetting('MAJ_SHOW_HTML_HEADER', Filter::postInteger('MAJ_SHOW_HTML_HEADER', Auth::PRIV_HIDE, Auth::PRIV_PRIVATE, Auth::PRIV_HIDE));
43
-            $this->module->setSetting('MAJ_HTML_HEADER', Filter::post('MAJ_HTML_HEADER'));
41
+			$this->module->setSetting('MAJ_ADD_HTML_HEADER', Filter::postInteger('MAJ_ADD_HTML_HEADER', 0, 1));
42
+			$this->module->setSetting('MAJ_SHOW_HTML_HEADER', Filter::postInteger('MAJ_SHOW_HTML_HEADER', Auth::PRIV_HIDE, Auth::PRIV_PRIVATE, Auth::PRIV_HIDE));
43
+			$this->module->setSetting('MAJ_HTML_HEADER', Filter::post('MAJ_HTML_HEADER'));
44 44
             
45
-            $this->module->setSetting('MAJ_ADD_HTML_FOOTER', Filter::postInteger('MAJ_ADD_HTML_FOOTER', 0, 1));
46
-            $this->module->setSetting('MAJ_SHOW_HTML_FOOTER', Filter::postInteger('MAJ_SHOW_HTML_FOOTER', Auth::PRIV_HIDE, Auth::PRIV_PRIVATE, Auth::PRIV_HIDE));
47
-            $this->module->setSetting('MAJ_HTML_FOOTER', Filter::post('MAJ_HTML_FOOTER'));
45
+			$this->module->setSetting('MAJ_ADD_HTML_FOOTER', Filter::postInteger('MAJ_ADD_HTML_FOOTER', 0, 1));
46
+			$this->module->setSetting('MAJ_SHOW_HTML_FOOTER', Filter::postInteger('MAJ_SHOW_HTML_FOOTER', Auth::PRIV_HIDE, Auth::PRIV_PRIVATE, Auth::PRIV_HIDE));
47
+			$this->module->setSetting('MAJ_HTML_FOOTER', Filter::post('MAJ_HTML_FOOTER'));
48 48
             
49
-            $this->module->setSetting('MAJ_DISPLAY_CNIL', Filter::postInteger('MAJ_DISPLAY_CNIL', 0, 1));
50
-            $this->module->setSetting('MAJ_CNIL_REFERENCE', Filter::post('MAJ_CNIL_REFERENCE'));
49
+			$this->module->setSetting('MAJ_DISPLAY_CNIL', Filter::postInteger('MAJ_DISPLAY_CNIL', 0, 1));
50
+			$this->module->setSetting('MAJ_CNIL_REFERENCE', Filter::post('MAJ_CNIL_REFERENCE'));
51 51
                 
52
-            FlashMessages::addMessage(I18N::translate('The preferences for the module “%s” have been updated.', $this->module->getTitle()), 'success');
52
+			FlashMessages::addMessage(I18N::translate('The preferences for the module “%s” have been updated.', $this->module->getTitle()), 'success');
53 53
     
54
-            return;
55
-        }
56
-    }
54
+			return;
55
+		}
56
+	}
57 57
     
58
-    /**
59
-     * Pages
60
-     */
58
+	/**
59
+	 * Pages
60
+	 */
61 61
         
62
-    /**
63
-     * AdminConfig@index
64
-     */
65
-    public function index() {      
66
-        global $WT_TREE;
62
+	/**
63
+	 * AdminConfig@index
64
+	 */
65
+	public function index() {      
66
+		global $WT_TREE;
67 67
         
68
-        $action = Filter::post('action');        
69
-        if($action == 'update' && Filter::checkCsrf()) $this->update();
68
+		$action = Filter::post('action');        
69
+		if($action == 'update' && Filter::checkCsrf()) $this->update();
70 70
         
71
-        Theme::theme(new AdministrationTheme)->init($WT_TREE);        
72
-        $ctrl = new PageController();
73
-        $ctrl
74
-            ->restrictAccess(Auth::isAdmin())
75
-            ->setPageTitle($this->module->getTitle());
71
+		Theme::theme(new AdministrationTheme)->init($WT_TREE);        
72
+		$ctrl = new PageController();
73
+		$ctrl
74
+			->restrictAccess(Auth::isAdmin())
75
+			->setPageTitle($this->module->getTitle());
76 76
             
77
-        $view_bag = new ViewBag();
78
-        $view_bag->set('title', $ctrl->getPageTitle());
79
-        $view_bag->set('module', $this->module);
77
+		$view_bag = new ViewBag();
78
+		$view_bag->set('title', $ctrl->getPageTitle());
79
+		$view_bag->set('module', $this->module);
80 80
         
81
-        ViewFactory::make('AdminConfig', $this, $ctrl, $view_bag)->render();
82
-    }
81
+		ViewFactory::make('AdminConfig', $this, $ctrl, $view_bag)->render();
82
+	}
83 83
 }
84 84
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
     protected function update() {
35 35
         global $WT_TREE;
36 36
     
37
-        if(Auth::isAdmin()){
37
+        if (Auth::isAdmin()) {
38 38
     
39 39
             $this->module->setSetting('MAJ_TITLE_PREFIX', Filter::post('MAJ_TITLE_PREFIX'));
40 40
             
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
         global $WT_TREE;
67 67
         
68 68
         $action = Filter::post('action');        
69
-        if($action == 'update' && Filter::checkCsrf()) $this->update();
69
+        if ($action == 'update' && Filter::checkCsrf()) $this->update();
70 70
         
71 71
         Theme::theme(new AdministrationTheme)->init($WT_TREE);        
72 72
         $ctrl = new PageController();
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -88,7 +88,9 @@
 block discarded – undo
88 88
         global $WT_TREE;
89 89
         
90 90
         $action = Filter::post('action');        
91
-        if($action == 'update' && Filter::checkCsrf()) $this->update();
91
+        if($action == 'update' && Filter::checkCsrf()) {
92
+        	$this->update();
93
+        }
92 94
         
93 95
         Theme::theme(new AdministrationTheme)->init($WT_TREE);        
94 96
         $ctrl = new PageController();
Please login to merge, or discard this patch.