Completed
Push — master ( 113d57...b40ea8 )
by Jonathan
02:59
created
src/Webtrees/Module/Certificates/Model/CertificateFileProvider.php 2 patches
Indentation   +92 added lines, -92 removed lines patch added patch discarded remove patch
@@ -20,111 +20,111 @@
 block discarded – undo
20 20
  */
21 21
 class CertificateFileProvider implements CertificateProviderInterface {
22 22
     
23
-    /**
24
-     * Relative path to the root certificate folder
25
-     * @var string $root_path
26
-     */
27
-    protected $root_path;
23
+	/**
24
+	 * Relative path to the root certificate folder
25
+	 * @var string $root_path
26
+	 */
27
+	protected $root_path;
28 28
     
29
-    /**
30
-     * Reference tree
31
-     * @var Tree $tree
32
-     */
33
-    protected $tree;
29
+	/**
30
+	 * Reference tree
31
+	 * @var Tree $tree
32
+	 */
33
+	protected $tree;
34 34
     
35
-    /**
36
-     * Cached list of certificates' cities.
37
-     * @var (null|array) $cities_list
38
-     */
39
-    protected $cities_list = null;
35
+	/**
36
+	 * Cached list of certificates' cities.
37
+	 * @var (null|array) $cities_list
38
+	 */
39
+	protected $cities_list = null;
40 40
     
41
-    /**
42
-     * Constructor for the File Provider
43
-     * @param string $root_path
44
-     * @param Tree $tree
45
-     */
46
-    public function __construct($root_path, Tree $tree) {
47
-        $this->root_path = $root_path;
48
-        $this->tree = $tree;
49
-    }
41
+	/**
42
+	 * Constructor for the File Provider
43
+	 * @param string $root_path
44
+	 * @param Tree $tree
45
+	 */
46
+	public function __construct($root_path, Tree $tree) {
47
+		$this->root_path = $root_path;
48
+		$this->tree = $tree;
49
+	}
50 50
         
51
-    /**
52
-     * {@inhericDoc}
53
-     * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getRealCertificatesDirectory()
54
-     */
55
-    public function getRealCertificatesDirectory(){
56
-        return WT_DATA_DIR . $this->root_path;
57
-    }
51
+	/**
52
+	 * {@inhericDoc}
53
+	 * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getRealCertificatesDirectory()
54
+	 */
55
+	public function getRealCertificatesDirectory(){
56
+		return WT_DATA_DIR . $this->root_path;
57
+	}
58 58
     
59
-    /**
60
-     * {@inhericDoc}
61
-     * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getCitiesList()
62
-     */
63
-    public function getCitiesList(){
64
-        if(!isset($this->cities_list) || is_null($this->cities_list)){
65
-            $certdir = $this->getRealCertificatesDirectory();
66
-            $this->cities_list = array();
59
+	/**
60
+	 * {@inhericDoc}
61
+	 * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getCitiesList()
62
+	 */
63
+	public function getCitiesList(){
64
+		if(!isset($this->cities_list) || is_null($this->cities_list)){
65
+			$certdir = $this->getRealCertificatesDirectory();
66
+			$this->cities_list = array();
67 67
     
68
-            $dir = opendir($certdir);
68
+			$dir = opendir($certdir);
69 69
             
70
-            while($entry = readdir($dir)){
71
-                if($entry != '.' && $entry != '..' && is_dir($certdir.$entry)){
72
-                    $this->cities_list[]= Functions::encodeFileSystemToUtf8($entry);
73
-                }
74
-            }
75
-            sort($this->cities_list);
76
-        }
77
-        return $this->cities_list;
78
-    }
70
+			while($entry = readdir($dir)){
71
+				if($entry != '.' && $entry != '..' && is_dir($certdir.$entry)){
72
+					$this->cities_list[]= Functions::encodeFileSystemToUtf8($entry);
73
+				}
74
+			}
75
+			sort($this->cities_list);
76
+		}
77
+		return $this->cities_list;
78
+	}
79 79
     
80
-    /**
81
-     * {@inhericDoc}
82
-     * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getCertificatesList()
83
-     */
84
-    public function getCertificatesList($selCity){
80
+	/**
81
+	 * {@inhericDoc}
82
+	 * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getCertificatesList()
83
+	 */
84
+	public function getCertificatesList($selCity){
85 85
     
86
-        $selCity = Functions::encodeUtf8ToFileSystem($selCity);
86
+		$selCity = Functions::encodeUtf8ToFileSystem($selCity);
87 87
     
88
-        $certdir = $this->getRealCertificatesDirectory();
89
-        $tabCertif= array();
88
+		$certdir = $this->getRealCertificatesDirectory();
89
+		$tabCertif= array();
90 90
     
91
-        if(is_dir($certdir.$selCity)){
92
-            $dir=opendir($certdir.$selCity);
93
-            while($entry = readdir($dir)){
94
-                if($entry!='.' && $entry!='..' && !is_dir($certdir.$entry.'/')){
95
-                    $path = Functions::encodeFileSystemToUtf8($selCity.'/'.$entry);
96
-                    $certificate = new Certificate($path, $this->tree, $this);
97
-                    if(Functions::isImageTypeSupported($certificate->extension())){
98
-                        $tabCertif[] = 	$certificate;
99
-                    }
100
-                }
101
-            }
102
-        }
103
-        return $tabCertif;
104
-    }
91
+		if(is_dir($certdir.$selCity)){
92
+			$dir=opendir($certdir.$selCity);
93
+			while($entry = readdir($dir)){
94
+				if($entry!='.' && $entry!='..' && !is_dir($certdir.$entry.'/')){
95
+					$path = Functions::encodeFileSystemToUtf8($selCity.'/'.$entry);
96
+					$certificate = new Certificate($path, $this->tree, $this);
97
+					if(Functions::isImageTypeSupported($certificate->extension())){
98
+						$tabCertif[] = 	$certificate;
99
+					}
100
+				}
101
+			}
102
+		}
103
+		return $tabCertif;
104
+	}
105 105
     
106
-    /**
107
-     * {@inhericDoc}
108
-     * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getCertificatesListBeginWith()
109
-     */
110
-    public function getCertificatesListBeginWith($city, $contains, $limit= 9999){
111
-        $tabFiles= array();
112
-        $dirPath= $this->getRealCertificatesDirectory() . Functions::encodeUtf8ToFileSystem($city).'/';
113
-        $contains = utf8_decode($contains);
114
-        $nbCert = 0;
106
+	/**
107
+	 * {@inhericDoc}
108
+	 * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getCertificatesListBeginWith()
109
+	 */
110
+	public function getCertificatesListBeginWith($city, $contains, $limit= 9999){
111
+		$tabFiles= array();
112
+		$dirPath= $this->getRealCertificatesDirectory() . Functions::encodeUtf8ToFileSystem($city).'/';
113
+		$contains = utf8_decode($contains);
114
+		$nbCert = 0;
115 115
     
116
-        if(is_dir($dirPath)){
117
-            $dir=opendir($dirPath);
118
-            while(($entry = readdir($dir)) && $nbCert < $limit){
119
-                if($entry!='.' && $entry!='..' && $entry!='Thumbs.db' &&!is_dir($dirPath.$entry.'/') && stripos($entry, $contains)!== false){
120
-                    $tabFiles[]= Functions::encodeFileSystemToUtf8($entry);
121
-                    $nbCert++;
122
-                }
123
-            }
124
-        }
125
-        sort($tabFiles);
126
-        return $tabFiles;
127
-    }
116
+		if(is_dir($dirPath)){
117
+			$dir=opendir($dirPath);
118
+			while(($entry = readdir($dir)) && $nbCert < $limit){
119
+				if($entry!='.' && $entry!='..' && $entry!='Thumbs.db' &&!is_dir($dirPath.$entry.'/') && stripos($entry, $contains)!== false){
120
+					$tabFiles[]= Functions::encodeFileSystemToUtf8($entry);
121
+					$nbCert++;
122
+				}
123
+			}
124
+		}
125
+		sort($tabFiles);
126
+		return $tabFiles;
127
+	}
128 128
     
129 129
 }
130 130
 
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -52,24 +52,24 @@  discard block
 block discarded – undo
52 52
      * {@inhericDoc}
53 53
      * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getRealCertificatesDirectory()
54 54
      */
