@@ -26,11 +26,11 @@ discard block |
||
| 26 | 26 | * {@inhericDoc} |
| 27 | 27 | * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent() |
| 28 | 28 | */ |
| 29 | - protected function renderContent() { |
|
| 29 | + protected function renderContent() { |
|
| 30 | 30 | |
| 31 | - /** @var AbstractModule $module */ |
|
| 32 | - $module = $this->data->get('module'); |
|
| 33 | - ?> |
|
| 31 | + /** @var AbstractModule $module */ |
|
| 32 | + $module = $this->data->get('module'); |
|
| 33 | + ?> |
|
| 34 | 34 | <ol class="breadcrumb small"> |
| 35 | 35 | <li><a href="admin.php"><?php echo I18N::translate('Control panel'); ?></a></li> |
| 36 | 36 | <li><a href="admin_modules.php"><?php echo I18N::translate('Module administration'); ?></a></li> |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | </form> |
| 187 | 187 | |
| 188 | 188 | <?php |
| 189 | - } |
|
| 189 | + } |
|
| 190 | 190 | |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | \ No newline at end of file |
@@ -77,8 +77,7 @@ |
||
| 77 | 77 | $index = str_replace('%', '', $match2); |
| 78 | 78 | if(is_numeric($index) && $index >0 && $index <= $nbLevels){ |
| 79 | 79 | $displayPlace = str_replace($match2, $levels[$index-1] , $displayPlace); |
| 80 | - } |
|
| 81 | - else{ |
|
| 80 | + } else{ |
|
| 82 | 81 | $displayPlace = str_replace($match2, '' , $displayPlace); |
| 83 | 82 | } |
| 84 | 83 | } |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | * |
| 28 | 28 | * @param \Fisharebest\Webtrees\Place $place_in The Place to extend |
| 29 | 29 | */ |
| 30 | - public function __construct(\Fisharebest\Webtrees\Place $place){ |
|
| 30 | + public function __construct(\Fisharebest\Webtrees\Place $place) { |
|
| 31 | 31 | $this->place = $place; |
| 32 | 32 | } |
| 33 | 33 | |
@@ -39,9 +39,9 @@ discard block |
||
| 39 | 39 | * @param \Fisharebest\Webtrees\Tree $tree |
| 40 | 40 | * @return \MyArtJaub\Webtrees\Place|null Instance of \MyArtJaub\Webtrees\Place, if relevant |
| 41 | 41 | */ |
| 42 | - public static function getIntance($place_str, Tree $tree){ |
|
| 42 | + public static function getIntance($place_str, Tree $tree) { |
|
| 43 | 43 | $dplace = null; |
| 44 | - if(is_string($place_str) && strlen($place_str) > 0){ |
|
| 44 | + if (is_string($place_str) && strlen($place_str) > 0) { |
|
| 45 | 45 | $dplace = new Place(new \Fisharebest\Webtrees\Place($place_str, $tree)); |
| 46 | 46 | } |
| 47 | 47 | return $dplace; |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | * |
| 53 | 53 | * @return \Fisharebest\Webtrees\Place Embedded place record |
| 54 | 54 | */ |
| 55 | - public function getDerivedPlace(){ |
|
| 55 | + public function getDerivedPlace() { |
|
| 56 | 56 | return $this->place; |
| 57 | 57 | } |
| 58 | 58 | |
@@ -65,8 +65,8 @@ discard block |
||
| 65 | 65 | * @param bool $anchor Option to print a link to placelist |
| 66 | 66 | * @return string HTML code for formatted place |
| 67 | 67 | */ |
| 68 | - public function htmlFormattedName($format, $anchor = false){ |
|
| 69 | - $html=''; |
|
| 68 | + public function htmlFormattedName($format, $anchor = false) { |
|
| 69 | + $html = ''; |
|
| 70 | 70 | |
| 71 | 71 | $levels = array_map('trim', explode(',', $this->place->getGedcomName())); |
| 72 | 72 | $nbLevels = count($levels); |
@@ -74,15 +74,15 @@ discard block |
||
| 74 | 74 | preg_match_all('/%[^%]/', $displayPlace, $matches); |
| 75 | 75 | foreach ($matches[0] as $match2) { |
| 76 | 76 | $index = str_replace('%', '', $match2); |
| 77 | - if(is_numeric($index) && $index >0 && $index <= $nbLevels){ |
|
| 78 | - $displayPlace = str_replace($match2, $levels[$index-1] , $displayPlace); |
|
| 77 | + if (is_numeric($index) && $index > 0 && $index <= $nbLevels) { |
|
| 78 | + $displayPlace = str_replace($match2, $levels[$index - 1], $displayPlace); |
|
| 79 | 79 | } |
| 80 | - else{ |
|
| 81 | - $displayPlace = str_replace($match2, '' , $displayPlace); |
|
| 80 | + else { |
|
| 81 | + $displayPlace = str_replace($match2, '', $displayPlace); |
|
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | if ($anchor && !Auth::isSearchEngine()) { |
| 85 | - $html .='<a href="' . $this->place->getURL() . '">' . $displayPlace . '</a>'; |
|
| 85 | + $html .= '<a href="'.$this->place->getURL().'">'.$displayPlace.'</a>'; |
|
| 86 | 86 | } else { |
| 87 | 87 | $html .= $displayPlace; |
| 88 | 88 | } |
@@ -15,12 +15,12 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | interface MvcControllerInterface { |
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * Return the module attached to this controller. |
|
| 20 | - * |
|
| 21 | - * @return \Fisharebest\Webtrees\Module\AbstractModule |
|
| 22 | - */ |
|
| 23 | - function getModule(); |
|
| 18 | + /** |
|
| 19 | + * Return the module attached to this controller. |
|
| 20 | + * |
|
| 21 | + * @return \Fisharebest\Webtrees\Module\AbstractModule |
|
| 22 | + */ |
|
| 23 | + function getModule(); |
|
| 24 | 24 | |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | \ No newline at end of file |
@@ -17,28 +17,28 @@ |
||
| 17 | 17 | */ |
| 18 | 18 | class MvcController implements MvcControllerInterface |
| 19 | 19 | { |
| 20 | - /** |
|
| 21 | - * Reference module |
|
| 22 | - * @var Fisharebest\Webtrees\Module\AbstractModule $module |
|
| 23 | - */ |
|
| 24 | - protected $module; |
|
| 20 | + /** |
|
| 21 | + * Reference module |
|
| 22 | + * @var Fisharebest\Webtrees\Module\AbstractModule $module |
|
| 23 | + */ |
|
| 24 | + protected $module; |
|
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * Constructor for MvcController |
|
| 28 | - * |
|
| 29 | - * @param AbstractModule $module |
|
| 30 | - */ |
|
| 31 | - public function __construct(AbstractModule $module) { |
|
| 32 | - $this->module = $module; |
|
| 33 | - } |
|
| 26 | + /** |
|
| 27 | + * Constructor for MvcController |
|
| 28 | + * |
|
| 29 | + * @param AbstractModule $module |
|
| 30 | + */ |
|
| 31 | + public function __construct(AbstractModule $module) { |
|
| 32 | + $this->module = $module; |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * {@inheritDoc} |
|
| 37 | - * @see \MyArtJaub\Webtrees\Mvc\Controller\MvcControllerInterface::getModule() |
|
| 38 | - */ |
|
| 39 | - public function getModule() { |
|
| 40 | - return $this->module; |
|
| 41 | - } |
|
| 35 | + /** |
|
| 36 | + * {@inheritDoc} |
|
| 37 | + * @see \MyArtJaub\Webtrees\Mvc\Controller\MvcControllerInterface::getModule() |
|
| 38 | + */ |
|
| 39 | + public function getModule() { |
|
| 40 | + return $this->module; |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | \ No newline at end of file |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | * @param \Fisharebest\Webtrees\Module\AbstractModule $module |
| 22 | 22 | * @param string $request |
| 23 | 23 | */ |
| 24 | - public function handle(\Fisharebest\Webtrees\Module\AbstractModule $module, $request); |
|
| 24 | + public function handle(\Fisharebest\Webtrees\Module\AbstractModule $module, $request); |
|
| 25 | 25 | |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | \ No newline at end of file |
@@ -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 | } |