Completed
Push — master ( 15d977...8c59e5 )
by Jonathan
07:24
created
src/Webtrees/Module/AdminTasks/Model/AbstractTask.php 1 patch
Indentation   +194 added lines, -194 removed lines patch added patch discarded remove patch
@@ -20,253 +20,253 @@
 block discarded – undo
20 20
  */
21 21
 abstract class AbstractTask {
22 22
     
23
-    /**
24
-     * Time out for runnign tasks, in seconds. Default 5 min
25
-     * @var int TASK_TIME_OUT
26
-     */
27
-    const TASK_TIME_OUT = 300;
23
+	/**
24
+	 * Time out for runnign tasks, in seconds. Default 5 min
25
+	 * @var int TASK_TIME_OUT
26
+	 */
27
+	const TASK_TIME_OUT = 300;
28 28
               
29
-    /**
30
-     * Task provider
31
-     * @var TaskProviderInterface $provider
32
-     */
29
+	/**
30
+	 * Task provider
31
+	 * @var TaskProviderInterface $provider
32
+	 */
33 33
 	protected $provider;
34 34
 			
35 35
 	/**
36 36
 	 * Task name
37 37
 	 * @var string $name
38 38
 	 */
39
-    protected $name;
39
+	protected $name;
40 40
     
41
-    /**
42
-     * Status of the task
43
-     * @var bool $is_enabled
44
-     */
45
-    protected $is_enabled;
41
+	/**
42
+	 * Status of the task
43
+	 * @var bool $is_enabled
44
+	 */
45
+	protected $is_enabled;
46 46
     
47
-    /**
48
-     * Last updated date
49
-     * @var \DateTime $last_updated
50
-     */
51
-    protected $last_updated;
47
+	/**
48
+	 * Last updated date
49
+	 * @var \DateTime $last_updated
50
+	 */
51
+	protected $last_updated;
52 52
     
53
-    /**
54
-     * Last run result
55
-     * @var bool $last_result
56
-     */
57
-    protected $last_result;
53
+	/**
54
+	 * Last run result
55
+	 * @var bool $last_result
56
+	 */
57
+	protected $last_result;
58 58
     
59
-    /**
60
-     * Task run frequency
61
-     * @var int $frequency
62
-     */
63
-    protected $frequency;
59
+	/**
60
+	 * Task run frequency
61
+	 * @var int $frequency
62
+	 */
63
+	protected $frequency;
64 64
     
65
-    /**
66
-     * Task remaining runs
67
-     * @var int $nb_occurrences
68
-     */
69
-    protected $nb_occurrences;
65
+	/**
66
+	 * Task remaining runs
67
+	 * @var int $nb_occurrences
68
+	 */
69
+	protected $nb_occurrences;
70 70
     
71
-    /**
72
-     * Current running status of the task
73
-     * @var bool $is_running
74
-     */
75
-    protected $is_running;
71
+	/**
72
+	 * Current running status of the task
73
+	 * @var bool $is_running
74
+	 */
75
+	protected $is_running;
76 76
     
77
-    /**
78
-     * Constructor for the Admin task class
77
+	/**
78
+	 * Constructor for the Admin task class
79 79
 	 *
80 80
 	 * @param string $file Filename containing the task object
81 81
 	 * @param TaskProviderInterface $provider Provider for tasks
82
-     */
83
-    public function __construct($file, TaskProviderInterface $provider = null){
84
-        $this->name = trim(basename($file, '.php'));
82
+	 */
83
+	public function __construct($file, TaskProviderInterface $provider = null){
84
+		$this->name = trim(basename($file, '.php'));
85 85
 		$this->provider = $provider;
86
-    }
86
+	}
87 87
     
88
-    /**
89
-     * Get the provider.
90
-     *
91
-     * @return TaskProviderInterface 
92
-     */
93
-    public function getProvider(){
94
-        return $this->provider;
95
-    }
88
+	/**
89
+	 * Get the provider.
90
+	 *
91
+	 * @return TaskProviderInterface 
92
+	 */
93
+	public function getProvider(){
94
+		return $this->provider;
95
+	}
96 96
     
97
-    /**
98
-     * Set the provider.
99
-     *
100
-     * @param TaskProviderInterface $provider
101
-     * @return self Enable method-chaining
102
-     */
103
-    public function setProvider(TaskProviderInterface $provider){
104
-        $this->provider = $provider;
105
-        return $this;
106
-    }
97
+	/**
98
+	 * Set the provider.
99
+	 *
100
+	 * @param TaskProviderInterface $provider
101
+	 * @return self Enable method-chaining
102
+	 */
103
+	public function setProvider(TaskProviderInterface $provider){
104
+		$this->provider = $provider;
105
+		return $this;
106
+	}
107 107
     
108
-    /**
109
-     * Set parameters of the Task
110
-     *
111
-     * @param bool $is_enabled Status of the task
112
-     * @param \DateTime $lastupdated Time of the last task run
113
-     * @param bool $last_result Result of the last run, true for success, false for failure
114
-     * @param int $frequency Frequency of execution in minutes
115
-     * @param int $nb_occur Number of remaining occurrences, 0 for tasks not limited
116
-     * @param bool $is_running Indicates if the task is currently running
117
-     */
118
-    public function setParameters($is_enabled, \DateTime $last_updated, $last_result, $frequency, $nb_occur, $is_running){
119
-        $this->is_enabled = $is_enabled;
120
-        $this->last_updated = $last_updated;
121
-        $this->last_result = $last_result;
122
-        $this->frequency = $frequency;
123
-        $this->nb_occurrences = $nb_occur;
124
-        $this->is_running = $is_running;
125
-    }
108
+	/**
109
+	 * Set parameters of the Task
110
+	 *
111
+	 * @param bool $is_enabled Status of the task
112
+	 * @param \DateTime $lastupdated Time of the last task run
113
+	 * @param bool $last_result Result of the last run, true for success, false for failure
114
+	 * @param int $frequency Frequency of execution in minutes
115
+	 * @param int $nb_occur Number of remaining occurrences, 0 for tasks not limited
116
+	 * @param bool $is_running Indicates if the task is currently running
117
+	 */
118
+	public function setParameters($is_enabled, \DateTime $last_updated, $last_result, $frequency, $nb_occur, $is_running){
119
+		$this->is_enabled = $is_enabled;
120
+		$this->last_updated = $last_updated;
121
+		$this->last_result = $last_result;
122
+		$this->frequency = $frequency;
123
+		$this->nb_occurrences = $nb_occur;
124
+		$this->is_running = $is_running;
125
+	}
126 126
     
127
-    /**
128
-     * Get the name of the task
129
-     *
130
-     * @return string
131
-     */
132
-    public function getName(){
133
-        return $this->name;
134
-    }
127
+	/**
128
+	 * Get the name of the task
129
+	 *
130
+	 * @return string
131
+	 */
132
+	public function getName(){
133
+		return $this->name;
134
+	}
135 135
     
136 136
     
137
-    /**
138
-     * Return the status of the task in a boolean way
139
-     *
140
-     * @return boolean True if enabled
141
-     */
142
-    public function isEnabled(){
143
-        return $this->is_enabled;
144
-    }
137
+	/**
138
+	 * Return the status of the task in a boolean way
139
+	 *
140
+	 * @return boolean True if enabled
141
+	 */
142
+	public function isEnabled(){
143
+		return $this->is_enabled;
144
+	}
145 145
     
146
-    /**
147
-     * Get the last updated time.
148
-     *
149
-     * @return \DateTime
150
-     */
151
-    public function getLastUpdated(){
152
-        return $this->last_updated;
153
-    }
146
+	/**
147
+	 * Get the last updated time.
148
+	 *
149
+	 * @return \DateTime
150
+	 */
151
+	public function getLastUpdated(){
152
+		return $this->last_updated;
153
+	}
154 154
     
155
-    /**
156
-     * Check if the last result has been successful.
157
-     *
158
-     * @return bool
159
-     */
160
-    public function isLastRunSuccess(){
161
-        return $this->last_result;
162
-    }
155
+	/**
156
+	 * Check if the last result has been successful.
157
+	 *
158
+	 * @return bool
159
+	 */
160
+	public function isLastRunSuccess(){
161
+		return $this->last_result;
162
+	}
163 163
     
164
-    /**
165
-     * Get the task frequency.
166
-     *
167
-     * @return int
168
-     */
169
-    public function getFrequency(){
170
-        return $this->frequency;
171
-    }
164
+	/**
165
+	 * Get the task frequency.
166
+	 *
167
+	 * @return int
168
+	 */
169
+	public function getFrequency(){
170
+		return $this->frequency;
171
+	}
172 172
 	
173 173
 	/**
174
-     * Set the task frequency.
175
-     *
174
+	 * Set the task frequency.
175
+	 *
176 176
 	 * @param int $frequency
177
-     * @return self Enable method-chaining
178
-     */
179
-    public function setFrequency($frequency){
180
-        $this->frequency = $frequency;
177
+	 * @return self Enable method-chaining
178
+	 */
179
+	public function setFrequency($frequency){
180
+		$this->frequency = $frequency;
181 181
 		return $this;
182
-    }
182
+	}
183 183
     
184
-    /**
185
-     * Get the number of remaining occurrences.
186
-     *
187
-     * @return int
188
-     */
189
-    public function getRemainingOccurrences(){
190
-        return $this->nb_occurrences;
191
-    }
184
+	/**
185
+	 * Get the number of remaining occurrences.
186
+	 *
187
+	 * @return int
188
+	 */
189
+	public function getRemainingOccurrences(){
190
+		return $this->nb_occurrences;
191
+	}
192 192
 	
193 193
 	/**
194
-     * Set the number of remaining occurrences.
195
-     *
194
+	 * Set the number of remaining occurrences.
195
+	 *
196 196
 	 * @param int $nb_occur
197
-     * @return self Enable method-chaining
198
-     */
199
-    public function setRemainingOccurrences($nb_occur){
200
-        $this->nb_occurrences = $nb_occur;
197
+	 * @return self Enable method-chaining
198
+	 */
199
+	public function setRemainingOccurrences($nb_occur){
200
+		$this->nb_occurrences = $nb_occur;
201 201
 		return $this;
202
-    }
202
+	}
203 203
     
204
-    /**
205
-     * Check if the task if running.
206
-     *
207
-     * @return bool
208
-     */
209
-    public function isRunning(){
210
-        return $this->is_running;
211
-    }
204
+	/**
205
+	 * Check if the task if running.
206
+	 *
207
+	 * @return bool
208
+	 */
209
+	public function isRunning(){
210
+		return $this->is_running;
211
+	}
212 212
     
213 213
     
214
-    /**
215
-     * Return the name to display for the task
216
-     *
217
-     * @return string Title for the task
218
-     */
219
-    abstract public function getTitle();
214
+	/**
215
+	 * Return the name to display for the task
216
+	 *
217
+	 * @return string Title for the task
218
+	 */
219
+	abstract public function getTitle();
220 220
     
221
-    /**
222
-     * Return the default frequency for the execution of the task
223
-     *
224
-     * @return int Frequency for the execution of the task
225
-     */
226
-    abstract public function getDefaultFrequency();
221
+	/**
222
+	 * Return the default frequency for the execution of the task
223
+	 *
224
+	 * @return int Frequency for the execution of the task
225
+	 */
226
+	abstract public function getDefaultFrequency();
227 227
     
228
-    /**
229
-     * Execute the task's actions
230
-     */
231
-    abstract protected function executeSteps();
228
+	/**
229
+	 * Execute the task's actions
230
+	 */
231
+	abstract protected function executeSteps();
232 232
     
233 233
 	/**
234 234
 	 * Persist task state into database.
235 235
 	 * @return bool
236 236
 	 */
237 237
 	public function save() {
238
-	    if(!$this->provider) throw new \Exception('The task has not been initialised with a provider.');
238
+		if(!$this->provider) throw new \Exception('The task has not been initialised with a provider.');
239 239
 		return $this->provider->updateTask($this);
240 240
 	}
241 241
 	
242
-    /**
243
-     * Execute the task, default skeleton
244
-     *
245
-     */
246
-    public function execute(){
242
+	/**
243
+	 * Execute the task, default skeleton
244
+	 *
245
+	 */
246
+	public function execute(){
247 247
     
248
-        if($this->last_updated->add(new \DateInterval('PT'.self::TASK_TIME_OUT.'S')) < new \DateTime())
249
-            $this->is_running = false;
248
+		if($this->last_updated->add(new \DateInterval('PT'.self::TASK_TIME_OUT.'S')) < new \DateTime())
249
+			$this->is_running = false;
250 250
     
251
-        if(!$this->is_running){
252
-            $this->last_result = false;
253
-            $this->is_running = true;
254
-            $this->save();
251
+		if(!$this->is_running){
252
+			$this->last_result = false;
253
+			$this->is_running = true;
254
+			$this->save();
255 255
     
256
-            Log::addDebugLog('Start execution of Admin task: '.$this->getTitle());
257
-            $this->last_result = $this->executeSteps();
258
-            if($this->last_result){
259
-                $this->last_updated = new \DateTime();
260
-                if($this->nb_occurrences > 0){
261
-                    $this->nb_occurrences--;
262
-                    if($this->nb_occurrences == 0) $this->is_enabled = false;
263
-                }
264
-            }
265
-            $this->is_running = false;
266
-            $this->save();
267
-            Log::addDebugLog('Execution completed for Admin task: '.$this->getTitle().' - '.($this->last_result ? 'Success' : 'Failure'));
268
-        }
269
-    }
256
+			Log::addDebugLog('Start execution of Admin task: '.$this->getTitle());
257
+			$this->last_result = $this->executeSteps();
258
+			if($this->last_result){
259
+				$this->last_updated = new \DateTime();
260
+				if($this->nb_occurrences > 0){
261
+					$this->nb_occurrences--;
262
+					if($this->nb_occurrences == 0) $this->is_enabled = false;
263
+				}
264
+			}
265
+			$this->is_running = false;
266
+			$this->save();
267
+			Log::addDebugLog('Execution completed for Admin task: '.$this->getTitle().' - '.($this->last_result ? 'Success' : 'Failure'));
268
+		}
269
+	}
270 270
     
271 271
     
272 272
 }
Please login to merge, or discard this patch.
src/Webtrees/Hook/HookProviderInterface.php 1 patch
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -16,51 +16,51 @@
 block discarded – undo
16 16
  */
17 17
 interface HookProviderInterface {
18 18
 
19
-    /**
20
-     * Return an instance of the hook linked to the specifed function / context
21
-     *
22
-     * @param string $hook_function
23
-     * @param string $hook_context
24
-     * @return Hook
25
-     */
26
-    public function get($hook_function, $hook_context = null);
19
+	/**
20
+	 * Return an instance of the hook linked to the specifed function / context
21
+	 *
22
+	 * @param string $hook_function
23
+	 * @param string $hook_context
24
+	 * @return Hook
25
+	 */
26
+	public function get($hook_function, $hook_context = null);
27 27
     
28
-    /**
29
-     * Return whether the Hook module is active and the table has been created.
30
-     *
31
-     * @uses \MyArtJaub\Webtrees\Module\ModuleManager to check if the module is operational
32
-     * @return bool True if module active and table created, false otherwise
33
-     */
34
-    public function isModuleOperational();
28
+	/**
29
+	 * Return whether the Hook module is active and the table has been created.
30
+	 *
31
+	 * @uses \MyArtJaub\Webtrees\Module\ModuleManager to check if the module is operational
32
+	 * @return bool True if module active and table created, false otherwise
33
+	 */
34
+	public function isModuleOperational();
35 35
     
36
-    /**
37
-     * Get the list of possible hooks in the list of modules files.
38
-     * A hook will be registered:
39
-     * 		- for all modules already registered in Webtrees
40
-     * 		- if the module implements HookSubscriberInterface
41
-     * 		- if the method exist within the module
42
-     *
43
-     * @return Array List of possible hooks, with the priority
44
-     */
45
-    public function getPossibleHooks();
36
+	/**
37
+	 * Get the list of possible hooks in the list of modules files.
38
+	 * A hook will be registered:
39
+	 * 		- for all modules already registered in Webtrees
40
+	 * 		- if the module implements HookSubscriberInterface
41
+	 * 		- if the method exist within the module
42
+	 *
43
+	 * @return Array List of possible hooks, with the priority
44
+	 */
45
+	public function getPossibleHooks();
46 46
     
47
-    /**
48
-     * Get the list of hooks intalled in webtrees, with their id, status and priority.
49
-     *
50
-     * @return array List of installed hooks
51
-     */
52
-    public function getRawInstalledHooks();
47
+	/**
48
+	 * Get the list of hooks intalled in webtrees, with their id, status and priority.
49
+	 *
50
+	 * @return array List of installed hooks
51
+	 */
52
+	public function getRawInstalledHooks();
53 53
     
54
-    /**
55
-     * Get the list of hooks intalled in webtrees, with their id, status and priority.
56
-     *
57
-     * @return Array List of installed hooks, with id, status and priority
58
-     */
59
-    public function getInstalledHooks();
54
+	/**
55
+	 * Get the list of hooks intalled in webtrees, with their id, status and priority.
56
+	 *
57
+	 * @return Array List of installed hooks, with id, status and priority
58
+	 */
59
+	public function getInstalledHooks();
60 60
     
61
-    /**
62
-     * Update the list of hooks, identifying missing ones and removed ones.
63
-     */
64
-    public function updateHooks();
61
+	/**
62
+	 * Update the list of hooks, identifying missing ones and removed ones.
63
+	 */
64
+	public function updateHooks();
65 65
     
66 66
 }
67 67
\ No newline at end of file
Please login to merge, or discard this patch.
src/Webtrees/Module/Sosa/Model/SosaCalculator.php 1 patch
Indentation   +97 added lines, -97 removed lines patch added patch discarded remove patch
@@ -19,116 +19,116 @@
 block discarded – undo
19 19
  */
