Completed
Push — feature/code-analysis ( 110b5c...ddc57d )
by Jonathan
03:27
created
src/Webtrees/Mvc/DispatcherInterface.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
 	 * @param \Fisharebest\Webtrees\Module\AbstractModule $module
22 22
 	 * @param string $request
23 23
 	 */
24
-    public function handle(\Fisharebest\Webtrees\Module\AbstractModule $module, $request);
24
+	public function handle(\Fisharebest\Webtrees\Module\AbstractModule $module, $request);
25 25
     
26 26
 }
27 27
  
28 28
\ No newline at end of file
Please login to merge, or discard this patch.
src/Webtrees/Mvc/View/ViewFactory.php 1 patch
Indentation   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -17,87 +17,87 @@
 block discarded – undo
17 17
  */
18 18
 class ViewFactory {
19 19
     
20
-    /**
21
-     * @var ViewFactory $instance Singleton pattern instance
22
-     */
23
-    private static $instance = null;
20
+	/**
21
+	 * @var ViewFactory $instance Singleton pattern instance
22
+	 */
23
+	private static $instance = null;
24 24
     
25
-    /**
26
-     * Returns the *ViewFactory* instance of this class.
27
-     *
28
-     * @return ViewFactory The *Singleton* instance.
29
-     */
30
-    public static function getInstance()
31
-    {
32
-        if (null === static::$instance) {
33
-            static::$instance = new static();
34
-        }
25
+	/**
26
+	 * Returns the *ViewFactory* instance of this class.
27
+	 *
28
+	 * @return ViewFactory The *Singleton* instance.
29
+	 */
30
+	public static function getInstance()
31
+	{
32
+		if (null === static::$instance) {
33
+			static::$instance = new static();
34
+		}
35 35
     
36
-        return static::$instance;
37
-    }
36
+		return static::$instance;
37
+	}
38 38
     
39
-    /**
40
-     * Protected constructor
41
-     */
42
-    protected function __construct() {}
39
+	/**
40
+	 * Protected constructor
41
+	 */
42
+	protected function __construct() {}
43 43
               
44
-    /**
45
-     * Return the view specified by the controller and view name, using data from the ViewBag
46
-     * 
47
-     * @param string $view_name
48
-     * @param \MyArtJaub\Webtrees\Mvc\Controller\MvcControllerInterface $mvc_ctrl
49
-     * @param \Fisharebest\Webtrees\Controller\BaseController $ctrl
50
-     * @param \MyArtJaub\Webtrees\Mvc\View\ViewBag $data
51
-     * @return \MyArtJaub\Webtrees\Mvc\View\AbstractView View
52
-     * @throws \Exception
53
-     */
54
-    public function makeView($view_name, MvcController $mvc_ctrl, BaseController $ctrl, ViewBag $data) 
55
-    {
56
-        if(!$mvc_ctrl) throw new \Exception('Mvc Controller not defined');
57
-        if(!$ctrl) throw new \Exception('Base Controller not defined');
58
-        if(!$view_name) throw new \Exception('View not defined');
44
+	/**
45
+	 * Return the view specified by the controller and view name, using data from the ViewBag
46
+	 * 
47
+	 * @param string $view_name
48
+	 * @param \MyArtJaub\Webtrees\Mvc\Controller\MvcControllerInterface $mvc_ctrl
49
+	 * @param \Fisharebest\Webtrees\Controller\BaseController $ctrl
50
+	 * @param \MyArtJaub\Webtrees\Mvc\View\ViewBag $data
51
+	 * @return \MyArtJaub\Webtrees\Mvc\View\AbstractView View
52
+	 * @throws \Exception
53
+	 */
54
+	public function makeView($view_name, MvcController $mvc_ctrl, BaseController $ctrl, ViewBag $data) 
55
+	{
56
+		if(!$mvc_ctrl) throw new \Exception('Mvc Controller not defined');
57
+		if(!$ctrl) throw new \Exception('Base Controller not defined');
58
+		if(!$view_name) throw new \Exception('View not defined');
59 59
         
60
-        $mvc_ctrl_refl = new \ReflectionObject($mvc_ctrl);
61
-        $view_class = $mvc_ctrl_refl->getNamespaceName() . '\\Views\\' . $view_name . 'View';       
62
-        if(!class_exists($view_class)) throw new \Exception('View does not exist');
60
+		$mvc_ctrl_refl = new \ReflectionObject($mvc_ctrl);
61
+		$view_class = $mvc_ctrl_refl->getNamespaceName() . '\\Views\\' . $view_name . 'View';       
62
+		if(!class_exists($view_class)) throw new \Exception('View does not exist');
63 63
         
64
-        return new $view_class($ctrl, $data);
65
-    }
64
+		return new $view_class($ctrl, $data);
65
+	}
66 66
     
67
-    /**
68
-     * Static invocation of the makeView method
69
-     * 
70
-     * @param string $view_name
71
-     * @param \MyArtJaub\Webtrees\Mvc\Controller\MvcControllerInterface $mvc_ctrl
72
-     * @param \Fisharebest\Webtrees\Controller\BaseController $ctrl
73
-     * @param \MyArtJaub\Webtrees\Mvc\View\ViewBag $data
74
-     * @return \MyArtJaub\Webtrees\Mvc\View\AbstractView View
75
-     * @see \MyArtJaub\Webtrees\Mvc\View\ViewFactory::handle()
76
-     */
77
-    public static function make($view_name, MvcController $mvc_ctrl, BaseController $ctrl, ViewBag $data) 
78
-    {
79
-        return self::getInstance()->makeView($view_name, $mvc_ctrl, $ctrl, $data);
80
-    }
67
+	/**
68
+	 * Static invocation of the makeView method
69
+	 * 
70
+	 * @param string $view_name
71
+	 * @param \MyArtJaub\Webtrees\Mvc\Controller\MvcControllerInterface $mvc_ctrl
72
+	 * @param \Fisharebest\Webtrees\Controller\BaseController $ctrl
73
+	 * @param \MyArtJaub\Webtrees\Mvc\View\ViewBag $data
74
+	 * @return \MyArtJaub\Webtrees\Mvc\View\AbstractView View
75
+	 * @see \MyArtJaub\Webtrees\Mvc\View\ViewFactory::handle()
76
+	 */
77
+	public static function make($view_name, MvcController $mvc_ctrl, BaseController $ctrl, ViewBag $data) 
78
+	{
79
+		return self::getInstance()->makeView($view_name, $mvc_ctrl, $ctrl, $data);
80
+	}
81 81
     
82
-    /**
83
-     * Private clone method to prevent cloning of the instance of the
84
-     * *Dispatcher* instance.
85
-     *
86
-     * @return void
87
-     */
88
-    private function __clone()
89
-    {
90
-    }
82
+	/**
83
+	 * Private clone method to prevent cloning of the instance of the
84
+	 * *Dispatcher* instance.
85
+	 *
86
+	 * @return void
87
+	 */
88
+	private function __clone()
89
+	{
90
+	}
91 91
     
92
-    /**
93
-     * Private unserialize method to prevent unserializing of the *Dispatcher*
94
-     * instance.
95
-     *
96
-     * @return void
97
-     */
98
-    private function __wakeup()
99
-    {
100
-    }
92
+	/**
93
+	 * Private unserialize method to prevent unserializing of the *Dispatcher*
94
+	 * instance.
95
+	 *
96
+	 * @return void
97
+	 */
98
+	private function __wakeup()
99
+	{
100
+	}
101 101
     
102 102
 }
