@@ -17,87 +17,87 @@ |
||
17 | 17 | */ |
18 | 18 | class ViewFactory { |
19 | 19 | |
20 | - /** |
|
21 | - * @var ViewFactory $instance Singleton pattern instance |
|
22 | - */ |
|
23 | - private static $instance = null; |
|
20 | + /** |
|
21 | + * @var ViewFactory $instance Singleton pattern instance |
|
22 | + */ |
|
23 | + private static $instance = null; |
|
24 | 24 | |
25 | - /** |
|
26 | - * Returns the *ViewFactory* instance of this class. |
|
27 | - * |
|
28 | - * @return ViewFactory The *Singleton* instance. |
|
29 | - */ |
|
30 | - public static function getInstance() |
|
31 | - { |
|
32 | - if (null === static::$instance) { |
|
33 | - static::$instance = new static(); |
|
34 | - } |
|
25 | + /** |
|
26 | + * Returns the *ViewFactory* instance of this class. |
|
27 | + * |
|
28 | + * @return ViewFactory The *Singleton* instance. |
|
29 | + */ |
|
30 | + public static function getInstance() |
|
31 | + { |
|
32 | + if (null === static::$instance) { |
|
33 | + static::$instance = new static(); |
|
34 | + } |
|
35 | 35 | |
36 | - return static::$instance; |
|
37 | - } |
|
36 | + return static::$instance; |
|
37 | + } |
|
38 | 38 | |
39 | - /** |
|
40 | - * Protected constructor |
|
41 | - */ |
|
42 | - protected function __construct() {} |
|
39 | + /** |
|
40 | + * Protected constructor |
|
41 | + */ |
|
42 | + protected function __construct() {} |
|
43 | 43 | |
44 | - /** |
|
45 | - * Return the view specified by the controller and view name, using data from the ViewBag |
|
46 | - * |
|
47 | - * @param string $view_name |
|
48 | - * @param \MyArtJaub\Webtrees\Mvc\Controller\MvcControllerInterface $mvc_ctrl |
|
49 | - * @param \Fisharebest\Webtrees\Controller\BaseController $ctrl |
|
50 | - * @param \MyArtJaub\Webtrees\Mvc\View\ViewBag $data |
|
51 | - * @return \MyArtJaub\Webtrees\Mvc\View\AbstractView View |
|
52 | - * @throws \Exception |
|
53 | - */ |
|
54 | - public function makeView($view_name, MvcController $mvc_ctrl, BaseController $ctrl, ViewBag $data) |
|
55 | - { |
|
56 | - if(!$mvc_ctrl) throw new \Exception('Mvc Controller not defined'); |
|
57 | - if(!$ctrl) throw new \Exception('Base Controller not defined'); |
|
58 | - if(!$view_name) throw new \Exception('View not defined'); |
|
44 | + /** |
|
45 | + * Return the view specified by the controller and view name, using data from the ViewBag |
|
46 | + * |
|
47 | + * @param string $view_name |
|
48 | + * @param \MyArtJaub\Webtrees\Mvc\Controller\MvcControllerInterface $mvc_ctrl |
|
49 | + * @param \Fisharebest\Webtrees\Controller\BaseController $ctrl |
|
50 | + * @param \MyArtJaub\Webtrees\Mvc\View\ViewBag $data |
|
51 | + * @return \MyArtJaub\Webtrees\Mvc\View\AbstractView View |
|
52 | + * @throws \Exception |
|
53 | + */ |
|
54 | + public function makeView($view_name, MvcController $mvc_ctrl, BaseController $ctrl, ViewBag $data) |
|
55 | + { |
|
56 | + if(!$mvc_ctrl) throw new \Exception('Mvc Controller not defined'); |
|
57 | + if(!$ctrl) throw new \Exception('Base Controller not defined'); |
|
58 | + if(!$view_name) throw new \Exception('View not defined'); |
|
59 | 59 | |
60 | - $mvc_ctrl_refl = new \ReflectionObject($mvc_ctrl); |
|
61 | - $view_class = $mvc_ctrl_refl->getNamespaceName() . '\\Views\\' . $view_name . 'View'; |
|
62 | - if(!class_exists($view_class)) throw new \Exception('View does not exist'); |
|
60 | + $mvc_ctrl_refl = new \ReflectionObject($mvc_ctrl); |
|
61 | + $view_class = $mvc_ctrl_refl->getNamespaceName() . '\\Views\\' . $view_name . 'View'; |
|
62 | + if(!class_exists($view_class)) throw new \Exception('View does not exist'); |
|
63 | 63 | |
64 | - return new $view_class($ctrl, $data); |
|
65 | - } |
|
64 | + return new $view_class($ctrl, $data); |
|
65 | + } |
|
66 | 66 | |
67 | - /** |
|
68 | - * Static invocation of the makeView method |
|
69 | - * |
|
70 | - * @param string $view_name |
|
71 | - * @param \MyArtJaub\Webtrees\Mvc\Controller\MvcControllerInterface $mvc_ctrl |
|
72 | - * @param \Fisharebest\Webtrees\Controller\BaseController $ctrl |
|
73 | - * @param \MyArtJaub\Webtrees\Mvc\View\ViewBag $data |
|
74 | - * @return \MyArtJaub\Webtrees\Mvc\View\AbstractView View |
|
75 | - * @see \MyArtJaub\Webtrees\Mvc\View\ViewFactory::handle() |
|
76 | - */ |
|
77 | - public static function make($view_name, MvcController $mvc_ctrl, BaseController $ctrl, ViewBag $data) |
|
78 | - { |
|
79 | - return self::getInstance()->makeView($view_name, $mvc_ctrl, $ctrl, $data); |
|
80 | - } |
|
67 | + /** |
|
68 | + * Static invocation of the makeView method |
|
69 | + * |
|
70 | + * @param string $view_name |
|
71 | + * @param \MyArtJaub\Webtrees\Mvc\Controller\MvcControllerInterface $mvc_ctrl |
|
72 | + * @param \Fisharebest\Webtrees\Controller\BaseController $ctrl |
|
73 | + * @param \MyArtJaub\Webtrees\Mvc\View\ViewBag $data |
|
74 | + * @return \MyArtJaub\Webtrees\Mvc\View\AbstractView View |
|
75 | + * @see \MyArtJaub\Webtrees\Mvc\View\ViewFactory::handle() |
|
76 | + */ |
|
77 | + public static function make($view_name, MvcController $mvc_ctrl, BaseController $ctrl, ViewBag $data) |
|
78 | + { |
|
79 | + return self::getInstance()->makeView($view_name, $mvc_ctrl, $ctrl, $data); |
|
80 | + } |
|
81 | 81 | |
82 | - /** |
|
83 | - * Private clone method to prevent cloning of the instance of the |
|
84 | - * *Dispatcher* instance. |
|
85 | - * |
|
86 | - * @return void |
|
87 | - */ |
|
88 | - private function __clone() |
|
89 | - { |
|
90 | - } |
|
82 | + /** |
|
83 | + * Private clone method to prevent cloning of the instance of the |
|
84 | + * *Dispatcher* instance. |
|
85 | + * |
|
86 | + * @return void |
|
87 | + */ |
|
88 | + private function __clone() |
|
89 | + { |
|
90 | + } |
|
91 | 91 | |
92 | - /** |
|
93 | - * Private unserialize method to prevent unserializing of the *Dispatcher* |
|
94 | - * instance. |
|
95 | - * |
|
96 | - * @return void |
|
97 | - */ |
|
98 | - private function __wakeup() |
|
99 | - { |
|
100 | - } |
|
92 | + /** |
|
93 | + * Private unserialize method to prevent unserializing of the *Dispatcher* |
|
94 | + * instance. |
|
95 | + * |
|
96 | + * @return void |
|
97 | + */ |
|
98 | + private function __wakeup() |
|
99 | + { |
|
100 | + } |
|
101 | 101 | |
102 | 102 | } |
103 | 103 | |
104 | 104 | \ No newline at end of file |
@@ -53,13 +53,13 @@ |
||
53 | 53 | */ |
54 | 54 | public function makeView($view_name, MvcController $mvc_ctrl, BaseController $ctrl, ViewBag $data) |
55 | 55 | { |
56 | - if(!$mvc_ctrl) throw new \Exception('Mvc Controller not defined'); |
|
57 | - if(!$ctrl) throw new \Exception('Base Controller not defined'); |
|
58 | - if(!$view_name) throw new \Exception('View not defined'); |
|
56 | + if (!$mvc_ctrl) throw new \Exception('Mvc Controller not defined'); |
|
57 | + if (!$ctrl) throw new \Exception('Base Controller not defined'); |
|
58 | + if (!$view_name) throw new \Exception('View not defined'); |
|
59 | 59 | |
60 | 60 | $mvc_ctrl_refl = new \ReflectionObject($mvc_ctrl); |
61 | - $view_class = $mvc_ctrl_refl->getNamespaceName() . '\\Views\\' . $view_name . 'View'; |
|
62 | - if(!class_exists($view_class)) throw new \Exception('View does not exist'); |
|
61 | + $view_class = $mvc_ctrl_refl->getNamespaceName().'\\Views\\'.$view_name.'View'; |
|
62 | + if (!class_exists($view_class)) throw new \Exception('View does not exist'); |
|
63 | 63 | |
64 | 64 | return new $view_class($ctrl, $data); |
65 | 65 | } |
@@ -53,13 +53,21 @@ |
||
53 | 53 | */ |
54 | 54 | public function makeView($view_name, MvcController $mvc_ctrl, BaseController $ctrl, ViewBag $data) |
55 | 55 | { |
56 | - if(!$mvc_ctrl) throw new \Exception('Mvc Controller not defined'); |
|
57 | - if(!$ctrl) throw new \Exception('Base Controller not defined'); |
|
58 | - if(!$view_name) throw new \Exception('View not defined'); |
|
56 | + if(!$mvc_ctrl) { |
|
57 | + throw new \Exception('Mvc Controller not defined'); |
|
58 | + } |
|
59 | + if(!$ctrl) { |
|
60 | + throw new \Exception('Base Controller not defined'); |
|
61 | + } |
|
62 | + if(!$view_name) { |
|
63 | + throw new \Exception('View not defined'); |
|
64 | + } |
|
59 | 65 | |
60 | 66 | $mvc_ctrl_refl = new \ReflectionObject($mvc_ctrl); |
61 | 67 | $view_class = $mvc_ctrl_refl->getNamespaceName() . '\\Views\\' . $view_name . 'View'; |
62 | - if(!class_exists($view_class)) throw new \Exception('View does not exist'); |
|
68 | + if(!class_exists($view_class)) { |
|
69 | + throw new \Exception('View does not exist'); |
|
70 | + } |
|
63 | 71 | |
64 | 72 | return new $view_class($ctrl, $data); |
65 | 73 | } |
@@ -73,8 +73,8 @@ discard block |
||
73 | 73 | * @param bool $override |
74 | 74 | */ |
75 | 75 | public function set($key, $value, $override = true) { |
76 | - if(is_null($key)) return; |
|
77 | - if(!$override && array_key_exists($key, $this->data)) return; |
|
76 | + if (is_null($key)) return; |
|
77 | + if (!$override && array_key_exists($key, $this->data)) return; |
|
78 | 78 | $this->data[$key] = $value; |
79 | 79 | } |
80 | 80 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | * @param string $key |
108 | 108 | */ |
109 | 109 | public function __unset($key) { |
110 | - unset($this->data[$key]);; |
|
110 | + unset($this->data[$key]); ; |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | } |
@@ -73,8 +73,12 @@ |
||
73 | 73 | * @param bool $override |
74 | 74 | */ |
75 | 75 | public function set($key, $value, $override = true) { |
76 | - if(is_null($key)) return; |
|
77 | - if(!$override && array_key_exists($key, $this->data)) return; |
|
76 | + if(is_null($key)) { |
|
77 | + return; |
|
78 | + } |
|
79 | + if(!$override && array_key_exists($key, $this->data)) { |
|
80 | + return; |
|
81 | + } |
|
78 | 82 | $this->data[$key] = $value; |
79 | 83 | } |
80 | 84 |
@@ -18,97 +18,97 @@ |
||
18 | 18 | /** |
19 | 19 | * @var array $data Container for data |
20 | 20 | */ |
21 | - protected $data = array(); |
|
21 | + protected $data = array(); |
|
22 | 22 | |
23 | - /** |
|
24 | - * Constructor for ViewBag |
|
25 | - * @param array $data_in |
|
26 | - */ |
|
27 | - public function __construct(array $data_in = array()) { |
|
28 | - $this->data = $data_in; |
|
29 | - } |
|
23 | + /** |
|
24 | + * Constructor for ViewBag |
|
25 | + * @param array $data_in |
|
26 | + */ |
|
27 | + public function __construct(array $data_in = array()) { |
|
28 | + $this->data = $data_in; |
|
29 | + } |
|
30 | 30 | |
31 | - /** |
|
32 | - * Get the keys present in the view bag. |
|
33 | - * |
|
34 | - * @return array |
|
35 | - */ |
|
36 | - public function keys() |
|
37 | - { |
|
38 | - return array_keys($this->data); |
|
39 | - } |
|
31 | + /** |
|
32 | + * Get the keys present in the view bag. |
|
33 | + * |
|
34 | + * @return array |
|
35 | + */ |
|
36 | + public function keys() |
|
37 | + { |
|
38 | + return array_keys($this->data); |
|
39 | + } |
|
40 | 40 | |
41 | - /** |
|
42 | - * Get all the data from the bag for a given key. |
|
43 | - * |
|
44 | - * @param string $key |
|
45 | - * @param string $format |
|
46 | - * @return unknown |
|
47 | - */ |
|
48 | - public function get($key, $default = null) |
|
49 | - { |
|
50 | - if (array_key_exists($key, $this->data)) { |
|
51 | - return $this->data[$key]; |
|
52 | - } |
|
53 | - return $default; |
|
54 | - } |
|
41 | + /** |
|
42 | + * Get all the data from the bag for a given key. |
|
43 | + * |
|
44 | + * @param string $key |
|
45 | + * @param string $format |
|
46 | + * @return unknown |
|
47 | + */ |
|
48 | + public function get($key, $default = null) |
|
49 | + { |
|
50 | + if (array_key_exists($key, $this->data)) { |
|
51 | + return $this->data[$key]; |
|
52 | + } |
|
53 | + return $default; |
|
54 | + } |
|
55 | 55 | |
56 | - /** |
|
57 | - * Magic getter. |
|
58 | - * Returns the value associated with the key. |
|
59 | - * |
|
60 | - * @param string $key |
|
61 | - * @return unknown |
|
62 | - */ |
|
63 | - public function __get($key) { |
|
64 | - return $this->get($key, null); |
|
65 | - } |
|
56 | + /** |
|
57 | + * Magic getter. |
|
58 | + * Returns the value associated with the key. |
|
59 | + * |
|
60 | + * @param string $key |
|
61 | + * @return unknown |
|
62 | + */ |
|
63 | + public function __get($key) { |
|
64 | + return $this->get($key, null); |
|
65 | + } |
|
66 | 66 | |
67 | - /** |
|
68 | - * Set the value for the specified key. |
|
69 | - * Can define whether to override an existing value; |
|
70 | - * |
|
71 | - * @param string $key |
|
72 | - * @param mixed $value |
|
73 | - * @param bool $override |
|
74 | - */ |
|
75 | - public function set($key, $value, $override = true) { |
|
76 | - if(is_null($key)) return; |
|
77 | - if(!$override && array_key_exists($key, $this->data)) return; |
|
78 | - $this->data[$key] = $value; |
|
79 | - } |
|
67 | + /** |
|
68 | + * Set the value for the specified key. |
|
69 | + * Can define whether to override an existing value; |
|
70 | + * |
|
71 | + * @param string $key |
|
72 | + * @param mixed $value |
|
73 | + * @param bool $override |
|
74 | + */ |
|
75 | + public function set($key, $value, $override = true) { |
|
76 | + if(is_null($key)) return; |
|
77 | + if(!$override && array_key_exists($key, $this->data)) return; |
|
78 | + $this->data[$key] = $value; |
|
79 | + } |
|
80 | 80 | |
81 | - /** |
|
82 | - * Magic setter. |
|
83 | - * Set the value for the specified key. |
|
84 | - * |
|
85 | - * @param string $key |
|
86 | - * @param mixed $value |
|
87 | - */ |
|
88 | - public function __set($key, $value) { |
|
89 | - $this->set($key, $value); |
|
90 | - } |
|
81 | + /** |
|
82 | + * Magic setter. |
|
83 | + * Set the value for the specified key. |
|
84 | + * |
|
85 | + * @param string $key |
|
86 | + * @param mixed $value |
|
87 | + */ |
|
88 | + public function __set($key, $value) { |
|
89 | + $this->set($key, $value); |
|
90 | + } |
|
91 | 91 | |
92 | - /** |
|
93 | - * Magic isset |
|
94 | - * Checks whether the ViewBag contains the specified key |
|
95 | - * |
|
96 | - * @param string $key |
|
97 | - * @return bool |
|
98 | - */ |
|
99 | - public function __isset($key) { |
|
100 | - return isset($this->data[$key]); |
|
101 | - } |
|
92 | + /** |
|
93 | + * Magic isset |
|
94 | + * Checks whether the ViewBag contains the specified key |
|
95 | + * |
|
96 | + * @param string $key |
|
97 | + * @return bool |
|
98 | + */ |
|
99 | + public function __isset($key) { |
|
100 | + return isset($this->data[$key]); |
|
101 | + } |
|
102 | 102 | |
103 | - /** |
|
104 | - * Magic unset |
|
105 | - * Unset the specified key from the ViewBag |
|
106 | - * |
|
107 | - * @param string $key |
|
108 | - */ |
|
109 | - public function __unset($key) { |
|
110 | - unset($this->data[$key]);; |
|
111 | - } |
|
103 | + /** |
|
104 | + * Magic unset |
|
105 | + * Unset the specified key from the ViewBag |
|
106 | + * |
|
107 | + * @param string $key |
|
108 | + */ |
|
109 | + public function __unset($key) { |
|
110 | + unset($this->data[$key]);; |
|
111 | + } |
|
112 | 112 | |
113 | 113 | } |
114 | 114 | |
115 | 115 | \ No newline at end of file |
@@ -15,13 +15,13 @@ |
||
15 | 15 | */ |
16 | 16 | interface HookSubscriberInterface { |
17 | 17 | |
18 | - /** |
|
18 | + /** |
|
19 | 19 | * Return the list of functions implementented in the class which needs to be registered as hooks. |
20 | 20 | * The format is either { function1, function 2,...} in which case the priority is the default one |
21 | 21 | * or { function1 => priority1, function2 => priority2, ...} |
22 | 22 | * |
23 | 23 | * @return array Array of hooks |
24 | 24 | */ |
25 | - public function getSubscribedHooks(); |
|
25 | + public function getSubscribedHooks(); |
|
26 | 26 | |
27 | 27 | } |
28 | 28 | \ No newline at end of file |
@@ -20,111 +20,111 @@ |
||
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 |
@@ -52,24 +52,24 @@ discard block |
||
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 |
||
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 |
||
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 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | * @return string HTML code of the inserted flag |
80 | 80 | */ |
81 | 81 | public static function htmlPlaceIcon(\Fisharebest\Webtrees\Place $place, $icon_path , $size = 50) { |
82 | - return '<img class="flag_gm_h'. $size . '" src="' . $icon_path . '" title="' . $place->getGedcomName() . '" alt="' . $place->getGedcomName() . '" />'; |
|
82 | + return '<img class="flag_gm_h'. $size . '" src="' . $icon_path . '" title="' . $place->getGedcomName() . '" alt="' . $place->getGedcomName() . '" />'; |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | * @return boolean |
356 | 356 | */ |
357 | 357 | public static function isDateWithinChartsRange(Date $date) { |
358 | - return $date->gregorianYear() >= 1550 && $date->gregorianYear() < 2030; |
|
358 | + return $date->gregorianYear() >= 1550 && $date->gregorianYear() < 2030; |
|
359 | 359 | } |
360 | 360 | |
361 | 361 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * @return string List of elements |
33 | 33 | */ |
34 | 34 | public static function getListFromArray(array $array) { |
35 | - $n=count($array); |
|
35 | + $n = count($array); |
|
36 | 36 | switch ($n) { |
37 | 37 | case 0: |
38 | 38 | return ''; |
@@ -41,10 +41,10 @@ discard block |
||
41 | 41 | default: |
42 | 42 | return implode( |
43 | 43 | /* I18N: list separator */ I18N::translate(', '), |
44 | - array_slice($array, 0, $n-1) |
|
45 | - ) . |
|
46 | - /* I18N: last list separator, " and " in English, " et " in French */ I18N::translate(' and ') . |
|
47 | - $array[$n-1]; |
|
44 | + array_slice($array, 0, $n - 1) |
|
45 | + ). |
|
46 | + /* I18N: last list separator, " and " in English, " et " in French */ I18N::translate(' and '). |
|
47 | + $array[$n - 1]; |
|
48 | 48 | } |
49 | 49 | } |
50 | 50 | |
@@ -60,10 +60,10 @@ discard block |
||
60 | 60 | \MyArtJaub\Webtrees\Map\MapProviderInterface $mapProvider |
61 | 61 | ) { |
62 | 62 | $place = $fact->getPlace(); |
63 | - if(!$place->isEmpty()) { |
|
64 | - $iconPlace= $mapProvider->getPlaceIcon($place); |
|
65 | - if($iconPlace && strlen($iconPlace) > 0){ |
|
66 | - return '<div class="fact_flag">'. self::htmlPlaceIcon($place, $iconPlace, 50). '</div>'; |
|
63 | + if (!$place->isEmpty()) { |
|
64 | + $iconPlace = $mapProvider->getPlaceIcon($place); |
|
65 | + if ($iconPlace && strlen($iconPlace) > 0) { |
|
66 | + return '<div class="fact_flag">'.self::htmlPlaceIcon($place, $iconPlace, 50).'</div>'; |
|
67 | 67 | } |
68 | 68 | } |
69 | 69 | return ''; |
@@ -77,8 +77,8 @@ discard block |
||
77 | 77 | * @param number $size |
78 | 78 | * @return string HTML code of the inserted flag |
79 | 79 | */ |
80 | - public static function htmlPlaceIcon(\Fisharebest\Webtrees\Place $place, $icon_path , $size = 50) { |
|
81 | - return '<img class="flag_gm_h'. $size . '" src="' . $icon_path . '" title="' . $place->getGedcomName() . '" alt="' . $place->getGedcomName() . '" />'; |
|
80 | + public static function htmlPlaceIcon(\Fisharebest\Webtrees\Place $place, $icon_path, $size = 50) { |
|
81 | + return '<img class="flag_gm_h'.$size.'" src="'.$icon_path.'" title="'.$place->getGedcomName().'" alt="'.$place->getGedcomName().'" />'; |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | /** |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $minimum = PHP_INT_MAX; |
97 | 97 | $maximum = 1; |
98 | 98 | foreach ($list as $params) { |
99 | - if(array_key_exists('count', $params)) { |
|
99 | + if (array_key_exists('count', $params)) { |
|
100 | 100 | $maximum = max($maximum, $params['count']); |
101 | 101 | $minimum = min($minimum, $params['count']); |
102 | 102 | } |
@@ -114,15 +114,15 @@ discard block |
||
114 | 114 | $size = 75.0 + 125.0 * ($count - $minimum) / ($maximum - $minimum); |
115 | 115 | } |
116 | 116 | |
117 | - $html .= '<a style="font-size:' . $size . '%" href="' . $url . '">'; |
|
117 | + $html .= '<a style="font-size:'.$size.'%" href="'.$url.'">'; |
|
118 | 118 | if ($totals) { |
119 | - $html .= I18N::translate('%1$s (%2$s)', '<span dir="auto">' . $text . '</span>', I18N::number($count)); |
|
119 | + $html .= I18N::translate('%1$s (%2$s)', '<span dir="auto">'.$text.'</span>', I18N::number($count)); |
|
120 | 120 | } else { |
121 | 121 | $html .= $text; |
122 | 122 | } |
123 | 123 | $html .= '</a>'; |
124 | 124 | } |
125 | - return '<div class="tag_cloud">' . $html . '</div>'; |
|
125 | + return '<div class="tag_cloud">'.$html.'</div>'; |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | |
@@ -157,11 +157,11 @@ discard block |
||
157 | 157 | * @param bool $isStrong Bolden the name ? |
158 | 158 | * @return string HTML Code for individual item |
159 | 159 | */ |
160 | - public static function htmlIndividualForList(\Fisharebest\Webtrees\Individual $individual, $isStrong = true){ |
|
160 | + public static function htmlIndividualForList(\Fisharebest\Webtrees\Individual $individual, $isStrong = true) { |
|
161 | 161 | $html = ''; |
162 | 162 | $tag = 'em'; |
163 | - if($isStrong) $tag = 'strong'; |
|
164 | - if($individual && $individual->canShow()){ |
|
163 | + if ($isStrong) $tag = 'strong'; |
|
164 | + if ($individual && $individual->canShow()) { |
|
165 | 165 | $dindi = new Individual($individual); |
166 | 166 | $html = $individual->getSexImage(); |
167 | 167 | $html .= '<a class="list_item" href="'. |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | $html .= '</a>'; |
177 | 177 | } |
178 | 178 | else { |
179 | - $html .= '<span class=\"list_item\"><'.$tag.'>' . I18N::translate('Private') . '</'.$tag.'></span>'; |
|
179 | + $html .= '<span class=\"list_item\"><'.$tag.'>'.I18N::translate('Private').'</'.$tag.'></span>'; |
|
180 | 180 | } |
181 | 181 | return $html; |
182 | 182 | } |
@@ -188,20 +188,20 @@ discard block |
||
188 | 188 | * @param boolean $anchor option to print a link to calendar |
189 | 189 | * @return string HTML code for short date |
190 | 190 | */ |
191 | - public static function formatFactDateShort(\Fisharebest\Webtrees\Fact $fact, $anchor=false) { |
|
192 | - $html=''; |
|
191 | + public static function formatFactDateShort(\Fisharebest\Webtrees\Fact $fact, $anchor = false) { |
|
192 | + $html = ''; |
|
193 | 193 | $date = $fact->getDate(); |
194 | - if($date->isOK()){ |
|
195 | - $html.=' '.$date->Display($anchor && !Globals::isSearchSpider(), '%Y'); |
|
194 | + if ($date->isOK()) { |
|
195 | + $html .= ' '.$date->Display($anchor && !Globals::isSearchSpider(), '%Y'); |
|
196 | 196 | } |
197 | - else{ |
|
197 | + else { |
|
198 | 198 | // 1 DEAT Y with no DATE => print YES |
199 | 199 | // 1 BIRT 2 SOUR @S1@ => print YES |
200 | 200 | // 1 DEAT N is not allowed |
201 | 201 | // It is not proper GEDCOM form to use a N(o) value with an event tag to infer that it did not happen. |
202 | 202 | $factdetail = explode(' ', trim($fact->getGedcom())); |
203 | 203 | if (isset($factdetail) && (count($factdetail) == 3 && strtoupper($factdetail[2]) == 'Y') || (count($factdetail) == 4 && $factdetail[2] == 'SOUR')) { |
204 | - $html.=I18N::translate('yes'); |
|
204 | + $html .= I18N::translate('yes'); |
|
205 | 205 | } |
206 | 206 | } |
207 | 207 | return $html; |
@@ -215,12 +215,12 @@ discard block |
||
215 | 215 | * @param boolean $anchor option to print a link to placelist |
216 | 216 | * @return string HTML code for short place |
217 | 217 | */ |
218 | - public static function formatFactPlaceShort(\Fisharebest\Webtrees\Fact $fact, $format, $anchor=false){ |
|
219 | - $html=''; |
|
218 | + public static function formatFactPlaceShort(\Fisharebest\Webtrees\Fact $fact, $format, $anchor = false) { |
|
219 | + $html = ''; |
|
220 | 220 | |
221 | 221 | if ($fact === null) return $html; |
222 | 222 | $place = $fact->getPlace(); |
223 | - if($place){ |
|
223 | + if ($place) { |
|
224 | 224 | $dplace = new Place($place); |
225 | 225 | $html .= $dplace->htmlFormattedName($format, $anchor); |
226 | 226 | } |
@@ -238,21 +238,21 @@ discard block |
||
238 | 238 | * @param string $size CSS size for the icon. A CSS style css_$size is required |
239 | 239 | * @return string HTML code for the formatted Sosa numbers |
240 | 240 | */ |
241 | - public static function formatSosaNumbers(array $sosatab, $format = 1, $size = 'small'){ |
|
241 | + public static function formatSosaNumbers(array $sosatab, $format = 1, $size = 'small') { |
|
242 | 242 | $html = ''; |
243 | - switch($format){ |
|
243 | + switch ($format) { |
|
244 | 244 | case 1: |
245 | - if(count($sosatab)>0){ |
|
245 | + if (count($sosatab) > 0) { |
|
246 | 246 | $html = '<i class="icon-maj-sosa_'.$size.'" title="'.I18N::translate('Sosa').'"></i>'; |
247 | 247 | } |
248 | 248 | break; |
249 | 249 | case 2: |
250 | - if(count($sosatab)>0){ |
|
250 | + if (count($sosatab) > 0) { |
|
251 | 251 | ksort($sosatab); |
252 | 252 | $tmp_html = array(); |
253 | 253 | foreach ($sosatab as $sosa => $gen) { |
254 | 254 | $tmp_html[] = sprintf( |
255 | - '<i class="icon-maj-sosa_%1$s" title="'.I18N::translate('Sosa').'"></i> <strong>%2$d '.I18N::translate('(G%s)', $gen) .'</strong>', |
|
255 | + '<i class="icon-maj-sosa_%1$s" title="'.I18N::translate('Sosa').'"></i> <strong>%2$d '.I18N::translate('(G%s)', $gen).'</strong>', |
|
256 | 256 | $size, |
257 | 257 | $sosa |
258 | 258 | ); |
@@ -278,15 +278,15 @@ discard block |
||
278 | 278 | * @param string $size CSS size for the icon. A CSS style css_$size is required |
279 | 279 | * @return string HTML code for IsSourced icon |
280 | 280 | */ |
281 | - public static function formatIsSourcedIcon($sourceType, $isSourced, $tag='EVEN', $format = 1, $size='normal'){ |
|
282 | - $html=''; |
|
283 | - $image=null; |
|
284 | - $title=null; |
|
285 | - switch($format){ |
|
281 | + public static function formatIsSourcedIcon($sourceType, $isSourced, $tag = 'EVEN', $format = 1, $size = 'normal') { |
|
282 | + $html = ''; |
|
283 | + $image = null; |
|
284 | + $title = null; |
|
285 | + switch ($format) { |
|
286 | 286 | case 1: |
287 | - switch($sourceType){ |
|
287 | + switch ($sourceType) { |
|
288 | 288 | case 'E': |
289 | - switch($isSourced){ |
|
289 | + switch ($isSourced) { |
|
290 | 290 | case 0: |
291 | 291 | $image = 'event_unknown'; |
292 | 292 | $title = I18N::translate('%s not found', GedcomTag::getLabel($tag)); |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | } |
317 | 317 | break; |
318 | 318 | case 'R': |
319 | - switch($isSourced){ |
|
319 | + switch ($isSourced) { |
|
320 | 320 | case -1: |
321 | 321 | $image = 'record_notsourced'; |
322 | 322 | $title = I18N::translate('%s not sourced', GedcomTag::getLabel($tag)); |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | default: |
337 | 337 | break; |
338 | 338 | } |
339 | - if($image && $title) $html = '<i class="icon-maj-sourced-'.$size.'_'.$image.'" title="'.$title.'"></i>'; |
|
339 | + if ($image && $title) $html = '<i class="icon-maj-sourced-'.$size.'_'.$image.'" title="'.$title.'"></i>'; |
|
340 | 340 | break; |
341 | 341 | default: |
342 | 342 | break; |
@@ -160,7 +160,9 @@ discard block |
||
160 | 160 | public static function htmlIndividualForList(\Fisharebest\Webtrees\Individual $individual, $isStrong = true){ |
161 | 161 | $html = ''; |
162 | 162 | $tag = 'em'; |
163 | - if($isStrong) $tag = 'strong'; |
|
163 | + if($isStrong) { |
|
164 | + $tag = 'strong'; |
|
165 | + } |
|
164 | 166 | if($individual && $individual->canShow()){ |
165 | 167 | $dindi = new Individual($individual); |
166 | 168 | $html = $individual->getSexImage(); |
@@ -174,8 +176,7 @@ discard block |
||
174 | 176 | $html .= ' <span><small><em>'.$dindi->formatFirstMajorFact(WT_EVENTS_BIRT, 10).'</em></small></span>'; |
175 | 177 | $html .= ' <span><small><em>'.$dindi->formatFirstMajorFact(WT_EVENTS_DEAT, 10).'</em></small></span>'; |
176 | 178 | $html .= '</a>'; |
177 | - } |
|
178 | - else { |
|
179 | + } else { |
|
179 | 180 | $html .= '<span class=\"list_item\"><'.$tag.'>' . I18N::translate('Private') . '</'.$tag.'></span>'; |
180 | 181 | } |
181 | 182 | return $html; |
@@ -193,8 +194,7 @@ discard block |
||
193 | 194 | $date = $fact->getDate(); |
194 | 195 | if($date->isOK()){ |
195 | 196 | $html.=' '.$date->Display($anchor && !Globals::isSearchSpider(), '%Y'); |
196 | - } |
|
197 | - else{ |
|
197 | + } else{ |
|
198 | 198 | // 1 DEAT Y with no DATE => print YES |
199 | 199 | // 1 BIRT 2 SOUR @S1@ => print YES |
200 | 200 | // 1 DEAT N is not allowed |
@@ -218,7 +218,9 @@ discard block |
||
218 | 218 | public static function formatFactPlaceShort(\Fisharebest\Webtrees\Fact $fact, $format, $anchor=false){ |
219 | 219 | $html=''; |
220 | 220 | |
221 | - if ($fact === null) return $html; |
|
221 | + if ($fact === null) { |
|
222 | + return $html; |
|
223 | + } |
|
222 | 224 | $place = $fact->getPlace(); |
223 | 225 | if($place){ |
224 | 226 | $dplace = new Place($place); |
@@ -336,7 +338,9 @@ discard block |
||
336 | 338 | default: |
337 | 339 | break; |
338 | 340 | } |
339 | - if($image && $title) $html = '<i class="icon-maj-sourced-'.$size.'_'.$image.'" title="'.$title.'"></i>'; |
|
341 | + if($image && $title) { |
|
342 | + $html = '<i class="icon-maj-sourced-'.$size.'_'.$image.'" title="'.$title.'"></i>'; |
|
343 | + } |
|
340 | 344 | break; |
341 | 345 | default: |
342 | 346 | break; |
@@ -30,10 +30,10 @@ discard block |
||
30 | 30 | * @param string $gedcom |
31 | 31 | * @return NULL|\MyArtJaub\Webtrees\Family |
32 | 32 | */ |
33 | - public static function getIntance($xref, Tree $tree, $gedcom = null){ |
|
33 | + public static function getIntance($xref, Tree $tree, $gedcom = null) { |
|
34 | 34 | $dfam = null; |
35 | 35 | $fam = fw\Family::getInstance($xref, $tree, $gedcom); |
36 | - if($fam){ |
|
36 | + if ($fam) { |
|
37 | 37 | $dfam = new Family($fam); |
38 | 38 | } |
39 | 39 | return $dfam; |
@@ -44,8 +44,8 @@ discard block |
||
44 | 44 | * |
45 | 45 | * @return int Level of sources |
46 | 46 | * */ |
47 | - function isMarriageSourced(){ |
|
48 | - if($this->is_marriage_sourced !== null) return $this->is_marriage_sourced; |
|
47 | + function isMarriageSourced() { |
|
48 | + if ($this->is_marriage_sourced !== null) return $this->is_marriage_sourced; |
|
49 | 49 | $this->is_marriage_sourced = $this->isFactSourced(WT_EVENTS_MARR.'|MARC'); |
50 | 50 | return $this->is_marriage_sourced; |
51 | 51 | } |
@@ -45,7 +45,9 @@ |
||
45 | 45 | * @return int Level of sources |
46 | 46 | * */ |
47 | 47 | function isMarriageSourced(){ |
48 | - if($this->is_marriage_sourced !== null) return $this->is_marriage_sourced; |
|
48 | + if($this->is_marriage_sourced !== null) { |
|
49 | + return $this->is_marriage_sourced; |
|
50 | + } |
|
49 | 51 | $this->is_marriage_sourced = $this->isFactSourced(WT_EVENTS_MARR.'|MARC'); |
50 | 52 | return $this->is_marriage_sourced; |
51 | 53 | } |
@@ -40,10 +40,10 @@ |
||
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
43 | - * Check if this family's marriages are sourced |
|
44 | - * |
|
45 | - * @return int Level of sources |
|
46 | - * */ |
|
43 | + * Check if this family's marriages are sourced |
|
44 | + * |
|
45 | + * @return int Level of sources |
|
46 | + * */ |
|
47 | 47 | function isMarriageSourced(){ |
48 | 48 | if($this->is_marriage_sourced !== null) return $this->is_marriage_sourced; |
49 | 49 | $this->is_marriage_sourced = $this->isFactSourced(WT_EVENTS_MARR.'|MARC'); |
@@ -113,29 +113,29 @@ discard block |
||
113 | 113 | * @return string|array Estimated birth place if found, null otherwise |
114 | 114 | */ |
115 | 115 | public function getSignificantPlace(){ |
116 | - if($bplace = $this->gedcomrecord->getBirthPlace()){ |
|
117 | - return $bplace; |
|
118 | - } |
|
116 | + if($bplace = $this->gedcomrecord->getBirthPlace()){ |
|
117 | + return $bplace; |
|
118 | + } |
|
119 | 119 | |
120 | - foreach ($this->gedcomrecord->getAllEventPlaces('RESI') as $rplace) { |
|
121 | - if ($rplace) { |
|
122 | - return $rplace; |
|
123 | - } |
|
124 | - } |
|
120 | + foreach ($this->gedcomrecord->getAllEventPlaces('RESI') as $rplace) { |
|
121 | + if ($rplace) { |
|
122 | + return $rplace; |
|
123 | + } |
|
124 | + } |
|
125 | 125 | |
126 | - if($dplace = $this->gedcomrecord->getDeathPlace()){ |
|
127 | - return $dplace; |
|
128 | - } |
|
126 | + if($dplace = $this->gedcomrecord->getDeathPlace()){ |
|
127 | + return $dplace; |
|
128 | + } |
|
129 | 129 | |
130 | - foreach($this->gedcomrecord->getSpouseFamilies() as $fams) { |
|
131 | - foreach ($fams->getAllEventPlaces('RESI') as $rplace) { |
|
132 | - if ($rplace) { |
|
133 | - return $rplace; |
|
134 | - } |
|
135 | - } |
|
136 | - } |
|
130 | + foreach($this->gedcomrecord->getSpouseFamilies() as $fams) { |
|
131 | + foreach ($fams->getAllEventPlaces('RESI') as $rplace) { |
|
132 | + if ($rplace) { |
|
133 | + return $rplace; |
|
134 | + } |
|
135 | + } |
|
136 | + } |
|
137 | 137 | |
138 | - return null; |
|
138 | + return null; |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | /** |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | * @return boolean Is the individual a Sosa ancestor |
145 | 145 | */ |
146 | 146 | public function isSosa(){ |
147 | - return count($this->getSosaNumbers()) > 0; |
|
147 | + return count($this->getSosaNumbers()) > 0; |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | /** |
@@ -155,11 +155,11 @@ discard block |
||
155 | 155 | * @return array List of Sosa numbers |
156 | 156 | */ |
157 | 157 | public function getSosaNumbers(){ |
158 | - if($this->sosa === null) { |
|
159 | - $provider = new SosaProvider($this->gedcomrecord->getTree()); |
|
160 | - $this->sosa = $provider->getSosaNumbers($this->gedcomrecord); |
|
161 | - } |
|
162 | - return $this->sosa; |
|
158 | + if($this->sosa === null) { |
|
159 | + $provider = new SosaProvider($this->gedcomrecord->getTree()); |
|
160 | + $this->sosa = $provider->getSosaNumbers($this->gedcomrecord); |
|
161 | + } |
|
162 | + return $this->sosa; |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | /** |
@@ -174,10 +174,10 @@ discard block |
||
174 | 174 | } |
175 | 175 | |
176 | 176 | /** |
177 | - * Check if this individual's death is sourced |
|
178 | - * |
|
179 | - * @return int Level of sources |
|
180 | - * */ |
|
177 | + * Check if this individual's death is sourced |
|
178 | + * |
|
179 | + * @return int Level of sources |
|
180 | + * */ |
|
181 | 181 | public function isDeathSourced(){ |
182 | 182 | if($this->is_death_sourced !== null) return $this->is_death_sourced; |
183 | 183 | $this->is_death_sourced = $this->isFactSourced(WT_EVENTS_DEAT); |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | class Individual extends GedcomRecord { |
22 | 22 | |
23 | 23 | /** @var array|null List of titles the individal holds */ |
24 | - protected $titles=null; |
|
24 | + protected $titles = null; |
|
25 | 25 | |
26 | 26 | /** @var string|null Individual's primary surname, without any privacy applied to it */ |
27 | 27 | protected $unprotected_prim_surname = null; |
@@ -43,9 +43,9 @@ discard block |
||
43 | 43 | * @param null|string $gedcom |
44 | 44 | * @return null|Individual |
45 | 45 | */ |
46 | - public static function getIntance($xref, Tree $tree, $gedcom = null){ |
|
46 | + public static function getIntance($xref, Tree $tree, $gedcom = null) { |
|
47 | 47 | $indi = \Fisharebest\Webtrees\Individual::getInstance($xref, $tree, $gedcom); |
48 | - if($indi){ |
|
48 | + if ($indi) { |
|
49 | 49 | return new Individual($indi); |
50 | 50 | } |
51 | 51 | return null; |
@@ -56,18 +56,18 @@ discard block |
||
56 | 56 | * |
57 | 57 | * @return array Array of titles |
58 | 58 | */ |
59 | - public function getTitles(){ |
|
60 | - if(is_null($this->titles) && $module = Module::getModuleByName(Constants::MODULE_MAJ_MISC_NAME)){ |
|
59 | + public function getTitles() { |
|
60 | + if (is_null($this->titles) && $module = Module::getModuleByName(Constants::MODULE_MAJ_MISC_NAME)) { |
|
61 | 61 | $pattern = '/(.*) (('.$module->getSetting('MAJ_TITLE_PREFIX', '').')(.*))/'; |
62 | - $this->titles=array(); |
|
62 | + $this->titles = array(); |
|
63 | 63 | $titlefacts = $this->gedcomrecord->getFacts('TITL'); |
64 | - foreach($titlefacts as $titlefact){ |
|
64 | + foreach ($titlefacts as $titlefact) { |
|
65 | 65 | $ct2 = preg_match_all($pattern, $titlefact->getValue(), $match2); |
66 | - if($ct2>0){ |
|
67 | - $this->titles[$match2[1][0]][]= trim($match2[2][0]); |
|
66 | + if ($ct2 > 0) { |
|
67 | + $this->titles[$match2[1][0]][] = trim($match2[2][0]); |
|
68 | 68 | } |
69 | - else{ |
|
70 | - $this->titles[$titlefact->getValue()][]=''; |
|
69 | + else { |
|
70 | + $this->titles[$titlefact->getValue()][] = ''; |
|
71 | 71 | } |
72 | 72 | } |
73 | 73 | } |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | * @return string Primary surname |
82 | 82 | */ |
83 | 83 | public function getUnprotectedPrimarySurname() { |
84 | - if(!$this->unprotected_prim_surname){ |
|
85 | - $tmp=$this->gedcomrecord->getAllNames(); |
|
84 | + if (!$this->unprotected_prim_surname) { |
|
85 | + $tmp = $this->gedcomrecord->getAllNames(); |
|
86 | 86 | $this->unprotected_prim_surname = $tmp[$this->gedcomrecord->getPrimaryName()]['surname']; |
87 | 87 | } |
88 | 88 | return $this->unprotected_prim_surname; |
@@ -94,12 +94,12 @@ discard block |
||
94 | 94 | * @param boolean $perc Should the coefficient of reliability be returned |
95 | 95 | * @return string|array Estimated birth place if found, null otherwise |
96 | 96 | */ |
97 | - public function getEstimatedBirthPlace($perc=false){ |
|
98 | - if($bplace = $this->gedcomrecord->getBirthPlace()){ |
|
99 | - if($perc){ |
|
100 | - return array ($bplace, 1); |
|
97 | + public function getEstimatedBirthPlace($perc = false) { |
|
98 | + if ($bplace = $this->gedcomrecord->getBirthPlace()) { |
|
99 | + if ($perc) { |
|
100 | + return array($bplace, 1); |
|
101 | 101 | } |
102 | - else{ |
|
102 | + else { |
|
103 | 103 | return $bplace; |
104 | 104 | } |
105 | 105 | } |
@@ -112,8 +112,8 @@ discard block |
||
112 | 112 | * @param boolean $perc Should the coefficient of reliability be returned |
113 | 113 | * @return string|array Estimated birth place if found, null otherwise |
114 | 114 | */ |
115 | - public function getSignificantPlace(){ |
|
116 | - if($bplace = $this->gedcomrecord->getBirthPlace()){ |
|
115 | + public function getSignificantPlace() { |
|
116 | + if ($bplace = $this->gedcomrecord->getBirthPlace()) { |
|
117 | 117 | return $bplace; |
118 | 118 | } |
119 | 119 | |
@@ -123,11 +123,11 @@ discard block |
||
123 | 123 | } |
124 | 124 | } |
125 | 125 | |
126 | - if($dplace = $this->gedcomrecord->getDeathPlace()){ |
|
126 | + if ($dplace = $this->gedcomrecord->getDeathPlace()) { |
|
127 | 127 | return $dplace; |
128 | 128 | } |
129 | 129 | |
130 | - foreach($this->gedcomrecord->getSpouseFamilies() as $fams) { |
|
130 | + foreach ($this->gedcomrecord->getSpouseFamilies() as $fams) { |
|
131 | 131 | foreach ($fams->getAllEventPlaces('RESI') as $rplace) { |
132 | 132 | if ($rplace) { |
133 | 133 | return $rplace; |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * |
144 | 144 | * @return boolean Is the individual a Sosa ancestor |
145 | 145 | */ |
146 | - public function isSosa(){ |
|
146 | + public function isSosa() { |
|
147 | 147 | return count($this->getSosaNumbers()) > 0; |
148 | 148 | } |
149 | 149 | |
@@ -154,8 +154,8 @@ discard block |
||
154 | 154 | * @uses \MyArtJaub\Webtrees\Functions\ModuleManager |
155 | 155 | * @return array List of Sosa numbers |
156 | 156 | */ |
157 | - public function getSosaNumbers(){ |
|
158 | - if($this->sosa === null) { |
|
157 | + public function getSosaNumbers() { |
|
158 | + if ($this->sosa === null) { |
|
159 | 159 | $provider = new SosaProvider($this->gedcomrecord->getTree()); |
160 | 160 | $this->sosa = $provider->getSosaNumbers($this->gedcomrecord); |
161 | 161 | } |
@@ -167,8 +167,8 @@ discard block |
||
167 | 167 | * |
168 | 168 | * @return int Level of sources |
169 | 169 | * */ |
170 | - public function isBirthSourced(){ |
|
171 | - if($this->is_birth_sourced !== null) return $this->is_birth_sourced; |
|
170 | + public function isBirthSourced() { |
|
171 | + if ($this->is_birth_sourced !== null) return $this->is_birth_sourced; |
|
172 | 172 | $this->is_birth_sourced = $this->isFactSourced(WT_EVENTS_BIRT); |
173 | 173 | return $this->is_birth_sourced; |
174 | 174 | } |
@@ -178,8 +178,8 @@ discard block |
||
178 | 178 | * |
179 | 179 | * @return int Level of sources |
180 | 180 | * */ |
181 | - public function isDeathSourced(){ |
|
182 | - if($this->is_death_sourced !== null) return $this->is_death_sourced; |
|
181 | + public function isDeathSourced() { |
|
182 | + if ($this->is_death_sourced !== null) return $this->is_death_sourced; |
|
183 | 183 | $this->is_death_sourced = $this->isFactSourced(WT_EVENTS_DEAT); |
184 | 184 | return $this->is_death_sourced; |
185 | 185 | } |
@@ -65,8 +65,7 @@ discard block |
||
65 | 65 | $ct2 = preg_match_all($pattern, $titlefact->getValue(), $match2); |
66 | 66 | if($ct2>0){ |
67 | 67 | $this->titles[$match2[1][0]][]= trim($match2[2][0]); |
68 | - } |
|
69 | - else{ |
|
68 | + } else{ |
|
70 | 69 | $this->titles[$titlefact->getValue()][]=''; |
71 | 70 | } |
72 | 71 | } |
@@ -98,8 +97,7 @@ discard block |
||
98 | 97 | if($bplace = $this->gedcomrecord->getBirthPlace()){ |
99 | 98 | if($perc){ |
100 | 99 | return array ($bplace, 1); |
101 | - } |
|
102 | - else{ |
|
100 | + } else{ |
|
103 | 101 | return $bplace; |
104 | 102 | } |
105 | 103 | } |
@@ -168,7 +166,9 @@ discard block |
||
168 | 166 | * @return int Level of sources |
169 | 167 | * */ |
170 | 168 | public function isBirthSourced(){ |
171 | - if($this->is_birth_sourced !== null) return $this->is_birth_sourced; |
|
169 | + if($this->is_birth_sourced !== null) { |
|
170 | + return $this->is_birth_sourced; |
|
171 | + } |
|
172 | 172 | $this->is_birth_sourced = $this->isFactSourced(WT_EVENTS_BIRT); |
173 | 173 | return $this->is_birth_sourced; |
174 | 174 | } |
@@ -179,7 +179,9 @@ discard block |
||
179 | 179 | * @return int Level of sources |
180 | 180 | * */ |
181 | 181 | public function isDeathSourced(){ |
182 | - if($this->is_death_sourced !== null) return $this->is_death_sourced; |
|
182 | + if($this->is_death_sourced !== null) { |
|
183 | + return $this->is_death_sourced; |
|
184 | + } |
|
183 | 185 | $this->is_death_sourced = $this->isFactSourced(WT_EVENTS_DEAT); |
184 | 186 | return $this->is_death_sourced; |
185 | 187 | } |
@@ -16,51 +16,51 @@ |
||
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 |
@@ -32,7 +32,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |