Completed
Push — master ( 95506d...0f93c5 )
by Jonathan
07:55
created
src/Webtrees/Hook/HookProvider.php 3 patches
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -74,16 +74,14 @@
 block discarded – undo
74 74
 								if(is_int($key)) {
75 75
 									$hook_item = $value;
76 76
 									$priority = self::DEFAULT_PRIORITY;
77
-								}
78
-								else{
77
+								} else{
79 78
 									$hook_item = explode('#', $key, 2);
80 79
 									$priority = $value;
81 80
 								}
82 81
 								if($hook_item && count($hook_item) == 2){
83 82
 									$hook_func = $hook_item[0];
84 83
 									$hook_cont = $hook_item[1];
85
-								}
86
-								else{
84
+								} else{
87 85
 									$hook_func = $hook_item[0];
88 86
 									$hook_cont = 'all';
89 87
 								}
Please login to merge, or discard this patch.
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 	 * @return Hook
39 39
 	 */
40 40
 	public static function get($hook_function, $hook_context = null) {
41
-	    return new Hook($hook_function, $hook_context);
41
+		return new Hook($hook_function, $hook_context);
42 42
 	}
43 43
 	
44 44
 	/**
@@ -63,11 +63,11 @@  discard block
 block discarded – undo
63 63
 	static public function getPossibleHooks() {
64 64
 		static $hooks=null;
65 65
 		if ($hooks === null) {
66
-		    $hooks = array();
67
-		    foreach (glob(WT_ROOT . WT_MODULES_DIR . '*/module.php') as $file) {
68
-		        try {
69
-		            $module = include $file;
70
-		            if($module instanceof HookSubscriberInterface){
66
+			$hooks = array();
67
+			foreach (glob(WT_ROOT . WT_MODULES_DIR . '*/module.php') as $file) {
68
+				try {
69
+					$module = include $file;
70
+					if($module instanceof HookSubscriberInterface){
71 71
 						$subscribedhooks = $module->getSubscribedHooks();
72 72
 						if(is_array($subscribedhooks)){
73 73
 							foreach($subscribedhooks as $key => $value){
@@ -93,9 +93,9 @@  discard block
 block discarded – undo
93 93
 							}
94 94
 						}
95 95
 					}
96
-    			} catch (\Exception $ex) {
97
-    				// Old or invalid module?
98
-    			}
96
+				} catch (\Exception $ex) {
97
+					// Old or invalid module?
98
+				}
99 99
 			}
100 100
 		}
101 101
 		return $hooks;
@@ -138,33 +138,33 @@  discard block
 block discarded – undo
138 138
 	 */
139 139
 	static public function updateHooks() {
140 140
 	    
141
-	    if(Auth::isAdmin()){
142
-	        $ihooks = self::getInstalledHooks();
143
-	        $phooks = self::getPossibleHooks();
141
+		if(Auth::isAdmin()){
142
+			$ihooks = self::getInstalledHooks();
143
+			$phooks = self::getPossibleHooks();
144 144
 	        	
145
-	        // Insert hooks not existing yet in the DB
146
-	        if($phooks !== null){
147
-	            foreach($phooks as $phook => $priority){
148
-	                $array_hook = explode('#', $phook);
149
-	                if($ihooks === null || !array_key_exists($phook, $ihooks)){
150
-	                    $chook = new Hook($array_hook[1], $array_hook[2]);
151
-	                    $chook->subscribe($array_hook[0]);
152
-	                    $chook->setPriority($array_hook[0], $priority);
153
-	                }
154
-	            }
155
-	        }
145
+			// Insert hooks not existing yet in the DB
146
+			if($phooks !== null){
147
+				foreach($phooks as $phook => $priority){
148
+					$array_hook = explode('#', $phook);
149
+					if($ihooks === null || !array_key_exists($phook, $ihooks)){
150
+						$chook = new Hook($array_hook[1], $array_hook[2]);
151
+						$chook->subscribe($array_hook[0]);
152
+						$chook->setPriority($array_hook[0], $priority);
153
+					}
154
+				}
155
+			}
156 156
 	        	
157
-	        //Remove hooks not existing any more in the file system
158
-	        if($ihooks !== null){
159
-	            foreach($ihooks as $ihook => $status){
160
-	                $array_hook = explode('#', $ihook);
161
-	                if($phooks === null || !array_key_exists($ihook, $phooks)){
162
-	                    $chook = new Hook($array_hook[1], $array_hook[2]);
163
-	                    $chook->remove($array_hook[0]);
164
-	                }
165
-	            }
166
-	        }
167
-	    }
157
+			//Remove hooks not existing any more in the file system
158
+			if($ihooks !== null){
159
+				foreach($ihooks as $ihook => $status){
160
+					$array_hook = explode('#', $ihook);
161
+					if($phooks === null || !array_key_exists($ihook, $phooks)){
162
+						$chook = new Hook($array_hook[1], $array_hook[2]);
163
+						$chook->remove($array_hook[0]);
164
+					}
165
+				}
166
+			}
167
+		}
168 168
 	}
169 169
 	
170 170
 }
171 171
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -61,34 +61,34 @@  discard block
 block discarded – undo
61 61
 	 * @return Array List of possible hooks, with the priority
62 62
 	 */
63 63
 	static public function getPossibleHooks() {
64
-		static $hooks=null;
64
+		static $hooks = null;
65 65
 		if ($hooks === null) {
66 66
 		    $hooks = array();
67
-		    foreach (glob(WT_ROOT . WT_MODULES_DIR . '*/module.php') as $file) {
67
+		    foreach (glob(WT_ROOT.WT_MODULES_DIR.'*/module.php') as $file) {
68 68
 		        try {
69 69
 		            $module = include $file;
70
-		            if($module instanceof HookSubscriberInterface){
70
+		            if ($module instanceof HookSubscriberInterface) {
71 71
 						$subscribedhooks = $module->getSubscribedHooks();
72
-						if(is_array($subscribedhooks)){
73
-							foreach($subscribedhooks as $key => $value){
74
-								if(is_int($key)) {
72
+						if (is_array($subscribedhooks)) {
73
+							foreach ($subscribedhooks as $key => $value) {
74
+								if (is_int($key)) {
75 75
 									$hook_item = $value;
76 76
 									$priority = self::DEFAULT_PRIORITY;
77 77
 								}
78
-								else{
78
+								else {
79 79
 									$hook_item = explode('#', $key, 2);
80 80
 									$priority = $value;
81 81
 								}
82
-								if($hook_item && count($hook_item) == 2){
82
+								if ($hook_item && count($hook_item) == 2) {
83 83
 									$hook_func = $hook_item[0];
84 84
 									$hook_cont = $hook_item[1];
85 85
 								}
86
-								else{
86
+								else {
87 87
 									$hook_func = $hook_item[0];
88 88
 									$hook_cont = 'all';
89 89
 								}
90
-								if(method_exists($module, $hook_func)){
91
-									$hooks[$module->getName().'#'.$hook_func.'#'.$hook_cont]=$priority;
90
+								if (method_exists($module, $hook_func)) {
91
+									$hooks[$module->getName().'#'.$hook_func.'#'.$hook_cont] = $priority;
92 92
 								}
93 93
 							}
94 94
 						}
@@ -106,8 +106,8 @@  discard block
 block discarded – undo
106 106
 	 *
107 107
 	 * @return array List of installed hooks
108 108
 	 */
109
-	static public function getRawInstalledHooks(){
110
-		if(self::isModuleOperational()){
109
+	static public function getRawInstalledHooks() {
110
+		if (self::isModuleOperational()) {
111 111
 			return fw\Database::prepare(
112 112
 					"SELECT majh_id AS id, majh_module_name AS module, majh_hook_function AS hook, majh_hook_context as context, majh_module_priority AS priority,  majh_status AS status".
113 113
 					" FROM `##maj_hooks`".
@@ -122,11 +122,11 @@  discard block
 block discarded – undo
122 122
 	 *
123 123
 	 * @return Array List of installed hooks, with id, status and priority
124 124
 	 */
125
-	static public function getInstalledHooks(){
126
-		static $installedhooks =null;
127
-		if($installedhooks===null){
128
-			$dbhooks=self::getRawInstalledHooks();
129
-			foreach($dbhooks as $dbhook){
125
+	static public function getInstalledHooks() {
126
+		static $installedhooks = null;
127
+		if ($installedhooks === null) {
128
+			$dbhooks = self::getRawInstalledHooks();
129
+			foreach ($dbhooks as $dbhook) {
130 130
 				$installedhooks[($dbhook->module).'#'.($dbhook->hook).'#'.($dbhook->context)] = array('id' => $dbhook->id, 'status' => $dbhook->status, 'priority' => $dbhook->priority);
131 131
 			}
132 132
 		}
@@ -138,15 +138,15 @@  discard block
 block discarded – undo
138 138
 	 */
139 139
 	static public function updateHooks() {
140 140
 	    
141
-	    if(Auth::isAdmin()){
141
+	    if (Auth::isAdmin()) {
142 142
 	        $ihooks = self::getInstalledHooks();
143 143
 	        $phooks = self::getPossibleHooks();
144 144
 	        	
145 145
 	        // Insert hooks not existing yet in the DB
146
-	        if($phooks !== null){
147
-	            foreach($phooks as $phook => $priority){
146
+	        if ($phooks !== null) {
147
+	            foreach ($phooks as $phook => $priority) {
148 148
 	                $array_hook = explode('#', $phook);
149
-	                if($ihooks === null || !array_key_exists($phook, $ihooks)){
149
+	                if ($ihooks === null || !array_key_exists($phook, $ihooks)) {
150 150
 	                    $chook = new Hook($array_hook[1], $array_hook[2]);
151 151
 	                    $chook->subscribe($array_hook[0]);
152 152
 	                    $chook->setPriority($array_hook[0], $priority);
@@ -155,10 +155,10 @@  discard block
 block discarded – undo
155 155
 	        }
156 156
 	        	
157 157
 	        //Remove hooks not existing any more in the file system
158
-	        if($ihooks !== null){
159
-	            foreach($ihooks as $ihook => $status){
158
+	        if ($ihooks !== null) {
159
+	            foreach ($ihooks as $ihook => $status) {
160 160
 	                $array_hook = explode('#', $ihook);
161
-	                if($phooks === null || !array_key_exists($ihook, $phooks)){
161
+	                if ($phooks === null || !array_key_exists($ihook, $phooks)) {
162 162
 	                    $chook = new Hook($array_hook[1], $array_hook[2]);
163 163
 	                    $chook->remove($array_hook[0]);
164 164
 	                }
Please login to merge, or discard this patch.
src/Webtrees/Hook/Hook.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@
 block discarded – undo
1 1
 <?php
2 2
  /**
3
- * webtrees-lib: MyArtJaub library for webtrees
4
- *
5
- * @package MyArtJaub\Webtrees
6
- * @subpackage Hook
7
- * @author Jonathan Jaubart <[email protected]>
8
- * @copyright Copyright (c) 2011-2016, Jonathan Jaubart
9
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3
10
- */
3
+  * webtrees-lib: MyArtJaub library for webtrees
4
+  *
5
+  * @package MyArtJaub\Webtrees
6
+  * @subpackage Hook
7
+  * @author Jonathan Jaubart <[email protected]>
8
+  * @copyright Copyright (c) 2011-2016, Jonathan Jaubart
9
+  * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3
10
+  */
11 11
 namespace MyArtJaub\Webtrees\Hook;
12 12
 
13 13
 use \Fisharebest\Webtrees as fw;
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 	 * @param string $hook_function_in Hook function to be subscribed or executed
31 31
 	 * @param string $hook_context_in Hook context to be subscribed or executed
32 32
 	 */
33
-	public function __construct($hook_function_in, $hook_context_in = 'all'){
33
+	public function __construct($hook_function_in, $hook_context_in = 'all') {
34 34
 		$this->hook_function = $hook_function_in;
35 35
 		$this->hook_context = $hook_context_in;
36 36
 	}
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
 	 *
47 47
 	 * @param string $hsubscriber Name of the subscriber module
48 48
 	 */
49
-	public function subscribe($hsubscriber){
50
-		if(HookProvider::isModuleOperational()){
49
+	public function subscribe($hsubscriber) {
50
+		if (HookProvider::isModuleOperational()) {
51 51
 			$statement = fw\Database::prepare(
52 52
 					"INSERT IGNORE INTO `##maj_hooks` (majh_hook_function, majh_hook_context, majh_module_name)".
53 53
 					" VALUES (?, ?, ?)"
@@ -61,8 +61,8 @@  discard block
 block discarded – undo
61 61
 	 * @param string $hsubscriber Name of the subscriber module
62 62
 	 * @param int $priority Priority of execution
63 63
 	 */
64
-	public function setPriority($hsubscriber, $priority){
65
-		if(HookProvider::isModuleOperational()){
64
+	public function setPriority($hsubscriber, $priority) {
65
+		if (HookProvider::isModuleOperational()) {
66 66
 			fw\Database::prepare(
67 67
 			"UPDATE `##maj_hooks`".
68 68
 			" SET majh_module_priority=?".
@@ -78,8 +78,8 @@  discard block
 block discarded – undo
78 78
 	 *
79 79
 	 * @param string $hsubscriber Name of the subscriber module
80 80
 	 */
81
-	public function enable($hsubscriber){
82
-		if(HookProvider::isModuleOperational()){
81
+	public function enable($hsubscriber) {
82
+		if (HookProvider::isModuleOperational()) {
83 83
 		fw\Database::prepare(
84 84
 			"UPDATE `##maj_hooks`".
85 85
 			" SET majh_status='enabled'".
@@ -95,8 +95,8 @@  discard block
 block discarded – undo
95 95
 	 *
96 96
 	 * @param string $hsubscriber Name of the subscriber module
97 97
 	 */
98
-	public function disable($hsubscriber){
99
-		if(HookProvider::isModuleOperational()){
98
+	public function disable($hsubscriber) {
99
+		if (HookProvider::isModuleOperational()) {
100 100
 		fw\Database::prepare(
101 101
 			"UPDATE `##maj_hooks`".
102 102
 			" SET majh_status='disabled'".
@@ -112,8 +112,8 @@  discard block
 block discarded – undo
112 112
 	 *
113 113
 	 * @param string $hsubscriber Name of the subscriber module
114 114
 	 */
115
-	public function remove($hsubscriber){
116
-		if(HookProvider::isModuleOperational()){
115
+	public function remove($hsubscriber) {
116
+		if (HookProvider::isModuleOperational()) {
117 117
 		fw\Database::prepare(
118 118
 			"DELETE FROM `##maj_hooks`".
119 119
 			" WHERE majh_hook_function=?".
@@ -135,24 +135,24 @@  discard block
 block discarded – undo
135 135
 	 *
136 136
 	 * @return array Results of the hook executions
137 137
 	 */
138
-	public function execute(){
138
+	public function execute() {
139 139
 		$result = array();
140
-		if(HookProvider::isModuleOperational()){
140
+		if (HookProvider::isModuleOperational()) {
141 141
 			$params = func_get_args();
142 142
 			$sqlquery = '';
143 143
 			$sqlparams = array($this->hook_function);
144
-			if($this->hook_context != 'all') {
144
+			if ($this->hook_context != 'all') {
145 145
 				$sqlparams = array($this->hook_function, $this->hook_context);
146 146
 				$sqlquery = " OR majh_hook_context=?";
147 147
 			}
148
-			$module_names=fw\Database::prepare(
148
+			$module_names = fw\Database::prepare(
149 149
 					"SELECT majh_module_name AS module, majh_module_priority AS priority FROM `##maj_hooks`".
150 150
 					" WHERE majh_hook_function = ? AND (majh_hook_context='all'".$sqlquery.") AND majh_status='enabled'".
151 151
 					" ORDER BY majh_module_priority ASC, module ASC"
152 152
 			)->execute($sqlparams)->fetchAssoc();
153 153
 			asort($module_names);
154 154
 			foreach ($module_names as $module_name => $module_priority) {
155
-				$module = include WT_ROOT . WT_MODULES_DIR . $module_name . '/module.php';
155
+				$module = include WT_ROOT.WT_MODULES_DIR.$module_name.'/module.php';
156 156
 				$result[] = call_user_func_array(array($module, $this->hook_function), $params);
157 157
 			}
158 158
 		}
@@ -164,15 +164,15 @@  discard block
 block discarded – undo
164 164
 	 *
165 165
 	 * @return int Number of active modules
166 166
 	 */
167
-	public function getNumberActiveModules(){
168
-		if(HookProvider::isModuleOperational()){
167
+	public function getNumberActiveModules() {
168
+		if (HookProvider::isModuleOperational()) {
169 169
 			$sqlquery = '';
170 170
 			$sqlparams = array($this->hook_function);
171
-			if($this->hook_context != 'all') {
171
+			if ($this->hook_context != 'all') {
172 172
 				$sqlparams = array($this->hook_function, $this->hook_context);
173 173
 				$sqlquery = " OR majh_hook_context=?";
174 174
 			}
175
-			$module_names=fw\Database::prepare(
175
+			$module_names = fw\Database::prepare(
176 176
 					"SELECT majh_module_name AS modules FROM `##maj_hooks`".
177 177
 					" WHERE majh_hook_function = ? AND (majh_hook_context='all'".$sqlquery.") AND majh_status='enabled'"
178 178
 			)->execute($sqlparams)->fetchOneColumn();
@@ -186,8 +186,8 @@  discard block
 block discarded – undo
186 186
 	 *
187 187
 	 * @return bool True is active modules exist, false otherwise
188 188
 	 */
189
-	public function hasAnyActiveModule(){
190
-		return ($this->getNumberActiveModules()>0);
189
+	public function hasAnyActiveModule() {
190
+		return ($this->getNumberActiveModules() > 0);
191 191
 	}
192 192
 
193 193
 }
Please login to merge, or discard this patch.
src/Webtrees/Hook/HookSubscriberInterface.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,13 +15,13 @@
 block discarded – undo
15 15
  */
16 16
 interface HookSubscriberInterface {
17 17
 	
18
-    /**
18
+	/**
19 19
 	 * Return the list of functions implementented in the class which needs to be registered as hooks.
20 20
 	 * The format is either { function1, function 2,...} in which case the priority is the default one
21 21
 	 * or { function1 => priority1, function2 => priority2, ...}
22 22
 	 * 
23 23
 	 * @return array Array of hooks
24 24
 	 */
25
-    public function getSubscribedHooks();
25
+	public function getSubscribedHooks();
26 26
     
27 27
 }
28 28
\ No newline at end of file
Please login to merge, or discard this patch.
src/Webtrees/Hook/HookInterfaces/CustomSimpleTagManagerInterface.php 2 patches
Doc Comments   +2 added lines patch added patch discarded remove patch
@@ -19,6 +19,7 @@  discard block
 block discarded – undo
19 19
 	 * Insert some content before the fact source text.
20 20
 	 * 
21 21
 	 * @param string $srec Source fact record
22
+	 * @return string
22 23
 	 */
23 24
 	public function hFactSourcePrepend($srec);
24 25
 	
@@ -26,6 +27,7 @@  discard block
 block discarded – undo
26 27
 	 * Insert some content after the fact source text.
27 28
 	 * 
28 29
 	 * @param string $srec Source fact record
30
+	 * @return void
29 31
 	 */
30 32
 	public function hFactSourceAppend($srec);
31 33
 	
Please login to merge, or discard this patch.
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
  /**
3
- * webtrees-lib: MyArtJaub library for webtrees
4
- *
5
- * @package MyArtJaub\Webtrees
6
- * @subpackage Hook
7
- * @author Jonathan Jaubart <[email protected]>
8
- * @copyright Copyright (c) 2011-2016, Jonathan Jaubart
9
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3
10
- */
3
+  * webtrees-lib: MyArtJaub library for webtrees
4
+  *
5
+  * @package MyArtJaub\Webtrees
6
+  * @subpackage Hook
7
+  * @author Jonathan Jaubart <[email protected]>
8
+  * @copyright Copyright (c) 2011-2016, Jonathan Jaubart
9
+  * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3
10
+  */
11 11
 namespace MyArtJaub\Webtrees\Hook\HookInterfaces;
12 12
 
13 13
 /**
@@ -18,12 +18,12 @@  discard block
 block discarded – undo
18 18
 interface CustomSimpleTagManager {
19 19
 
20 20
 
21
-    /**
22
-     * Returns the list of expected tags, classified by type of records.
23
-     *
24
-     * @return array List of expected tags
25
-     */
26
-    public function hGetExpectedTags();
21
+	/**
22
+	 * Returns the list of expected tags, classified by type of records.
23
+	 *
24
+	 * @return array List of expected tags
25
+	 */
26
+	public function hGetExpectedTags();
27 27
     
28 28
 	/**
29 29
 	 * Return the HTML code to be display for this tag.
Please login to merge, or discard this patch.
src/Webtrees/Hook/HookInterfaces/FactSourceTextExtenderInterface.php 2 patches
Doc Comments   +2 added lines patch added patch discarded remove patch
@@ -19,6 +19,7 @@  discard block
 block discarded – undo
19 19
 	 * Insert some content before the fact source text.
20 20
 	 * 
21 21
 	 * @param string $srec Source fact record
22
+	 * @return string
22 23
 	 */
23 24
 	public function hFactSourcePrepend($srec);
24 25
 	
@@ -26,6 +27,7 @@  discard block
 block discarded – undo
26 27
 	 * Insert some content after the fact source text.
27 28
 	 * 
28 29
 	 * @param string $srec Source fact record
30
+	 * @return void
29 31
 	 */
30 32
 	public function hFactSourceAppend($srec);
31 33
 	
Please login to merge, or discard this patch.
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@
 block discarded – undo
1 1
 <?php
2 2
  /**
3
- * webtrees-lib: MyArtJaub library for webtrees
4
- *
5
- * @package MyArtJaub\Webtrees
6
- * @subpackage Hook
7
- * @author Jonathan Jaubart <[email protected]>
8
- * @copyright Copyright (c) 2011-2016, Jonathan Jaubart
9
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3
10
- */
3
+  * webtrees-lib: MyArtJaub library for webtrees
4
+  *
5
+  * @package MyArtJaub\Webtrees
6
+  * @subpackage Hook
7
+  * @author Jonathan Jaubart <[email protected]>
8
+  * @copyright Copyright (c) 2011-2016, Jonathan Jaubart
9
+  * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3
10
+  */
11 11
 namespace MyArtJaub\Webtrees\Hook;
12 12
 
13 13
 use \Fisharebest\Webtrees as fw;
Please login to merge, or discard this patch.
src/Webtrees/Hook/HookInterfaces/RecordNameTextExtenderInterface.php 2 patches
Doc Comments   +2 added lines patch added patch discarded remove patch
@@ -21,6 +21,7 @@  discard block
 block discarded – undo
21 21
 	 * Insert some content before the record name text.
22 22
 	 * 
23 23
 	 * @param GedcomRecord $grec Gedcom record
24
+	 * @return void
24 25
 	 */
25 26
 	public function hRecordNamePrepend(GedcomRecord $grec);
26 27
 	
@@ -28,6 +29,7 @@  discard block
 block discarded – undo
28 29
 	 * Insert some content after the record name text.
29 30
 	 * 
30 31
 	 * @param GedcomRecord $grec Gedcom record
32
+	 * @return string
31 33
 	 */
32 34
 	public function hRecordNameAppend(GedcomRecord $grec);
33 35
 	
Please login to merge, or discard this patch.
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@
 block discarded – undo
1 1
 <?php
2 2
  /**
3
- * webtrees-lib: MyArtJaub library for webtrees
4
- *
5
- * @package MyArtJaub\Webtrees
6
- * @subpackage Hook
7
- * @author Jonathan Jaubart <[email protected]>
8
- * @copyright Copyright (c) 2011-2016, Jonathan Jaubart
9
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3
10
- */
3
+  * webtrees-lib: MyArtJaub library for webtrees
4
+  *
5
+  * @package MyArtJaub\Webtrees
6
+  * @subpackage Hook
7
+  * @author Jonathan Jaubart <[email protected]>
8
+  * @copyright Copyright (c) 2011-2016, Jonathan Jaubart
9
+  * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3
10
+  */
11 11
 namespace MyArtJaub\Webtrees\Hook;
12 12
 
13 13
 use \Fisharebest\Webtrees as fw;
Please login to merge, or discard this patch.
src/Webtrees/Module/AdminTasksModule.php 2 patches
Indentation   +86 added lines, -86 removed lines patch added patch discarded remove patch
@@ -23,64 +23,64 @@  discard block
 block discarded – undo
23 23
 class AdminTasksModule extends AbstractModule 
24 24
 implements ModuleConfigInterface, ModuleBlockInterface
25 25
 {
26
-    // How to update the database schema for this module
27
-    const SCHEMA_TARGET_VERSION   = 1;
28
-    const SCHEMA_SETTING_NAME     = 'MAJ_ADMTASKS_SCHEMA_VERSION';
29
-    const SCHEMA_MIGRATION_PREFIX = '\MyArtJaub\Webtrees\Module\AdminTasks\Schema';
26
+	// How to update the database schema for this module
27
+	const SCHEMA_TARGET_VERSION   = 1;
28
+	const SCHEMA_SETTING_NAME     = 'MAJ_ADMTASKS_SCHEMA_VERSION';
29
+	const SCHEMA_MIGRATION_PREFIX = '\MyArtJaub\Webtrees\Module\AdminTasks\Schema';
30 30
     
31
-    /** @var string For custom modules - link for support, upgrades, etc. */
32
-    const CUSTOM_WEBSITE = 'https://github.com/jon48/webtrees-lib';
31
+	/** @var string For custom modules - link for support, upgrades, etc. */
32
+	const CUSTOM_WEBSITE = 'https://github.com/jon48/webtrees-lib';
33 33
     
34
-    /**
35
-     * Admin Task provider
36
-     * @var \MyArtJaub\Webtrees\Module\AdminTasks\Model\TaskProviderInterface $provider
37
-     */
38
-    protected $provider;
34
+	/**
35
+	 * Admin Task provider
36
+	 * @var \MyArtJaub\Webtrees\Module\AdminTasks\Model\TaskProviderInterface $provider
37
+	 */
38
+	protected $provider;
39 39
     
40
-    /**
41
-     * {@inheritDoc}
42
-     * @see \Fisharebest\Webtrees\Module\AbstractModule::getTitle()
43
-     */
44
-    public function getTitle() {
45
-        return I18N::translate('Administration Tasks');
46
-    }
40
+	/**
41
+	 * {@inheritDoc}
42
+	 * @see \Fisharebest\Webtrees\Module\AbstractModule::getTitle()
43
+	 */
44
+	public function getTitle() {
45
+		return I18N::translate('Administration Tasks');
46
+	}
47 47
     
48 48
    /**
49 49
     * {@inheritDoc}
50 50
     * @see \Fisharebest\Webtrees\Module\AbstractModule::getDescription()
51 51
     */
52
-    public function getDescription() {
53
-        return I18N::translate('Manage and run nearly-scheduled administration tasks.');
54
-    }
52
+	public function getDescription() {
53
+		return I18N::translate('Manage and run nearly-scheduled administration tasks.');
54
+	}
55 55
     
56
-    /**
57
-     * {@inheritDoc}
58
-     * @see \Fisharebest\Webtrees\Module\AbstractModule::modAction()
59
-     */
60
-    public function modAction($mod_action) {
61
-        Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION);
56
+	/**
57
+	 * {@inheritDoc}
58
+	 * @see \Fisharebest\Webtrees\Module\AbstractModule::modAction()
59
+	 */
60
+	public function modAction($mod_action) {
61
+		Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION);
62 62
                 
63
-        \MyArtJaub\Webtrees\Mvc\Dispatcher::getInstance()->handle($this, $mod_action);
64
-    }
63
+		\MyArtJaub\Webtrees\Mvc\Dispatcher::getInstance()->handle($this, $mod_action);
64
+	}
65 65
     
66
-    /**
67
-     * {@inheritDoc}
68
-     * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink()
69
-     */
70
-    public function getConfigLink() {
71
-        Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION);
66
+	/**
67
+	 * {@inheritDoc}
68
+	 * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink()
69
+	 */
70
+	public function getConfigLink() {
71
+		Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION);
72 72
         
73
-        return 'module.php?mod=' . $this->getName() . '&amp;mod_action=AdminConfig';
74
-    }
73
+		return 'module.php?mod=' . $this->getName() . '&amp;mod_action=AdminConfig';
74
+	}
75 75
     
76
-    /**
77
-     * {@inheritDoc}
78
-     * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::getBlock()
79
-     */
80
-    public function getBlock($block_id, $template = true, $cfg = array()) {
81
-        global $controller;
76
+	/**
77
+	 * {@inheritDoc}
78
+	 * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::getBlock()
79
+	 */
80
+	public function getBlock($block_id, $template = true, $cfg = array()) {
81
+		global $controller;
82 82
         
83
-        $controller->addInlineJavascript('
83
+		$controller->addInlineJavascript('
84 84
 			$(document).ready(function(){
85 85
 				$.ajax({
86 86
 					url: "module.php",
@@ -91,60 +91,60 @@  discard block
 block discarded – undo
91 91
 				});
92 92
 			});
93 93
 		');
94
-        return '';
95
-    }
94
+		return '';
95
+	}
96 96
     
97
-    /**
98
-     * {@inheritDoc}
99
-     * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::loadAjax()
100
-     */
101
-    public function loadAjax() {
102
-        return false;
103
-    }
97
+	/**
98
+	 * {@inheritDoc}
99
+	 * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::loadAjax()
100
+	 */
101
+	public function loadAjax() {
102
+		return false;
103
+	}
104 104
     
105
-    /**
106
-     * {@inheritDoc}
107
-     * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::isGedcomBlock()
108
-     */
109
-    public function isGedcomBlock() {
110
-        return true;
111
-    }
105
+	/**
106
+	 * {@inheritDoc}
107
+	 * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::isGedcomBlock()
108
+	 */
109
+	public function isGedcomBlock() {
110
+		return true;
111
+	}
112 112
     
113
-    /**
114
-     * {@inheritDoc}
115
-     * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::isUserBlock()
116
-     */
117
-    public function isUserBlock() {
118
-        return false;
119
-    }
113
+	/**
114
+	 * {@inheritDoc}
115
+	 * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::isUserBlock()
116
+	 */
117
+	public function isUserBlock() {
118
+		return false;
119
+	}
120 120
     
121
-    /**
122
-     * {@inheritDoc}
123
-     * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::configureBlock()
124
-     */
125
-    public function configureBlock($block_id) {
121
+	/**
122
+	 * {@inheritDoc}
123
+	 * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::configureBlock()
124
+	 */
125
+	public function configureBlock($block_id) {
126 126
         
127
-    }
127
+	}
128 128
    
129 129
 /**
130
-	 * Get the Admin Tasks Provider (initialise it if not done yet).
131
-	 *
132
-	 * @return \MyArtJaub\Webtrees\Module\AdminTasks\Model\TaskProviderInterface
133
-	 */
134
-    public function getProvider() {        
135
-        if(!$this->provider) {
136
-            $this->provider = new TaskProvider(WT_ROOT.WT_MODULES_DIR.$this->getName().'/tasks/');
137
-        }
138
-        return $this->provider;
139
-    }
130
+ * Get the Admin Tasks Provider (initialise it if not done yet).
131
+ *
132
+ * @return \MyArtJaub\Webtrees\Module\AdminTasks\Model\TaskProviderInterface
133
+ */
134
+	public function getProvider() {        
135
+		if(!$this->provider) {
136
+			$this->provider = new TaskProvider(WT_ROOT.WT_MODULES_DIR.$this->getName().'/tasks/');
137
+		}
138
+		return $this->provider;
139
+	}
140 140
 	
141 141
 	/**
142 142
 	 * Set the Admin Tasks Provider.
143 143
 	 *
144 144
 	 * @return \MyArtJaub\Webtrees\Module\GeoDispersion\Model\TaskProviderInterface
145 145
 	 */
146
-    public function setProvider(TaskProviderInterface $provider) {
147
-        $this->provider = $provider;
148
-    }
146
+	public function setProvider(TaskProviderInterface $provider) {
147
+		$this->provider = $provider;
148
+	}
149 149
 }
150 150
  
151 151
\ 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
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
     public function getConfigLink() {
65 65
         Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION);
66 66
         
67
-        return 'module.php?mod=' . $this->getName() . '&amp;mod_action=AdminConfig';
67
+        return 'module.php?mod='.$this->getName().'&amp;mod_action=AdminConfig';
68 68
     }
69 69
     
70 70
     /**
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
     public function getProvider() {
84 84
         global $WT_TREE;
85 85
         
86
-        if(!$this->provider) {
86
+        if (!$this->provider) {
87 87
             $this->provider = new GeoAnalysisProvider($WT_TREE);
88 88
         }
89 89
         return $this->provider;
Please login to merge, or discard this patch.
src/Webtrees/Module/PatronymicLineage/Model/LineageBuilder.php 2 patches
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -54,30 +54,30 @@  discard block
 block discarded – undo
54 54
 	public function buildLineages() {				
55 55
 		$indis = \Fisharebest\Webtrees\Query\QueryName::individuals($this->tree, $this->surname, null, null, false, false);
56 56
 		
57
-		if(count($indis) == 0) return null;
57
+		if (count($indis) == 0) return null;
58 58
 		
59 59
 		$root_lineages = array();
60 60
 		
61
-		foreach($indis as $indi) {
61
+		foreach ($indis as $indi) {
62 62
 			$pid = $indi->getXref();
63
-			if(!isset($this->used_indis[$pid])){
63
+			if (!isset($this->used_indis[$pid])) {
64 64
 				//Find the root of the lineage
65 65
 				/** @var Fisharebest\Webtrees\Individual $indiFirst  */
66
-				$indiFirst= $this->getLineageRootIndividual($indi);
67
-				if($indiFirst){
66
+				$indiFirst = $this->getLineageRootIndividual($indi);
67
+				if ($indiFirst) {
68 68
 					$this->used_indis[$indiFirst->getXref()] = true;
69
-					if($indiFirst->canShow()){
69
+					if ($indiFirst->canShow()) {
70 70
 						//Check if the root individual has brothers and sisters, without parents
71 71
 						$indiChildFamily = $indiFirst->getPrimaryChildFamily();
72
-						if($indiChildFamily !== null){
72
+						if ($indiChildFamily !== null) {
73 73
 							$root_node = new LineageRootNode(null); 
74 74
 							$root_node->addFamily($indiChildFamily);
75 75
 						}
76
-						else{
76
+						else {
77 77
 							$root_node = new LineageRootNode($indiFirst);
78 78
 						}
79 79
 						$root_node = $this->buildLineage($root_node);		
80
-						if($root_node) $root_lineages[] = $root_node;
80
+						if ($root_node) $root_lineages[] = $root_node;
81 81
 					}
82 82
 				}
83 83
 			}
@@ -94,45 +94,45 @@  discard block
 block discarded – undo
94 94
 	 * @return (Individual|null) Root individual
95 95
 	 */
96 96
 	protected function getLineageRootIndividual(Individual $indi) {
97
-		$is_first=false;
97
+		$is_first = false;
98 98
 		$dindi = new \MyArtJaub\Webtrees\Individual($indi);
99
-		$indi_surname=$dindi->getUnprotectedPrimarySurname();
99
+		$indi_surname = $dindi->getUnprotectedPrimarySurname();
100 100
 		$resIndi = $indi;
101
-		while(!$is_first){
101
+		while (!$is_first) {
102 102
 			//Get the individual parents family
103
-			$fam=$resIndi->getPrimaryChildFamily();
104
-			if($fam){
105
-				$husb=$fam->getHusband();
106
-				$wife=$fam->getWife();
103
+			$fam = $resIndi->getPrimaryChildFamily();
104
+			if ($fam) {
105
+				$husb = $fam->getHusband();
106
+				$wife = $fam->getWife();
107 107
 				//If the father exists, take him
108
-				if($husb){
108
+				if ($husb) {
109 109
 					$dhusb = new \MyArtJaub\Webtrees\Individual($husb);
110
-					$dhusb->isNewAddition() ? $is_first = true : $resIndi=$husb;
110
+					$dhusb->isNewAddition() ? $is_first = true : $resIndi = $husb;
111 111
 				}
112 112
 				//If only a mother exists
113
-				else if($wife){
113
+				else if ($wife) {
114 114
 					$dwife = new \MyArtJaub\Webtrees\Individual($wife);
115
-					$wife_surname=$dwife->getUnprotectedPrimarySurname();
115
+					$wife_surname = $dwife->getUnprotectedPrimarySurname();
116 116
 					//Check if the child is a natural child of the mother (based on the surname - Warning : surname must be identical)
117
-					if(!$dwife->isNewAddition() && I18N::strcasecmp($wife_surname, $indi_surname) == 0){
118
-						$resIndi=$wife;
117
+					if (!$dwife->isNewAddition() && I18N::strcasecmp($wife_surname, $indi_surname) == 0) {
118
+						$resIndi = $wife;
119 119
 					}
120
-					else{
121
-						$is_first=true;
120
+					else {
121
+						$is_first = true;
122 122
 					}
123 123
 				}
124
-				else{
125
-					$is_first=true;
124
+				else {
125
+					$is_first = true;
126 126
 				}
127 127
 			}
128
-			else{
129
-				$is_first=true;
128
+			else {
129
+				$is_first = true;
130 130
 			}
131 131
 		}
132
-		if(isset($this->used_indis[$resIndi->getXref()])){
132
+		if (isset($this->used_indis[$resIndi->getXref()])) {
133 133
 			return null;
134 134
 		}
135
-		else{
135
+		else {
136 136
 			return $resIndi;
137 137
 		}
138 138
 	}
@@ -145,15 +145,15 @@  discard block
 block discarded – undo
145 145
 	 * @return LineageNode Computed lineage
146 146
 	 */
147 147
 	protected function buildLineage(LineageNode $node) {
148
-		if($node === null) return;
148
+		if ($node === null) return;
149 149
 		
150 150
 		$indi_surname = null;
151 151
 		
152 152
 		$indi_node = $node->getIndividual();			
153
-		if($indi_node) {
154
-			if(count($node->getFamiliesNodes()) == 0) {
153
+		if ($indi_node) {
154
+			if (count($node->getFamiliesNodes()) == 0) {
155 155
 				$indiSpouseFamilies = $indi_node->getSpouseFamilies();
156
-				foreach($indiSpouseFamilies as $indiSpouseFamily) {
156
+				foreach ($indiSpouseFamilies as $indiSpouseFamily) {
157 157
 					$node->addFamily($indiSpouseFamily);
158 158
 				}
159 159
 			}
@@ -162,62 +162,62 @@  discard block
 block discarded – undo
162 162
 			$indi_surname = $dindi_node->getUnprotectedPrimarySurname();
163 163
 			
164 164
 			//Get the estimated birth place and put it in the place table
165
-			$place=$dindi_node->getEstimatedBirthPlace(false);
166
-			if($place && strlen($place) > 0){
167
-				$place=trim($place);
165
+			$place = $dindi_node->getEstimatedBirthPlace(false);
166
+			if ($place && strlen($place) > 0) {
167
+				$place = trim($place);
168 168
 				$node->getRootNode()->addPlace(new Place($place, $this->tree));
169 169
 			}
170 170
 				
171 171
 			//Tag the individual as used
172
-			$this->used_indis[$indi_node->getXref()]=true;
172
+			$this->used_indis[$indi_node->getXref()] = true;
173 173
 		}
174 174
 		
175
-		foreach($node->getFamiliesNodes() as $family) {
175
+		foreach ($node->getFamiliesNodes() as $family) {
176 176
 			$spouse_surname = null;
177
-			if($indi_node && $spouse = $family->getSpouse($indi_node)) {
177
+			if ($indi_node && $spouse = $family->getSpouse($indi_node)) {
178 178
 				$dspouse = new \MyArtJaub\Webtrees\Individual($spouse);
179
-				$spouse_surname=$dspouse->getUnprotectedPrimarySurname();
179
+				$spouse_surname = $dspouse->getUnprotectedPrimarySurname();
180 180
 			}
181 181
 			
182 182
 			$children = $family->getChildren();
183 183
 
184
-			$nbChildren=0;
185
-			$nbNatural=0;
184
+			$nbChildren = 0;
185
+			$nbNatural = 0;
186 186
 			
187
-			foreach($children as $child){
187
+			foreach ($children as $child) {
188 188
 				$dchild = new \MyArtJaub\Webtrees\Individual($child);
189
-				$child_surname=$dchild->getUnprotectedPrimarySurname();
189
+				$child_surname = $dchild->getUnprotectedPrimarySurname();
190 190
 				
191
-				if(!$dchild->isNewAddition()) {
191
+				if (!$dchild->isNewAddition()) {
192 192
 					$nbChildren++;
193 193
 					//If the root individual is the mother
194
-					if($indi_node && I18N::strcasecmp($indi_node->getSex(), 'F') == 0) {
194
+					if ($indi_node && I18N::strcasecmp($indi_node->getSex(), 'F') == 0) {
195 195
 						//Print only lineages of children with the same surname as their mother (supposing they are natural children)
196
-						if(!$spouse || ($spouse_surname && I18N::strcasecmp($child_surname, $spouse_surname) != 0)){
197
-							if(I18N::strcasecmp($child_surname, $indi_surname) == 0){
196
+						if (!$spouse || ($spouse_surname && I18N::strcasecmp($child_surname, $spouse_surname) != 0)) {
197
+							if (I18N::strcasecmp($child_surname, $indi_surname) == 0) {
198 198
 								$nbNatural++;
199 199
 								$node_child = new LineageNode($child, $node->getRootNode());							
200 200
 								$node_child = $this->buildLineage($node_child);
201
-								if($node_child) $node->addChild($family, $node_child);
201
+								if ($node_child) $node->addChild($family, $node_child);
202 202
 							}
203 203
 						}
204 204
 					}
205 205
 					//If the root individual is the father
206 206
 					else {
207 207
 						//Print if the children does not bear the same name as his mother (and different from his father)
208
-						if( strlen($child_surname) == 0 || strlen($indi_surname) == 0 || strlen($spouse_surname) == 0 ||
208
+						if (strlen($child_surname) == 0 || strlen($indi_surname) == 0 || strlen($spouse_surname) == 0 ||
209 209
 							I18N::strcasecmp($child_surname, $indi_surname) == 0 ||
210
-							I18N::strcasecmp($child_surname, $spouse_surname) != 0 )
210
+							I18N::strcasecmp($child_surname, $spouse_surname) != 0)
211 211
 						{
212 212
 							$nbNatural++;
213 213
 							$node_child = new LineageNode($child, $node->getRootNode());							
214 214
 							$node_child = $this->buildLineage($node_child);
215
-							if($node_child) $node->addChild($family, $node_child);
215
+							if ($node_child) $node->addChild($family, $node_child);
216 216
 						}
217 217
 						else {
218 218
 							$nbNatural++;
219 219
 							$node_child = new LineageNode($child, $node->getRootNode(), $child_surname);
220
-							if($node_child) $node->addChild($family, $node_child);
220
+							if ($node_child) $node->addChild($family, $node_child);
221 221
 						}
222 222
 					}
223 223
 				}
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 
226 226
 
227 227
 			//Do not print other children
228
-			if(($nbChildren-$nbNatural)>0){
228
+			if (($nbChildren - $nbNatural) > 0) {
229 229
 				$node->addChild($family, null);
230 230
 			}
231 231
 		}
Please login to merge, or discard this patch.
Braces   +24 added lines, -18 removed lines patch added patch discarded remove patch
@@ -54,7 +54,9 @@  discard block
 block discarded – undo
54 54
 	public function buildLineages() {				
55 55
 		$indis = \Fisharebest\Webtrees\Query\QueryName::individuals($this->tree, $this->surname, null, null, false, false);
56 56
 		
57
-		if(count($indis) == 0) return null;
57
+		if(count($indis) == 0) {
58
+			return null;
59
+		}
58 60
 		
59 61
 		$root_lineages = array();
60 62
 		
@@ -72,12 +74,13 @@  discard block
 block discarded – undo
72 74
 						if($indiChildFamily !== null){
73 75
 							$root_node = new LineageRootNode(null); 
74 76
 							$root_node->addFamily($indiChildFamily);
75
-						}
76
-						else{
77
+						} else{
77 78
 							$root_node = new LineageRootNode($indiFirst);
78 79
 						}
79 80
 						$root_node = $this->buildLineage($root_node);		
80
-						if($root_node) $root_lineages[] = $root_node;
81
+						if($root_node) {
82
+							$root_lineages[] = $root_node;
83
+						}
81 84
 					}
82 85
 				}
83 86
 			}
@@ -116,23 +119,19 @@  discard block
 block discarded – undo
116 119
 					//Check if the child is a natural child of the mother (based on the surname - Warning : surname must be identical)
117 120
 					if(!$dwife->isNewAddition() && I18N::strcasecmp($wife_surname, $indi_surname) == 0){
118 121
 						$resIndi=$wife;
119
-					}
120
-					else{
122
+					} else{
121 123
 						$is_first=true;
122 124
 					}
123
-				}
124
-				else{
125
+				} else{
125 126
 					$is_first=true;
126 127
 				}
127
-			}
128
-			else{
128
+			} else{
129 129
 				$is_first=true;
130 130
 			}
131 131
 		}
132 132
 		if(isset($this->used_indis[$resIndi->getXref()])){
133 133
 			return null;
134
-		}
135
-		else{
134
+		} else{
136 135
 			return $resIndi;
137 136
 		}
138 137
 	}
@@ -145,7 +144,9 @@  discard block
 block discarded – undo
145 144
 	 * @return LineageNode Computed lineage
146 145
 	 */
147 146
 	protected function buildLineage(LineageNode $node) {
148
-		if($node === null) return;
147
+		if($node === null) {
148
+			return;
149
+		}
149 150
 		
150 151
 		$indi_surname = null;
151 152
 		
@@ -198,7 +199,9 @@  discard block
 block discarded – undo
198 199
 								$nbNatural++;
199 200
 								$node_child = new LineageNode($child, $node->getRootNode());							
200 201
 								$node_child = $this->buildLineage($node_child);
201
-								if($node_child) $node->addChild($family, $node_child);
202
+								if($node_child) {
203
+									$node->addChild($family, $node_child);
204
+								}
202 205
 							}
203 206
 						}
204 207
 					}
@@ -212,12 +215,15 @@  discard block
 block discarded – undo
212 215
 							$nbNatural++;
213 216
 							$node_child = new LineageNode($child, $node->getRootNode());							
214 217
 							$node_child = $this->buildLineage($node_child);
215
-							if($node_child) $node->addChild($family, $node_child);
216
-						}
217
-						else {
218
+							if($node_child) {
219
+								$node->addChild($family, $node_child);
220
+							}
221
+						} else {
218 222
 							$nbNatural++;
219 223
 							$node_child = new LineageNode($child, $node->getRootNode(), $child_surname);
220
-							if($node_child) $node->addChild($family, $node_child);
224
+							if($node_child) {
225
+								$node->addChild($family, $node_child);
226
+							}
221 227
 						}
222 228
 					}
223 229
 				}
Please login to merge, or discard this patch.
src/Webtrees/Module/Certificates/Model/CertificateFileProvider.php 2 patches
Indentation   +92 added lines, -92 removed lines patch added patch discarded remove patch
@@ -20,111 +20,111 @@
 block discarded – undo
20 20
  */
21 21
 class CertificateFileProvider implements CertificateProviderInterface {
22 22
     
23
-    /**
24
-     * Relative path to the root certificate folder
25
-     * @var string $root_path
26
-     */
27
-    protected $root_path;
23
+	/**
24
+	 * Relative path to the root certificate folder
25
+	 * @var string $root_path
26
+	 */
27
+	protected $root_path;
28 28
     
29
-    /**
30
-     * Reference tree
31
-     * @var Tree $tree
32
-     */
33
-    protected $tree;
29
+	/**
30
+	 * Reference tree
31
+	 * @var Tree $tree
32
+	 */
33
+	protected $tree;
34 34
     
35
-    /**
36
-     * Cached list of certificates' cities.
37
-     * @var (null|array) $cities_list
38
-     */
39
-    protected $cities_list = null;
35
+	/**
36
+	 * Cached list of certificates' cities.
37
+	 * @var (null|array) $cities_list
38
+	 */
39
+	protected $cities_list = null;
40 40
     
41
-    /**
42
-     * Constructor for the File Provider
43
-     * @param string $root_path
44
-     * @param Tree $tree
45
-     */
46
-    public function __construct($root_path, Tree $tree) {
47
-        $this->root_path = $root_path;
48
-        $this->tree = $tree;
49
-    }
41
+	/**
42
+	 * Constructor for the File Provider
43
+	 * @param string $root_path
44
+	 * @param Tree $tree
45
+	 */
46
+	public function __construct($root_path, Tree $tree) {
47
+		$this->root_path = $root_path;
48
+		$this->tree = $tree;
49
+	}
50 50
         
51
-    /**
52
-     * {@inhericDoc}
53
-     * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getRealCertificatesDirectory()
54
-     */
55
-    public function getRealCertificatesDirectory(){
56
-        return WT_DATA_DIR . $this->root_path;
57
-    }
51
+	/**
52
+	 * {@inhericDoc}
53
+	 * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getRealCertificatesDirectory()
54
+	 */
55
+	public function getRealCertificatesDirectory(){
56
+		return WT_DATA_DIR . $this->root_path;
57
+	}
58 58
     
59
-    /**
60
-     * {@inhericDoc}
61
-     * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getCitiesList()
62
-     */
63
-    public function getCitiesList(){
64
-        if(!isset($this->cities_list) || is_null($this->cities_list)){
65
-            $certdir = $this->getRealCertificatesDirectory();
66
-            $this->cities_list = array();
59
+	/**
60
+	 * {@inhericDoc}
61
+	 * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getCitiesList()
62
+	 */
63
+	public function getCitiesList(){
64
+		if(!isset($this->cities_list) || is_null($this->cities_list)){
65
+			$certdir = $this->getRealCertificatesDirectory();
66
+			$this->cities_list = array();
67 67
     
68
-            $dir = opendir($certdir);
68
+			$dir = opendir($certdir);
69 69
             
70
-            while($entry = readdir($dir)){
71
-                if($entry != '.' && $entry != '..' && is_dir($certdir.$entry)){
72
-                    $this->cities_list[]= Functions::encodeFileSystemToUtf8($entry);
73
-                }
74
-            }
75
-            sort($this->cities_list);
76
-        }
77
-        return $this->cities_list;
78
-    }
70
+			while($entry = readdir($dir)){
71
+				if($entry != '.' && $entry != '..' && is_dir($certdir.$entry)){
72
+					$this->cities_list[]= Functions::encodeFileSystemToUtf8($entry);
73
+				}
74
+			}
75
+			sort($this->cities_list);
76
+		}
77
+		return $this->cities_list;
78
+	}
79 79
     
80
-    /**
81
-     * {@inhericDoc}
82
-     * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getCertificatesList()
83
-     */
84
-    public function getCertificatesList($selCity){
80
+	/**
81
+	 * {@inhericDoc}
82
+	 * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getCertificatesList()
83
+	 */
84
+	public function getCertificatesList($selCity){
85 85
     
86
-        $selCity = Functions::encodeUtf8ToFileSystem($selCity);
86
+		$selCity = Functions::encodeUtf8ToFileSystem($selCity);
87 87
     
88
-        $certdir = $this->getRealCertificatesDirectory();
89
-        $tabCertif= array();
88
+		$certdir = $this->getRealCertificatesDirectory();
89
+		$tabCertif= array();
90 90
     
91
-        if(is_dir($certdir.$selCity)){
92
-            $dir=opendir($certdir.$selCity);
93
-            while($entry = readdir($dir)){
94
-                if($entry!='.' && $entry!='..' && !is_dir($certdir.$entry.'/')){
95
-                    $path = Functions::encodeFileSystemToUtf8($selCity.'/'.$entry);
96
-                    $certificate = new Certificate($path, $this->tree, $this);
97
-                    if(Functions::isImageTypeSupported($certificate->extension())){
98
-                        $tabCertif[] = 	$certificate;
99
-                    }
100
-                }
101
-            }
102
-        }
103
-        return $tabCertif;
104
-    }
91
+		if(is_dir($certdir.$selCity)){
92
+			$dir=opendir($certdir.$selCity);
93
+			while($entry = readdir($dir)){
94
+				if($entry!='.' && $entry!='..' && !is_dir($certdir.$entry.'/')){
95
+					$path = Functions::encodeFileSystemToUtf8($selCity.'/'.$entry);
96
+					$certificate = new Certificate($path, $this->tree, $this);
97
+					if(Functions::isImageTypeSupported($certificate->extension())){
98
+						$tabCertif[] = 	$certificate;
99
+					}
100
+				}
101
+			}
102
+		}
103
+		return $tabCertif;
104
+	}
105 105
     
106
-    /**
107
-     * {@inhericDoc}
108
-     * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getCertificatesListBeginWith()
109
-     */
110
-    public function getCertificatesListBeginWith($city, $contains, $limit= 9999){
111
-        $tabFiles= array();
112
-        $dirPath= $this->getRealCertificatesDirectory() . Functions::encodeUtf8ToFileSystem($city).'/';
113
-        $contains = utf8_decode($contains);
114
-        $nbCert = 0;
106
+	/**
107
+	 * {@inhericDoc}
108
+	 * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getCertificatesListBeginWith()
109
+	 */
110
+	public function getCertificatesListBeginWith($city, $contains, $limit= 9999){
111
+		$tabFiles= array();
112
+		$dirPath= $this->getRealCertificatesDirectory() . Functions::encodeUtf8ToFileSystem($city).'/';
113
+		$contains = utf8_decode($contains);
114
+		$nbCert = 0;
115 115
     
116
-        if(is_dir($dirPath)){
117
-            $dir=opendir($dirPath);
118
-            while(($entry = readdir($dir)) && $nbCert < $limit){
119
-                if($entry!='.' && $entry!='..' && $entry!='Thumbs.db' &&!is_dir($dirPath.$entry.'/') && stripos($entry, $contains)!== false){
120
-                    $tabFiles[]= Functions::encodeFileSystemToUtf8($entry);
121
-                    $nbCert++;
122
-                }
123
-            }
124
-        }
125
-        sort($tabFiles);
126
-        return $tabFiles;
127
-    }
116
+		if(is_dir($dirPath)){
117
+			$dir=opendir($dirPath);
118
+			while(($entry = readdir($dir)) && $nbCert < $limit){
119
+				if($entry!='.' && $entry!='..' && $entry!='Thumbs.db' &&!is_dir($dirPath.$entry.'/') && stripos($entry, $contains)!== false){
120
+					$tabFiles[]= Functions::encodeFileSystemToUtf8($entry);
121
+					$nbCert++;
122
+				}
123
+			}
124
+		}
125
+		sort($tabFiles);
126
+		return $tabFiles;
127
+	}
128 128
     
129 129
 }
130 130
 
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -52,24 +52,24 @@  discard block
 block discarded – undo
52 52
      * {@inhericDoc}
53 53
      * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getRealCertificatesDirectory()
54 54
      */
55
-    public function getRealCertificatesDirectory(){
56
-        return WT_DATA_DIR . $this->root_path;
55
+    public function getRealCertificatesDirectory() {
56
+        return WT_DATA_DIR.$this->root_path;
57 57
     }
58 58
     
59 59
     /**
60 60
      * {@inhericDoc}
61 61
      * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getCitiesList()
62 62
      */
63
-    public function getCitiesList(){
64
-        if(!isset($this->cities_list) || is_null($this->cities_list)){
63
+    public function getCitiesList() {
64
+        if (!isset($this->cities_list) || is_null($this->cities_list)) {
65 65
             $certdir = $this->getRealCertificatesDirectory();
66 66
             $this->cities_list = array();
67 67
     
68 68
             $dir = opendir($certdir);
69 69
             
70
-            while($entry = readdir($dir)){
71
-                if($entry != '.' && $entry != '..' && is_dir($certdir.$entry)){
72
-                    $this->cities_list[]= Functions::encodeFileSystemToUtf8($entry);
70
+            while ($entry = readdir($dir)) {
71
+                if ($entry != '.' && $entry != '..' && is_dir($certdir.$entry)) {
72
+                    $this->cities_list[] = Functions::encodeFileSystemToUtf8($entry);
73 73
                 }
74 74
             }
75 75
             sort($this->cities_list);
@@ -81,21 +81,21 @@  discard block
 block discarded – undo
81 81
      * {@inhericDoc}
82 82
      * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getCertificatesList()
83 83
      */
84
-    public function getCertificatesList($selCity){
84
+    public function getCertificatesList($selCity) {
85 85
     
86 86
         $selCity = Functions::encodeUtf8ToFileSystem($selCity);
87 87
     
88 88
         $certdir = $this->getRealCertificatesDirectory();
89
-        $tabCertif= array();
89
+        $tabCertif = array();
90 90
     
91
-        if(is_dir($certdir.$selCity)){
92
-            $dir=opendir($certdir.$selCity);
93
-            while($entry = readdir($dir)){
94
-                if($entry!='.' && $entry!='..' && !is_dir($certdir.$entry.'/')){
91
+        if (is_dir($certdir.$selCity)) {
92
+            $dir = opendir($certdir.$selCity);
93
+            while ($entry = readdir($dir)) {
94
+                if ($entry != '.' && $entry != '..' && !is_dir($certdir.$entry.'/')) {
95 95
                     $path = Functions::encodeFileSystemToUtf8($selCity.'/'.$entry);
96 96
                     $certificate = new Certificate($path, $this->tree, $this);
97
-                    if(Functions::isImageTypeSupported($certificate->extension())){
98
-                        $tabCertif[] = 	$certificate;
97
+                    if (Functions::isImageTypeSupported($certificate->extension())) {
98
+                        $tabCertif[] = $certificate;
99 99
                     }
100 100
                 }
101 101
             }
@@ -107,17 +107,17 @@  discard block
 block discarded – undo
107 107
      * {@inhericDoc}
108 108
      * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getCertificatesListBeginWith()
109 109
      */
110
-    public function getCertificatesListBeginWith($city, $contains, $limit= 9999){
111
-        $tabFiles= array();
112
-        $dirPath= $this->getRealCertificatesDirectory() . Functions::encodeUtf8ToFileSystem($city).'/';
110
+    public function getCertificatesListBeginWith($city, $contains, $limit = 9999) {
111
+        $tabFiles = array();
112
+        $dirPath = $this->getRealCertificatesDirectory().Functions::encodeUtf8ToFileSystem($city).'/';
113 113
         $contains = utf8_decode($contains);
114 114
         $nbCert = 0;
115 115
     
116
-        if(is_dir($dirPath)){
117
-            $dir=opendir($dirPath);
118
-            while(($entry = readdir($dir)) && $nbCert < $limit){
119
-                if($entry!='.' && $entry!='..' && $entry!='Thumbs.db' &&!is_dir($dirPath.$entry.'/') && stripos($entry, $contains)!== false){
120
-                    $tabFiles[]= Functions::encodeFileSystemToUtf8($entry);
116
+        if (is_dir($dirPath)) {
117
+            $dir = opendir($dirPath);
118
+            while (($entry = readdir($dir)) && $nbCert < $limit) {
119
+                if ($entry != '.' && $entry != '..' && $entry != 'Thumbs.db' && !is_dir($dirPath.$entry.'/') && stripos($entry, $contains) !== false) {
120
+                    $tabFiles[] = Functions::encodeFileSystemToUtf8($entry);
121 121
                     $nbCert++;
122 122
                 }
123 123
             }
Please login to merge, or discard this patch.