103 103
  
104 104
\ No newline at end of file
Please login to merge, or discard this patch.
src/Webtrees/Mvc/View/AbstractView.php 1 patch
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -15,62 +15,62 @@
 block discarded – undo
15 15
  */
16 16
 abstract class AbstractView {
17 17
     
18
-    /**
19
-     * Reference controller
20
-     * @var \Fisharebest\Webtrees\Controller\BaseController $ctrl
21
-     */
22
-    protected $ctrl;
18
+	/**
19
+	 * Reference controller
20
+	 * @var \Fisharebest\Webtrees\Controller\BaseController $ctrl
21
+	 */
22
+	protected $ctrl;
23 23
     
24
-    /**
25
-     * Structure containing the data of the view
26
-     * @var ViewBag $data
27
-     */
28
-    protected $data;
24
+	/**
25
+	 * Structure containing the data of the view
26
+	 * @var ViewBag $data
27
+	 */
28
+	protected $data;
29 29
     
30
-    /**
31
-     * Constructor 
32
-     * @param \Fisharebest\Webtrees\Controller\BaseController $ctrl Controller
33
-     * @param ViewBag $data ViewBag holding view data
34
-     */
35
-    public function __construct(\Fisharebest\Webtrees\Controller\BaseController $ctrl, ViewBag $data) {
36
-        $this->ctrl = $ctrl;
37
-        $this->data = $data;
38
-    }
30
+	/**
31
+	 * Constructor 
32
+	 * @param \Fisharebest\Webtrees\Controller\BaseController $ctrl Controller
33
+	 * @param ViewBag $data ViewBag holding view data
34
+	 */
35
+	public function __construct(\Fisharebest\Webtrees\Controller\BaseController $ctrl, ViewBag $data) {
36
+		$this->ctrl = $ctrl;
37
+		$this->data = $data;
38
+	}
39 39
     
40
-    /**
41
-     * Render the view to the page, including header.
42
-     * 
43
-     * @throws \Exception
44
-     */
45
-    public function render() {
40
+	/**
41
+	 * Render the view to the page, including header.
42
+	 * 
43
+	 * @throws \Exception
44
+	 */
45
+	public function render() {
46 46
 		global $controller;
47 47
 		
48
-        if(!$this->ctrl) throw new \Exception('Controller not initialised');
48
+		if(!$this->ctrl) throw new \Exception('Controller not initialised');
49 49
         
50 50
 		$controller = $this->ctrl;
51
-        $this->ctrl->pageHeader();
51
+		$this->ctrl->pageHeader();
52 52
         
53
-        echo $this->renderContent();
54
-    }
53
+		echo $this->renderContent();
54
+	}
55 55
     
56
-    /**
57
-     * Render the view to the page, without any header
58
-     */
59
-    public function renderPartial() {
60
-        echo $this->getHtmlPartial();
61
-    }
56
+	/**
57
+	 * Render the view to the page, without any header
58
+	 */
59
+	public function renderPartial() {
60
+		echo $this->getHtmlPartial();
61
+	}
62 62
     
63
-    /**
64
-     * Return the HTML code generated by the view, without any header
65
-     */
66
-    public function getHtmlPartial() {
67
-        return $this->renderContent();
68
-    }
63
+	/**
64
+	 * Return the HTML code generated by the view, without any header
65
+	 */
66
+	public function getHtmlPartial() {
67
+		return $this->renderContent();
68
+	}
69 69
     
70
-    /**
71
-     * Abstract method containing the details of the view.
72
-     */
73
-    abstract protected function renderContent();
70
+	/**
71
+	 * Abstract method containing the details of the view.
72
+	 */
73
+	abstract protected function renderContent();
74 74
     
75 75
 }
76 76
  
77 77
\ No newline at end of file
Please login to merge, or discard this patch.
src/Webtrees/Functions/Functions.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 	 */
185 185
 	public static function encodeFileSystemToUtf8($string){
186 186
 		if (strtoupper(substr(php_uname('s'), 0, 7)) === 'WINDOWS') {
187
-		    return iconv('cp1252', 'utf-8//IGNORE',$string);
187
+			return iconv('cp1252', 'utf-8//IGNORE',$string);
188 188
 		}
189 189
 		return $string;
190 190
 	}
@@ -249,20 +249,20 @@  discard block
 block discarded – undo
249 249
 	 * @return boolean|string Is supported?
250 250
 	 */
251 251
 	public static function isImageTypeSupported($reqtype) {
252
-	    $supportByGD = array('jpg'=>'jpeg', 'jpeg'=>'jpeg', 'gif'=>'gif', 'png'=>'png');
253
-	    $reqtype = strtolower($reqtype);
252
+		$supportByGD = array('jpg'=>'jpeg', 'jpeg'=>'jpeg', 'gif'=>'gif', 'png'=>'png');
253
+		$reqtype = strtolower($reqtype);
254 254
 	
255
-	    if (empty($supportByGD[$reqtype])) {
256
-	        return false;
257
-	    }
255
+		if (empty($supportByGD[$reqtype])) {
256
+			return false;
257
+		}
258 258
 	
259
-	    $type = $supportByGD[$reqtype];
259
+		$type = $supportByGD[$reqtype];
260 260
 	
261
-	    if (function_exists('imagecreatefrom'.$type) && function_exists('image'.$type)) {
262
-	        return $type;
263
-	    }
261
+		if (function_exists('imagecreatefrom'.$type) && function_exists('image'.$type)) {
262
+			return $type;
263
+		}
264 264
 	
265
-	    return false;
265
+		return false;
266 266
 	}
267 267
 		
268 268
 }
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
@@ -21,54 +21,54 @@  discard block
 block discarded – undo
21 21
  */