55
-    public function getRealCertificatesDirectory(){
56
-        return WT_DATA_DIR . $this->root_path;
55
+    public function getRealCertificatesDirectory() {
56
+        return WT_DATA_DIR.$this->root_path;
57 57
     }
58 58
     
59 59
     /**
60 60
      * {@inhericDoc}
61 61
      * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getCitiesList()
62 62
      */
63
-    public function getCitiesList(){
64
-        if(!isset($this->cities_list) || is_null($this->cities_list)){
63
+    public function getCitiesList() {
64
+        if (!isset($this->cities_list) || is_null($this->cities_list)) {
65 65
             $certdir = $this->getRealCertificatesDirectory();
66 66
             $this->cities_list = array();
67 67
     
68 68
             $dir = opendir($certdir);
69 69
             
70
-            while($entry = readdir($dir)){
71
-                if($entry != '.' && $entry != '..' && is_dir($certdir.$entry)){
72
-                    $this->cities_list[]= Functions::encodeFileSystemToUtf8($entry);
70
+            while ($entry = readdir($dir)) {
71
+                if ($entry != '.' && $entry != '..' && is_dir($certdir.$entry)) {
72
+                    $this->cities_list[] = Functions::encodeFileSystemToUtf8($entry);
73 73
                 }
74 74
             }
75 75
             sort($this->cities_list);
@@ -81,21 +81,21 @@  discard block
 block discarded – undo
81 81
      * {@inhericDoc}
82 82
      * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getCertificatesList()
83 83
      */
84
-    public function getCertificatesList($selCity){
84
+    public function getCertificatesList($selCity) {
85 85
     
86 86
         $selCity = Functions::encodeUtf8ToFileSystem($selCity);
87 87
     
88 88
         $certdir = $this->getRealCertificatesDirectory();
89
-        $tabCertif= array();
89
+        $tabCertif = array();
90 90
     
91
-        if(is_dir($certdir.$selCity)){
92
-            $dir=opendir($certdir.$selCity);
93
-            while($entry = readdir($dir)){
94
-                if($entry!='.' && $entry!='..' && !is_dir($certdir.$entry.'/')){
91
+        if (is_dir($certdir.$selCity)) {
92
+            $dir = opendir($certdir.$selCity);
93
+            while ($entry = readdir($dir)) {
94
+                if ($entry != '.' && $entry != '..' && !is_dir($certdir.$entry.'/')) {
95 95
                     $path = Functions::encodeFileSystemToUtf8($selCity.'/'.$entry);
96 96
                     $certificate = new Certificate($path, $this->tree, $this);
97
-                    if(Functions::isImageTypeSupported($certificate->extension())){
98
-                        $tabCertif[] = 	$certificate;
97
+                    if (Functions::isImageTypeSupported($certificate->extension())) {
98
+                        $tabCertif[] = $certificate;
99 99
                     }
100 100
                 }
101 101
             }
@@ -107,17 +107,17 @@  discard block
 block discarded – undo
107 107
      * {@inhericDoc}
108 108
      * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getCertificatesListBeginWith()
109 109
      */
110
-    public function getCertificatesListBeginWith($city, $contains, $limit= 9999){
111
-        $tabFiles= array();
112
-        $dirPath= $this->getRealCertificatesDirectory() . Functions::encodeUtf8ToFileSystem($city).'/';
110
+    public function getCertificatesListBeginWith($city, $contains, $limit = 9999) {
111
+        $tabFiles = array();
112
+        $dirPath = $this->getRealCertificatesDirectory().Functions::encodeUtf8ToFileSystem($city).'/';
113 113
         $contains = utf8_decode($contains);
114 114
         $nbCert = 0;
115 115
     
116
-        if(is_dir($dirPath)){
117
-            $dir=opendir($dirPath);
118
-            while(($entry = readdir($dir)) && $nbCert < $limit){
119
-                if($entry!='.' && $entry!='..' && $entry!='Thumbs.db' &&!is_dir($dirPath.$entry.'/') && stripos($entry, $contains)!== false){
120
-                    $tabFiles[]= Functions::encodeFileSystemToUtf8($entry);
116
+        if (is_dir($dirPath)) {
117
+            $dir = opendir($dirPath);
118
+            while (($entry = readdir($dir)) && $nbCert < $limit) {
119
+                if ($entry != '.' && $entry != '..' && $entry != 'Thumbs.db' && !is_dir($dirPath.$entry.'/') && stripos($entry, $contains) !== false) {
120
+                    $tabFiles[] = Functions::encodeFileSystemToUtf8($entry);
121 121
                     $nbCert++;
122 122
                 }
123 123
             }
Please login to merge, or discard this patch.
src/Webtrees/Module/Certificates/CertificateController.php 3 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -124,7 +124,9 @@
 block discarded – undo
124 124
         
125 125
         $cid   = Filter::get('cid');
126 126
         $certificate = null;
127
-        if(!empty($cid)) $certificate =  Certificate::getInstance($cid, $WT_TREE, null, $this->provider);
127
+        if(!empty($cid)) {
128
+        	$certificate =  Certificate::getInstance($cid, $WT_TREE, null, $this->provider);
129
+        }
128 130
         
129 131
         $imageBuilder = new ImageBuilder($certificate);
130 132
         
Please login to merge, or discard this patch.
Indentation   +148 added lines, -148 removed lines patch added patch discarded remove patch
@@ -32,158 +32,158 @@  discard block
 block discarded – undo
32 32
  */
33 33
 class CertificateController extends MvcController
34 34
 {
35
-    /**
36
-     * Certificate Provider
37
-     * @var CertificateProviderInterface $provider
38
-     */
39
-    protected $provider;
35
+	/**
36
+	 * Certificate Provider
37
+	 * @var CertificateProviderInterface $provider
38
+	 */
39
+	protected $provider;
40 40
     
41
-    /**
42
-     * Constructor for Certificate controller
43
-     * @param AbstractModule $module
44
-     */
45
-    public function __construct(AbstractModule $module) {
46
-        parent::__construct($module);
47
-        
48
-        $this->provider = $this->module->getProvider();
49
-    }
41
+	/**
42
+	 * Constructor for Certificate controller
43
+	 * @param AbstractModule $module
44
+	 */
45
+	public function __construct(AbstractModule $module) {
46
+		parent::__construct($module);
47
+        
48
+		$this->provider = $this->module->getProvider();
49
+	}
50 50
     
51 51
     
52
-    /**
53
-     * Pages
54
-     */
55
-        
56
-    /**
57
-     * Certificate@index
58
-     */
59
-    public function index() {
60
-        global $WT_TREE;
61
-        
62
-        $controller = new PageController();
63
-        $controller
64
-        ->setPageTitle(I18N::translate('Certificate'))
65
-        ->restrictAccess(
66
-            $this->module->getSetting('MAJ_SHOW_CERT', Auth::PRIV_HIDE) >= Auth::accessLevel($WT_TREE)
67
-        );
68
-        
69
-        $cid = Filter::get('cid');
70
-        
71
-        $certificate = null;
72
-        if(!empty($cid) && strlen($cid) > 22){
73
-            $certificate = Certificate::getInstance($cid, $WT_TREE, null, $this->provider);
74
-        }
75
-        
76
-        $data = new ViewBag();
77
-        $data->set('title', $controller->getPageTitle());
78
-        
79
-        $data->set('has_certif', false);
80
-        if($certificate) {
81
-            $controller->restrictAccess($certificate->canShow());
82
-            $data->set('title', $certificate->getTitle());
83
-            $data->set('has_certif', true);
84
-            $data->set('certificate', $certificate);
52
+	/**
53
+	 * Pages
54
+	 */
55
+        
56
+	/**
57
+	 * Certificate@index
58
+	 */
59
+	public function index() {
60
+		global $WT_TREE;
61
+        
62
+		$controller = new PageController();
63
+		$controller
64
+		->setPageTitle(I18N::translate('Certificate'))
65
+		->restrictAccess(
66
+			$this->module->getSetting('MAJ_SHOW_CERT', Auth::PRIV_HIDE) >= Auth::accessLevel($WT_TREE)
67
+		);
68
+        
69
+		$cid = Filter::get('cid');
70
+        
71
+		$certificate = null;
72
+		if(!empty($cid) && strlen($cid) > 22){
73
+			$certificate = Certificate::getInstance($cid, $WT_TREE, null, $this->provider);
74
+		}
75
+        
76
+		$data = new ViewBag();
77
+		$data->set('title', $controller->getPageTitle());
78
+        
79
+		$data->set('has_certif', false);
80
+		if($certificate) {
81
+			$controller->restrictAccess($certificate->canShow());
82
+			$data->set('title', $certificate->getTitle());
83
+			$data->set('has_certif', true);
84
+			$data->set('certificate', $certificate);
85 85
             
86
-            $data->set(
87
-                'url_certif_city', 
88
-                'module.php?mod=' . Constants::MODULE_MAJ_CERTIF_NAME . 
89
-                    '&mod_action=Certificate@listAll' .
90
-                    '&ged=' . $WT_TREE->getNameUrl() .
91
-                    '&city=' . Functions::encryptToSafeBase64($certificate->getCity())
92
-            );
86
+			$data->set(
87
+				'url_certif_city', 
88
+				'module.php?mod=' . Constants::MODULE_MAJ_CERTIF_NAME . 
89
+					'&mod_action=Certificate@listAll' .
90
+					'&ged=' . $WT_TREE->getNameUrl() .
91
+					'&city=' . Functions::encryptToSafeBase64($certificate->getCity())
92
+			);
93 93
             
94
-            $controller->addInlineJavascript('
94
+			$controller->addInlineJavascript('
95 95
                 jQuery("#certificate-tabs").tabs();
96 96
 			    jQuery("#certificate-tabs").css("visibility", "visible");    
97 97
             ');
98 98
             
99
-            $data->set('has_linked_indis', false);
100
-            $data->set('has_linked_fams', false);
99
+			$data->set('has_linked_indis', false);
100
+			$data->set('has_linked_fams', false);
101 101
             
102
-            $linked_indis = $certificate->linkedIndividuals();
103
-            $linked_fams = $certificate->linkedFamilies();
102
+			$linked_indis = $certificate->linkedIndividuals();
103
+			$linked_fams = $certificate->linkedFamilies();
104 104
                         
105
-            if($linked_indis && count($linked_indis) > 0) {
106
-                $data->set('has_linked_indis', true);
107
-                $data->set('linked_indis', $linked_indis);
108
-            }
105
+			if($linked_indis && count($linked_indis) > 0) {
106
+				$data->set('has_linked_indis', true);
107
+				$data->set('linked_indis', $linked_indis);
108
+			}
109 109
             
110
-            if(!empty($linked_fams)) {
111
-                $data->set('has_linked_fams', true);
112
-                $data->set('linked_fams', $linked_fams);
113
-            }
114
-        }
115
-        
116
-        ViewFactory::make('Certificate', $this, $controller, $data)->render();
117
-    }
110
+			if(!empty($linked_fams)) {
111
+				$data->set('has_linked_fams', true);
112
+				$data->set('linked_fams', $linked_fams);
113
+			}
114
+		}
115
+        
116
+		ViewFactory::make('Certificate', $this, $controller, $data)->render();
117
+	}
118 118
     
119
-    /**
120
-     * Certificate@image
121
-     */
122
-    public function image() {      
123
-        global $WT_TREE;
119
+	/**
120
+	 * Certificate@image
121
+	 */
122
+	public function image() {      
123
+		global $WT_TREE;
124 124
         
125
-        $cid   = Filter::get('cid');
126
-        $certificate = null;
127
-        if(!empty($cid)) $certificate =  Certificate::getInstance($cid, $WT_TREE, null, $this->provider);
125
+		$cid   = Filter::get('cid');
126
+		$certificate = null;
127
+		if(!empty($cid)) $certificate =  Certificate::getInstance($cid, $WT_TREE, null, $this->provider);
128 128
         
129
-        $imageBuilder = new ImageBuilder($certificate);
129
+		$imageBuilder = new ImageBuilder($certificate);
130 130
         
131
-        if (!empty(Filter::get('cb'))) {
132
-            $imageBuilder->setExpireOffset($imageBuilder->getExpireOffset() * 7);
133
-        }
131
+		if (!empty(Filter::get('cb'))) {
132
+			$imageBuilder->setExpireOffset($imageBuilder->getExpireOffset() * 7);
133
+		}
134 134
         
135
-        $imageBuilder
136
-            ->setShowWatermark(Auth::accessLevel($WT_TREE) >= $this->module->getSetting('MAJ_SHOW_NO_WATERMARK', Auth::PRIV_HIDE))
137
-            ->setFontMaxSize($this->module->getSetting('MAJ_WM_FONT_MAXSIZE', 18))
138
-            ->setFontColor($this->module->getSetting('MAJ_WM_FONT_COLOR', '#4D6DF3'))
139
-        ;
135
+		$imageBuilder
136
+			->setShowWatermark(Auth::accessLevel($WT_TREE) >= $this->module->getSetting('MAJ_SHOW_NO_WATERMARK', Auth::PRIV_HIDE))
137
+			->setFontMaxSize($this->module->getSetting('MAJ_WM_FONT_MAXSIZE', 18))
138
+			->setFontColor($this->module->getSetting('MAJ_WM_FONT_COLOR', '#4D6DF3'))
139
+		;
140 140
         
141
-        $imageBuilder->render();
141
+		$imageBuilder->render();
142 142
         
143
-    }
143
+	}
144 144
     
145
-    /**
146
-     * Certificate@listAll
147
-     */
148
-    public function listAll() {
149
-        global $WT_TREE;
150
-        
151
-        $controller = new PageController();
152
-        $controller
153
-            ->setPageTitle(I18N::translate('Certificates'))
154
-            ->restrictAccess(
155
-                $this->module->getSetting('MAJ_SHOW_CERT', Auth::PRIV_HIDE) >= Auth::accessLevel($WT_TREE)
156
-            );
157
-        
158
-        $city = Filter::get('city');
159
-        
160
-        if(!empty($city) && strlen($city) > 22){
161
-            $city = Functions::decryptFromSafeBase64($city);
162
-            $controller->setPageTitle(I18N::translate('Certificates for %s', $city));
163
-        }
164
-        
165
-        $data = new ViewBag();
166
-        $data->set('title', $controller->getPageTitle());
167
-        $data->set('url_module', $this->module->getName());
168
-        $data->set('url_action', 'Certificate@listAll');
169
-        $data->set('url_ged', $WT_TREE->getNameUrl());
170
-        
171
-        $data->set('cities', $this->provider->getCitiesList());
172
-        $data->set('selected_city', $city);
173
-        
174
-        $data->set('has_list', false);        
175
-        if(!empty($city)) {            
176
-            $table_id = 'table-certiflist-' . Uuid::uuid4();
145
+	/**
146
+	 * Certificate@listAll
147
+	 */
148
+	public function listAll() {
149
+		global $WT_TREE;
150
+        
151
+		$controller = new PageController();
152
+		$controller
153
+			->setPageTitle(I18N::translate('Certificates'))
154
+			->restrictAccess(
155
+				$this->module->getSetting('MAJ_SHOW_CERT', Auth::PRIV_HIDE) >= Auth::accessLevel($WT_TREE)
156
+			);
157
+        
158
+		$city = Filter::get('city');
159
+        
160
+		if(!empty($city) && strlen($city) > 22){
161
+			$city = Functions::decryptFromSafeBase64($city);
162
+			$controller->setPageTitle(I18N::translate('Certificates for %s', $city));
163
+		}
164
+        
165
+		$data = new ViewBag();
166
+		$data->set('title', $controller->getPageTitle());
167
+		$data->set('url_module', $this->module->getName());
168
+		$data->set('url_action', 'Certificate@listAll');
169
+		$data->set('url_ged', $WT_TREE->getNameUrl());
170
+        
171
+		$data->set('cities', $this->provider->getCitiesList());
172
+		$data->set('selected_city', $city);
173
+        
174
+		$data->set('has_list', false);        
175
+		if(!empty($city)) {            
176
+			$table_id = 'table-certiflist-' . Uuid::uuid4();
177 177
             
178
-            $certif_list = $this->provider->getCertificatesList($city);            
179
-            if(!empty($certif_list)) {                
180
-                $data->set('has_list', true);
181
-                $data->set('table_id', $table_id);
182
-                $data->set('certificate_list', $certif_list);
178
+			$certif_list = $this->provider->getCertificatesList($city);            
179
+			if(!empty($certif_list)) {                
180
+				$data->set('has_list', true);
181
+				$data->set('table_id', $table_id);
182
+				$data->set('certificate_list', $certif_list);
183 183
                 
184
-                $controller
185
-                    ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)
186
-                    ->addInlineJavascript('
184
+				$controller
185
+					->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)
186
+					->addInlineJavascript('
187 187
 				        jQuery.fn.dataTableExt.oSort["text-asc"] = textCompareAsc;
188 188
 				        jQuery.fn.dataTableExt.oSort["text-desc"] = textCompareDesc;
189 189
                         
@@ -205,29 +205,29 @@  discard block
 block discarded – undo
205 205
         				jQuery(".certificate-list").css("visibility", "visible");
206 206
         				jQuery(".loading-image").css("display", "none");
207 207
                     ');
208
-            }
209
-        }
208
+			}
209
+		}
210 210
         
211
-        ViewFactory::make('CertificatesList', $this, $controller, $data)->render();
211
+		ViewFactory::make('CertificatesList', $this, $controller, $data)->render();
212 212
         
213
-    }
213
+	}
214 214
     
215
-    /**
216
-     * Certificate@autocomplete
217
-     */
218
-    public function autocomplete() {
219
-        global $WT_TREE;
215
+	/**
216
+	 * Certificate@autocomplete
217
+	 */
218
+	public function autocomplete() {
219
+		global $WT_TREE;
220 220
         
221
-        $controller = new JsonController();
221
+		$controller = new JsonController();
222 222
         
223
-        $city = Filter::get('city');
224
-        $contains = Filter::get('term');        
223
+		$city = Filter::get('city');
224
+		$contains = Filter::get('term');        
225 225
 
226
-        $controller
227
-            ->restrictAccess(Auth::isEditor($WT_TREE) && !empty($city) && !empty($contains))
228
-            ->pageHeader();
226
+		$controller
227
+			->restrictAccess(Auth::isEditor($WT_TREE) && !empty($city) && !empty($contains))
228
+			->pageHeader();
229 229
         
230
-        $listCert = $this->provider->getCertificatesListBeginWith($city, $contains); 
231
-        $controller->encode($listCert);
232
-    }
230
+		$listCert = $this->provider->getCertificatesListBeginWith($city, $contains); 
231
+		$controller->encode($listCert);
232
+	}
233 233
 }
234 234
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
         $cid = Filter::get('cid');
70 70
         
71 71
         $certificate = null;
72
-        if(!empty($cid) && strlen($cid) > 22){
72
+        if (!empty($cid) && strlen($cid) > 22) {
73 73
             $certificate = Certificate::getInstance($cid, $WT_TREE, null, $this->provider);
74 74
         }
75 75
         
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
         $data->set('title', $controller->getPageTitle());
78 78
         
79 79
         $data->set('has_certif', false);
80
-        if($certificate) {
80
+        if ($certificate) {
81 81
             $controller->restrictAccess($certificate->canShow());
82 82
             $data->set('title', $certificate->getTitle());
83 83
             $data->set('has_certif', true);
@@ -85,10 +85,10 @@  discard block
 block discarded – undo
85 85
             
86 86
             $data->set(
87 87
                 'url_certif_city', 
88
-                'module.php?mod=' . Constants::MODULE_MAJ_CERTIF_NAME . 
89
-                    '&mod_action=Certificate@listAll' .
90
-                    '&ged=' . $WT_TREE->getNameUrl() .
91
-                    '&city=' . Functions::encryptToSafeBase64($certificate->getCity())
88
+                'module.php?mod='.Constants::MODULE_MAJ_CERTIF_NAME. 
89
+                    '&mod_action=Certificate@listAll'.
90
+                    '&ged='.$WT_TREE->getNameUrl().
91
+                    '&city='.Functions::encryptToSafeBase64($certificate->getCity())
92 92
             );
93 93
             
94 94
             $controller->addInlineJavascript('
@@ -102,12 +102,12 @@  discard block
 block discarded – undo
102 102
             $linked_indis = $certificate->linkedIndividuals();
103 103
             $linked_fams = $certificate->linkedFamilies();
104 104
                         
105
-            if($linked_indis && count($linked_indis) > 0) {
105
+            if ($linked_indis && count($linked_indis) > 0) {
106 106
                 $data->set('has_linked_indis', true);
107 107
                 $data->set('linked_indis', $linked_indis);
108 108
             }
109 109
             
110
-            if(!empty($linked_fams)) {
110
+            if (!empty($linked_fams)) {
111 111
                 $data->set('has_linked_fams', true);
112 112
                 $data->set('linked_fams', $linked_fams);
113 113
             }
@@ -122,9 +122,9 @@  discard block
 block discarded – undo
122 122
     public function image() {      
123 123
         global $WT_TREE;
124 124
         
125
-        $cid   = Filter::get('cid');
125
+        $cid = Filter::get('cid');
126 126
         $certificate = null;
127
-        if(!empty($cid)) $certificate =  Certificate::getInstance($cid, $WT_TREE, null, $this->provider);
127
+        if (!empty($cid)) $certificate = Certificate::getInstance($cid, $WT_TREE, null, $this->provider);
128 128
         
129 129
         $imageBuilder = new ImageBuilder($certificate);
130 130
         
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
         
158 158
         $city = Filter::get('city');
159 159
         
160
-        if(!empty($city) && strlen($city) > 22){
160
+        if (!empty($city) && strlen($city) > 22) {
161 161
             $city = Functions::decryptFromSafeBase64($city);
162 162
             $controller->setPageTitle(I18N::translate('Certificates for %s', $city));
163 163
         }
@@ -172,11 +172,11 @@  discard block
 block discarded – undo
172 172
         $data->set('selected_city', $city);
173 173
         
174 174
         $data->set('has_list', false);        
175
-        if(!empty($city)) {            
176
-            $table_id = 'table-certiflist-' . Uuid::uuid4();
175
+        if (!empty($city)) {            
176
+            $table_id = 'table-certiflist-'.Uuid::uuid4();
177 177
             
178 178
             $certif_list = $this->provider->getCertificatesList($city);            
179
-            if(!empty($certif_list)) {                
179
+            if (!empty($certif_list)) {                
180 180
                 $data->set('has_list', true);
181 181
                 $data->set('table_id', $table_id);
182 182
                 $data->set('certificate_list', $certif_list);
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 				        jQuery.fn.dataTableExt.oSort["text-desc"] = textCompareDesc;
189 189
                         
190 190
                         jQuery("#'.$table_id.'").dataTable( {
191
-        					dom: \'<"H"<"filtersH_' . $table_id . '">T<"dt-clear">pf<"dt-clear">irl>t<"F"pl<"dt-clear"><"filtersF_' . $table_id . '">>\',
191
+        					dom: \'<"H"<"filtersH_' . $table_id.'">T<"dt-clear">pf<"dt-clear">irl>t<"F"pl<"dt-clear"><"filtersF_'.$table_id.'">>\',
192 192
     					    '.I18N::datatablesI18N().',
193 193
     					    jQueryUI: true,
194 194
         					autoWidth: false,
Please login to merge, or discard this patch.
src/Webtrees/Module/Hooks/AdminConfigController.php 3 patches
Indentation   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -29,89 +29,89 @@  discard block
 block discarded – undo
29 29
  */
30 30
 class AdminConfigController extends MvcController
31 31
 {
32
-    /**
33
-     * Manage updates sent from the AdminConfig@index form.
34
-     */
35
-    protected function update() {
36
-        if(Auth::isAdmin()){
37
-            $ihooks = HookProvider::getInstance()->getInstalledHooks();
32
+	/**
33
+	 * Manage updates sent from the AdminConfig@index form.
34
+	 */
35
+	protected function update() {
36
+		if(Auth::isAdmin()){
37
+			$ihooks = HookProvider::getInstance()->getInstalledHooks();
38 38
             	
39
-            $module_names= Database::prepare(
40
-                "SELECT module_name FROM `##module` WHERE status='disabled'"
41
-            )->fetchOneColumn();
39
+			$module_names= Database::prepare(
40
+				"SELECT module_name FROM `##module` WHERE status='disabled'"
41
+			)->fetchOneColumn();
42 42
             	
43
-            if($ihooks !== null){
44
-                foreach ($ihooks as $ihook => $params) {
45
-                    if(Filter::post('hook-' . $params['id']) === 'yes') {                    
46
-                        $array_hook = explode('#', $ihook);
47
-                        //Update status
48
-                        $new_status= Filter::postBool('status-' . $params['id']);
49
-                        if(in_array($array_hook[0], $module_names)) $new_status = false;
50
-                        $previous_status = $params['status'];
51
-                        if ($new_status !== null) {
52
-                            $new_status= $new_status ? 'enabled' : 'disabled';
53
-                            if($new_status != $previous_status){
54
-                                $chook = new Hook($array_hook[1], $array_hook[2]);
55
-                                switch($new_status){
56
-                                    case 'enabled':
57
-                                        $chook->enable($array_hook[0]);
58
-                                        break;
59
-                                    case 'disabled':
60
-                                        $chook->disable($array_hook[0]);
61
-                                        break;
62
-                                    default:
63
-                                        break;
64
-                                }
65
-                            }
66
-                        }
43
+			if($ihooks !== null){
44
+				foreach ($ihooks as $ihook => $params) {
45
+					if(Filter::post('hook-' . $params['id']) === 'yes') {                    
46
+						$array_hook = explode('#', $ihook);
47
+						//Update status
48
+						$new_status= Filter::postBool('status-' . $params['id']);
49
+						if(in_array($array_hook[0], $module_names)) $new_status = false;
50
+						$previous_status = $params['status'];
51
+						if ($new_status !== null) {
52
+							$new_status= $new_status ? 'enabled' : 'disabled';
53
+							if($new_status != $previous_status){
54
+								$chook = new Hook($array_hook[1], $array_hook[2]);
55
+								switch($new_status){
56
+									case 'enabled':
57
+										$chook->enable($array_hook[0]);
58
+										break;
59
+									case 'disabled':
60
+										$chook->disable($array_hook[0]);
61
+										break;
62
+									default:
63
+										break;
64
+								}
65
+							}
66
+						}
67 67
                         
68
-                        //Update priority
69
-                        $new_priority = Filter::postInteger("moduleorder-{$params['id']}");
70
-                        $previous_priority = $params['priority'];
71
-                        if ($new_priority !== null) {
72
-                            if($new_priority != $previous_priority){
73
-                                $chook = new Hook($array_hook[1], $array_hook[2]);
74
-                                $chook->setPriority($array_hook[0], $new_priority);
75
-                            }
76
-                        }
77
-                    }
78
-                }
79
-            }
80
-        }
81
-    }
68
+						//Update priority
69
+						$new_priority = Filter::postInteger("moduleorder-{$params['id']}");
70
+						$previous_priority = $params['priority'];
71
+						if ($new_priority !== null) {
72
+							if($new_priority != $previous_priority){
73
+								$chook = new Hook($array_hook[1], $array_hook[2]);
74
+								$chook->setPriority($array_hook[0], $new_priority);
75
+							}
76
+						}
77
+					}
78
+				}
79
+			}
80
+		}
81
+	}
82 82
     
83
-    /**
84
-     * Pages
85
-     */
83
+	/**
84
+	 * Pages
85
+	 */
86 86
         
87
-    /**
88
-     * AdminConfig@index
89
-     */
90
-    public function index() {      
91
-        global $WT_TREE;
87
+	/**
88
+	 * AdminConfig@index
89
+	 */
90
+	public function index() {      
91
+		global $WT_TREE;
92 92
         
93
-        HookProvider::getInstance()->updateHooks();
93
+		HookProvider::getInstance()->updateHooks();
94 94
         
95
-        $action = Filter::post('action');        
96
-        if($action == 'update' && Filter::checkCsrf()) $this->update();
95
+		$action = Filter::post('action');        
96
+		if($action == 'update' && Filter::checkCsrf()) $this->update();
97 97
         
98
-        Theme::theme(new AdministrationTheme)->init($WT_TREE);        
99
-        $ctrl = new PageController();
100
-        $ctrl
101
-            ->restrictAccess(Auth::isAdmin())
102
-            ->setPageTitle($this->module->getTitle());
98
+		Theme::theme(new AdministrationTheme)->init($WT_TREE);        
99
+		$ctrl = new PageController();
100
+		$ctrl
101
+			->restrictAccess(Auth::isAdmin())
102
+			->setPageTitle($this->module->getTitle());
103 103
         
104
-        $table_id = 'table-installedhooks-' . Uuid::uuid4();
104
+		$table_id = 'table-installedhooks-' . Uuid::uuid4();
105 105
 
106
-        $view_bag = new ViewBag();
107
-        $view_bag->set('title', $ctrl->getPageTitle());
108
-        $view_bag->set('table_id', $table_id);
109
-        $view_bag->set('hook_list', HookProvider::getInstance()->getRawInstalledHooks());
106
+		$view_bag = new ViewBag();
107
+		$view_bag->set('title', $ctrl->getPageTitle());
108
+		$view_bag->set('table_id', $table_id);
109
+		$view_bag->set('hook_list', HookProvider::getInstance()->getRawInstalledHooks());
110 110
         
111
-        $ctrl
112
-        ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)
113
-        ->addExternalJavascript(WT_DATATABLES_BOOTSTRAP_JS_URL)
114
-        ->addInlineJavascript('
111
+		$ctrl
112
+		->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)
113
+		->addExternalJavascript(WT_DATATABLES_BOOTSTRAP_JS_URL)
114
+		->addInlineJavascript('
115 115
 		  	jQuery(document).ready(function() {
116 116
 				jQuery("#'.$table_id.'").dataTable( {
117 117
 					'.I18N::datatablesI18N().',		
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 			});
132 132
 		');
133 133
         
134
-        ViewFactory::make('AdminConfig', $this, $ctrl, $view_bag)->render();
135
-    }
134
+		ViewFactory::make('AdminConfig', $this, $ctrl, $view_bag)->render();
135
+	}
136 136
         
137 137
 }
138 138
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -33,26 +33,26 @@  discard block
 block discarded – undo
33 33
      * Manage updates sent from the AdminConfig@index form.
34 34
      */
35 35
     protected function update() {
36
-        if(Auth::isAdmin()){
36
+        if (Auth::isAdmin()) {
37 37
             $ihooks = HookProvider::getInstance()->getInstalledHooks();
38 38
             	
39
-            $module_names= Database::prepare(
39
+            $module_names = Database::prepare(
40 40
                 "SELECT module_name FROM `##module` WHERE status='disabled'"
41 41
             )->fetchOneColumn();
42 42
             	
43
-            if($ihooks !== null){
43
+            if ($ihooks !== null) {
44 44
                 foreach ($ihooks as $ihook => $params) {
45
-                    if(Filter::post('hook-' . $params['id']) === 'yes') {                    
45
+                    if (Filter::post('hook-'.$params['id']) === 'yes') {                    
46 46
                         $array_hook = explode('#', $ihook);
47 47
                         //Update status
48
-                        $new_status= Filter::postBool('status-' . $params['id']);
49
-                        if(in_array($array_hook[0], $module_names)) $new_status = false;
48
+                        $new_status = Filter::postBool('status-'.$params['id']);
49
+                        if (in_array($array_hook[0], $module_names)) $new_status = false;
50 50
                         $previous_status = $params['status'];
51 51
                         if ($new_status !== null) {
52
-                            $new_status= $new_status ? 'enabled' : 'disabled';
53
-                            if($new_status != $previous_status){
52
+                            $new_status = $new_status ? 'enabled' : 'disabled';
53
+                            if ($new_status != $previous_status) {
54 54
                                 $chook = new Hook($array_hook[1], $array_hook[2]);
55
-                                switch($new_status){
55
+                                switch ($new_status) {
56 56
                                     case 'enabled':
57 57
                                         $chook->enable($array_hook[0]);
58 58
                                         break;
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
                         $new_priority = Filter::postInteger("moduleorder-{$params['id']}");
70 70
                         $previous_priority = $params['priority'];
71 71
                         if ($new_priority !== null) {
72
-                            if($new_priority != $previous_priority){
72
+                            if ($new_priority != $previous_priority) {
73 73
                                 $chook = new Hook($array_hook[1], $array_hook[2]);
74 74
                                 $chook->setPriority($array_hook[0], $new_priority);
75 75
                             }
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
         HookProvider::getInstance()->updateHooks();
94 94
         
95 95
         $action = Filter::post('action');        
96
-        if($action == 'update' && Filter::checkCsrf()) $this->update();
96
+        if ($action == 'update' && Filter::checkCsrf()) $this->update();
97 97
         
98 98
         Theme::theme(new AdministrationTheme)->init($WT_TREE);        
99 99
         $ctrl = new PageController();
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
             ->restrictAccess(Auth::isAdmin())
102 102
             ->setPageTitle($this->module->getTitle());
103 103
         
104
-        $table_id = 'table-installedhooks-' . Uuid::uuid4();
104
+        $table_id = 'table-installedhooks-'.Uuid::uuid4();
105 105
 
106 106
         $view_bag = new ViewBag();
107 107
         $view_bag->set('title', $ctrl->getPageTitle());
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -46,7 +46,9 @@  discard block
 block discarded – undo
46 46
                         $array_hook = explode('#', $ihook);
47 47
                         //Update status
48 48
                         $new_status= Filter::postBool('status-' . $params['id']);
49
-                        if(in_array($array_hook[0], $module_names)) $new_status = false;
49
+                        if(in_array($array_hook[0], $module_names)) {
50
+                        	$new_status = false;
51
+                        }
50 52
                         $previous_status = $params['status'];
51 53
                         if ($new_status !== null) {
52 54
                             $new_status= $new_status ? 'enabled' : 'disabled';
@@ -93,7 +95,9 @@  discard block
 block discarded – undo
93 95
         HookProvider::getInstance()->updateHooks();
94 96
         
95 97
         $action = Filter::post('action');        
96
-        if($action == 'update' && Filter::checkCsrf()) $this->update();
98
+        if($action == 'update' && Filter::checkCsrf()) {
99
+        	$this->update();
100
+        }
97 101
         
98 102
         Theme::theme(new AdministrationTheme)->init($WT_TREE);        
99 103
         $ctrl = new PageController();
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/Controller/IndividualController.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	 *
33 33
 	 * @param \Fisharebest\Webtrees\Controller\IndividualController $ctrl_individual_in The Individual Controller to extend
34 34
 	 */
35
-	public function __construct(fw\Controller\IndividualController $ctrl_individual_in){
35
+	public function __construct(fw\Controller\IndividualController $ctrl_individual_in) {
36 36
 		$this->ctrl_individual = $ctrl_individual_in;
37 37
 		$this->dindi = new mw\Individual($this->ctrl_individual->getSignificantIndividual());
38 38
 	}
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 * 
44 44
 	 * @uses \MyArtJaub\Webtrees\Hook\Hook
45 45
 	 */
46
-	public function printHeaderExtensions(){
46
+	public function printHeaderExtensions() {
47 47
 		$hook_extend_indi_header_left = new mw\Hook\Hook('hExtendIndiHeaderLeft');
48 48
 		$hook_extend_indi_header_right = new mw\Hook\Hook('hExtendIndiHeaderRight');
49 49
 		$hook_extend_indi_header_left = $hook_extend_indi_header_left->execute($this->ctrl_individual);
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 		echo '<div id="indi_perso_header">',
53 53
 			'<div id="indi_perso_header_left">';
54 54
 		foreach ($hook_extend_indi_header_left as $div) {
55
-			if(count($div)==2){
55
+			if (count($div) == 2) {
56 56
 				echo '<div id="', $div[0], '" class="indi_perso_header_left_div">',
57 57
 					$div[1], '</div>';
58 58
 			}
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 		echo '</div>',
61 61
 			'<div id="indi_perso_header_right">';
62 62
 		foreach ($hook_extend_indi_header_right as $div) {
63
-			if(count($div)==2){
63
+			if (count($div) == 2) {
64 64
 				echo '<div id="', $div[0], '" class="indi_perso_header_right_div">',
65 65
 					$div[1], '</div>';
66 66
 			}
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	 *
76 76
 	 * @uses \MyArtJaub\Webtrees\Hook\Hook
77 77
 	 */
78
-	public function printHeaderExtraIcons(){
78
+	public function printHeaderExtraIcons() {
79 79
 		$hook_extend_indi_header_icons = new Hook('hExtendIndiHeaderIcons');
80 80
 		$hook_extend_indi_header_icons = $hook_extend_indi_header_icons->execute($this->ctrl_individual);
81 81
 		
Please login to merge, or discard this patch.
src/Webtrees/Module/AdminTasks/Schema/Migration0.php 2 patches
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.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,8 +28,8 @@
 block discarded – undo
28 28
 		    ' majat_name 		    VARCHAR(32)                      NOT NULL,'.
29 29
 		    ' majat_status          ENUM(\'enabled\',\'disabled\') 	 NOT NULL DEFAULT \'disabled\','.
30 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
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 33
 		    ' majat_nb_occur	 	SMALLINT					     NOT NULL DEFAULT 0,'.
34 34
 		    ' majat_running 		TINYINT(1)					     NOT NULL DEFAULT 0,'.
35 35
 		    ' PRIMARY KEY (majat_name)'.
Please login to merge, or discard this patch.
src/Webtrees/Module/GeoDispersion/Model/GeoAnalysisProvider.php 4 patches
Indentation   +327 added lines, -327 removed lines patch added patch discarded remove patch
@@ -21,130 +21,130 @@  discard block
 block discarded – undo
21 21
  */
22 22
 class GeoAnalysisProvider {
23 23
     
24
-    /**
25
-     * Reference tree
26
-     * @var Tree $tree
27
-     */
28
-    protected $tree;
24
+	/**
25
+	 * Reference tree
26
+	 * @var Tree $tree
27
+	 */
28
+	protected $tree;
29 29
     
30
-    /**
31
-     * Cached hierarchy of places in the Gedcom file.
32
-     * 
33
-     * @var (array|null) $place_hierarchy
34
-     */
35
-    protected $place_hierarchy;
30
+	/**
31
+	 * Cached hierarchy of places in the Gedcom file.
32
+	 * 
33
+	 * @var (array|null) $place_hierarchy
34
+	 */
35
+	protected $place_hierarchy;
36 36
     
37
-    /**
38
-     * Constructor for GeoAnalysis Provider.
39
-     * A provider is defined in relation to a specific tree.
40
-     *
41
-     * @param Tree $tree
42
-     */
43
-    public function __construct(Tree $tree) {
44
-        $this->tree = $tree;
45
-        $this->place_hierarchy = null;
46
-    }
37
+	/**
38
+	 * Constructor for GeoAnalysis Provider.
39
+	 * A provider is defined in relation to a specific tree.
40
+	 *
41
+	 * @param Tree $tree
42
+	 */
43
+	public function __construct(Tree $tree) {
44
+		$this->tree = $tree;
45
+		$this->place_hierarchy = null;
46
+	}
47 47
     
48
-    /**
49
-     * Creates and returns a GeoAnalysis object from a data row.
50
-     * The row data is expected to be an array with the indexes:
51
-     *  - majgd_id: geodispersion analysis ID
52
-     *  - majgd_descr: geodispersion analysis description/title
53
-     *  - majgd_sublevel: Analysis level
54
-     *  - majgd_useflagsgen: Use flags in places display
55
-     *  - majgd_detailsgen: Number of top places
56
-     *  - majgd_map: file name of the map
57
-     *  - majgd_toplevel: parent level for the map
58
-     * 
59
-     * @param array $row
60
-     * @return GeoAnalysis
61
-     */
62
-    protected function loadGeoAnalysisFromRow($row) {
63
-        $options = new GeoDisplayOptions();
64
-        $options
65
-        ->setUsingFlags($row['majgd_useflagsgen'] == 'yes')
66
-        ->setMaxDetailsInGen($row['majgd_detailsgen']);
48
+	/**
49
+	 * Creates and returns a GeoAnalysis object from a data row.
50
+	 * The row data is expected to be an array with the indexes:
51
+	 *  - majgd_id: geodispersion analysis ID
52
+	 *  - majgd_descr: geodispersion analysis description/title
53
+	 *  - majgd_sublevel: Analysis level
54
+	 *  - majgd_useflagsgen: Use flags in places display
55
+	 *  - majgd_detailsgen: Number of top places
56
+	 *  - majgd_map: file name of the map
57
+	 *  - majgd_toplevel: parent level for the map
58
+	 * 
59
+	 * @param array $row
60
+	 * @return GeoAnalysis
61
+	 */
62
+	protected function loadGeoAnalysisFromRow($row) {
63
+		$options = new GeoDisplayOptions();
64
+		$options
65
+		->setUsingFlags($row['majgd_useflagsgen'] == 'yes')
66
+		->setMaxDetailsInGen($row['majgd_detailsgen']);
67 67
         
68
-        if($row['majgd_map']) {
69
-            $options
70
-            ->setMap(new OutlineMap($row['majgd_map']))
71
-            ->setMapLevel($row['majgd_toplevel']);
72
-        }
68
+		if($row['majgd_map']) {
69
+			$options
70
+			->setMap(new OutlineMap($row['majgd_map']))
71
+			->setMapLevel($row['majgd_toplevel']);
72
+		}
73 73
         
74
-        $enabled = true;
75
-        if(isset($row['majgd_status']) && $row['majgd_status'] == 'disabled') {
76
-            $enabled = false;
77
-        }
74
+		$enabled = true;
75
+		if(isset($row['majgd_status']) && $row['majgd_status'] == 'disabled') {
76
+			$enabled = false;
77
+		}
78 78
         
79
-        return new GeoAnalysis(
80
-            $this->tree,
81
-            $row['majgd_id'],
82
-            $row['majgd_descr'],
83
-            $row['majgd_sublevel'],
84
-            $options,
85
-            $enabled
86
-            );
87
-    }
79
+		return new GeoAnalysis(
80
+			$this->tree,
81
+			$row['majgd_id'],
82
+			$row['majgd_descr'],
83
+			$row['majgd_sublevel'],
84
+			$options,
85
+			$enabled
86
+			);
87
+	}
88 88
     
89
-    /**
90
-     * Returns the number of geographical analysis (active and inactive). 
91
-     * 
92
-     * @return int
93
-     */
94
-    public function getGeoAnalysisCount() {
95
-        return Database::prepare(
96
-            'SELECT COUNT(majgd_id)' .
97
-            ' FROM `##maj_geodispersion`' .
98
-            ' WHERE majgd_file = :gedcom_id'
99
-            )->execute(array(
100
-                'gedcom_id' => $this->tree->getTreeId()
101
-            ))->fetchOne();
102
-    }
89
+	/**
90
+	 * Returns the number of geographical analysis (active and inactive). 
91
+	 * 
92
+	 * @return int
93
+	 */
94
+	public function getGeoAnalysisCount() {
95
+		return Database::prepare(
96
+			'SELECT COUNT(majgd_id)' .
97
+			' FROM `##maj_geodispersion`' .
98
+			' WHERE majgd_file = :gedcom_id'
99
+			)->execute(array(
100
+				'gedcom_id' => $this->tree->getTreeId()
101
+			))->fetchOne();
102
+	}
103 103
     
104
-    /**
105
-     * Get a geographical analysis by its ID.
106
-     * The function can only search for only enabled analysis, or all.
107
-     * 
108
-     * @param int $id geodispersion analysis ID
109
-     * @param bool $only_enabled Search for only enabled geodispersion analysis
110
-     * @return \MyArtJaub\Webtrees\Module\GeoDispersion\Model\GeoAnalysis|NULL
111
-     */
112
-    public function getGeoAnalysis($id, $only_enabled = true) {
113
-        $args = array (
114
-            'gedcom_id' => $this->tree->getTreeId(),
115
-            'ga_id' => $id
116
-        );
104
+	/**
105
+	 * Get a geographical analysis by its ID.
106
+	 * The function can only search for only enabled analysis, or all.
107
+	 * 
108
+	 * @param int $id geodispersion analysis ID
109
+	 * @param bool $only_enabled Search for only enabled geodispersion analysis
110
+	 * @return \MyArtJaub\Webtrees\Module\GeoDispersion\Model\GeoAnalysis|NULL
111
+	 */
112
+	public function getGeoAnalysis($id, $only_enabled = true) {
113
+		$args = array (
114
+			'gedcom_id' => $this->tree->getTreeId(),
115
+			'ga_id' => $id
116
+		);
117 117
         
118
-        $sql = 'SELECT majgd_id, majgd_descr, majgd_sublevel, majgd_map, majgd_toplevel, majgd_useflagsgen, majgd_detailsgen, majgd_status' .
119
-            ' FROM `##maj_geodispersion`' .
120
-            ' WHERE majgd_file = :gedcom_id AND majgd_id=:ga_id';
121
-        if($only_enabled) {
122
-            $sql .= ' AND majgd_status = :status';
123
-            $args['status'] = 'enabled';
124
-        }
125
-        $sql .= ' ORDER BY majgd_descr';
118
+		$sql = 'SELECT majgd_id, majgd_descr, majgd_sublevel, majgd_map, majgd_toplevel, majgd_useflagsgen, majgd_detailsgen, majgd_status' .
119
+			' FROM `##maj_geodispersion`' .
120
+			' WHERE majgd_file = :gedcom_id AND majgd_id=:ga_id';
121
+		if($only_enabled) {
122
+			$sql .= ' AND majgd_status = :status';
123
+			$args['status'] = 'enabled';
124
+		}
125
+		$sql .= ' ORDER BY majgd_descr';
126 126
         
127
-        $ga_array = Database::prepare($sql)->execute($args)->fetchOneRow(\PDO::FETCH_ASSOC);
127
+		$ga_array = Database::prepare($sql)->execute($args)->fetchOneRow(\PDO::FETCH_ASSOC);
128 128
         
129
-        if($ga_array) {
130
-            return $this->loadGeoAnalysisFromRow($ga_array);
131
-        }
129
+		if($ga_array) {
130
+			return $this->loadGeoAnalysisFromRow($ga_array);
131
+		}
132 132
         
133
-        return null;            
134
-    }
133
+		return null;            
134
+	}
135 135
     
136
-    /**
137
-     * Add a new geodispersion analysis in the database, in a transactional manner.
138
-     * When successful, eturns the newly created GeoAnalysis object.
139
-     * 
140
-     * @param string $description geodispersion analysis title
141
-     * @param int $analysis_level Analysis level
142
-     * @param string $map_file Filename of the map
143
-     * @param int $map_top_level Parent level of the map
144
-     * @param bool $use_flags Use flag in the place display
145
-     * @param int $gen_details Number of top places to display
146
-     * @return GeoAnalysis
147
-     */
136
+	/**
137
+	 * Add a new geodispersion analysis in the database, in a transactional manner.
138
+	 * When successful, eturns the newly created GeoAnalysis object.
139
+	 * 
140
+	 * @param string $description geodispersion analysis title
141
+	 * @param int $analysis_level Analysis level
142
+	 * @param string $map_file Filename of the map
143
+	 * @param int $map_top_level Parent level of the map
144
+	 * @param bool $use_flags Use flag in the place display
145
+	 * @param int $gen_details Number of top places to display
146
+	 * @return GeoAnalysis
147
+	 */
148 148
 	public function createGeoAnalysis($description, $analysis_level, $map_file, $map_top_level, $use_flags, $gen_details) {
149 149
 		try{
150 150
 			Database::beginTransaction();
@@ -174,17 +174,17 @@  discard block
 block discarded – undo
174 174
 			Log::addErrorLog('A new Geo Analysis failed to be created. Transaction rollbacked. Parameters ['.$description.', '.$analysis_level.','.$map_file.','.$map_top_level.','.$use_flags.', '.$gen_details.']. Exception: '.$ex->getMessage());
175 175
 		}
176 176
 		return $ga;
177
-    }
177
+	}
178 178
 	
179
-    /**
180
-     * Update a geodispersion analysis in the database, in transactional manner.
181
-     * When successful, returns the updated GeoAnalysis object
182
-     *  
183
-     * @param GeoAnalysis $ga
184
-     * @return GeoAnalysis
185
-     */
186
-    public function updateGeoAnalysis(GeoAnalysis $ga) {
187
-        try {
179
+	/**
180
+	 * Update a geodispersion analysis in the database, in transactional manner.
181
+	 * When successful, returns the updated GeoAnalysis object
182
+	 *  
183
+	 * @param GeoAnalysis $ga
184
+	 * @return GeoAnalysis
185
+	 */
186
+	public function updateGeoAnalysis(GeoAnalysis $ga) {
187
+		try {
188 188
 			Database::beginTransaction();
189 189
 		
190 190
 			Database::prepare(
@@ -217,236 +217,236 @@  discard block
 block discarded – undo
217 217
 			$ga = null;
218 218
 		}
219 219
 		return $ga;
220
-    }
220
+	}
221 221
     
222
-    /**
223
-     * Set the status of a specific analysis.
224
-     * The status can be enabled (true), or disabled (false).
225
-     * 
226
-     * @param GeoAnalysis $ga
227
-     * @param bool $status
228
-     */
229
-    public function setGeoAnalysisStatus(GeoAnalysis $ga, $status) {
230
-        Database::prepare(
231
-            'UPDATE `##maj_geodispersion`'.
232
-            ' SET majgd_status = :status'.
233
-            ' WHERE majgd_file = :gedcom_id AND majgd_id=:ga_id'
234
-        )->execute(array(
235
-                'gedcom_id' => $this->tree->getTreeId(),
236
-                'status' => $status ? 'enabled' : 'disabled',
237
-                'ga_id' => $ga->getId()
238
-        ));
239
-    }
222
+	/**
223
+	 * Set the status of a specific analysis.
224
+	 * The status can be enabled (true), or disabled (false).
225
+	 * 
226
+	 * @param GeoAnalysis $ga
227
+	 * @param bool $status
228
+	 */
229
+	public function setGeoAnalysisStatus(GeoAnalysis $ga, $status) {
230
+		Database::prepare(
231
+			'UPDATE `##maj_geodispersion`'.
232
+			' SET majgd_status = :status'.
233
+			' WHERE majgd_file = :gedcom_id AND majgd_id=:ga_id'
234
+		)->execute(array(
235
+				'gedcom_id' => $this->tree->getTreeId(),
236
+				'status' => $status ? 'enabled' : 'disabled',
237
+				'ga_id' => $ga->getId()
238
+		));
239
+	}
240 240
     
241
-    /**
242
-     * Delete a geodispersion analysis from the database.
243
-     * 
244
-     * @param GeoAnalysis $ga
245
-     */
246
-    public function deleteGeoAnalysis(GeoAnalysis $ga) {
247
-        Database::prepare(
248
-            'DELETE FROM `##maj_geodispersion`'.
249
-            ' WHERE majgd_file = :gedcom_id AND majgd_id=:ga_id'
250
-            )->execute(array(
251
-                'gedcom_id' => $this->tree->getTreeId(),
252
-                'ga_id' => $ga->getId()
253
-            ));
254
-    }
241
+	/**
242
+	 * Delete a geodispersion analysis from the database.
243
+	 * 
244
+	 * @param GeoAnalysis $ga
245
+	 */
246
+	public function deleteGeoAnalysis(GeoAnalysis $ga) {
247
+		Database::prepare(
248
+			'DELETE FROM `##maj_geodispersion`'.
249
+			' WHERE majgd_file = :gedcom_id AND majgd_id=:ga_id'
250
+			)->execute(array(
251
+				'gedcom_id' => $this->tree->getTreeId(),
252
+				'ga_id' => $ga->getId()
253
+			));
254
+	}
255 255
         
256
-    /**
257
-     * Return the list of geodispersion analysis recorded and enabled for a specific GEDCOM
258
-     *
259
-     * @return array List of enabled maps
260
-     */
261
-    public function getGeoAnalysisList(){
262
-        $res = array();
256
+	/**
257
+	 * Return the list of geodispersion analysis recorded and enabled for a specific GEDCOM
258
+	 *
259
+	 * @return array List of enabled maps
260
+	 */
261
+	public function getGeoAnalysisList(){
262
+		$res = array();
263 263
         
264
-        $list = Database::prepare(
265
-            'SELECT majgd_id, majgd_descr, majgd_sublevel, majgd_map, majgd_toplevel, majgd_useflagsgen, majgd_detailsgen' .
266
-            ' FROM `##maj_geodispersion`' .
267
-            ' WHERE majgd_file = :gedcom_id AND majgd_status = :status'.
268
-            ' ORDER BY majgd_descr'
269
-        )->execute(array(
270
-            'gedcom_id' => $this->tree->getTreeId(),
271
-            'status' => 'enabled'
272
-        ))->fetchAll(\PDO::FETCH_ASSOC);
264
+		$list = Database::prepare(
265
+			'SELECT majgd_id, majgd_descr, majgd_sublevel, majgd_map, majgd_toplevel, majgd_useflagsgen, majgd_detailsgen' .
266
+			' FROM `##maj_geodispersion`' .
267
+			' WHERE majgd_file = :gedcom_id AND majgd_status = :status'.
268
+			' ORDER BY majgd_descr'
269
+		)->execute(array(
270
+			'gedcom_id' => $this->tree->getTreeId(),
271
+			'status' => 'enabled'
272
+		))->fetchAll(\PDO::FETCH_ASSOC);
273 273
         
274
-        foreach($list as $ga) {
275
-           $res[] = $this->loadGeoAnalysisFromRow($ga);
276
-        }
274
+		foreach($list as $ga) {
275
+		   $res[] = $this->loadGeoAnalysisFromRow($ga);
276
+		}
277 277
         
278
-        return $res;
279
-    }
278
+		return $res;
279
+	}
280 280
     
281
-    /**
282
-     * Return the list of geodispersion analysis matching specified criterias.
283
-     * 
284
-     * @param string $search Search criteria in analysis description
285
-     * @param array $order_by Columns to order by
286
-     * @param int $start Offset to start with (for pagination)
287
-     * @param int|null $limit Max number of items to return (for pagination)
288
-     * @return \MyArtJaub\Webtrees\Module\GeoDispersion\Model\GeoAnalysis[]
289
-     */
290
-    public function getFilteredGeoAnalysisList($search = null, $order_by = null, $start = 0, $limit = null){
291
-        $res = array();
281
+	/**
282
+	 * Return the list of geodispersion analysis matching specified criterias.
283
+	 * 
284
+	 * @param string $search Search criteria in analysis description
285
+	 * @param array $order_by Columns to order by
286
+	 * @param int $start Offset to start with (for pagination)
287
+	 * @param int|null $limit Max number of items to return (for pagination)
288
+	 * @return \MyArtJaub\Webtrees\Module\GeoDispersion\Model\GeoAnalysis[]
289
+	 */
290
+	public function getFilteredGeoAnalysisList($search = null, $order_by = null, $start = 0, $limit = null){
291
+		$res = array();
292 292
             
293
-        $sql = 
294
-            'SELECT majgd_id, majgd_descr, majgd_sublevel, majgd_map, majgd_toplevel, majgd_useflagsgen, majgd_detailsgen, majgd_status' .
295
-            ' FROM `##maj_geodispersion`' .
296
-            ' WHERE majgd_file = :gedcom_id';
293
+		$sql = 
294
+			'SELECT majgd_id, majgd_descr, majgd_sublevel, majgd_map, majgd_toplevel, majgd_useflagsgen, majgd_detailsgen, majgd_status' .
295
+			' FROM `##maj_geodispersion`' .
296
+			' WHERE majgd_file = :gedcom_id';
297 297
         
298
-        $args = array('gedcom_id'=> $this->tree->getTreeId());
298
+		$args = array('gedcom_id'=> $this->tree->getTreeId());
299 299
         
300
-        if($search) {
301
-            $sql .= ' AND majgd_descr LIKE CONCAT(\'%\', :search, \'%\')';
302
-            $args['search'] = $search;
303
-        }
300
+		if($search) {
301
+			$sql .= ' AND majgd_descr LIKE CONCAT(\'%\', :search, \'%\')';
302
+			$args['search'] = $search;
303
+		}
304 304
         
305
-        if ($order_by) {
306
-            $sql .= ' ORDER BY ';
307
-            foreach ($order_by as $key => $value) {
308
-                if ($key > 0) {
309
-                    $sql .= ',';
310
-                }
305
+		if ($order_by) {
306
+			$sql .= ' ORDER BY ';
307
+			foreach ($order_by as $key => $value) {
308
+				if ($key > 0) {
309
+					$sql .= ',';
310
+				}
311 311
                 
312
-                switch ($value['dir']) {
313
-                    case 'asc':
314
-                        $sql .= $value['column'] . ' ASC ';
315
-                        break;
316
-                    case 'desc':
317
-                        $sql .= $value['column'] . ' DESC ';
318
-                        break;
319
-                }
320
-            }
321
-        } else {
322
-            $sql = " ORDER BY majgd_descr ASC";
323
-        }
312
+				switch ($value['dir']) {
313
+					case 'asc':
314
+						$sql .= $value['column'] . ' ASC ';
315
+						break;
316
+					case 'desc':
317
+						$sql .= $value['column'] . ' DESC ';
318
+						break;
319
+				}
320
+			}
321
+		} else {
322
+			$sql = " ORDER BY majgd_descr ASC";
323
+		}
324 324
         
325
-        if ($limit) {
326
-            $sql .= " LIMIT :limit OFFSET :offset";
327
-            $args['limit']  = $limit;
328
-            $args['offset'] = $start;
329
-        }
325
+		if ($limit) {
326
+			$sql .= " LIMIT :limit OFFSET :offset";
327
+			$args['limit']  = $limit;
328
+			$args['offset'] = $start;
329
+		}
330 330
             
331
-        $data = Database::prepare($sql)->execute($args)->fetchAll(\PDO::FETCH_ASSOC);
331
+		$data = Database::prepare($sql)->execute($args)->fetchAll(\PDO::FETCH_ASSOC);
332 332
 
333
-        foreach($data as $ga) {
334
-            $res[] = $this->loadGeoAnalysisFromRow($ga);
335
-        }
333
+		foreach($data as $ga) {
334
+			$res[] = $this->loadGeoAnalysisFromRow($ga);
335
+		}
336 336
         
337
-        return $res;
338
-    }
337
+		return $res;
338
+	}
339 339
             
340
-    /**
341
-     * Returns the infered place hierarchy, determined from the Gedcom data.
342
-     * Depending on the data, it can be based on the Gedcom Header description, or from a place example.
343
-     * This is returned as an associative array:
344
-     *      - type:    describe the source of the data (<em>header<em> / <em>data</em>)
345
-     *      - hierarchy: an array of the place hierarchy (in reverse order of the gedcom)
346
-     *      
347
-     * @return array
348
-     */
349
-    public function getPlacesHierarchy() {
350
-        if(!$this->place_hierarchy) {
351
-            if($place_structure = $this->getPlacesHierarchyFromHeader()) {
352
-                $this->place_hierarchy = array('type' => 'header', 'hierarchy' => $place_structure);
353
-            }
354
-            else {
355
-                $this->place_hierarchy = array('type' => 'data', 'hierarchy' => $this->getPlacesHierarchyFromData());
356
-            }            
357
-        }
358
-        return $this->place_hierarchy;        
359
-    }
340
+	/**
341
+	 * Returns the infered place hierarchy, determined from the Gedcom data.
342
+	 * Depending on the data, it can be based on the Gedcom Header description, or from a place example.
343
+	 * This is returned as an associative array:
344
+	 *      - type:    describe the source of the data (<em>header<em> / <em>data</em>)
345
+	 *      - hierarchy: an array of the place hierarchy (in reverse order of the gedcom)
346
+	 *      
347
+	 * @return array
348
+	 */
349
+	public function getPlacesHierarchy() {
350
+		if(!$this->place_hierarchy) {
351
+			if($place_structure = $this->getPlacesHierarchyFromHeader()) {
352
+				$this->place_hierarchy = array('type' => 'header', 'hierarchy' => $place_structure);
353
+			}
354
+			else {
355
+				$this->place_hierarchy = array('type' => 'data', 'hierarchy' => $this->getPlacesHierarchyFromData());
356
+			}            
357
+		}
358
+		return $this->place_hierarchy;        
359
+	}
360 360
     
361
-    /**
362
-     * Returns an array of the place hierarchy, as defined in the GEDCOM header.
363
-     * The places are reversed compared to normal GEDCOM structure.
364
-     * 
365
-     * @return array|null
366
-     */
367
-    protected function getPlacesHierarchyFromHeader() {
368
-        $head = GedcomRecord::getInstance('HEAD', $this->tree);
369
-        $head_place = $head->getFirstFact('PLAC');
370
-        if($head_place && $head_place_value = $head_place->getAttribute('FORM')){
371
-            return array_reverse(array_map('trim',explode(',', $head_place_value)));
372
-        }
373
-        return null;
374
-    }
361
+	/**
362
+	 * Returns an array of the place hierarchy, as defined in the GEDCOM header.
363
+	 * The places are reversed compared to normal GEDCOM structure.
364
+	 * 
365
+	 * @return array|null
366
+	 */
367
+	protected function getPlacesHierarchyFromHeader() {
368
+		$head = GedcomRecord::getInstance('HEAD', $this->tree);
369
+		$head_place = $head->getFirstFact('PLAC');
370
+		if($head_place && $head_place_value = $head_place->getAttribute('FORM')){
371
+			return array_reverse(array_map('trim',explode(',', $head_place_value)));
372
+		}
373
+		return null;
374
+	}
375 375
     
376
-    /**
377
-     * Returns an array of the place hierarchy, based on a random example of place within the GEDCOM.
378
-     * It will look for the longest hierarchy in the tree.
379
-     * The places are reversed compared to normal GEDCOM structure.
380
-     * 
381
-     * @return array
382
-     */
383
-    protected function getPlacesHierarchyFromData() {
384
-        $nb_levels = 0;
376
+	/**
377
+	 * Returns an array of the place hierarchy, based on a random example of place within the GEDCOM.
378
+	 * It will look for the longest hierarchy in the tree.
379
+	 * The places are reversed compared to normal GEDCOM structure.
380
+	 * 
381
+	 * @return array
382
+	 */
383
+	protected function getPlacesHierarchyFromData() {
384
+		$nb_levels = 0;
385 385
         
386
-        //Select all '2 PLAC ' tags in the file and create array
387
-        $places_list=array();
388
-        $ged_data = Database::prepare(
389
-            'SELECT i_gedcom AS gedcom'.
390
-            ' FROM `##individuals`'.
391
-            ' WHERE i_gedcom LIKE :gedcom AND i_file = :gedcom_id'.
392
-            ' UNION ALL'.
393
-            'SELECT f_gedcom AS gedcom'.
394
-            ' FROM `##families`'.
395
-            ' WHERE f_gedcom LIKE :gedcom AND f_file = :gedcom_id'
396
-        )->execute(array(
397
-            'gedcom' => '%\n2 PLAC %',
398
-            'gedcom_id' => $this->tree->getTreeId()            
399
-        ))->fetchOneColumn();
400
-        foreach ($ged_data as $ged_datum) {
401
-            $matches = null;
402
-            preg_match_all('/\n2 PLAC (.+)/', $ged_datum, $matches);
403
-            foreach ($matches[1] as $match) {
404
-                $places_list[$match]=true;
405
-            }
406
-        }
386
+		//Select all '2 PLAC ' tags in the file and create array
387
+		$places_list=array();
388
+		$ged_data = Database::prepare(
389
+			'SELECT i_gedcom AS gedcom'.
390
+			' FROM `##individuals`'.
391
+			' WHERE i_gedcom LIKE :gedcom AND i_file = :gedcom_id'.
392
+			' UNION ALL'.
393
+			'SELECT f_gedcom AS gedcom'.
394
+			' FROM `##families`'.
395
+			' WHERE f_gedcom LIKE :gedcom AND f_file = :gedcom_id'
396
+		)->execute(array(
397
+			'gedcom' => '%\n2 PLAC %',
398
+			'gedcom_id' => $this->tree->getTreeId()            
399
+		))->fetchOneColumn();
400
+		foreach ($ged_data as $ged_datum) {
401
+			$matches = null;
402
+			preg_match_all('/\n2 PLAC (.+)/', $ged_datum, $matches);
403
+			foreach ($matches[1] as $match) {
404
+				$places_list[$match]=true;
405
+			}
406
+		}
407 407
         
408
-        // Unique list of places
409
-        $places_list=array_keys($places_list);
408
+		// Unique list of places
409
+		$places_list=array_keys($places_list);
410 410
         
411
-        //sort the array, limit to unique values, and count them
412
-        usort($places_list, array('I18N', 'strcasecmp'));
411
+		//sort the array, limit to unique values, and count them
412
+		usort($places_list, array('I18N', 'strcasecmp'));
413 413
         
414
-        //calculate maximum no. of levels to display
415
-        $has_found_good_example = false;
416
-        foreach($places_list as $place){
417
-            $levels = explode(",", $place);
418
-            $parts = count($levels);
419
-            if ($parts >= $nb_levels){
420
-                $nb_levels = $parts;
421
-                if(!$has_found_good_example){
422
-                    $random_place = $place;
423
-                    if(min(array_map('strlen', $levels)) > 0){
424
-                        $has_found_good_example = true;
425
-                    }
426
-                }
427
-            }
428
-        }
414
+		//calculate maximum no. of levels to display
415
+		$has_found_good_example = false;
416
+		foreach($places_list as $place){
417
+			$levels = explode(",", $place);
418
+			$parts = count($levels);
419
+			if ($parts >= $nb_levels){
420
+				$nb_levels = $parts;
421
+				if(!$has_found_good_example){
422
+					$random_place = $place;
423
+					if(min(array_map('strlen', $levels)) > 0){
424
+						$has_found_good_example = true;
425
+					}
426
+				}
427
+			}
428
+		}
429 429
         
430
-        return array_reverse(array_map('trim',explode(',', $random_place)));
431
-    }
430
+		return array_reverse(array_map('trim',explode(',', $random_place)));
431
+	}
432 432
     
433
-    /**
434
-     * Returns the list of geodispersion maps available within the maps folder.
435
-     * 
436
-     * @return \MyArtJaub\Webtrees\Module\GeoDispersion\Model\OutlineMap[]
437
-     */
438
-    public function getOutlineMapsList() {
439
-        $res = array();
440
-        $root_path = WT_ROOT.WT_MODULES_DIR.Constants::MODULE_MAJ_GEODISP_NAME.'/maps/';
441
-        if(is_dir($root_path)){
442
-            $dir = opendir($root_path);
443
-            while (($file=readdir($dir))!== false) {
444
-                if (preg_match('/^[a-zA-Z0-9_]+.xml$/', $file)) {
445
-                    $res[base64_encode($file)] = new OutlineMap($file, true);
446
-                }
447
-            }
448
-        }
449
-        return $res;
450
-    }
433
+	/**
434
+	 * Returns the list of geodispersion maps available within the maps folder.
435
+	 * 
436
+	 * @return \MyArtJaub\Webtrees\Module\GeoDispersion\Model\OutlineMap[]
437
+	 */
438
+	public function getOutlineMapsList() {
439
+		$res = array();
440
+		$root_path = WT_ROOT.WT_MODULES_DIR.Constants::MODULE_MAJ_GEODISP_NAME.'/maps/';
441
+		if(is_dir($root_path)){
442
+			$dir = opendir($root_path);
443
+			while (($file=readdir($dir))!== false) {
444
+				if (preg_match('/^[a-zA-Z0-9_]+.xml$/', $file)) {
445
+					$res[base64_encode($file)] = new OutlineMap($file, true);
446
+				}
447
+			}
448
+		}
449
+		return $res;
450
+	}
451 451
 }
452 452
  
453 453
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -65,14 +65,14 @@  discard block
 block discarded – undo
65 65
         ->setUsingFlags($row['majgd_useflagsgen'] == 'yes')
66 66
         ->setMaxDetailsInGen($row['majgd_detailsgen']);
67 67
         
68
-        if($row['majgd_map']) {
68
+        if ($row['majgd_map']) {
69 69
             $options
70 70
             ->setMap(new OutlineMap($row['majgd_map']))
71 71
             ->setMapLevel($row['majgd_toplevel']);
72 72
         }
73 73
         
74 74
         $enabled = true;
75
-        if(isset($row['majgd_status']) && $row['majgd_status'] == 'disabled') {
75
+        if (isset($row['majgd_status']) && $row['majgd_status'] == 'disabled') {
76 76
             $enabled = false;
77 77
         }
78 78
         
@@ -93,8 +93,8 @@  discard block
 block discarded – undo
93 93
      */
94 94
     public function getGeoAnalysisCount() {
95 95
         return Database::prepare(
96
-            'SELECT COUNT(majgd_id)' .
97
-            ' FROM `##maj_geodispersion`' .
96
+            'SELECT COUNT(majgd_id)'.
97
+            ' FROM `##maj_geodispersion`'.
98 98
             ' WHERE majgd_file = :gedcom_id'
99 99
             )->execute(array(
100 100
                 'gedcom_id' => $this->tree->getTreeId()
@@ -110,15 +110,15 @@  discard block
 block discarded – undo
110 110
      * @return \MyArtJaub\Webtrees\Module\GeoDispersion\Model\GeoAnalysis|NULL
111 111
      */
112 112
     public function getGeoAnalysis($id, $only_enabled = true) {
113
-        $args = array (
113
+        $args = array(
114 114
             'gedcom_id' => $this->tree->getTreeId(),
115 115
             'ga_id' => $id
116 116
         );
117 117
         
118
-        $sql = 'SELECT majgd_id, majgd_descr, majgd_sublevel, majgd_map, majgd_toplevel, majgd_useflagsgen, majgd_detailsgen, majgd_status' .
119
-            ' FROM `##maj_geodispersion`' .
118
+        $sql = 'SELECT majgd_id, majgd_descr, majgd_sublevel, majgd_map, majgd_toplevel, majgd_useflagsgen, majgd_detailsgen, majgd_status'.
119
+            ' FROM `##maj_geodispersion`'.
120 120
             ' WHERE majgd_file = :gedcom_id AND majgd_id=:ga_id';
121
-        if($only_enabled) {
121
+        if ($only_enabled) {
122 122
             $sql .= ' AND majgd_status = :status';
123 123
             $args['status'] = 'enabled';
124 124
         }
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
         
127 127
         $ga_array = Database::prepare($sql)->execute($args)->fetchOneRow(\PDO::FETCH_ASSOC);
128 128
         
129
-        if($ga_array) {
129
+        if ($ga_array) {
130 130
             return $this->loadGeoAnalysisFromRow($ga_array);
131 131
         }
132 132
         
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
      * @return GeoAnalysis
147 147
      */
148 148
 	public function createGeoAnalysis($description, $analysis_level, $map_file, $map_top_level, $use_flags, $gen_details) {
149
-		try{
149
+		try {
150 150
 			Database::beginTransaction();
151 151
 		
152 152
 			Database::prepare(
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 			
169 169
 			Database::commit();
170 170
 		}
171
-		catch(\Exception $ex) {
171
+		catch (\Exception $ex) {
172 172
 			Database::rollback();
173 173
 			$ga = null;
174 174
 			Log::addErrorLog('A new Geo Analysis failed to be created. Transaction rollbacked. Parameters ['.$description.', '.$analysis_level.','.$map_file.','.$map_top_level.','.$use_flags.', '.$gen_details.']. Exception: '.$ex->getMessage());
@@ -211,9 +211,9 @@  discard block
 block discarded – undo
211 211
 			
212 212
 			 Database::commit();
213 213
 		}
214
-		catch(\Exception $ex) {		    
214
+		catch (\Exception $ex) {		    
215 215
 			Database::rollback();
216
-			Log::addErrorLog('The Geo Analysis ID “' . $ga->getId() . '” failed to be updated. Transaction rollbacked. Exception: '.$ex->getMessage());
216
+			Log::addErrorLog('The Geo Analysis ID “'.$ga->getId().'” failed to be updated. Transaction rollbacked. Exception: '.$ex->getMessage());
217 217
 			$ga = null;
218 218
 		}
219 219
 		return $ga;
@@ -258,12 +258,12 @@  discard block
 block discarded – undo
258 258
      *
259 259
      * @return array List of enabled maps
260 260
      */
261
-    public function getGeoAnalysisList(){
261
+    public function getGeoAnalysisList() {
262 262
         $res = array();
263 263
         
264 264
         $list = Database::prepare(
265
-            'SELECT majgd_id, majgd_descr, majgd_sublevel, majgd_map, majgd_toplevel, majgd_useflagsgen, majgd_detailsgen' .
266
-            ' FROM `##maj_geodispersion`' .
265
+            'SELECT majgd_id, majgd_descr, majgd_sublevel, majgd_map, majgd_toplevel, majgd_useflagsgen, majgd_detailsgen'.
266
+            ' FROM `##maj_geodispersion`'.
267 267
             ' WHERE majgd_file = :gedcom_id AND majgd_status = :status'.
268 268
             ' ORDER BY majgd_descr'
269 269
         )->execute(array(
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
             'status' => 'enabled'
272 272
         ))->fetchAll(\PDO::FETCH_ASSOC);
273 273
         
274
-        foreach($list as $ga) {
274
+        foreach ($list as $ga) {
275 275
            $res[] = $this->loadGeoAnalysisFromRow($ga);
276 276
         }
277 277
         
@@ -287,17 +287,17 @@  discard block
 block discarded – undo
287 287
      * @param int|null $limit Max number of items to return (for pagination)
288 288
      * @return \MyArtJaub\Webtrees\Module\GeoDispersion\Model\GeoAnalysis[]
289 289
      */
290
-    public function getFilteredGeoAnalysisList($search = null, $order_by = null, $start = 0, $limit = null){
290
+    public function getFilteredGeoAnalysisList($search = null, $order_by = null, $start = 0, $limit = null) {
291 291
         $res = array();
292 292
             
293 293
         $sql = 
294
-            'SELECT majgd_id, majgd_descr, majgd_sublevel, majgd_map, majgd_toplevel, majgd_useflagsgen, majgd_detailsgen, majgd_status' .
295
-            ' FROM `##maj_geodispersion`' .
294
+            'SELECT majgd_id, majgd_descr, majgd_sublevel, majgd_map, majgd_toplevel, majgd_useflagsgen, majgd_detailsgen, majgd_status'.
295
+            ' FROM `##maj_geodispersion`'.
296 296
             ' WHERE majgd_file = :gedcom_id';
297 297
         
298 298
         $args = array('gedcom_id'=> $this->tree->getTreeId());
299 299
         
300
-        if($search) {
300
+        if ($search) {
301 301
             $sql .= ' AND majgd_descr LIKE CONCAT(\'%\', :search, \'%\')';
302 302
             $args['search'] = $search;
303 303
         }
@@ -311,10 +311,10 @@  discard block
 block discarded – undo
311 311
                 
312 312
                 switch ($value['dir']) {
313 313
                     case 'asc':
314
-                        $sql .= $value['column'] . ' ASC ';
314
+                        $sql .= $value['column'].' ASC ';
315 315
                         break;
316 316
                     case 'desc':
317
-                        $sql .= $value['column'] . ' DESC ';
317
+                        $sql .= $value['column'].' DESC ';
318 318
                         break;
319 319
                 }
320 320
             }
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
             
331 331
         $data = Database::prepare($sql)->execute($args)->fetchAll(\PDO::FETCH_ASSOC);
332 332
 
333
-        foreach($data as $ga) {
333
+        foreach ($data as $ga) {
334 334
             $res[] = $this->loadGeoAnalysisFromRow($ga);
335 335
         }
336 336
         
@@ -347,8 +347,8 @@  discard block
 block discarded – undo
347 347
      * @return array
348 348
      */
349 349
     public function getPlacesHierarchy() {
350
-        if(!$this->place_hierarchy) {
351
-            if($place_structure = $this->getPlacesHierarchyFromHeader()) {
350
+        if (!$this->place_hierarchy) {
351
+            if ($place_structure = $this->getPlacesHierarchyFromHeader()) {
352 352
                 $this->place_hierarchy = array('type' => 'header', 'hierarchy' => $place_structure);
353 353
             }
354 354
             else {
@@ -367,8 +367,8 @@  discard block
 block discarded – undo
367 367
     protected function getPlacesHierarchyFromHeader() {
368 368
         $head = GedcomRecord::getInstance('HEAD', $this->tree);
369 369
         $head_place = $head->getFirstFact('PLAC');
370
-        if($head_place && $head_place_value = $head_place->getAttribute('FORM')){
371
-            return array_reverse(array_map('trim',explode(',', $head_place_value)));
370
+        if ($head_place && $head_place_value = $head_place->getAttribute('FORM')) {
371
+            return array_reverse(array_map('trim', explode(',', $head_place_value)));
372 372
         }
373 373
         return null;
374 374
     }
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
         $nb_levels = 0;
385 385
         
386 386
         //Select all '2 PLAC ' tags in the file and create array
387
-        $places_list=array();
387
+        $places_list = array();
388 388
         $ged_data = Database::prepare(
389 389
             'SELECT i_gedcom AS gedcom'.
390 390
             ' FROM `##individuals`'.
@@ -401,33 +401,33 @@  discard block
 block discarded – undo
401 401
             $matches = null;
402 402
             preg_match_all('/\n2 PLAC (.+)/', $ged_datum, $matches);
403 403
             foreach ($matches[1] as $match) {
404
-                $places_list[$match]=true;
404
+                $places_list[$match] = true;
405 405
             }
406 406
         }
407 407
         
408 408
         // Unique list of places
409
-        $places_list=array_keys($places_list);
409
+        $places_list = array_keys($places_list);
410 410
         
411 411
         //sort the array, limit to unique values, and count them
412 412
         usort($places_list, array('I18N', 'strcasecmp'));
413 413
         
414 414
         //calculate maximum no. of levels to display
415 415
         $has_found_good_example = false;
416
-        foreach($places_list as $place){
416
+        foreach ($places_list as $place) {
417 417
             $levels = explode(",", $place);
418 418
             $parts = count($levels);
419
-            if ($parts >= $nb_levels){
419
+            if ($parts >= $nb_levels) {
420 420
                 $nb_levels = $parts;
421
-                if(!$has_found_good_example){
421
+                if (!$has_found_good_example) {
422 422
                     $random_place = $place;
423
-                    if(min(array_map('strlen', $levels)) > 0){
423
+                    if (min(array_map('strlen', $levels)) > 0) {
424 424
                         $has_found_good_example = true;
425 425
                     }
426 426
                 }
427 427
             }
428 428
         }
429 429
         
430
-        return array_reverse(array_map('trim',explode(',', $random_place)));
430
+        return array_reverse(array_map('trim', explode(',', $random_place)));
431 431
     }
432 432
     
433 433
     /**
@@ -438,9 +438,9 @@  discard block
 block discarded – undo
438 438
     public function getOutlineMapsList() {
439 439
         $res = array();
440 440
         $root_path = WT_ROOT.WT_MODULES_DIR.Constants::MODULE_MAJ_GEODISP_NAME.'/maps/';
441
-        if(is_dir($root_path)){
441
+        if (is_dir($root_path)) {
442 442
             $dir = opendir($root_path);
443
-            while (($file=readdir($dir))!== false) {
443
+            while (($file = readdir($dir)) !== false) {
444 444
                 if (preg_match('/^[a-zA-Z0-9_]+.xml$/', $file)) {
445 445
                     $res[base64_encode($file)] = new OutlineMap($file, true);
446 446
                 }
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@
 block discarded – undo
89 89
     /**
90 90
      * Returns the number of geographical analysis (active and inactive). 
91 91
      * 
92
-     * @return int
92
+     * @return string|null
93 93
      */
94 94
     public function getGeoAnalysisCount() {
95 95
         return Database::prepare(
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -167,8 +167,7 @@  discard block
 block discarded – undo
167 167
 			$ga = $this->getGeoAnalysis($id, false);
168 168
 			
169 169
 			Database::commit();
170
-		}
171
-		catch(\Exception $ex) {
170
+		} catch(\Exception $ex) {
172 171
 			Database::rollback();
173 172
 			$ga = null;
174 173
 			Log::addErrorLog('A new Geo Analysis failed to be created. Transaction rollbacked. Parameters ['.$description.', '.$analysis_level.','.$map_file.','.$map_top_level.','.$use_flags.', '.$gen_details.']. Exception: '.$ex->getMessage());
@@ -210,8 +209,7 @@  discard block
 block discarded – undo
210 209
 			$ga = $this->getGeoAnalysis($ga->getId(), false);
211 210
 			
212 211
 			 Database::commit();
213
-		}
214
-		catch(\Exception $ex) {		    
212
+		} catch(\Exception $ex) {		    
215 213
 			Database::rollback();
216 214
 			Log::addErrorLog('The Geo Analysis ID “' . $ga->getId() . '” failed to be updated. Transaction rollbacked. Exception: '.$ex->getMessage());
217 215
 			$ga = null;
@@ -350,8 +348,7 @@  discard block
 block discarded – undo
350 348
         if(!$this->place_hierarchy) {
351 349
             if($place_structure = $this->getPlacesHierarchyFromHeader()) {
352 350
                 $this->place_hierarchy = array('type' => 'header', 'hierarchy' => $place_structure);
353
-            }
354
-            else {
351
+            } else {
355 352
                 $this->place_hierarchy = array('type' => 'data', 'hierarchy' => $this->getPlacesHierarchyFromData());
356 353
             }            
357 354
         }
Please login to merge, or discard this patch.
src/Webtrees/Module/Sosa/Views/SosaStatsView.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -30,11 +30,11 @@  discard block
 block discarded – undo
30 30
 			<?php 
31 31
 			/** @var \Fisharebest\Webtrees\Individual $root_indi */
32 32
 			$root_indi = $this->data->get('root_indi');
33
-			if($root_indi !== null && $root_indi->canShowName()) { ?>
33
+			if ($root_indi !== null && $root_indi->canShowName()) { ?>
34 34
 			<h4 class="center"><?= I18N::translate('%s: %s', I18N::translate('Root individual'), $root_indi->getFullName()); ?><h4>
35 35
 			<?php } ?>
36 36
 			
37
-			<?php  if($this->data->get('is_setup')) {  
37
+			<?php  if ($this->data->get('is_setup')) {  
38 38
 			    $general_stats = $this->data->get('general_stats'); ?>
39 39
 			<h3><?php echo I18N::translate('General statistics'); ?></h3>
40 40
 			<div class="maj-table">
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 				</div>
57 57
 				<div class="maj-row">
58 58
 					<div class="label"><?php echo I18N::translate('Mean generation time'); ?></div>
59
-					<div class="value"><?php echo I18N::plural('%s year', '%s years', $general_stats['mean_gen_time'],  I18N::number($general_stats['mean_gen_time'], 1)); ?></div>
59
+					<div class="value"><?php echo I18N::plural('%s year', '%s years', $general_stats['mean_gen_time'], I18N::number($general_stats['mean_gen_time'], 1)); ?></div>
60 60
 				</div>
61 61
 			</div>
62 62
 			
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 					</tr>
97 97
 				</thead>
98 98
 				<tbody>
99
-					<?php foreach($this->data->get('generation_stats') as $gen => $row) { ?>
99
+					<?php foreach ($this->data->get('generation_stats') as $gen => $row) { ?>
100 100
 					<tr class="maj-row">
101 101
 						<td class="label"><?php echo I18N::translate('<strong>G%d</strong>', $gen); ?></td>
102 102
 						<td class="label"><?php echo I18N::translate('%1$s <> %2$s', $row['gen_min_birth'], $row['gen_max_birth']); ?></td>
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 						<td class="value"><?php echo I18N::number($row['different']); ?></td>
111 111
 						<td class="value left percent_container">
112 112
 							<div class="percent_frame">
113
-								<div class="percent_cell" style="width:<?php echo 100*$row['perc_different'] ?>%;">
113
+								<div class="percent_cell" style="width:<?php echo 100 * $row['perc_different'] ?>%;">
114 114
 									&nbsp;<?php echo I18N::percentage($row['perc_different']); ?>&nbsp;
115 115
 								</div>
116 116
 							</div>
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 				<tfoot>
124 124
 					<tr class="maj-row">
125 125
 						<td class="label" colspan="13">
126
-							<?php echo I18N::translate('Generation-equivalent: %s generations', I18N::number($this->data->get('equivalent_gen'),2)); ?>
126
+							<?php echo I18N::translate('Generation-equivalent: %s generations', I18N::number($this->data->get('equivalent_gen'), 2)); ?>
127 127
 						</td>
128 128
 					</tr>
129 129
 				</tfoot>
@@ -132,8 +132,8 @@  discard block
 block discarded – undo
132 132
 			
133 133
 			<h3><?php echo I18N::translate('Known Sosa ancestors\' family dispersion'); ?></h3>
134 134
 			<div class="center">
135
-				<?php echo $this->data->get('chart_img_g2') ?: '' ; ?>
136
-				<?php echo $this->data->get('chart_img_g3') ?: '' ; ?>				
135
+				<?php echo $this->data->get('chart_img_g2') ?: ''; ?>
136
+				<?php echo $this->data->get('chart_img_g3') ?: ''; ?>				
137 137
 				<!--  <canvas id="chart_ancestors_g2" width="300" height="300"></canvas>  -->
138 138
 			</div>
139 139
 			
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -22,8 +22,8 @@  discard block
 block discarded – undo
22 22
 	 * {@inhericDoc}
23 23
 	 * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent()
24 24
 	 */
25
-    protected function renderContent() {      
26
-        ?>                
25
+	protected function renderContent() {      
26
+		?>                
27 27
         <div id="maj-sosa-stats-page">
28 28
 			<h2><?php echo $this->data->get('title'); ?></h2>
29 29
 			
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 			<?php } ?>
36 36
 			
37 37
 			<?php  if($this->data->get('is_setup')) {  
38
-			    $general_stats = $this->data->get('general_stats'); ?>
38
+				$general_stats = $this->data->get('general_stats'); ?>
39 39
 			<h3><?php echo I18N::translate('General statistics'); ?></h3>
40 40
 			<div class="maj-table">
41 41
 				<div class="maj-row">
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 			<?php   } else { ?>
141 141
 			<div class="center warning"><?php echo I18N::translate('No Sosa root individual has been defined.'); ?></div>
142 142
 			<?php }     
143
-    }
143
+	}
144 144
     
145 145
 }
146 146
  
147 147
\ No newline at end of file
Please login to merge, or discard this patch.
src/Webtrees/Functions/Functions.php 3 patches
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -38,9 +38,9 @@  discard block
 block discarded – undo
38 38
 	 *
39 39
 	 * @param string $text Text to display
40 40
 	 */
41
-	static public function promptAlert($text){
41
+	static public function promptAlert($text) {
42 42
 		echo '<script>';
43
-		echo 'alert("',fw\Filter::escapeHtml($text),'")';
43
+		echo 'alert("', fw\Filter::escapeHtml($text), '")';
44 44
 		echo '</script>';
45 45
 	}
46 46
 	
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	 * @return float Result of the safe division
54 54
 	 */
55 55
 	public static function safeDivision($num, $denom, $default = 0) {
56
-		if($denom && $denom!=0){
56
+		if ($denom && $denom != 0) {
57 57
 			return $num / $denom;
58 58
 		}
59 59
 		return $default;
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	 * @param float $default Default value if denominator null or 0
68 68
 	 * @return float Percentage
69 69
 	 */
70
-	public static function getPercentage($num, $denom, $default = 0){
70
+	public static function getPercentage($num, $denom, $default = 0) {
71 71
 		return 100 * self::safeDivision($num, $denom, $default);
72 72
 	}
73 73
 	
@@ -78,8 +78,8 @@  discard block
 block discarded – undo
78 78
 	 * @param int $target	The final max width/height
79 79
 	 * @return array array of ($width, $height). One of them must be $target
80 80
 	 */
81
-	static public function getResizedImageSize($file, $target=25){
82
-		list($width, $height, , ) = getimagesize($file);
81
+	static public function getResizedImageSize($file, $target = 25) {
82
+		list($width, $height,,) = getimagesize($file);
83 83
 		$max = max($width, $height);
84 84
 		$rapp = $target / $max;
85 85
 		$width = intval($rapp * $width);
@@ -109,21 +109,21 @@  discard block
 block discarded – undo
109 109
 	 * @param int $length Length of the token, default to 32
110 110
 	 * @return string Random token
111 111
 	 */
112
-	public static function generateRandomToken($length=32) {
112
+	public static function generateRandomToken($length = 32) {
113 113
 		$chars = str_split('abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789');
114 114
 		$len_chars = count($chars);
115 115
 		$token = '';
116 116
 		
117 117
 		for ($i = 0; $i < $length; $i++)
118
-			$token .= $chars[ mt_rand(0, $len_chars - 1) ];
118
+			$token .= $chars[mt_rand(0, $len_chars - 1)];
119 119
 		
120 120
 		# Number of 32 char chunks
121
-		$chunks = ceil( strlen($token) / 32 );
121
+		$chunks = ceil(strlen($token) / 32);
122 122
 		$md5token = '';
123 123
 		
124 124
 		# Run each chunk through md5
125
-		for ( $i=1; $i<=$chunks; $i++ )
126
-			$md5token .= md5( substr($token, $i * 32 - 32, 32) );
125
+		for ($i = 1; $i <= $chunks; $i++)
126
+			$md5token .= md5(substr($token, $i * 32 - 32, 32));
127 127
 		
128 128
 			# Trim the token
129 129
 		return substr($md5token, 0, $length);		
@@ -145,15 +145,15 @@  discard block
 block discarded – undo
145 145
 	 * @param string $data Text to encrypt
146 146
 	 * @return string Encrypted and encoded text
147 147
 	 */
148
-	public static function encryptToSafeBase64($data){
149
-	    if(!self::isEncryptionCompatible())
148
+	public static function encryptToSafeBase64($data) {
149
+	    if (!self::isEncryptionCompatible())
150 150
 	        throw new \Exception('MCrypt PHP extension is required to use encryption.');
151 151
 	    
152 152
 		$key = 'STANDARDKEYIFNOSERVER';
153
-		if(!empty(Filter::server('SERVER_NAME')) && !empty(Filter::server('SERVER_SOFTWARE')))
153
+		if (!empty(Filter::server('SERVER_NAME')) && !empty(Filter::server('SERVER_SOFTWARE')))
154 154
 			$key = md5(Filter::server('SERVER_NAME').Filter::server('SERVER_SOFTWARE'));
155 155
 		$iv = mcrypt_create_iv(self::ENCRYPTION_IV_SIZE, MCRYPT_RAND);
156
-		$id = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $data, MCRYPT_MODE_CBC,$iv);
156
+		$id = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $data, MCRYPT_MODE_CBC, $iv);
157 157
 		$encrypted = base64_encode($iv.$id);
158 158
 		// +, / and = are not URL-compatible
159 159
 		$encrypted = str_replace('+', '-', $encrypted);
@@ -168,25 +168,25 @@  discard block
 block discarded – undo
168 168
 	 * @param string $encrypted Text to decrypt
169 169
 	 * @return string Decrypted text
170 170
 	 */
171
-	public static function decryptFromSafeBase64($encrypted){
172
-	    if(!self::isEncryptionCompatible())
171
+	public static function decryptFromSafeBase64($encrypted) {
172
+	    if (!self::isEncryptionCompatible())
173 173
 	        throw new \Exception('MCrypt PHP extension is required to use encryption.');
174 174
 	    
175 175
 		$key = 'STANDARDKEYIFNOSERVER';
176
-		if(!empty(Filter::server('SERVER_NAME')) && !empty(Filter::server('SERVER_SOFTWARE')))
176
+		if (!empty(Filter::server('SERVER_NAME')) && !empty(Filter::server('SERVER_SOFTWARE')))
177 177
 			$key = md5(Filter::server('SERVER_NAME').Filter::server('SERVER_SOFTWARE'));
178 178
 		$encrypted = str_replace('-', '+', $encrypted);
179 179
 		$encrypted = str_replace('_', '/', $encrypted);
180 180
 		$encrypted = str_replace('*', '=', $encrypted);
181 181
 		$encrypted = base64_decode($encrypted);
182
-		if(!$encrypted)
182
+		if (!$encrypted)
183 183
 			throw new \InvalidArgumentException('The encrypted value is not in correct base64 format.');
184
-		if(strlen($encrypted) < self::ENCRYPTION_IV_SIZE) 
184
+		if (strlen($encrypted) < self::ENCRYPTION_IV_SIZE) 
185 185
 			throw new \InvalidArgumentException('The encrypted value does not contain enough characters for the key.');
186 186
 		$iv_dec = substr($encrypted, 0, self::ENCRYPTION_IV_SIZE);
187 187
 		$encrypted = substr($encrypted, self::ENCRYPTION_IV_SIZE);
188 188
 		$decrypted = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $key, $encrypted, MCRYPT_MODE_CBC, $iv_dec);
189
-		return  preg_replace('~(?:\\000+)$~','',$decrypted);
189
+		return  preg_replace('~(?:\\000+)$~', '', $decrypted);
190 190
 	}
191 191
 	
192 192
 	/**
@@ -195,9 +195,9 @@  discard block
 block discarded – undo
195 195
 	 * @param string $string Filesystem encoded string to encode
196 196
 	 * @return string UTF-8 encoded string
197 197
 	 */
198
-	public static function encodeFileSystemToUtf8($string){
198
+	public static function encodeFileSystemToUtf8($string) {
199 199
 		if (strtoupper(substr(php_uname('s'), 0, 7)) === 'WINDOWS') {
200
-		    return iconv('cp1252', 'utf-8//IGNORE',$string);
200
+		    return iconv('cp1252', 'utf-8//IGNORE', $string);
201 201
 		}
202 202
 		return $string;
203 203
 	}
@@ -208,9 +208,9 @@  discard block
 block discarded – undo
208 208
 	 * @param string $string UTF-8 encoded string to encode
209 209
 	 * @return string Filesystem encoded string
210 210
 	 */
211
-	public static function encodeUtf8ToFileSystem($string){
211
+	public static function encodeUtf8ToFileSystem($string) {
212 212
 		if (preg_match('//u', $string) && strtoupper(substr(php_uname('s'), 0, 7)) === 'WINDOWS') {
213
-			return iconv('utf-8', 'cp1252//IGNORE' ,  $string);
213
+			return iconv('utf-8', 'cp1252//IGNORE', $string);
214 214
 		}
215 215
 		return $string;
216 216
 	}
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 	 * @return boolean True if path valid
224 224
 	 */
225 225
 	public static function isValidPath($filename, $acceptfolder = FALSE) {		
226
-		if(strpbrk($filename, $acceptfolder ? '?%*:|"<>' : '\\/?%*:|"<>') === FALSE) return true;
226
+		if (strpbrk($filename, $acceptfolder ? '?%*:|"<>' : '\\/?%*:|"<>') === FALSE) return true;
227 227
 		return false;
228 228
 	}
229 229
 	
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 	 * @return array Array of month short names
236 236
 	 */
237 237
 	public static function getCalendarShortMonths($calendarId = 0) {
238
-		if(!isset(self::$calendarShortMonths[$calendarId])) {
238
+		if (!isset(self::$calendarShortMonths[$calendarId])) {
239 239
 			$calendar_info = cal_info($calendarId);
240 240
 			self::$calendarShortMonths[$calendarId] = $calendar_info['abbrevmonths'];
241 241
 		}		
@@ -248,8 +248,8 @@  discard block
 block discarded – undo
248 248
 	 * @param int $sosa Sosa number
249 249
 	 * @return number
250 250
 	 */
251
-	public static function getGeneration($sosa){
252
-		return(int)log($sosa, 2)+1;
251
+	public static function getGeneration($sosa) {
252
+		return(int)log($sosa, 2) + 1;
253 253
 	}
254 254
 	
255 255
 	
Please login to merge, or discard this patch.
Braces   +27 added lines, -17 removed lines patch added patch discarded remove patch
@@ -114,16 +114,18 @@  discard block
 block discarded – undo
114 114
 		$len_chars = count($chars);
115 115
 		$token = '';
116 116
 		
117
-		for ($i = 0; $i < $length; $i++)
118
-			$token .= $chars[ mt_rand(0, $len_chars - 1) ];
117
+		for ($i = 0; $i < $length; $i++) {
118
+					$token .= $chars[ mt_rand(0, $len_chars - 1) ];
119
+		}
119 120
 		
120 121
 		# Number of 32 char chunks
121 122
 		$chunks = ceil( strlen($token) / 32 );
122 123
 		$md5token = '';
123 124
 		
124 125
 		# Run each chunk through md5
125
-		for ( $i=1; $i<=$chunks; $i++ )
126
-			$md5token .= md5( substr($token, $i * 32 - 32, 32) );
126
+		for ( $i=1; $i<=$chunks; $i++ ) {
127
+					$md5token .= md5( substr($token, $i * 32 - 32, 32) );
128
+		}
127 129
 		
128 130
 			# Trim the token
129 131
 		return substr($md5token, 0, $length);		
@@ -146,12 +148,14 @@  discard block
 block discarded – undo
146 148
 	 * @return string Encrypted and encoded text
147 149
 	 */
148 150
 	public static function encryptToSafeBase64($data){
149
-	    if(!self::isEncryptionCompatible())
150
-	        throw new \Exception('MCrypt PHP extension is required to use encryption.');
151
+	    if(!self::isEncryptionCompatible()) {
152
+	    	        throw new \Exception('MCrypt PHP extension is required to use encryption.');
153
+	    }
151 154
 	    
152 155
 		$key = 'STANDARDKEYIFNOSERVER';
153
-		if(!empty(Filter::server('SERVER_NAME')) && !empty(Filter::server('SERVER_SOFTWARE')))
154
-			$key = md5(Filter::server('SERVER_NAME').Filter::server('SERVER_SOFTWARE'));
156
+		if(!empty(Filter::server('SERVER_NAME')) && !empty(Filter::server('SERVER_SOFTWARE'))) {
157
+					$key = md5(Filter::server('SERVER_NAME').Filter::server('SERVER_SOFTWARE'));
158
+		}
155 159
 		$iv = mcrypt_create_iv(self::ENCRYPTION_IV_SIZE, MCRYPT_RAND);
156 160
 		$id = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $data, MCRYPT_MODE_CBC,$iv);
157 161
 		$encrypted = base64_encode($iv.$id);
@@ -169,20 +173,24 @@  discard block
 block discarded – undo
169 173
 	 * @return string Decrypted text
170 174
 	 */
171 175
 	public static function decryptFromSafeBase64($encrypted){
172
-	    if(!self::isEncryptionCompatible())
173
-	        throw new \Exception('MCrypt PHP extension is required to use encryption.');
176
+	    if(!self::isEncryptionCompatible()) {
177
+	    	        throw new \Exception('MCrypt PHP extension is required to use encryption.');
178
+	    }
174 179
 	    
175 180
 		$key = 'STANDARDKEYIFNOSERVER';
176
-		if(!empty(Filter::server('SERVER_NAME')) && !empty(Filter::server('SERVER_SOFTWARE')))
177
-			$key = md5(Filter::server('SERVER_NAME').Filter::server('SERVER_SOFTWARE'));
181
+		if(!empty(Filter::server('SERVER_NAME')) && !empty(Filter::server('SERVER_SOFTWARE'))) {
182
+					$key = md5(Filter::server('SERVER_NAME').Filter::server('SERVER_SOFTWARE'));
183
+		}
178 184
 		$encrypted = str_replace('-', '+', $encrypted);
179 185
 		$encrypted = str_replace('_', '/', $encrypted);
180 186
 		$encrypted = str_replace('*', '=', $encrypted);
181 187
 		$encrypted = base64_decode($encrypted);
182
-		if(!$encrypted)
183
-			throw new \InvalidArgumentException('The encrypted value is not in correct base64 format.');
184
-		if(strlen($encrypted) < self::ENCRYPTION_IV_SIZE) 
185
-			throw new \InvalidArgumentException('The encrypted value does not contain enough characters for the key.');
188
+		if(!$encrypted) {
189
+					throw new \InvalidArgumentException('The encrypted value is not in correct base64 format.');
190
+		}
191
+		if(strlen($encrypted) < self::ENCRYPTION_IV_SIZE) {
192
+					throw new \InvalidArgumentException('The encrypted value does not contain enough characters for the key.');
193
+		}
186 194
 		$iv_dec = substr($encrypted, 0, self::ENCRYPTION_IV_SIZE);
187 195
 		$encrypted = substr($encrypted, self::ENCRYPTION_IV_SIZE);
188 196
 		$decrypted = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $key, $encrypted, MCRYPT_MODE_CBC, $iv_dec);
@@ -223,7 +231,9 @@  discard block
 block discarded – undo
223 231
 	 * @return boolean True if path valid
224 232
 	 */
225 233
 	public static function isValidPath($filename, $acceptfolder = FALSE) {		
226
-		if(strpbrk($filename, $acceptfolder ? '?%*:|"<>' : '\\/?%*:|"<>') === FALSE) return true;
234
+		if(strpbrk($filename, $acceptfolder ? '?%*:|"<>' : '\\/?%*:|"<>') === FALSE) {
235
+			return true;
236
+		}
227 237
 		return false;
228 238
 	}
229 239
 	
Please login to merge, or discard this patch.
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 	 * @return boolean
136 136
 	 */
137 137
 	public static function isEncryptionCompatible() {
138
-	    return function_exists('mcrypt_encrypt') && function_exists('mcrypt_encrypt') && function_exists('mcrypt_decrypt');
138
+		return function_exists('mcrypt_encrypt') && function_exists('mcrypt_encrypt') && function_exists('mcrypt_decrypt');
139 139
 	}
140 140
 	
141 141
 	/**	  
@@ -146,8 +146,8 @@  discard block
 block discarded – undo
146 146
 	 * @return string Encrypted and encoded text
147 147
 	 */
148 148
 	public static function encryptToSafeBase64($data){
149
-	    if(!self::isEncryptionCompatible())
150
-	        throw new \Exception('MCrypt PHP extension is required to use encryption.');
149
+		if(!self::isEncryptionCompatible())
150
+			throw new \Exception('MCrypt PHP extension is required to use encryption.');
151 151
 	    
152 152
 		$key = 'STANDARDKEYIFNOSERVER';
153 153
 		if(!empty(Filter::server('SERVER_NAME')) && !empty(Filter::server('SERVER_SOFTWARE')))
@@ -169,8 +169,8 @@  discard block
 block discarded – undo
169 169
 	 * @return string Decrypted text
170 170
 	 */
171 171
 	public static function decryptFromSafeBase64($encrypted){
172
-	    if(!self::isEncryptionCompatible())
173
-	        throw new \Exception('MCrypt PHP extension is required to use encryption.');
172
+		if(!self::isEncryptionCompatible())
173
+			throw new \Exception('MCrypt PHP extension is required to use encryption.');
174 174
 	    
175 175
 		$key = 'STANDARDKEYIFNOSERVER';
176 176
 		if(!empty(Filter::server('SERVER_NAME')) && !empty(Filter::server('SERVER_SOFTWARE')))
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 	 */
198 198
 	public static function encodeFileSystemToUtf8($string){
199 199
 		if (strtoupper(substr(php_uname('s'), 0, 7)) === 'WINDOWS') {
200
-		    return iconv('cp1252', 'utf-8//IGNORE',$string);
200
+			return iconv('cp1252', 'utf-8//IGNORE',$string);
201 201
 		}
202 202
 		return $string;
203 203
 	}
@@ -262,20 +262,20 @@  discard block
 block discarded – undo
262 262
 	 * @return boolean|string Is supported?
263 263
 	 */
264 264
 	public static function isImageTypeSupported($reqtype) {
265
-	    $supportByGD = array('jpg'=>'jpeg', 'jpeg'=>'jpeg', 'gif'=>'gif', 'png'=>'png');
266
-	    $reqtype = strtolower($reqtype);
265
+		$supportByGD = array('jpg'=>'jpeg', 'jpeg'=>'jpeg', 'gif'=>'gif', 'png'=>'png');
266
+		$reqtype = strtolower($reqtype);
267 267
 	
268
-	    if (empty($supportByGD[$reqtype])) {
269
-	        return false;
270
-	    }
268
+		if (empty($supportByGD[$reqtype])) {
269
+			return false;
270
+		}
271 271
 	
272
-	    $type = $supportByGD[$reqtype];
272
+		$type = $supportByGD[$reqtype];
273 273
 	
274
-	    if (function_exists('imagecreatefrom'.$type) && function_exists('image'.$type)) {
275
-	        return $type;
276
-	    }
274
+		if (function_exists('imagecreatefrom'.$type) && function_exists('image'.$type)) {
275
+			return $type;
276
+		}
277 277
 	
278
-	    return false;
278
+		return false;
279 279
 	}
280 280
 		
281 281
 }
Please login to merge, or discard this patch.