20 20
 class SosaCalculator {
21 21
     
22
-    /**
23
-     * Maximium size for the temporary Sosa table
24
-     * @var int TMP_SOSA_TABLE_LIMIT
25
-     */
26
-    const TMP_SOSA_TABLE_LIMIT = 1000;
22
+	/**
23
+	 * Maximium size for the temporary Sosa table
24
+	 * @var int TMP_SOSA_TABLE_LIMIT
25
+	 */
26
+	const TMP_SOSA_TABLE_LIMIT = 1000;
27 27
     
28
-    /**
29
-     * Reference user
30
-     * @var Fisharebest\Webtrees\User $user
31
-     */
32
-    protected $user;
28
+	/**
29
+	 * Reference user
30
+	 * @var Fisharebest\Webtrees\User $user
31
+	 */
32
+	protected $user;
33 33
     
34
-    /**
35
-     * Reference tree
36
-     * @var Fisharebest\Webtrees\Tree $tree
37
-     */
38
-    protected $tree;
34
+	/**
35
+	 * Reference tree
36
+	 * @var Fisharebest\Webtrees\Tree $tree
37
+	 */
38
+	protected $tree;
39 39
     
40
-    /**
41
-     * Sosa Provider for the calculator
42
-     * @var \MyArtJaub\Webtrees\Module\Sosa\Model\SosaCalculator $sosa_provider
43
-     */
44
-    protected $sosa_provider;
40
+	/**
41
+	 * Sosa Provider for the calculator
42
+	 * @var \MyArtJaub\Webtrees\Module\Sosa\Model\SosaCalculator $sosa_provider
43
+	 */
44
+	protected $sosa_provider;
45 45
     
46
-    /**
47
-     * Temporary Sosa table, used during construction
48
-     * @var array $tmp_sosa_table
49
-     */
50
-    protected $tmp_sosa_table;
46
+	/**
47
+	 * Temporary Sosa table, used during construction
48
+	 * @var array $tmp_sosa_table
49
+	 */
50
+	protected $tmp_sosa_table;
51 51
     
52
-    /**
53
-     * Constructor for the Sosa Calculator
54
-     * @param Tree $tree
55
-     * @param User $user
56
-     */
57
-    public function __construct(Tree $tree, User $user) {        
58
-        $this->tree = $tree;
59
-        $this->user = $user;
52
+	/**
53
+	 * Constructor for the Sosa Calculator
54
+	 * @param Tree $tree
55
+	 * @param User $user
56
+	 */
57
+	public function __construct(Tree $tree, User $user) {        
58
+		$this->tree = $tree;
59
+		$this->user = $user;
60 60
         
61
-        $this->sosa_provider = new SosaProvider($this->tree, $this->user);;
62
-    }
61
+		$this->sosa_provider = new SosaProvider($this->tree, $this->user);;
62
+	}
63 63
     
64
-    /**
65
-     * Compute all Sosa ancestors from the user's root individual.
66
-     * @return bool Result of the computation
67
-     */
68
-    public function computeAll() {
69
-        $root_id = $this->tree->getUserPreference($this->user, 'MAJ_SOSA_ROOT_ID');        
70
-        $indi = Individual::getInstance($root_id, $this->tree);
71
-        if($indi){
72
-            $this->sosa_provider->deleteAll();
73
-            $this->addNode($indi, 1);
74
-            $this->flushTmpSosaTable(true);
75
-            return true;
76
-        }     
77
-        return false;
78
-    }
64
+	/**
65
+	 * Compute all Sosa ancestors from the user's root individual.
66
+	 * @return bool Result of the computation
67
+	 */
68
+	public function computeAll() {
69
+		$root_id = $this->tree->getUserPreference($this->user, 'MAJ_SOSA_ROOT_ID');        
70
+		$indi = Individual::getInstance($root_id, $this->tree);
71
+		if($indi){
72
+			$this->sosa_provider->deleteAll();
73
+			$this->addNode($indi, 1);
74
+			$this->flushTmpSosaTable(true);
75
+			return true;
76
+		}     
77
+		return false;
78
+	}
79 79
     
80
-    /**
81
-     * Compute all Sosa Ancestors from a specified Individual
82
-     * @param Individual $indi
83
-     * @return bool Result of the computation
84
-     */
85
-    public function computeFromIndividual(Individual $indi) {
86
-        $dindi = new \MyArtJaub\Webtrees\Individual($indi);
87
-        $current_sosas = $dindi->getSosaNumbers();
88
-        foreach($current_sosas as $current_sosa => $gen) {
89
-            $this->sosa_provider->deleteAncestors($current_sosa);
90
-            $this->addNode($indi, $current_sosa);
91
-        }
92
-        $this->flushTmpSosaTable(true);
93
-        return true;
94
-    }
80
+	/**
81
+	 * Compute all Sosa Ancestors from a specified Individual
82
+	 * @param Individual $indi
83
+	 * @return bool Result of the computation
84
+	 */
85
+	public function computeFromIndividual(Individual $indi) {
86
+		$dindi = new \MyArtJaub\Webtrees\Individual($indi);
87
+		$current_sosas = $dindi->getSosaNumbers();
88
+		foreach($current_sosas as $current_sosa => $gen) {
89
+			$this->sosa_provider->deleteAncestors($current_sosa);
90
+			$this->addNode($indi, $current_sosa);
91
+		}
92
+		$this->flushTmpSosaTable(true);
93
+		return true;
94
+	}
95 95
     
96
-    /**
97
-     * Recursive method to add individual to the Sosa table, and flush it regularly
98
-     * @param Individual $indi Individual to add
99
-     * @param int $sosa Individual's sosa
100
-     */
101
-    protected function addNode(Individual $indi, $sosa) {                
102
-        $birth_year = $indi->getEstimatedBirthDate()->gregorianYear();
103
-        $death_year = $indi->getEstimatedDeathDate()->gregorianYear();
96
+	/**
97
+	 * Recursive method to add individual to the Sosa table, and flush it regularly
98
+	 * @param Individual $indi Individual to add
99
+	 * @param int $sosa Individual's sosa
100
+	 */
101
+	protected function addNode(Individual $indi, $sosa) {                
102
+		$birth_year = $indi->getEstimatedBirthDate()->gregorianYear();
103
+		$death_year = $indi->getEstimatedDeathDate()->gregorianYear();
104 104
         
105
-        $this->tmp_sosa_table[] = array(
106
-            'indi' => $indi->getXref(), 
107
-            'sosa' => $sosa, 
108
-            'birth_year' => $birth_year,
109
-            'death_year' => $death_year
110
-        );
105
+		$this->tmp_sosa_table[] = array(
106
+			'indi' => $indi->getXref(), 
107
+			'sosa' => $sosa, 
108
+			'birth_year' => $birth_year,
109
+			'death_year' => $death_year
110
+		);
111 111
         
112
-        $this->flushTmpSosaTable();
112
+		$this->flushTmpSosaTable();
113 113
         
114
-        if($fam = $indi->getPrimaryChildFamily()) {
115
-            if($husb = $fam->getHusband()) $this->addNode($husb, 2 * $sosa);
116
-            if($wife = $fam->getWife()) $this->addNode($wife, 2 * $sosa + 1);
117
-        }
118
-    }
114
+		if($fam = $indi->getPrimaryChildFamily()) {
115
+			if($husb = $fam->getHusband()) $this->addNode($husb, 2 * $sosa);
116
+			if($wife = $fam->getWife()) $this->addNode($wife, 2 * $sosa + 1);
117
+		}
118
+	}
119 119
     
120
-    /**
121
-     * Write sosas in the table, if the number of items is superior to the limit, or if forced.
122
-     *
123
-     * @param bool $force Should the flush be forced
124
-     */
125
-    protected function flushTmpSosaTable($force = false) {
126
-        if( count($this->tmp_sosa_table)> 0 && 
127
-            ($force ||  count($this->tmp_sosa_table) >= self::TMP_SOSA_TABLE_LIMIT)){            
128
-                $this->sosa_provider->insertOrUpdate($this->tmp_sosa_table);
129
-                $this->tmp_sosa_table = array();
130
-        }
131
-    }
120
+	/**
121
+	 * Write sosas in the table, if the number of items is superior to the limit, or if forced.
122
+	 *
123
+	 * @param bool $force Should the flush be forced
124
+	 */
125
+	protected function flushTmpSosaTable($force = false) {
126
+		if( count($this->tmp_sosa_table)> 0 && 
127
+			($force ||  count($this->tmp_sosa_table) >= self::TMP_SOSA_TABLE_LIMIT)){            
128
+				$this->sosa_provider->insertOrUpdate($this->tmp_sosa_table);
129
+				$this->tmp_sosa_table = array();
130
+		}
131
+	}
132 132
                
133 133
 }
134 134
  
135 135
\ No newline at end of file
Please login to merge, or discard this patch.
src/Webtrees/Module/AdminTasks/Tasks/HealthCheckEmailTask.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -29,11 +29,11 @@  discard block
 block discarded – undo
29 29
  */