22 22
 class ImageBuilder {
23 23
     
24
-    /**
25
-     * Reference media
26
-     * @var Media $media
27
-     */
28
-    protected $media;
24
+	/**
25
+	 * Reference media
26
+	 * @var Media $media
27
+	 */
28
+	protected $media;
29 29
     
30
-    /**
31
-     * Use TTF font
32
-     * @var bool $use_ttf
33
-     */
34
-    protected $use_ttf;
30
+	/**
31
+	 * Use TTF font
32
+	 * @var bool $use_ttf
33
+	 */
34
+	protected $use_ttf;
35 35
     
36
-    /**
37
-     * Expiration offset. Default is one day.
38
-     * @var int $expire_offset
39
-     */
40
-    protected $expire_offset;
36
+	/**
37
+	 * Expiration offset. Default is one day.
38
+	 * @var int $expire_offset
39
+	 */
40
+	protected $expire_offset;
41 41
    
42
-    /**
43
-     * Should the certificate display a watermark
44
-     * @var bool $show_watermark
45
-     */
46
-    protected $show_watermark;
42
+	/**
43
+	 * Should the certificate display a watermark
44
+	 * @var bool $show_watermark
45
+	 */
46
+	protected $show_watermark;
47 47
         
48
-    /**
49
-     * Maximum watermark font size. Default is 18.
50
-     * @var int $font_max_size
51
-     */
52
-    protected $font_max_size;
48
+	/**
49
+	 * Maximum watermark font size. Default is 18.
50
+	 * @var int $font_max_size
51
+	 */
52
+	protected $font_max_size;
53 53
     
54
-    /**
55
-     * Watermark font color, in hexadecimal. Default is #4D6DF3.
56
-     * @var string $font_color
57
-     */
58
-    protected $font_color;
54
+	/**
55
+	 * Watermark font color, in hexadecimal. Default is #4D6DF3.
56
+	 * @var string $font_color
57
+	 */
58
+	protected $font_color;
59 59
     
60 60
 	/**
61
-	* Contructor for ImageBuilder
62
-	*
63
-	* @param Media|null $media Reference media object
64
-	*/
61
+	 * Contructor for ImageBuilder
62
+	 *
63
+	 * @param Media|null $media Reference media object
64
+	 */
65 65
 	public function __construct(Media $media = null){
66
-	    $this->media = $media;
67
-	    $this->use_ttf = function_exists('imagettftext');
68
-	    $this->expire_offset = 3600 * 24;
69
-	    $this->show_watermark = true;
70
-	    $this->font_max_size = 18;
71
-	    $this->font_color = '#4D6DF3';
66
+		$this->media = $media;
67
+		$this->use_ttf = function_exists('imagettftext');
68
+		$this->expire_offset = 3600 * 24;
69
+		$this->show_watermark = true;
70
+		$this->font_max_size = 18;
71
+		$this->font_color = '#4D6DF3';
72 72
 	}
73 73
 	
74 74
 	/**
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 	 * @return int
78 78
 	 */
79 79
 	public function getExpireOffset() {
80
-	    return $this->expire_offset;
80
+		return $this->expire_offset;
81 81
 	}
82 82
 	
83 83
 	/**
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
 	 * @return ImageBuilder
88 88
 	 */
89 89
 	public function setExpireOffset($expireOffset) {
90
-	    if($expireOffset) $this->expire_offset = $expireOffset;
91
-	    return $this;
90
+		if($expireOffset) $this->expire_offset = $expireOffset;
91
+		return $this;
92 92
 	}
93 93
 	
94 94
 	/**
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 	 * @return bool
98 98
 	 */
99 99
 	public function isShowWatermark() {
100
-	    return $this->show_watermark;
100
+		return $this->show_watermark;
101 101
 	}
102 102
 	
103 103
 	/**
@@ -107,8 +107,8 @@  discard block
 block discarded – undo
107 107
 	 * @return ImageBuilder
108 108
 	 */
109 109
 	public function setShowWatermark($show_watermark) {
110
-	    if(!is_null($show_watermark)) $this->show_watermark = $show_watermark;
111
-	    return $this;
110
+		if(!is_null($show_watermark)) $this->show_watermark = $show_watermark;
111
+		return $this;
112 112
 	}
113 113
 	
114 114
 	/**
@@ -118,8 +118,8 @@  discard block
 block discarded – undo
118 118
 	 * @return ImageBuilder
119 119
 	 */
120 120
 	public function setFontMaxSize($font_max_size) {
121
-	    if($font_max_size) $this->font_max_size = $font_max_size;
122
-	    return $this;
121
+		if($font_max_size) $this->font_max_size = $font_max_size;
122
+		return $this;
123 123
 	}
124 124
 	
125 125
 	/**
@@ -129,8 +129,8 @@  discard block
 block discarded – undo
129 129
 	 * @return ImageBuilder
130 130
 	 */
131 131
 	public function setFontColor($font_color) {
132
-	    if($font_color) $this->font_color = $font_color;
133
-	    return $this;
132
+		if($font_color) $this->font_color = $font_color;
133
+		return $this;
134 134
 	}
135 135
 	
136 136
 	/**
@@ -138,134 +138,134 @@  discard block
 block discarded – undo
138 138
 	 */
139 139
 	public function render(){
140 140
 	    
141
-	    if (!$this->media || !$this->media->canShow()) {
142
-	        Log::addMediaLog('Image Builder error: >' . I18N::translate('Missing or private media object.'));
143
-	        $this->renderError();
144
-	    }
141
+		if (!$this->media || !$this->media->canShow()) {
142
+			Log::addMediaLog('Image Builder error: >' . I18N::translate('Missing or private media object.'));
143
+			$this->renderError();
144
+		}
145 145
 	    
146
-	    $serverFilename = $this->media->getServerFilename();
146
+		$serverFilename = $this->media->getServerFilename();
147 147
 	    
148
-	    if (!file_exists($serverFilename)) {
149
-	        Log::addMediaLog('Image Builder error: >'. I18N::translate('The media object does not exist.').'< for path >'.$serverFilename.'<');
150
-	        $this->renderError();
151
-	    }
148
+		if (!file_exists($serverFilename)) {
149
+			Log::addMediaLog('Image Builder error: >'. I18N::translate('The media object does not exist.').'< for path >'.$serverFilename.'<');
150
+			$this->renderError();
151
+		}
152 152
 	    
153
-	    $mimetype = $this->media->mimeType();
154
-	    $imgsize = $this->media->getImageAttributes();
155
-	    $filetime = $this->media->getFiletime();
156
-	    $filetimeHeader = gmdate('D, d M Y H:i:s', $filetime) . ' GMT';	    
157
-	    $expireHeader = gmdate('D, d M Y H:i:s', WT_TIMESTAMP + $this->getExpireOffset()) . ' GMT';
153
+		$mimetype = $this->media->mimeType();
154
+		$imgsize = $this->media->getImageAttributes();
155
+		$filetime = $this->media->getFiletime();
156
+		$filetimeHeader = gmdate('D, d M Y H:i:s', $filetime) . ' GMT';	    
157
+		$expireHeader = gmdate('D, d M Y H:i:s', WT_TIMESTAMP + $this->getExpireOffset()) . ' GMT';
158 158
 	    
159
-	    $type = Functions::isImageTypeSupported($imgsize['ext']);
160
-	    $usewatermark = false;
161
-	    // if this image supports watermarks and the watermark module is intalled...
162
-	    if ($type) {
163
-	        $usewatermark = $this->isShowWatermark();
164
-	    }
159
+		$type = Functions::isImageTypeSupported($imgsize['ext']);
160
+		$usewatermark = false;
161
+		// if this image supports watermarks and the watermark module is intalled...
162
+		if ($type) {
163
+			$usewatermark = $this->isShowWatermark();
164
+		}
165 165
 	    
166
-	    // determine whether we have enough memory to watermark this image
167
-	    if ($usewatermark) {
168
-	        if (!FunctionsMedia::hasMemoryForImage($serverFilename)) {
169
-	            // not enough memory to watermark this file
170
-	            $usewatermark = false;
171
-	        }
172
-	    }
166
+		// determine whether we have enough memory to watermark this image
167
+		if ($usewatermark) {
168
+			if (!FunctionsMedia::hasMemoryForImage($serverFilename)) {
169
+				// not enough memory to watermark this file
170
+				$usewatermark = false;
171
+			}
172
+		}
173 173
 	    
174
-	    $etag = $this->media->getEtag();
174
+		$etag = $this->media->getEtag();
175 175
 	    
176
-	    // parse IF_MODIFIED_SINCE header from client
177
-	    $if_modified_since = 'x';
178
-	    if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
179
-	        $if_modified_since = preg_replace('/;.*$/', '', $_SERVER['HTTP_IF_MODIFIED_SINCE']);
180
-	    }
176
+		// parse IF_MODIFIED_SINCE header from client
177
+		$if_modified_since = 'x';
178
+		if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
179
+			$if_modified_since = preg_replace('/;.*$/', '', $_SERVER['HTTP_IF_MODIFIED_SINCE']);
180
+		}
181 181
 	    
182
-	    // parse IF_NONE_MATCH header from client
183
-	    $if_none_match = 'x';
184
-	    if (isset($_SERVER['HTTP_IF_NONE_MATCH'])) {
185
-	        $if_none_match = str_replace('"', '', $_SERVER['HTTP_IF_NONE_MATCH']);
186
-	    }
182
+		// parse IF_NONE_MATCH header from client
183
+		$if_none_match = 'x';
184
+		if (isset($_SERVER['HTTP_IF_NONE_MATCH'])) {
185
+			$if_none_match = str_replace('"', '', $_SERVER['HTTP_IF_NONE_MATCH']);
186
+		}
187 187
 	    
188
-	    // add caching headers.  allow browser to cache file, but not proxy
189
-	    header('Last-Modified: ' . $filetimeHeader);
190
-	    header('ETag: "' . $etag . '"');
191
-	    header('Expires: ' . $expireHeader);
192
-	    header('Cache-Control: max-age=' . $this->getExpireOffset() . ', s-maxage=0, proxy-revalidate');
188
+		// add caching headers.  allow browser to cache file, but not proxy
189
+		header('Last-Modified: ' . $filetimeHeader);
190
+		header('ETag: "' . $etag . '"');
191
+		header('Expires: ' . $expireHeader);
192
+		header('Cache-Control: max-age=' . $this->getExpireOffset() . ', s-maxage=0, proxy-revalidate');
193 193
 	    
194
-	    // if this file is already in the user’s cache, don’t resend it
195
-	    // first check if the if_modified_since param matches
196
-	    if ($if_modified_since === $filetimeHeader) {
197
-	        // then check if the etag matches
198
-	        if ($if_none_match === $etag) {
199
-	            http_response_code(304);
194
+		// if this file is already in the user’s cache, don’t resend it
195
+		// first check if the if_modified_since param matches
196
+		if ($if_modified_since === $filetimeHeader) {
197
+			// then check if the etag matches
198
+			if ($if_none_match === $etag) {
199
+				http_response_code(304);
200 200
 	    
201
-	            return;
202
-	        }
203
-	    }	    
201
+				return;
202
+			}
203
+		}	    
204 204
 
205
-	    // send headers for the image
206
-	    header('Content-Type: ' . $mimetype);
207
-	    header('Content-Disposition: filename="' . addslashes(basename($this->media->getFilename())) . '"');
205
+		// send headers for the image
206
+		header('Content-Type: ' . $mimetype);
207
+		header('Content-Disposition: filename="' . addslashes(basename($this->media->getFilename())) . '"');
208 208
 	     
209
-	    if ($usewatermark) {
210
-	        // generate the watermarked image
211
-	        $imCreateFunc = 'imagecreatefrom' . $type;
212
-	        $imSendFunc   = 'image' . $type;
209
+		if ($usewatermark) {
210
+			// generate the watermarked image
211
+			$imCreateFunc = 'imagecreatefrom' . $type;
212
+			$imSendFunc   = 'image' . $type;
213 213
 	    
214
-	        if (function_exists($imCreateFunc) && function_exists($imSendFunc)) {
215
-	            $im = $imCreateFunc($serverFilename);
216
-	            $im = $this->applyWatermark($im);
214
+			if (function_exists($imCreateFunc) && function_exists($imSendFunc)) {
215
+				$im = $imCreateFunc($serverFilename);
216
+				$im = $this->applyWatermark($im);
217 217
 	    	    
218
-	            // send the image
219
-	            $imSendFunc($im);
220
-	            imagedestroy($im);
218
+				// send the image
219
+				$imSendFunc($im);
220
+				imagedestroy($im);
221 221
 	    
222
-	            return;
223
-	        } else {
224
-	            // this image is defective.  log it
225
-	            Log::addMediaLog('Image Builder error: >' . I18N::translate('This media file is broken and cannot be watermarked.') . '< in file >' . $serverFilename . '< memory used: ' . memory_get_usage());
226
-	        }
227
-	    }
222
+				return;
223
+			} else {
224
+				// this image is defective.  log it
225
+				Log::addMediaLog('Image Builder error: >' . I18N::translate('This media file is broken and cannot be watermarked.') . '< in file >' . $serverFilename . '< memory used: ' . memory_get_usage());
226
+			}
227
+		}
228 228
 	    
229
-	    // determine filesize of image (could be original or watermarked version)
230
-	    $filesize = filesize($serverFilename);
229
+		// determine filesize of image (could be original or watermarked version)
230
+		$filesize = filesize($serverFilename);
231 231
 	    
232
-	    // set content-length header, send file
233
-	    header('Content-Length: ' . $filesize);
232
+		// set content-length header, send file
233
+		header('Content-Length: ' . $filesize);
234 234
 	    
235
-	    // Some servers disable fpassthru() and readfile()
236
-	    if (function_exists('readfile')) {
237
-	        readfile($serverFilename);
238
-	    } else {
239
-	        $fp = fopen($serverFilename, 'rb');
240
-	        if (function_exists('fpassthru')) {
241
-	            fpassthru($fp);
242
-	        } else {
243
-	            while (!feof($fp)) {
244
-	                echo fread($fp, 65536);
245
-	            }
246
-	        }
247
-	        fclose($fp);
248
-	    }	    
235
+		// Some servers disable fpassthru() and readfile()
236
+		if (function_exists('readfile')) {
237
+			readfile($serverFilename);
238
+		} else {
239
+			$fp = fopen($serverFilename, 'rb');
240
+			if (function_exists('fpassthru')) {
241
+				fpassthru($fp);
242
+			} else {
243
+				while (!feof($fp)) {
244
+					echo fread($fp, 65536);
245
+				}
246
+			}
247
+			fclose($fp);
248
+		}	    
249 249
 	}
250 250
 	
251 251
 	/**
252 252
 	 * Render an error as an image.
253 253
 	 */
254 254
 	protected function renderError() {	
255
-	    $error = I18N::translate('The media file was not found in this family tree.');
255
+		$error = I18N::translate('The media file was not found in this family tree.');
256 256
 
257
-    	$width  = (mb_strlen($error) * 6.5 + 50) * 1.15;
258
-    	$height = 60;
259
-    	$im     = imagecreatetruecolor($width, $height); /* Create a black image */
260
-    	$bgc    = imagecolorallocate($im, 255, 255, 255); /* set background color */
261
-    	imagefilledrectangle($im, 2, 2, $width - 4, $height - 4, $bgc); /* create a rectangle, leaving 2 px border */
257
+		$width  = (mb_strlen($error) * 6.5 + 50) * 1.15;
258
+		$height = 60;
259
+		$im     = imagecreatetruecolor($width, $height); /* Create a black image */
260
+		$bgc    = imagecolorallocate($im, 255, 255, 255); /* set background color */
261
+		imagefilledrectangle($im, 2, 2, $width - 4, $height - 4, $bgc); /* create a rectangle, leaving 2 px border */
262 262
     
263
-    	$this->embedText($im, $error, 100, '255, 0, 0', WT_ROOT . Config::FONT_DEJAVU_SANS_TTF, 'top', 'left');
263
+		$this->embedText($im, $error, 100, '255, 0, 0', WT_ROOT . Config::FONT_DEJAVU_SANS_TTF, 'top', 'left');
264 264
     
265
-    	http_response_code(404);
266
-    	header('Content-Type: image/png');
267
-    	imagepng($im);
268
-    	imagedestroy($im);
265
+		http_response_code(404);
266
+		header('Content-Type: image/png');
267
+		imagepng($im);
268
+		imagedestroy($im);
269 269
 	}
270 270
 	
271 271
 	/**
@@ -277,25 +277,25 @@  discard block
 block discarded – undo
277 277
 	 */
278 278
 	protected function applyWatermark($im) {
279 279
 	    
280
-	    // text to watermark with	    
281
-	    if(method_exists($this->media, 'getWatermarkText')) {
282
-	       $word1_text = $this->media->getWatermarkText();
283
-	    }
284
-	    else {
285
-	        $word1_text = $this->media->getTitle();
286
-	    }
280
+		// text to watermark with	    
281
+		if(method_exists($this->media, 'getWatermarkText')) {
282
+		   $word1_text = $this->media->getWatermarkText();
283
+		}
284
+		else {
285
+			$word1_text = $this->media->getTitle();
286
+		}
287 287
 	
288
-	    $this->embedText(
289
-	        $im, 
290
-	        $word1_text, 
291
-	        $this->font_max_size,
292
-	        $this->font_color,
293
-	        WT_ROOT . Config::FONT_DEJAVU_SANS_TTF,
294
-	        'top', 
295
-	        'left'
296
-	     );
288
+		$this->embedText(
289
+			$im, 
290
+			$word1_text, 
291
+			$this->font_max_size,
292
+			$this->font_color,
293
+			WT_ROOT . Config::FONT_DEJAVU_SANS_TTF,
294
+			'top', 
295
+			'left'
296
+		 );
297 297
 	
298
-	    return ($im);
298
+		return ($im);
299 299
 	}
300 300
 	
301 301
 	/**
@@ -312,94 +312,94 @@  discard block
 block discarded – undo
312 312
 	 */
313 313
 	protected function embedText($im, $text, $maxsize, $color, $font, $vpos, $hpos) {
314 314
 	    
315
-	    // there are two ways to embed text with PHP
316
-	    // (preferred) using GD and FreeType you can embed text using any True Type font
317
-	    // (fall back) if that is not available, you can insert basic monospaced text
315
+		// there are two ways to embed text with PHP
316
+		// (preferred) using GD and FreeType you can embed text using any True Type font
317
+		// (fall back) if that is not available, you can insert basic monospaced text
318 318
 	    
319
-	    $col = $this->hexrgb($color);
320
-	    $textcolor = imagecolorallocate($im, $col['red'], $col['green'], $col['blue']);
319
+		$col = $this->hexrgb($color);
320
+		$textcolor = imagecolorallocate($im, $col['red'], $col['green'], $col['blue']);
321 321
 	    
322
-	    // make adjustments to settings that imagestring and imagestringup can’t handle
323
-	    if (!$this->use_ttf) {
324
-	        // imagestringup only writes up, can’t use top2bottom
325
-	        if ($hpos === 'top2bottom') {
326
-	            $hpos = 'bottom2top';
327
-	        }
328
-	    }
322
+		// make adjustments to settings that imagestring and imagestringup can’t handle
323
+		if (!$this->use_ttf) {
324
+			// imagestringup only writes up, can’t use top2bottom
325
+			if ($hpos === 'top2bottom') {
326
+				$hpos = 'bottom2top';
327
+			}
328
+		}
329 329
 	    
330
-	    $text       = I18N::reverseText($text);
331
-	    $height     = imagesy($im);
332
-	    $width      = imagesx($im);
333
-	    $calc_angle = rad2deg(atan($height / $width));
334
-	    $hypoth     = $height / sin(deg2rad($calc_angle));
330
+		$text       = I18N::reverseText($text);
331
+		$height     = imagesy($im);
332
+		$width      = imagesx($im);
333
+		$calc_angle = rad2deg(atan($height / $width));
334
+		$hypoth     = $height / sin(deg2rad($calc_angle));
335 335
 	    
336
-	    // vertical and horizontal position of the text
337
-	    switch ($vpos) {
338
-	        default:
339
-	        case 'top':
340
-	            $taille   = $this->textLength($maxsize, $width, $text);
341
-	            $pos_y    = $height * 0.15 + $taille;
342
-	            $pos_x    = $width * 0.15;
343
-	            $rotation = 0;
344
-	            break;
345
-	        case 'middle':
346
-	            $taille   = $this->textLength($maxsize, $width, $text);
347
-	            $pos_y    = ($height + $taille) / 2;
348
-	            $pos_x    = $width * 0.15;
349
-	            $rotation = 0;
350
-	            break;
351
-	        case 'bottom':
352
-	            $taille   = $this->textLength($maxsize, $width, $text);
353
-	            $pos_y    = ($height * .85 - $taille);
354
-	            $pos_x    = $width * 0.15;
355
-	            $rotation = 0;
356
-	            break;
357
-	        case 'across':
358
-	            switch ($hpos) {
359
-	                default:
360
-	                case 'left':
361
-	                    $taille   = $this->textLength($maxsize, $hypoth, $text);
362
-	                    $pos_y    = ($height * .85 - $taille);
363
-	                    $pos_x    = $width * 0.15;
364
-	                    $rotation = $calc_angle;
365
-	                    break;
366
-	                case 'right':
367
-	                    $taille   = $this->textLength($maxsize, $hypoth, $text);
368
-	                    $pos_y    = ($height * .15 - $taille);
369
-	                    $pos_x    = $width * 0.85;
370
-	                    $rotation = $calc_angle + 180;
371
-	                    break;
372
-	                case 'top2bottom':
373
-	                    $taille   = $this->textLength($maxsize, $height, $text);
374
-	                    $pos_y    = ($height * .15 - $taille);
375
-	                    $pos_x    = ($width * .90 - $taille);
376
-	                    $rotation = -90;
377
-	                    break;
378
-	                case 'bottom2top':
379
-	                    $taille   = $this->textLength($maxsize, $height, $text);
380
-	                    $pos_y    = $height * 0.85;
381
-	                    $pos_x    = $width * 0.15;
382
-	                    $rotation = 90;
383
-	                    break;
384
-	            }
385
-	            break;
386
-	    }
336
+		// vertical and horizontal position of the text
337
+		switch ($vpos) {
338
+			default:
339
+			case 'top':
340
+				$taille   = $this->textLength($maxsize, $width, $text);
341
+				$pos_y    = $height * 0.15 + $taille;
342
+				$pos_x    = $width * 0.15;
343
+				$rotation = 0;
344
+				break;
345
+			case 'middle':
346
+				$taille   = $this->textLength($maxsize, $width, $text);
347
+				$pos_y    = ($height + $taille) / 2;
348
+				$pos_x    = $width * 0.15;
349
+				$rotation = 0;
350
+				break;
351
+			case 'bottom':
352
+				$taille   = $this->textLength($maxsize, $width, $text);
353
+				$pos_y    = ($height * .85 - $taille);
354
+				$pos_x    = $width * 0.15;
355
+				$rotation = 0;
356
+				break;
357
+			case 'across':
358
+				switch ($hpos) {
359
+					default:
360
+					case 'left':
361
+						$taille   = $this->textLength($maxsize, $hypoth, $text);
362
+						$pos_y    = ($height * .85 - $taille);
363
+						$pos_x    = $width * 0.15;
364
+						$rotation = $calc_angle;
365
+						break;
366
+					case 'right':
367
+						$taille   = $this->textLength($maxsize, $hypoth, $text);
368
+						$pos_y    = ($height * .15 - $taille);
369
+						$pos_x    = $width * 0.85;
370
+						$rotation = $calc_angle + 180;
371
+						break;
372
+					case 'top2bottom':
373
+						$taille   = $this->textLength($maxsize, $height, $text);
374
+						$pos_y    = ($height * .15 - $taille);
375
+						$pos_x    = ($width * .90 - $taille);
376
+						$rotation = -90;
377
+						break;
378
+					case 'bottom2top':
379
+						$taille   = $this->textLength($maxsize, $height, $text);
380
+						$pos_y    = $height * 0.85;
381
+						$pos_x    = $width * 0.15;
382
+						$rotation = 90;
383
+						break;
384
+				}
385
+				break;
386
+		}
387 387
 	    
388
-	    // apply the text
389
-	    if ($this->use_ttf) {
390
-	        // if imagettftext throws errors, catch them with a custom error handler
391
-	        set_error_handler(array($this, 'imageTtfTextErrorHandler'));
392
-	        imagettftext($im, $taille, $rotation, $pos_x, $pos_y, $textcolor, $font, $text);
393
-	        restore_error_handler();
394
-	    }
395
-	    // Don’t use an ‘else’ here since imagettftextErrorHandler may have changed the value of $useTTF from true to false
396
-	    if (!$this->use_ttf) {
397
-	        if ($rotation !== 90) {
398
-	            imagestring($im, 5, $pos_x, $pos_y, $text, $textcolor);
399
-	        } else {
400
-	            imagestringup($im, 5, $pos_x, $pos_y, $text, $textcolor);
401
-	        }
402
-	    }
388
+		// apply the text
389
+		if ($this->use_ttf) {
390
+			// if imagettftext throws errors, catch them with a custom error handler
391
+			set_error_handler(array($this, 'imageTtfTextErrorHandler'));
392
+			imagettftext($im, $taille, $rotation, $pos_x, $pos_y, $textcolor, $font, $text);
393
+			restore_error_handler();
394
+		}
395
+		// Don’t use an ‘else’ here since imagettftextErrorHandler may have changed the value of $useTTF from true to false
396
+		if (!$this->use_ttf) {
397
+			if ($rotation !== 90) {
398
+				imagestring($im, 5, $pos_x, $pos_y, $text, $textcolor);
399
+			} else {
400
+				imagestringup($im, 5, $pos_x, $pos_y, $text, $textcolor);
401
+			}
402
+		}
403 403
 	
404 404
 	}