30 30
 class HealthCheckEmailTask extends AbstractTask implements ConfigurableTaskInterface {
31 31
     
32
-    /**
33
-     * {@inheritDoc}
34
-     * @see \MyArtJaub\Webtrees\Module\AdminTasks\Model\AbstractTask::getTitle()
35
-     */
36
-    public function getTitle() {
32
+	/**
33
+	 * {@inheritDoc}
34
+	 * @see \MyArtJaub\Webtrees\Module\AdminTasks\Model\AbstractTask::getTitle()
35
+	 */
36
+	public function getTitle() {
37 37
 		return I18N::translate('Healthcheck Email');
38 38
 	}
39 39
 	
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	 * {@inheritDoc}
42 42
 	 * @see \MyArtJaub\Webtrees\Module\AdminTasks\Model\AbstractTask::getDefaultFrequency()
43 43
 	 */
44
-    public function getDefaultFrequency() {
44
+	public function getDefaultFrequency() {
45 45
 		return 10080;  // = 1 week = 7 * 24 * 60 min
46 46
 	}
47 47
     
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	 * {@inheritDoc}
50 50
 	 * @see \MyArtJaub\Webtrees\Module\AdminTasks\Model\AbstractTask::executeSteps()
51 51
 	 */
52
-    protected function executeSteps() {
52
+	protected function executeSteps() {
53 53
 	
54 54
 		$res = false;		
55 55
 		
@@ -63,14 +63,14 @@  discard block
 block discarded – undo
63 63
 		$interval = max($this->frequency, $interval_sincelast);
64 64
 		$nbdays = ceil($interval / (24 * 60));
65 65
 				
66
-        // Check for updates
67
-        $latest_version_txt = Functions::fetchLatestVersion();
68
-        if (preg_match('/^[0-9.]+\|[0-9.]+\|/', $latest_version_txt)) {
69
-        	list($latest_version, , $download_url) = explode('|', $latest_version_txt);
70
-        } else {
71
-        	// Cannot determine the latest version
72
-        	list($latest_version, , $download_url) = explode('|', '||');
73
-        }
66
+		// Check for updates
67
+		$latest_version_txt = Functions::fetchLatestVersion();
68
+		if (preg_match('/^[0-9.]+\|[0-9.]+\|/', $latest_version_txt)) {
69
+			list($latest_version, , $download_url) = explode('|', $latest_version_txt);
70
+		} else {
71
+			// Cannot determine the latest version
72
+			list($latest_version, , $download_url) = explode('|', '||');
73
+		}
74 74
 		
75 75
 		// Users statistics
76 76
 		$warnusers = 0;
@@ -213,15 +213,15 @@  discard block
 block discarded – undo
213 213
 		$html = '
214 214
 			<div class="form-group">
215 215
     			<label class="control-label col-sm-3"> '.
216
-    				I18N::translate('Enable healthcheck emails for') .
217
-    			'</label>
216
+					I18N::translate('Enable healthcheck emails for') .
217
+				'</label>
218 218
     			<div class="col-sm-9">';
219 219
 
220 220
 		foreach(Tree::getAll() as $tree){
221 221
 			if(Auth::isManager($tree)){	
222
-			    $html .= '<div class="form-group row">
222
+				$html .= '<div class="form-group row">
223 223
 			        <span class="col-sm-3 control-label">' .
224
-			             $tree->getTitle() .
224
+						 $tree->getTitle() .
225 225
 					'</span>
226 226
 					 <div class="col-sm-2">';
227 227
 				$html .= FunctionsEdit::editFieldYesNo('HEALTHCHECK_ENABLED_' . $tree->getTreeId(), $tree->getPreference('MAJ_AT_'.$this->getName().'_ENABLED', 1), 'class="radio-inline"');
@@ -230,8 +230,8 @@  discard block
 block discarded – undo
230 230
 		}
231 231
 		
232 232
 		$html .= '	<p class="small text-muted">'.
233
-    					I18N::translate('Enable the health check emails for each of the selected trees.') .
234
-    				'</p>
233
+						I18N::translate('Enable the health check emails for each of the selected trees.') .
234
+					'</p>
235 235
     			</div>
236 236
     		</div>';
237 237
 			
Please login to merge, or discard this patch.
src/Webtrees/Module/AdminTasks/Schema/Migration0.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -24,16 +24,16 @@
 block discarded – undo
24 24
 	 */
25 25
 	public function upgrade() {
26 26
 		Database::exec(
27
-		    'CREATE TABLE IF NOT EXISTS `##maj_admintasks` ('.
28
-		    ' majat_name 		    VARCHAR(32)                      NOT NULL,'.
29
-		    ' majat_status          ENUM(\'enabled\',\'disabled\') 	 NOT NULL DEFAULT \'disabled\','.
30
-		    ' majat_last_run 		DATETIME 					     NOT NULL DEFAULT \'2000-01-01 00:00:00\','.
31
-		    ' majat_last_result 	TINYINT(1)					     NOT NULL DEFAULT 1,'.		// 0 means error, 1 is success
32
-		    ' majat_frequency		INTEGER						     NOT NULL DEFAULT 10080,'.	// In min, Default every week
33
-		    ' majat_nb_occur	 	SMALLINT					     NOT NULL DEFAULT 0,'.
34
-		    ' majat_running 		TINYINT(1)					     NOT NULL DEFAULT 0,'.
35
-		    ' PRIMARY KEY (majat_name)'.
36
-		    ') COLLATE utf8_unicode_ci ENGINE=InnoDB'
27
+			'CREATE TABLE IF NOT EXISTS `##maj_admintasks` ('.
28
+			' majat_name 		    VARCHAR(32)                      NOT NULL,'.
29
+			' majat_status          ENUM(\'enabled\',\'disabled\') 	 NOT NULL DEFAULT \'disabled\','.
30
+			' majat_last_run 		DATETIME 					     NOT NULL DEFAULT \'2000-01-01 00:00:00\','.
31
+			' majat_last_result 	TINYINT(1)					     NOT NULL DEFAULT 1,'.		// 0 means error, 1 is success
32
+			' majat_frequency		INTEGER						     NOT NULL DEFAULT 10080,'.	// In min, Default every week
33
+			' majat_nb_occur	 	SMALLINT					     NOT NULL DEFAULT 0,'.
34
+			' majat_running 		TINYINT(1)					     NOT NULL DEFAULT 0,'.
35
+			' PRIMARY KEY (majat_name)'.
36
+			') COLLATE utf8_unicode_ci ENGINE=InnoDB'
37 37
 		);
38 38
 	}
39 39
 }
Please login to merge, or discard this patch.
src/Webtrees/Module/GeoDispersion/Views/GeoAnalysisTabGenerationsView.php 1 patch
Indentation   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -24,89 +24,89 @@  discard block
 block discarded – undo
24 24
 	 * {@inhericDoc}
25 25
 	 * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent()
26 26
 	 */
27
-    protected function renderContent() {       
27
+	protected function renderContent() {       
28 28
 
29
-        $max_details_gen = $this->data->get('max_details_gen');
30
-        $analysis_level = $this->data->get('analysis_level');
31
-        $results_by_gen = $this->data->get('results_by_generations');
32
-        $display_all_places = $this->data->get('display_all_places', true);
29
+		$max_details_gen = $this->data->get('max_details_gen');
30
+		$analysis_level = $this->data->get('analysis_level');
31
+		$results_by_gen = $this->data->get('results_by_generations');
32
+		$display_all_places = $this->data->get('display_all_places', true);
33 33
         
34
-        $html = 
35
-        '<div id="geodispersion_gen">
34
+		$html = 
35
+		'<div id="geodispersion_gen">
36 36
         	<table id="geodispersion_gentable" class="center">';
37 37
             
38
-        foreach($results_by_gen as $gen => $genData){
39
-            $html .= 
40
-            '<tr>
38
+		foreach($results_by_gen as $gen => $genData){
39
+			$html .= 
40
+			'<tr>
41 41
                 <td class="descriptionbox">' .
42
-                    I18N::translate("Generation %s", I18N::number($gen)).
43
-                    ($display_all_places ? '<br />' : ' ').
44
-                    I18N::translate('(%s)', I18N::percentage(Functions::safeDivision($genData['sum'] + $genData['other'], $genData['sum'] + $genData['other'] + $genData['unknown']),1)) . 
45
-                '</td>
42
+					I18N::translate("Generation %s", I18N::number($gen)).
43
+					($display_all_places ? '<br />' : ' ').
44
+					I18N::translate('(%s)', I18N::percentage(Functions::safeDivision($genData['sum'] + $genData['other'], $genData['sum'] + $genData['other'] + $genData['unknown']),1)) . 
45
+				'</td>
46 46
                  <td class="optionbox left">'.
47
-                    ($display_all_places ? 
48
-                        $this->htmlGenerationAllPlacesRow($genData, $analysis_level) :
49
-                        $this->htmlGenerationTopPlacesRow($genData, $analysis_level)
50
-                     ) .
51
-                '</ditdv>
47
+					($display_all_places ? 
48
+						$this->htmlGenerationAllPlacesRow($genData, $analysis_level) :
49
+						$this->htmlGenerationTopPlacesRow($genData, $analysis_level)
50
+					 ) .
51
+				'</ditdv>
52 52
             </tr>';
53
-        }       
53
+		}       
54 54
         
55
-        $html.= 
56
-            '</table>
55
+		$html.= 
56
+			'</table>
57 57
             <div class="left">
58 58
                 <strong>' . I18N::translate('Interpretation help:') . '</strong>
59 59
                 <br />'.
60
-                I18N::translate('<strong>Generation X (yy %%)</strong>: The percentage indicates the number of found places compared to the total number of ancestors in this generation.') . 
61
-                '<br />';
62
-        if(!is_null($max_details_gen) && $max_details_gen == 0){
63
-            $html .= I18N::translate('<strong><em>Place</em> or <em>Flag</em> aa (bb %%)</strong>: The first number indicates the total number of ancestors born in this place, the percentage relates this count to the total number of found places. No percentage means it is less than 10%%.').'<br />';
64
-            $html .= I18N::translate('If any, the darker area indicates the number of unknown places within the generation or places outside the analysed area, and its percentage compared to the number of ancestors. No percentage means it is less than 10%%.');
65
-        }
66
-        else{
67
-            $html .= I18N::translate('<strong><em>Place</em> [aa - bb %%]</strong>: The first number indicates the total number of ancestors born in this place, the percentage compares this count to the total number of found places.').'<br />';
68
-            $html .= I18N::translate('Only the %d more frequent places for each generation are displayed.', $max_details_gen);
69
-        }
70
-        $html.= 
71
-            '</div>
60
+				I18N::translate('<strong>Generation X (yy %%)</strong>: The percentage indicates the number of found places compared to the total number of ancestors in this generation.') . 
61
+				'<br />';
62
+		if(!is_null($max_details_gen) && $max_details_gen == 0){
63
+			$html .= I18N::translate('<strong><em>Place</em> or <em>Flag</em> aa (bb %%)</strong>: The first number indicates the total number of ancestors born in this place, the percentage relates this count to the total number of found places. No percentage means it is less than 10%%.').'<br />';
64
+			$html .= I18N::translate('If any, the darker area indicates the number of unknown places within the generation or places outside the analysed area, and its percentage compared to the number of ancestors. No percentage means it is less than 10%%.');
65
+		}
66
+		else{
67
+			$html .= I18N::translate('<strong><em>Place</em> [aa - bb %%]</strong>: The first number indicates the total number of ancestors born in this place, the percentage compares this count to the total number of found places.').'<br />';
68
+			$html .= I18N::translate('Only the %d more frequent places for each generation are displayed.', $max_details_gen);
69
+		}
70
+		$html.= 
71
+			'</div>
72 72
         </div>';
73 73
         
74
-        return $html;
75
-    }
74
+		return $html;
75
+	}
76 76
     
77 77
     
78
-    /**
79
-     * Return the HTML code to display a row with all places found in a generation.
80
-     *
81
-     * @param array $data Data array
82
-     * @param int $analysis_level Level of subdivision of analysis
83
-     * @return string HTML code for all places row
84
-     */
85
-    protected function htmlGenerationAllPlacesRow($data, $analysis_level) {
86
-        $html =
87
-        '<table class="geodispersion_bigrow">
78
+	/**
79
+	 * Return the HTML code to display a row with all places found in a generation.
80
+	 *
81
+	 * @param array $data Data array
82
+	 * @param int $analysis_level Level of subdivision of analysis
83
+	 * @return string HTML code for all places row
84
+	 */
85
+	protected function htmlGenerationAllPlacesRow($data, $analysis_level) {
86
+		$html =
87
+		'<table class="geodispersion_bigrow">
88 88
             <tr>';
89 89
         
90
-        $sum_gen = $data['sum'];
91
-        $unknownother = $data['unknown'] + $data['other'];
92
-        foreach($data['places'] as $placename=> $dataplace){
93
-            $levels = array_map('trim',explode(',', $placename));
94
-            $content = '';
95
-            if(isset($dataplace['flag'])){
96
-                $content .= '<td class="geodispersion_flag">'. FunctionsPrint::htmlPlaceIcon($dataplace['place'], $dataplace['flag']) .'</td><td>';
97
-            }
98
-            else{
99
-                $content .= '<td><span title="'.implode(I18N::$list_separator, array_reverse($levels)).'">'.$levels[$analysis_level-1].'</span><br/>';
100
-            }
101
-            $count = $dataplace['count'];
102
-            $content .= I18N::number($count);
103
-            $perc = Functions::safeDivision($count, $sum_gen + $unknownother);
104
-            $perc2= Functions::safeDivision($count, $sum_gen);
105
-            if($perc2>=0.1) 
106
-                $content.= '<br/><span class="small">('.I18N::percentage($perc2, 1).')</span>';
107
-            $content .= '</td>';
90
+		$sum_gen = $data['sum'];
91
+		$unknownother = $data['unknown'] + $data['other'];
92
+		foreach($data['places'] as $placename=> $dataplace){
93
+			$levels = array_map('trim',explode(',', $placename));
94
+			$content = '';
95
+			if(isset($dataplace['flag'])){
96
+				$content .= '<td class="geodispersion_flag">'. FunctionsPrint::htmlPlaceIcon($dataplace['place'], $dataplace['flag']) .'</td><td>';
97
+			}
98
+			else{
99
+				$content .= '<td><span title="'.implode(I18N::$list_separator, array_reverse($levels)).'">'.$levels[$analysis_level-1].'</span><br/>';
100
+			}
101
+			$count = $dataplace['count'];
102
+			$content .= I18N::number($count);
103
+			$perc = Functions::safeDivision($count, $sum_gen + $unknownother);
104
+			$perc2= Functions::safeDivision($count, $sum_gen);
105
+			if($perc2>=0.1) 
106
+				$content.= '<br/><span class="small">('.I18N::percentage($perc2, 1).')</span>';
107
+			$content .= '</td>';
108 108
                
109
-            $html .= '
109
+			$html .= '
110 110
                 <td class="geodispersion_rowitem" width="'.max(round(100*$perc, 0),1).'%">
111 111
                     <table>
112 112
                         <tr>
@@ -118,46 +118,46 @@  discard block
 block discarded – undo
118 118
                         </tr>
119 119
                     </table>
120 120
                 </td>';
121
-        }
121
+		}
122 122
         
123
-        if($unknownother>0){
124
-            $perc= Functions::safeDivision($unknownother, $sum_gen + $unknownother);
125
-            $html .='<td class="geodispersion_unknownitem left" >'.I18N::number($unknownother);
126
-            if($perc>=0.1) $html.= '<br/><span class="small">('.I18N::percentage($perc, 1).')</span>';
127
-            $html .='</td>';
128
-        }
123
+		if($unknownother>0){
124
+			$perc= Functions::safeDivision($unknownother, $sum_gen + $unknownother);
125
+			$html .='<td class="geodispersion_unknownitem left" >'.I18N::number($unknownother);
126
+			if($perc>=0.1) $html.= '<br/><span class="small">('.I18N::percentage($perc, 1).')</span>';
127
+			$html .='</td>';
128
+		}
129 129
         
130
-        $html .= 
131
-            '</tr>
130
+		$html .= 
131
+			'</tr>
132 132
         </table>';
133
-        return $html;
134
-    }
133
+		return $html;
134
+	}
135 135
     
136 136
 	/**
137 137
 	 * Returns the HTML code fo display a row of the Top Places found for a generation.
138 138
 	 *
139 139
 	 * @param array $data Data array
140
-     * @param int $analysis_level Level of subdivision of analysis
140
+	 * @param int $analysis_level Level of subdivision of analysis
141 141
 	 * @return string HTML code for Top Places row
142 142
 	 */
143
-    protected function htmlGenerationTopPlacesRow($data, $analysis_level) {
144
-        $tmp_places = array();
145
-        $sum_gen = $data['sum'];
146
-        $other = $data['other'];
143
+	protected function htmlGenerationTopPlacesRow($data, $analysis_level) {
144
+		$tmp_places = array();
145
+		$sum_gen = $data['sum'];
146
+		$other = $data['other'];
147 147
         
148
-        foreach($data['places'] as $placename => $count) {
149
-            if($placename != 'other'){
150
-                $levels = array_map('trim',explode(',', $placename));
151
-                $placename = '<span title="'.implode(I18N::$list_separator, array_reverse($levels)).'">'.$levels[$analysis_level-1].'</span>';
152
-            }
153
-            else{
154
-                $placename = I18N::translate('Other places');
155
-            }
156
-            $tmp_places[] = I18N::translate('<strong>%s</strong> [%d - %s]', $placename, $count, I18N::percentage(Functions::safeDivision($count, $sum_gen + $other), 1));         	
157
-        }
148
+		foreach($data['places'] as $placename => $count) {
149
+			if($placename != 'other'){
150
+				$levels = array_map('trim',explode(',', $placename));
151
+				$placename = '<span title="'.implode(I18N::$list_separator, array_reverse($levels)).'">'.$levels[$analysis_level-1].'</span>';
152
+			}
153
+			else{
154
+				$placename = I18N::translate('Other places');
155
+			}
156
+			$tmp_places[] = I18N::translate('<strong>%s</strong> [%d - %s]', $placename, $count, I18N::percentage(Functions::safeDivision($count, $sum_gen + $other), 1));         	
157
+		}
158 158
         
159
-        return implode(I18N::$list_separator, $tmp_places);
160
-    }
159
+		return implode(I18N::$list_separator, $tmp_places);
160
+	}
161 161
     
162 162
 }
163 163
  
164 164
\ No newline at end of file
Please login to merge, or discard this patch.
src/Webtrees/ImageBuilder.php 1 patch
Indentation   +290 added lines, -290 removed lines patch added patch discarded remove patch
@@ -22,54 +22,54 @@  discard block
 block discarded – undo
22 22
  */
23 23
 class ImageBuilder {
24 24
     
25
-    /**
26
-     * Reference media
27
-     * @var Media $media
28
-     */
29
-    protected $media;
25
+	/**
26
+	 * Reference media
27
+	 * @var Media $media
28
+	 */
29
+	protected $media;
30 30
     
31
-    /**
32
-     * Use TTF font
33
-     * @var bool $use_ttf
34
-     */
35
-    protected $use_ttf;
31
+	/**
32
+	 * Use TTF font
33
+	 * @var bool $use_ttf
34
+	 */
35
+	protected $use_ttf;
36 36
     
37
-    /**
38
-     * Expiration offset. Default is one day.
39
-     * @var int $expire_offset
40
-     */
41
-    protected $expire_offset;
37
+	/**
38
+	 * Expiration offset. Default is one day.
39
+	 * @var int $expire_offset
40
+	 */
41
+	protected $expire_offset;
42 42
    
43
-    /**
44
-     * Should the certificate display a watermark
45
-     * @var bool $show_watermark
46
-     */
47
-    protected $show_watermark;
43
+	/**
44
+	 * Should the certificate display a watermark
45
+	 * @var bool $show_watermark
46
+	 */
47
+	protected $show_watermark;
48 48
         
49
-    /**
50
-     * Maximum watermark font size. Default is 18.
51
-     * @var int $font_max_size
52
-     */
53
-    protected $font_max_size;
49
+	/**
50
+	 * Maximum watermark font size. Default is 18.
51
+	 * @var int $font_max_size
52
+	 */
53
+	protected $font_max_size;
54 54
     
55
-    /**
56
-     * Watermark font color, in hexadecimal. Default is #4D6DF3.
57
-     * @var string $font_color
58
-     */
59
-    protected $font_color;
55
+	/**
56
+	 * Watermark font color, in hexadecimal. Default is #4D6DF3.
57
+	 * @var string $font_color
58
+	 */
59
+	protected $font_color;
60 60
     
61 61
 	/**
62
-	* Contructor for ImageBuilder
63
-	*
64
-	* @param Media|null $media Reference media object
65
-	*/
62
+	 * Contructor for ImageBuilder
63
+	 *
64
+	 * @param Media|null $media Reference media object
65
+	 */
66 66
 	public function __construct(Media $media = null){
67
-	    $this->media = $media;
68
-	    $this->use_ttf = function_exists('imagettftext');
69
-	    $this->expire_offset = 3600 * 24;
70
-	    $this->show_watermark = true;
71
-	    $this->font_max_size = 18;
72
-	    $this->font_color = '#4D6DF3';
67
+		$this->media = $media;
68
+		$this->use_ttf = function_exists('imagettftext');
69
+		$this->expire_offset = 3600 * 24;
70
+		$this->show_watermark = true;
71
+		$this->font_max_size = 18;
72
+		$this->font_color = '#4D6DF3';
73 73
 	}
74 74
 	
75 75
 	/**
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 * @return int
79 79
 	 */
80 80
 	public function getExpireOffset() {
81
-	    return $this->expire_offset;
81
+		return $this->expire_offset;
82 82
 	}
83 83
 	
84 84
 	/**
@@ -88,8 +88,8 @@  discard block
 block discarded – undo
88 88
 	 * @return ImageBuilder
89 89
 	 */
90 90
 	public function setExpireOffset($expireOffset) {
91
-	    if($expireOffset) $this->expire_offset = $expireOffset;
92
-	    return $this;
91
+		if($expireOffset) $this->expire_offset = $expireOffset;
92
+		return $this;
93 93
 	}
94 94
 	
95 95
 	/**
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 	 * @return bool
99 99
 	 */
100 100
 	public function isShowWatermark() {
101
-	    return $this->show_watermark;
101
+		return $this->show_watermark;
102 102
 	}
103 103
 	
104 104
 	/**
@@ -108,8 +108,8 @@  discard block
 block discarded – undo
108 108
 	 * @return ImageBuilder
109 109
 	 */
110 110
 	public function setShowWatermark($show_watermark) {
111
-	    if(!is_null($show_watermark)) $this->show_watermark = $show_watermark;
112
-	    return $this;
111
+		if(!is_null($show_watermark)) $this->show_watermark = $show_watermark;
112
+		return $this;
113 113
 	}
114 114
 	
115 115
 	/**
@@ -119,8 +119,8 @@  discard block
 block discarded – undo
119 119
 	 * @return ImageBuilder
120 120
 	 */
121 121
 	public function setFontMaxSize($font_max_size) {
122
-	    if($font_max_size) $this->font_max_size = $font_max_size;
123
-	    return $this;
122
+		if($font_max_size) $this->font_max_size = $font_max_size;
123
+		return $this;
124 124
 	}
125 125
 	
126 126
 	/**
@@ -130,8 +130,8 @@  discard block
 block discarded – undo
130 130
 	 * @return ImageBuilder
131 131
 	 */
132 132
 	public function setFontColor($font_color) {
133
-	    if($font_color) $this->font_color = $font_color;
134
-	    return $this;
133
+		if($font_color) $this->font_color = $font_color;
134
+		return $this;
135 135
 	}
136 136
 	
137 137
 	/**
@@ -139,134 +139,134 @@  discard block
 block discarded – undo
139 139
 	 */
140 140
 	public function render(){
141 141
 	    
142
-	    if (!$this->media || !$this->media->canShow()) {
143
-	        Log::addMediaLog('Image Builder error: >' . I18N::translate('Missing or private media object.'));
144
-	        $this->renderError();
145
-	    }
142
+		if (!$this->media || !$this->media->canShow()) {
143
+			Log::addMediaLog('Image Builder error: >' . I18N::translate('Missing or private media object.'));
144
+			$this->renderError();
145
+		}
146 146
 	    
147
-	    $serverFilename = $this->media->getServerFilename();
147
+		$serverFilename = $this->media->getServerFilename();
148 148
 	    
149
-	    if (!file_exists($serverFilename)) {
150
-	        Log::addMediaLog('Image Builder error: >'. I18N::translate('The media object does not exist.').'< for path >'.$serverFilename.'<');
151
-	        $this->renderError();
152
-	    }
149
+		if (!file_exists($serverFilename)) {
150
+			Log::addMediaLog('Image Builder error: >'. I18N::translate('The media object does not exist.').'< for path >'.$serverFilename.'<');
151
+			$this->renderError();
152
+		}
153 153
 	    
154
-	    $mimetype = $this->media->mimeType();
155
-	    $imgsize = $this->media->getImageAttributes();
156
-	    $filetime = $this->media->getFiletime();
157
-	    $filetimeHeader = gmdate('D, d M Y H:i:s', $filetime) . ' GMT';	    
158
-	    $expireHeader = gmdate('D, d M Y H:i:s', WT_TIMESTAMP + $this->getExpireOffset()) . ' GMT';
154
+		$mimetype = $this->media->mimeType();
155
+		$imgsize = $this->media->getImageAttributes();
156
+		$filetime = $this->media->getFiletime();
157
+		$filetimeHeader = gmdate('D, d M Y H:i:s', $filetime) . ' GMT';	    
158
+		$expireHeader = gmdate('D, d M Y H:i:s', WT_TIMESTAMP + $this->getExpireOffset()) . ' GMT';
159 159
 	    
160
-	    $type = Functions::isImageTypeSupported($imgsize['ext']);
161
-	    $usewatermark = false;
162
-	    // if this image supports watermarks and the watermark module is intalled...
163
-	    if ($type) {
164
-	        $usewatermark = $this->isShowWatermark();
165
-	    }
160
+		$type = Functions::isImageTypeSupported($imgsize['ext']);
161
+		$usewatermark = false;
162
+		// if this image supports watermarks and the watermark module is intalled...
163
+		if ($type) {
164
+			$usewatermark = $this->isShowWatermark();
165
+		}
166 166
 	    
167
-	    // determine whether we have enough memory to watermark this image
168
-	    if ($usewatermark) {
169
-	        if (!FunctionsMedia::hasMemoryForImage($serverFilename)) {
170
-	            // not enough memory to watermark this file
171
-	            $usewatermark = false;
172
-	        }
173
-	    }
167
+		// determine whether we have enough memory to watermark this image
168
+		if ($usewatermark) {
169
+			if (!FunctionsMedia::hasMemoryForImage($serverFilename)) {
170
+				// not enough memory to watermark this file
171
+				$usewatermark = false;
172
+			}
173
+		}
174 174
 	    
175
-	    $etag = $this->media->getEtag();
175
+		$etag = $this->media->getEtag();
176 176
 	    
177
-	    // parse IF_MODIFIED_SINCE header from client
178
-	    $if_modified_since = 'x';
179
-	    if (!empty(Filter::server('HTTP_IF_MODIFIED_SINCE'))) {
180
-	        $if_modified_since = preg_replace('/;.*$/', '', Filter::server('HTTP_IF_MODIFIED_SINCE'));
181
-	    }
177
+		// parse IF_MODIFIED_SINCE header from client
178
+		$if_modified_since = 'x';
179
+		if (!empty(Filter::server('HTTP_IF_MODIFIED_SINCE'))) {
180
+			$if_modified_since = preg_replace('/;.*$/', '', Filter::server('HTTP_IF_MODIFIED_SINCE'));
181
+		}
182 182
 	    
183
-	    // parse IF_NONE_MATCH header from client
184
-	    $if_none_match = 'x';
185
-	    if (!empty(Filter::server('HTTP_IF_NONE_MATCH'))) {
186
-	        $if_none_match = str_replace('"', '', Filter::server('HTTP_IF_NONE_MATCH'));
187
-	    }
183
+		// parse IF_NONE_MATCH header from client
184
+		$if_none_match = 'x';
185
+		if (!empty(Filter::server('HTTP_IF_NONE_MATCH'))) {
186
+			$if_none_match = str_replace('"', '', Filter::server('HTTP_IF_NONE_MATCH'));
187
+		}
188 188
 	    
189
-	    // add caching headers.  allow browser to cache file, but not proxy
190
-	    header('Last-Modified: ' . $filetimeHeader);
191
-	    header('ETag: "' . $etag . '"');
192
-	    header('Expires: ' . $expireHeader);
193
-	    header('Cache-Control: max-age=' . $this->getExpireOffset() . ', s-maxage=0, proxy-revalidate');
189
+		// add caching headers.  allow browser to cache file, but not proxy
190
+		header('Last-Modified: ' . $filetimeHeader);
191
+		header('ETag: "' . $etag . '"');
192
+		header('Expires: ' . $expireHeader);
193
+		header('Cache-Control: max-age=' . $this->getExpireOffset() . ', s-maxage=0, proxy-revalidate');
194 194
 	    
195
-	    // if this file is already in the user’s cache, don’t resend it
196
-	    // first check if the if_modified_since param matches
197
-	    if ($if_modified_since === $filetimeHeader) {
198
-	        // then check if the etag matches
199
-	        if ($if_none_match === $etag) {
200
-	            http_response_code(304);
195
+		// if this file is already in the user’s cache, don’t resend it
196
+		// first check if the if_modified_since param matches
197
+		if ($if_modified_since === $filetimeHeader) {
198
+			// then check if the etag matches
199
+			if ($if_none_match === $etag) {
200
+				http_response_code(304);
201 201
 	    
202
-	            return;
203
-	        }
204
-	    }	    
202
+				return;
203
+			}
204
+		}	    
205 205
 
206
-	    // send headers for the image
207
-	    header('Content-Type: ' . $mimetype);
208
-	    header('Content-Disposition: filename="' . addslashes(basename($this->media->getFilename())) . '"');
206
+		// send headers for the image
207
+		header('Content-Type: ' . $mimetype);
208
+		header('Content-Disposition: filename="' . addslashes(basename($this->media->getFilename())) . '"');
209 209
 	     
210
-	    if ($usewatermark) {
211
-	        // generate the watermarked image
212
-	        $imCreateFunc = 'imagecreatefrom' . $type;
213
-	        $imSendFunc   = 'image' . $type;
210
+		if ($usewatermark) {
211
+			// generate the watermarked image
212
+			$imCreateFunc = 'imagecreatefrom' . $type;
213
+			$imSendFunc   = 'image' . $type;
214 214
 	    
215
-	        if (function_exists($imCreateFunc) && function_exists($imSendFunc)) {
216
-	            $im = $imCreateFunc($serverFilename);
217
-	            $im = $this->applyWatermark($im);
215
+			if (function_exists($imCreateFunc) && function_exists($imSendFunc)) {
216
+				$im = $imCreateFunc($serverFilename);
217
+				$im = $this->applyWatermark($im);
218 218
 	    	    
219
-	            // send the image
220
-	            $imSendFunc($im);
221
-	            imagedestroy($im);
219
+				// send the image
220
+				$imSendFunc($im);
221
+				imagedestroy($im);
222 222
 	    
223
-	            return;
224
-	        } else {
225
-	            // this image is defective.  log it
226
-	            Log::addMediaLog('Image Builder error: >' . I18N::translate('This media file is broken and cannot be watermarked.') . '< in file >' . $serverFilename . '< memory used: ' . memory_get_usage());
227
-	        }
228
-	    }
223
+				return;
224
+			} else {
225
+				// this image is defective.  log it
226
+				Log::addMediaLog('Image Builder error: >' . I18N::translate('This media file is broken and cannot be watermarked.') . '< in file >' . $serverFilename . '< memory used: ' . memory_get_usage());
227
+			}
228
+		}
229 229
 	    
230
-	    // determine filesize of image (could be original or watermarked version)
231
-	    $filesize = filesize($serverFilename);
230
+		// determine filesize of image (could be original or watermarked version)
231
+		$filesize = filesize($serverFilename);
232 232
 	    
233
-	    // set content-length header, send file
234
-	    header('Content-Length: ' . $filesize);
233
+		// set content-length header, send file
234
+		header('Content-Length: ' . $filesize);
235 235
 	    
236
-	    // Some servers disable fpassthru() and readfile()
237
-	    if (function_exists('readfile')) {
238
-	        readfile($serverFilename);
239
-	    } else {
240
-	        $fp = fopen($serverFilename, 'rb');
241
-	        if (function_exists('fpassthru')) {
242
-	            fpassthru($fp);
243
-	        } else {
244
-	            while (!feof($fp)) {
245
-	                echo fread($fp, 65536);
246
-	            }
247
-	        }
248
-	        fclose($fp);
249
-	    }	    
236
+		// Some servers disable fpassthru() and readfile()
237
+		if (function_exists('readfile')) {
238
+			readfile($serverFilename);
239
+		} else {
240
+			$fp = fopen($serverFilename, 'rb');
241
+			if (function_exists('fpassthru')) {
242
+				fpassthru($fp);
243
+			} else {
244
+				while (!feof($fp)) {
245
+					echo fread($fp, 65536);
246
+				}
247
+			}
248
+			fclose($fp);
249
+		}	    
250 250
 	}
251 251
 	
252 252
 	/**
253 253
 	 * Render an error as an image.
254 254
 	 */
255 255
 	protected function renderError() {	
256
-	    $error = I18N::translate('The media file was not found in this family tree.');
256
+		$error = I18N::translate('The media file was not found in this family tree.');
257 257
 
258
-    	$width  = (mb_strlen($error) * 6.5 + 50) * 1.15;
259
-    	$height = 60;
260
-    	$im     = imagecreatetruecolor($width, $height); /* Create a black image */
261
-    	$bgc    = imagecolorallocate($im, 255, 255, 255); /* set background color */
262
-    	imagefilledrectangle($im, 2, 2, $width - 4, $height - 4, $bgc); /* create a rectangle, leaving 2 px border */
258
+		$width  = (mb_strlen($error) * 6.5 + 50) * 1.15;
259
+		$height = 60;
260
+		$im     = imagecreatetruecolor($width, $height); /* Create a black image */
261
+		$bgc    = imagecolorallocate($im, 255, 255, 255); /* set background color */
262
+		imagefilledrectangle($im, 2, 2, $width - 4, $height - 4, $bgc); /* create a rectangle, leaving 2 px border */
263 263
     
264
-    	$this->embedText($im, $error, 100, '255, 0, 0', WT_ROOT . Config::FONT_DEJAVU_SANS_TTF, 'top', 'left');
264
+		$this->embedText($im, $error, 100, '255, 0, 0', WT_ROOT . Config::FONT_DEJAVU_SANS_TTF, 'top', 'left');
265 265
     
266
-    	http_response_code(404);
267
-    	header('Content-Type: image/png');
268
-    	imagepng($im);
269
-    	imagedestroy($im);
266
+		http_response_code(404);
267
+		header('Content-Type: image/png');
268
+		imagepng($im);
269
+		imagedestroy($im);
270 270
 	}
271 271
 	
272 272
 	/**
@@ -278,25 +278,25 @@  discard block
 block discarded – undo
278 278
 	 */
279 279
 	protected function applyWatermark($im) {
280 280
 	    
281
-	    // text to watermark with	    
282
-	    if(method_exists($this->media, 'getWatermarkText')) {
283
-	       $word1_text = $this->media->getWatermarkText();
284
-	    }
285
-	    else {
286
-	        $word1_text = $this->media->getTitle();
287
-	    }
281
+		// text to watermark with	    
282
+		if(method_exists($this->media, 'getWatermarkText')) {
283
+		   $word1_text = $this->media->getWatermarkText();
284
+		}
285
+		else {
286
+			$word1_text = $this->media->getTitle();
287
+		}
288 288
 	
289
-	    $this->embedText(
290
-	        $im, 
291
-	        $word1_text, 
292
-	        $this->font_max_size,
293
-	        $this->font_color,
294
-	        WT_ROOT . Config::FONT_DEJAVU_SANS_TTF,
295
-	        'top', 
296
-	        'left'
297
-	     );
289
+		$this->embedText(
290
+			$im, 
291
+			$word1_text, 
292
+			$this->font_max_size,
293
+			$this->font_color,
294
+			WT_ROOT . Config::FONT_DEJAVU_SANS_TTF,
295
+			'top', 
296
+			'left'
297
+		 );
298 298
 	
299
-	    return ($im);
299
+		return ($im);
300 300
 	}
301 301
 	
302 302
 	/**
@@ -313,94 +313,94 @@  discard block
 block discarded – undo
313 313
 	 */
314 314
 	protected function embedText($im, $text, $maxsize, $color, $font, $vpos, $hpos) {
315 315
 	    
316
-	    // there are two ways to embed text with PHP
317
-	    // (preferred) using GD and FreeType you can embed text using any True Type font
318
-	    // (fall back) if that is not available, you can insert basic monospaced text
316
+		// there are two ways to embed text with PHP
317
+		// (preferred) using GD and FreeType you can embed text using any True Type font
318
+		// (fall back) if that is not available, you can insert basic monospaced text
319 319
 	    
320
-	    $col = $this->hexrgb($color);
321
-	    $textcolor = imagecolorallocate($im, $col['red'], $col['green'], $col['blue']);
320
+		$col = $this->hexrgb($color);
321
+		$textcolor = imagecolorallocate($im, $col['red'], $col['green'], $col['blue']);
322 322
 	    
323
-	    // make adjustments to settings that imagestring and imagestringup can’t handle
324
-	    if (!$this->use_ttf) {
325
-	        // imagestringup only writes up, can’t use top2bottom
326
-	        if ($hpos === 'top2bottom') {
327
-	            $hpos = 'bottom2top';
328
-	        }
329
-	    }
323
+		// make adjustments to settings that imagestring and imagestringup can’t handle
324
+		if (!$this->use_ttf) {
325
+			// imagestringup only writes up, can’t use top2bottom
326
+			if ($hpos === 'top2bottom') {
327
+				$hpos = 'bottom2top';
328
+			}
329
+		}
330 330
 	    
331
-	    $text       = I18N::reverseText($text);
332
-	    $height     = imagesy($im);
333
-	    $width      = imagesx($im);
334
-	    $calc_angle = rad2deg(atan($height / $width));
335
-	    $hypoth     = $height / sin(deg2rad($calc_angle));
331
+		$text       = I18N::reverseText($text);
332
+		$height     = imagesy($im);
333
+		$width      = imagesx($im);
334
+		$calc_angle = rad2deg(atan($height / $width));
335
+		$hypoth     = $height / sin(deg2rad($calc_angle));
336 336
 	    
337
-	    // vertical and horizontal position of the text
338
-	    switch ($vpos) {
339
-	        default:
340
-	        case 'top':
341
-	            $taille   = $this->textLength($maxsize, $width, $text);
342
-	            $pos_y    = $height * 0.15 + $taille;
343
-	            $pos_x    = $width * 0.15;
344
-	            $rotation = 0;
345
-	            break;
346
-	        case 'middle':
347
-	            $taille   = $this->textLength($maxsize, $width, $text);
348
-	            $pos_y    = ($height + $taille) / 2;
349
-	            $pos_x    = $width * 0.15;
350
-	            $rotation = 0;
351
-	            break;
352
-	        case 'bottom':
353
-	            $taille   = $this->textLength($maxsize, $width, $text);
354
-	            $pos_y    = ($height * .85 - $taille);
355
-	            $pos_x    = $width * 0.15;
356
-	            $rotation = 0;
357
-	            break;
358
-	        case 'across':
359
-	            switch ($hpos) {
360
-	                default:
361
-	                case 'left':
362
-	                    $taille   = $this->textLength($maxsize, $hypoth, $text);
363
-	                    $pos_y    = ($height * .85 - $taille);
364
-	                    $pos_x    = $width * 0.15;
365
-	                    $rotation = $calc_angle;
366
-	                    break;
367
-	                case 'right':
368
-	                    $taille   = $this->textLength($maxsize, $hypoth, $text);
369
-	                    $pos_y    = ($height * .15 - $taille);
370
-	                    $pos_x    = $width * 0.85;
371
-	                    $rotation = $calc_angle + 180;
372
-	                    break;
373
-	                case 'top2bottom':
374
-	                    $taille   = $this->textLength($maxsize, $height, $text);
375
-	                    $pos_y    = ($height * .15 - $taille);
376
-	                    $pos_x    = ($width * .90 - $taille);
377
-	                    $rotation = -90;
378
-	                    break;
379
-	                case 'bottom2top':
380
-	                    $taille   = $this->textLength($maxsize, $height, $text);
381
-	                    $pos_y    = $height * 0.85;
382
-	                    $pos_x    = $width * 0.15;
383
-	                    $rotation = 90;
384
-	                    break;
385
-	            }
386
-	            break;
387
-	    }
337
+		// vertical and horizontal position of the text
338
+		switch ($vpos) {
339
+			default:
340
+			case 'top':
341
+				$taille   = $this->textLength($maxsize, $width, $text);
342
+				$pos_y    = $height * 0.15 + $taille;
343
+				$pos_x    = $width * 0.15;
344
+				$rotation = 0;
345
+				break;
346
+			case 'middle':
347
+				$taille   = $this->textLength($maxsize, $width, $text);
348
+				$pos_y    = ($height + $taille) / 2;
349
+				$pos_x    = $width * 0.15;
350
+				$rotation = 0;
351
+				break;
352
+			case 'bottom':
353
+				$taille   = $this->textLength($maxsize, $width, $text);
354
+				$pos_y    = ($height * .85 - $taille);
355
+				$pos_x    = $width * 0.15;
356
+				$rotation = 0;
357
+				break;
358
+			case 'across':
359
+				switch ($hpos) {
360
+					default:
361
+					case 'left':
362
+						$taille   = $this->textLength($maxsize, $hypoth, $text);
363
+						$pos_y    = ($height * .85 - $taille);
364
+						$pos_x    = $width * 0.15;
365
+						$rotation = $calc_angle;
366
+						break;
367
+					case 'right':
368
+						$taille   = $this->textLength($maxsize, $hypoth, $text);
369
+						$pos_y    = ($height * .15 - $taille);
370
+						$pos_x    = $width * 0.85;
371
+						$rotation = $calc_angle + 180;
372
+						break;
373
+					case 'top2bottom':
374
+						$taille   = $this->textLength($maxsize, $height, $text);
375
+						$pos_y    = ($height * .15 - $taille);
376
+						$pos_x    = ($width * .90 - $taille);
377
+						$rotation = -90;
378
+						break;
379
+					case 'bottom2top':
380
+						$taille   = $this->textLength($maxsize, $height, $text);
381
+						$pos_y    = $height * 0.85;
382
+						$pos_x    = $width * 0.15;
383
+						$rotation = 90;
384
+						break;
385
+				}
386
+				break;
387
+		}
388 388
 	    
389
-	    // apply the text
390
-	    if ($this->use_ttf) {
391
-	        // if imagettftext throws errors, catch them with a custom error handler
392
-	        set_error_handler(array($this, 'imageTtfTextErrorHandler'));
393
-	        imagettftext($im, $taille, $rotation, $pos_x, $pos_y, $textcolor, $font, $text);
394
-	        restore_error_handler();
395
-	    }
396
-	    // Don’t use an ‘else’ here since imagettftextErrorHandler may have changed the value of $useTTF from true to false
397
-	    if (!$this->use_ttf) {
398
-	        if ($rotation !== 90) {
399
-	            imagestring($im, 5, $pos_x, $pos_y, $text, $textcolor);
400
-	        } else {
401
-	            imagestringup($im, 5, $pos_x, $pos_y, $text, $textcolor);
402
-	        }
403
-	    }
389
+		// apply the text
390
+		if ($this->use_ttf) {
391
+			// if imagettftext throws errors, catch them with a custom error handler
392
+			set_error_handler(array($this, 'imageTtfTextErrorHandler'));
393
+			imagettftext($im, $taille, $rotation, $pos_x, $pos_y, $textcolor, $font, $text);
394
+			restore_error_handler();
395
+		}
396
+		// Don’t use an ‘else’ here since imagettftextErrorHandler may have changed the value of $useTTF from true to false
397
+		if (!$this->use_ttf) {
398
+			if ($rotation !== 90) {
399
+				imagestring($im, 5, $pos_x, $pos_y, $text, $textcolor);
400
+			} else {
401
+				imagestringup($im, 5, $pos_x, $pos_y, $text, $textcolor);
402
+			}
403
+		}
404 404
 	
405 405
 	}
406 406
 	
@@ -412,53 +412,53 @@  discard block
 block discarded – undo
412 412
 	 */
413 413
 	protected function hexrgb ($hexstr)
414 414
 	{
415
-	    $int = hexdec($hexstr);
415
+		$int = hexdec($hexstr);
416 416
 	
417
-	    return array('red' => 0xFF & ($int >> 0x10),
418
-	        'green' => 0xFF & ($int >> 0x8),
419
-	        'blue' => 0xFF & $int);
417
+		return array('red' => 0xFF & ($int >> 0x10),
418
+			'green' => 0xFF & ($int >> 0x8),
419
+			'blue' => 0xFF & $int);
420 420
 	}
421 421
 	
422
-    /**
423
-     * Generate an approximate length of text, in pixels.
424
-     *
425
-     * @param int    $t
426
-     * @param int    $mxl
427
-     * @param string $text
428
-     *
429
-     * @return int
430
-     */
431
-    function textLength($t, $mxl, $text) {
432
-    	$taille_c = $t;
433
-    	$len      = mb_strlen($text);
434
-    	while (($taille_c - 2) * $len > $mxl) {
435
-    		$taille_c--;
436
-    		if ($taille_c == 2) {
437
-    			break;
438
-    		}
439
-    	}
422
+	/**
423
+	 * Generate an approximate length of text, in pixels.
424
+	 *
425
+	 * @param int    $t
426
+	 * @param int    $mxl
427
+	 * @param string $text
428
+	 *
429
+	 * @return int
430
+	 */
431
+	function textLength($t, $mxl, $text) {
432
+		$taille_c = $t;
433
+		$len      = mb_strlen($text);
434
+		while (($taille_c - 2) * $len > $mxl) {
435
+			$taille_c--;
436
+			if ($taille_c == 2) {
437
+				break;
438
+			}
439
+		}
440 440
     
441
-    	return $taille_c;
442
-    }
441
+		return $taille_c;
442
+	}
443 443
     
444
-    /**
445
-     * imagettftext is the function that is most likely to throw an error
446
-     * use this custom error handler to catch and log it
447
-     *
448
-     * @param int    $errno
449
-     * @param string $errstr
450
-     *
451
-     * @return bool
452
-     */
453
-    function imageTtfTextErrorHandler($errno, $errstr) {
454
-        // log the error
455
-        Log::addErrorLog('Image Builder error: >' . $errno . '/' . $errstr . '< while processing file >' . $this->media->getServerFilename() . '<');
444
+	/**
445
+	 * imagettftext is the function that is most likely to throw an error
446
+	 * use this custom error handler to catch and log it
447
+	 *
448
+	 * @param int    $errno
449
+	 * @param string $errstr
450
+	 *
451
+	 * @return bool
452
+	 */
453
+	function imageTtfTextErrorHandler($errno, $errstr) {
454
+		// log the error
455
+		Log::addErrorLog('Image Builder error: >' . $errno . '/' . $errstr . '< while processing file >' . $this->media->getServerFilename() . '<');
456 456
     
457
-        // change value of useTTF to false so the fallback watermarking can be used.
458
-        $this->use_ttf = false;
457
+		// change value of useTTF to false so the fallback watermarking can be used.
458
+		$this->use_ttf = false;
459 459
     
460
-        return true;
461
-    }
460
+		return true;
461
+	}
462 462
 		
463 463
 }
464 464
 
Please login to merge, or discard this patch.
src/Webtrees/Mvc/Dispatcher.php 1 patch
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -18,35 +18,35 @@  discard block
 block discarded – undo
18 18
  */
19 19
 class Dispatcher implements DispatcherInterface {
20 20
     
21
-    /**
22
-     * @var Dispatcher $instance Singleton pattern instance
23
-     */
24
-    private static $instance = null;
21
+	/**
22
+	 * @var Dispatcher $instance Singleton pattern instance
23
+	 */
24
+	private static $instance = null;
25 25
     
26
-    /**
27
-     * Returns the *Dispatcher* instance of this class.
28
-     *
29
-     * @return Dispatcher The *Singleton* instance.
30
-     */
31
-    public static function getInstance()
32
-    {
33
-        if (null === static::$instance) {
34
-            static::$instance = new static();
35
-        }
26
+	/**
27
+	 * Returns the *Dispatcher* instance of this class.
28
+	 *
29
+	 * @return Dispatcher The *Singleton* instance.
30
+	 */
31
+	public static function getInstance()
32
+	{
33
+		if (null === static::$instance) {
34
+			static::$instance = new static();
35
+		}
36 36
     
37
-        return static::$instance;
38
-    }    
37
+		return static::$instance;
38
+	}    
39 39
     
40 40
 	/**
41
-     * Protected constructor.
42
-     */
43
-    protected function __construct() {}
41
+	 * Protected constructor.
42
+	 */
43
+	protected function __construct() {}
44 44
     
45
-    /**
46
-     * {@inheritdoc }
47
-     * @see \MyArtJaub\Webtrees\Mvc\DispatcherInterface::handle()
48
-     */
49
-    public function handle(fw\Module\AbstractModule $module, $request) {
45
+	/**
46
+	 * {@inheritdoc }
47
+	 * @see \MyArtJaub\Webtrees\Mvc\DispatcherInterface::handle()
48
+	 */
49
+	public function handle(fw\Module\AbstractModule $module, $request) {
50 50
 		
51 51
 		$fq_modclass_name = get_class($module);
52 52
 		$ctrl_namespace = substr($fq_modclass_name, 0, - strlen('Module')) . '\\';
@@ -66,18 +66,18 @@  discard block
 block discarded – undo
66 66
 		
67 67
 		$ctrl_class = $ctrl_namespace . $ctrl_name . 'Controller';
68 68
 		if(class_exists($ctrl_class) 
69
-		    && is_subclass_of($ctrl_class, '\\MyArtJaub\\Webtrees\\Mvc\\Controller\\MvcController')
69
+			&& is_subclass_of($ctrl_class, '\\MyArtJaub\\Webtrees\\Mvc\\Controller\\MvcController')
70 70
 			&& $ctrl = new $ctrl_class($module) ) {
71 71
 			if(method_exists($ctrl, $method)) {
72
-			    try {
73
-			        call_user_func_array(array($ctrl, $method), array());
74
-			    }
75
-			    catch (MvcException $ex) {
76
-			        if(!headers_sent()) {
77
-			            http_response_code($ex->getHttpCode());
78
-			        }
79
-			        echo $ex->getMessage();			        
80
-			    }
72
+				try {
73
+					call_user_func_array(array($ctrl, $method), array());
74
+				}
75
+				catch (MvcException $ex) {
76
+					if(!headers_sent()) {
77
+						http_response_code($ex->getHttpCode());
78
+					}
79
+					echo $ex->getMessage();			        
80
+				}
81 81
 			}
82 82
 			 else {
83 83
 				 throw new \Exception('The page requested does not exist');
@@ -86,27 +86,27 @@  discard block
 block discarded – undo
86 86
 		 else {
87 87
 			 throw new \Exception('The page requested does not exist');
88 88
 		 }
89
-    }
89
+	}
90 90
 
91
-    /**
92
-     * Private clone method to prevent cloning of the instance of the
93
-     * *Dispatcher* instance.
94
-     *
95
-     * @return void
96
-     */
97
-    private function __clone()
98
-    {
99
-    }
91
+	/**
92
+	 * Private clone method to prevent cloning of the instance of the
93
+	 * *Dispatcher* instance.
94
+	 *
95
+	 * @return void
96
+	 */
97
+	private function __clone()
98
+	{
99
+	}
100 100
     
101
-    /**
102
-     * Private unserialize method to prevent unserializing of the *Dispatcher*
103
-     * instance.
104
-     *
105
-     * @return void
106
-     */
107
-    private function __wakeup()
108
-    {
109
-    }
101
+	/**
102
+	 * Private unserialize method to prevent unserializing of the *Dispatcher*
103
+	 * instance.
104
+	 *
105
+	 * @return void
106
+	 */
107
+	private function __wakeup()
108
+	{
109
+	}
110 110
     
111 111
 }
112 112
 
Please login to merge, or discard this patch.
src/Webtrees/Mvc/MvcException.php 1 patch
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -16,52 +16,52 @@
 block discarded – undo
16 16
  */
17 17
 class MvcException extends \Exception {
18 18
 
19
-    /** @var int[] $VALID_HTTP List of valid HTTP codes */
20
-    protected static $VALID_HTTP =  array(
21
-        100, 101,
22
-        200, 201, 202, 203, 204, 205, 206,
23
-        300, 301, 302, 303, 304, 305, 306, 307,
24
-        400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417,
25
-        500, 501, 502, 503, 504, 505
26
-    );
19
+	/** @var int[] $VALID_HTTP List of valid HTTP codes */
20
+	protected static $VALID_HTTP =  array(
21
+		100, 101,
22
+		200, 201, 202, 203, 204, 205, 206,
23
+		300, 301, 302, 303, 304, 305, 306, 307,
24
+		400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417,
25
+		500, 501, 502, 503, 504, 505
26
+	);
27 27
     
28
-    /** @var int $http_code */
29
-    protected $http_code;
28
+	/** @var int $http_code */
29
+	protected $http_code;
30 30
     
31
-    /**
32
-     * Constructor for MvcException
33
-     * 
34
-     * @param int $http_code
35
-     * @param string $message
36
-     * @param int $code
37
-     * @param \Throwable $previous
38
-     */
39
-    public function __construct($http_code = 500, $message = "", $code = 0, \Throwable $previous = null) {
40
-        parent::__construct($message, $code, $previous);   
31
+	/**
32
+	 * Constructor for MvcException
33
+	 * 
34
+	 * @param int $http_code
35
+	 * @param string $message
36
+	 * @param int $code
37
+	 * @param \Throwable $previous
38
+	 */
39
+	public function __construct($http_code = 500, $message = "", $code = 0, \Throwable $previous = null) {
40
+		parent::__construct($message, $code, $previous);   
41 41
                 
42
-        $this->http_code = in_array($http_code, self::$VALID_HTTP) ? $http_code : 500;
43
-    }
42
+		$this->http_code = in_array($http_code, self::$VALID_HTTP) ? $http_code : 500;
43
+	}
44 44
     
45
-    /**
46
-     * Get the HTTP code
47
-     * 
48
-     * @return int
49
-     */
50
-    public function getHttpCode() {
51
-        return $this->http_code;
52
-    }
45
+	/**
46
+	 * Get the HTTP code
47
+	 * 
48
+	 * @return int
49
+	 */
50
+	public function getHttpCode() {
51
+		return $this->http_code;
52
+	}
53 53
     
54
-    /**
55
-     * Set the HTTP code
56
-     * 
57
-     * @param int $http_code
58
-     * @throws InvalidArgumentException Thrown if not valid Http code
59
-     */
60
-    public function setHttpCode($http_code) {
61
-        if(!in_array($http_code, self::$VALID_HTTP))
62
-            throw new \InvalidArgumentException('Invalid HTTP code');
63
-        $this->http_code= $http_code;
64
-    }   
54
+	/**
55
+	 * Set the HTTP code
56
+	 * 
57
+	 * @param int $http_code
58
+	 * @throws InvalidArgumentException Thrown if not valid Http code
59
+	 */
60
+	public function setHttpCode($http_code) {
61
+		if(!in_array($http_code, self::$VALID_HTTP))
62
+			throw new \InvalidArgumentException('Invalid HTTP code');
63
+		$this->http_code= $http_code;
64
+	}   
65 65
 
66 66
 }
67 67
 
Please login to merge, or discard this patch.