405 405
 	
@@ -411,53 +411,53 @@  discard block
 block discarded – undo
411 411
 	 */
412 412
 	protected function hexrgb ($hexstr)
413 413
 	{
414
-	    $int = hexdec($hexstr);
414
+		$int = hexdec($hexstr);
415 415
 	
416
-	    return array('red' => 0xFF & ($int >> 0x10),
417
-	        'green' => 0xFF & ($int >> 0x8),
418
-	        'blue' => 0xFF & $int);
416
+		return array('red' => 0xFF & ($int >> 0x10),
417
+			'green' => 0xFF & ($int >> 0x8),
418
+			'blue' => 0xFF & $int);
419 419
 	}
420 420
 	
421
-    /**
422
-     * Generate an approximate length of text, in pixels.
423
-     *
424
-     * @param int    $t
425
-     * @param int    $mxl
426
-     * @param string $text
427
-     *
428
-     * @return int
429
-     */
430
-    function textLength($t, $mxl, $text) {
431
-    	$taille_c = $t;
432
-    	$len      = mb_strlen($text);
433
-    	while (($taille_c - 2) * $len > $mxl) {
434
-    		$taille_c--;
435
-    		if ($taille_c == 2) {
436
-    			break;
437
-    		}
438
-    	}
421
+	/**
422
+	 * Generate an approximate length of text, in pixels.
423
+	 *
424
+	 * @param int    $t
425
+	 * @param int    $mxl
426
+	 * @param string $text
427
+	 *
428
+	 * @return int
429
+	 */
430
+	function textLength($t, $mxl, $text) {
431
+		$taille_c = $t;
432
+		$len      = mb_strlen($text);
433
+		while (($taille_c - 2) * $len > $mxl) {
434
+			$taille_c--;
435
+			if ($taille_c == 2) {
436
+				break;
437
+			}
438
+		}
439 439
     
440
-    	return $taille_c;
441
-    }
440
+		return $taille_c;
441
+	}
442 442
     
443
-    /**
444
-     * imagettftext is the function that is most likely to throw an error
445
-     * use this custom error handler to catch and log it
446
-     *
447
-     * @param int    $errno
448
-     * @param string $errstr
449
-     *
450
-     * @return bool
451
-     */
452
-    function imageTtfTextErrorHandler($errno, $errstr) {
453
-        // log the error
454
-        Log::addErrorLog('Image Builder error: >' . $errno . '/' . $errstr . '< while processing file >' . $this->media->getServerFilename() . '<');
443
+	/**
444
+	 * imagettftext is the function that is most likely to throw an error
445
+	 * use this custom error handler to catch and log it
446
+	 *
447
+	 * @param int    $errno
448
+	 * @param string $errstr
449
+	 *
450
+	 * @return bool
451
+	 */
452
+	function imageTtfTextErrorHandler($errno, $errstr) {
453
+		// log the error
454
+		Log::addErrorLog('Image Builder error: >' . $errno . '/' . $errstr . '< while processing file >' . $this->media->getServerFilename() . '<');
455 455
     
456
-        // change value of useTTF to false so the fallback watermarking can be used.
457
-        $this->use_ttf = false;
456
+		// change value of useTTF to false so the fallback watermarking can be used.
457
+		$this->use_ttf = false;
458 458
     
459
-        return true;
460
-    }
459
+		return true;
460
+	}
461 461
 		
462 462
 }
463 463
 
Please login to merge, or discard this patch.
src/Webtrees/Hook/Hook.php 1 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/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/Module/IsSourcedModule.php 1 patch
Indentation   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -28,29 +28,29 @@  discard block
 block discarded – undo
28 28
 class IsSourcedModule extends AbstractModule 
29 29
 implements ModuleSidebarInterface, HookSubscriberInterface, IndividualHeaderExtenderInterface, RecordNameTextExtenderInterface
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
-     * {@inheritDoc}
36
-     * @see \Fisharebest\Webtrees\Module\AbstractModule::getTitle()
37
-     */
38
-    public function getTitle() {
39
-        return I18N::translate('Sourced events');
40
-    }
34
+	/**
35
+	 * {@inheritDoc}
36
+	 * @see \Fisharebest\Webtrees\Module\AbstractModule::getTitle()
37
+	 */
38
+	public function getTitle() {
39
+		return I18N::translate('Sourced events');
40
+	}
41 41
     
42 42
    /**
43 43
     * {@inheritDoc}
44 44
     * @see \Fisharebest\Webtrees\Module\AbstractModule::getDescription()
45 45
     */
46
-    public function getDescription() {
47
-        return I18N::translate('Indicate if events related to an record are sourced.');
48
-    }
46
+	public function getDescription() {
47
+		return I18N::translate('Indicate if events related to an record are sourced.');
48
+	}
49 49
     
50
-    /**
51
-     * {@inheritDoc}
52
-     * @see \MyArtJaub\Webtrees\Hook\HookSubscriberInterface::getSubscribedHooks()
53
-     */
50
+	/**
51
+	 * {@inheritDoc}
52
+	 * @see \MyArtJaub\Webtrees\Hook\HookSubscriberInterface::getSubscribedHooks()
53
+	 */
54 54
 	public function getSubscribedHooks() {
55 55
 		return array(
56 56
  			'hExtendIndiHeaderIcons' => 10,
@@ -63,12 +63,12 @@  discard block
 block discarded – undo
63 63
 	 * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\IndividualHeaderExtenderInterface::hExtendIndiHeaderIcons()
64 64
 	 */
65 65
 	public function hExtendIndiHeaderIcons(IndividualController $ctrlIndi) {
66
-	    if($ctrlIndi){
67
-	        $dindi = new Individual($ctrlIndi->getSignificantIndividual());
68
-	        if ($dindi->canDisplayIsSourced()) 
69
-	            return FunctionsPrint::formatIsSourcedIcon('R', $dindi->isSourced(), 'INDI', 1, 'large');
70
-	    }
71
-	    return '';
66
+		if($ctrlIndi){
67
+			$dindi = new Individual($ctrlIndi->getSignificantIndividual());
68
+			if ($dindi->canDisplayIsSourced()) 
69
+				return FunctionsPrint::formatIsSourcedIcon('R', $dindi->isSourced(), 'INDI', 1, 'large');
70
+		}
71
+		return '';
72 72
 	}
73 73
 	
74 74
 	/**
@@ -94,15 +94,15 @@  discard block
 block discarded – undo
94 94
 	 * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\RecordNameTextExtenderInterface::hRecordNameAppend()
95 95
 	 */
96 96
 	public function hRecordNameAppend(GedcomRecord $grec){
97
-	    $html = '';
98
-	    if($grec instanceof \Fisharebest\Webtrees\Individual){
99
-	        $dindi = new Individual($grec);
100
-	        $html .= FunctionsPrint::formatIsSourcedIcon('R', $dindi->isSourced(), 'INDI', 1, 'small');
101
-	        $html .= FunctionsPrint::formatIsSourcedIcon('E', $dindi->isBirthSourced(), 'BIRT', 1, 'small');
102
-	        if($grec->isDead())
103
-	            $html .= FunctionsPrint::formatIsSourcedIcon('E', $dindi->isDeathSourced(), 'DEAT', 1, 'small');
104
-	    }
105
-	    return $html;
97
+		$html = '';
98
+		if($grec instanceof \Fisharebest\Webtrees\Individual){
99
+			$dindi = new Individual($grec);
100
+			$html .= FunctionsPrint::formatIsSourcedIcon('R', $dindi->isSourced(), 'INDI', 1, 'small');
101
+			$html .= FunctionsPrint::formatIsSourcedIcon('E', $dindi->isBirthSourced(), 'BIRT', 1, 'small');
102
+			if($grec->isDead())
103
+				$html .= FunctionsPrint::formatIsSourcedIcon('E', $dindi->isDeathSourced(), 'DEAT', 1, 'small');
104
+		}
105
+		return $html;
106 106
 	}
107 107
 	
108 108
 	/**
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	 * @see \Fisharebest\Webtrees\Module\ModuleSidebarInterface::defaultSidebarOrder()
111 111
 	 */
112 112
 	public function defaultSidebarOrder() {
113
-	    return 15;
113
+		return 15;
114 114
 	}
115 115
 	
116 116
 	/**
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 	 * @see \Fisharebest\Webtrees\Module\ModuleSidebarInterface::hasSidebarContent()
119 119
 	 */
120 120
 	public function hasSidebarContent(){ 
121
-	    return true;
121
+		return true;
122 122
 	}
123 123
 	
124 124
 	/**
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 	 * @see \Fisharebest\Webtrees\Module\ModuleSidebarInterface::getSidebarAjaxContent()
127 127
 	 */
128 128
 	public function getSidebarAjaxContent() {
129
-	    return '';
129
+		return '';
130 130
 	}
131 131
 	
132 132
 	/**
@@ -134,17 +134,17 @@  discard block
 block discarded – undo
134 134
 	 * @see \Fisharebest\Webtrees\Module\ModuleSidebarInterface::getSidebarContent()
135 135
 	 */
136 136
 	public function getSidebarContent() {
137
-	    global $controller;
137
+		global $controller;
138 138
 	    
139
-	    ob_start();
140
-	    $root = $controller->getSignificantIndividual();
141
-	    if ($root) {
142
-	        $dindi = new Individual($root);
139
+		ob_start();
140
+		$root = $controller->getSignificantIndividual();
141
+		if ($root) {
142
+			$dindi = new Individual($root);
143 143
 	        	
144
-	        if (!$dindi->canDisplayIsSourced()) {
145
-	            echo '<div class="error">', I18N::translate('This information is private and cannot be shown.'), '</div>';
146
-	        } else {
147
-	            echo '
144
+			if (!$dindi->canDisplayIsSourced()) {
145
+				echo '<div class="error">', I18N::translate('This information is private and cannot be shown.'), '</div>';
146
+			} else {
147
+				echo '
148 148
 	                <table class="issourcedtable">
149 149
 	                   <tr>
150 150
 	                       <td class="slabel"> ' . GedcomTag::getLabel('INDI') . '</td>
@@ -155,35 +155,35 @@  discard block
 block discarded – undo
155 155
 	                       <td class="svalue">' . FunctionsPrint::formatIsSourcedIcon('E', $dindi->isBirthSourced(), 'BIRT', 1).'</td>
156 156
 	                   </tr>';
157 157
 	            
158
-	            $fams = $root->getSpouseFamilies();
159
-	            ($ct = count($fams)) > 1 ? $nb=1 : $nb=' ';	            
160
-	            foreach($fams as $fam){
161
-	                $dfam = new Family($fam);
162
-	                echo '
158
+				$fams = $root->getSpouseFamilies();
159
+				($ct = count($fams)) > 1 ? $nb=1 : $nb=' ';	            
160
+				foreach($fams as $fam){
161
+					$dfam = new Family($fam);
162
+					echo '
163 163
 	                    <tr>
164 164
 	                       <td class="slabel right">
165 165
 	                           <a href="' . $fam->getHtmlUrl() . '"> '. GedcomTag::getLabel('MARR');
166
-	                if($ct > 1){
167
-	                    echo ' ',$nb;
168
-	                    $nb++;
169
-	                }
170
-	                echo '     </a>
166
+					if($ct > 1){
167
+						echo ' ',$nb;
168
+						$nb++;
169
+					}
170
+					echo '     </a>
171 171
 	                       </td>
172 172
 	                       <td class="svalue">' . FunctionsPrint::formatIsSourcedIcon('E', $dfam->isMarriageSourced(), 'MARR', 1).'</td>
173 173
 	                   </tr>';
174
-	            }
174
+				}
175 175
 	            
176
-	            if( $root->isDead() )
177
-	                echo '
176
+				if( $root->isDead() )
177
+					echo '
178 178
 	                    <tr>
179 179
 	                       <td class="slabel">' . GedcomTag::getLabel('DEAT') . '</td>
180 180
 	                       <td class="svalue">' . FunctionsPrint::formatIsSourcedIcon('E', $dindi->isDeathSourced(), 'DEAT', 1).'</td>
181 181
 	                   </tr>';
182 182
 	            
183
-	            echo '</table>';
184
-	        }
185
-	    }
186
-	    return ob_get_clean();	    
183
+				echo '</table>';
184
+			}
185
+		}
186
+		return ob_get_clean();	    
187 187
 	}
188 188
 	
189 189
 	
Please login to merge, or discard this patch.
src/Webtrees/Module/GeoDispersionModule.php 1 patch
Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -24,82 +24,82 @@
 block discarded – undo
24 24
 class GeoDispersionModule extends AbstractModule implements ModuleConfigInterface, DependentInterface {
25 25
     
26 26
 	// How to update the database schema for this module
27
-    const SCHEMA_TARGET_VERSION   = 1;
28
-    const SCHEMA_SETTING_NAME     = 'MAJ_GEODISP_SCHEMA_VERSION';
29
-    const SCHEMA_MIGRATION_PREFIX = '\MyArtJaub\Webtrees\Module\GeoDispersion\Schema';
27
+	const SCHEMA_TARGET_VERSION   = 1;
28
+	const SCHEMA_SETTING_NAME     = 'MAJ_GEODISP_SCHEMA_VERSION';
29
+	const SCHEMA_MIGRATION_PREFIX = '\MyArtJaub\Webtrees\Module\GeoDispersion\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
-     * GeoDispersion analysis provider
36
-     * @var \MyArtJaub\Webtrees\Module\GeoDispersion\Model\GeoAnalysisProvider $provider
37
-     */
38
-    protected $provider;
34
+	/**
35
+	 * GeoDispersion analysis provider
36
+	 * @var \MyArtJaub\Webtrees\Module\GeoDispersion\Model\GeoAnalysisProvider $provider
37
+	 */
38
+	protected $provider;
39 39
     
40
-    /**
41
-     * {@inhericDoc}
42
-     */
43
-    public function getTitle() {
44
-        return /* I18N: Name of the “Hooks” module */ I18N::translate('Geographical Dispersion');
45
-    }
40
+	/**
41
+	 * {@inhericDoc}
42
+	 */
43
+	public function getTitle() {
44
+		return /* I18N: Name of the “Hooks” module */ I18N::translate('Geographical Dispersion');
45
+	}
46 46
     
47
-    /**
48
-     * {@inhericDoc}
49
-     */
50
-    public function getDescription() {
51
-        return /* I18N: Description of the “Hooks” module */ I18N::translate('Display the geographical dispersion of the root person’s Sosa ancestors.');
52
-    }
47
+	/**
48
+	 * {@inhericDoc}
49
+	 */
50
+	public function getDescription() {
51
+		return /* I18N: Description of the “Hooks” module */ I18N::translate('Display the geographical dispersion of the root person’s Sosa ancestors.');
52
+	}
53 53
     
54
-    /**
55
-     * {@inhericDoc}
56
-     */
57
-    public function modAction($mod_action) {
58
-        Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION);
54
+	/**
55
+	 * {@inhericDoc}
56
+	 */
57
+	public function modAction($mod_action) {
58
+		Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION);
59 59
         
60
-        \MyArtJaub\Webtrees\Mvc\Dispatcher::getInstance()->handle($this, $mod_action);
61
-    }
60
+		\MyArtJaub\Webtrees\Mvc\Dispatcher::getInstance()->handle($this, $mod_action);
61
+	}
62 62
     
63
-    /**
64
-     * {@inhericDoc}
65
-     * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink()
66
-     */
67
-    public function getConfigLink() {
68
-        Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION);
63
+	/**
64
+	 * {@inhericDoc}
65
+	 * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink()
66
+	 */
67
+	public function getConfigLink() {
68
+		Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION);
69 69
         
70
-        return 'module.php?mod=' . $this->getName() . '&amp;mod_action=AdminConfig';
71
-    }
70
+		return 'module.php?mod=' . $this->getName() . '&amp;mod_action=AdminConfig';
71
+	}
72 72
     
73
-    /**
74
-     * {@inhericDoc}
75
-     * @see \MyArtJaub\Webtrees\Module\DependentInterface::validatePrerequisites()
76
-     */
77
-    public function validatePrerequisites() {
78
-        return !is_null(Module::getModuleByName(Constants::MODULE_MAJ_SOSA_NAME));
79
-    }
73
+	/**
74
+	 * {@inhericDoc}
75
+	 * @see \MyArtJaub\Webtrees\Module\DependentInterface::validatePrerequisites()
76
+	 */
77
+	public function validatePrerequisites() {
78
+		return !is_null(Module::getModuleByName(Constants::MODULE_MAJ_SOSA_NAME));
79
+	}
80 80
     
81 81
 	/**
82 82
 	 * Get the GeoAnalysis Provider (initialise it if not done yet).
83 83
 	 *
84 84
 	 * @return \MyArtJaub\Webtrees\Module\GeoDispersion\Model\GeoAnalysisProvider
85 85
 	 */
86
-    public function getProvider() {
87
-        global $WT_TREE;
86
+	public function getProvider() {
87
+		global $WT_TREE;
88 88
         
89
-        if(!$this->provider) {
90
-            $this->provider = new GeoAnalysisProvider($WT_TREE);
91
-        }
92
-        return $this->provider;
93
-    }
89
+		if(!$this->provider) {
90
+			$this->provider = new GeoAnalysisProvider($WT_TREE);
91
+		}
92
+		return $this->provider;
93
+	}
94 94
 	
95 95
 	/**
96 96
 	 * Set the GeoAnalysis Provider.
97 97
 	 *
98 98
 	 * @return \MyArtJaub\Webtrees\Module\GeoDispersion\Model\GeoAnalysisProvider
99 99
 	 */
100
-    public function setProvider(GeoAnalysisProvider $provider) {
101
-        $this->provider = $provider;
102
-    }
100
+	public function setProvider(GeoAnalysisProvider $provider) {
101
+		$this->provider = $provider;
102
+	}
103 103
     
104 104
 
105 105
 }
Please login to merge, or discard this patch.