Completed
Push — master ( 6276bd...113d57 )
by Jonathan
02:27
created
src/Webtrees/Module/WelcomeBlockModule.php 3 patches
Indentation   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -20,81 +20,81 @@
 block discarded – undo
20 20
  * Welcome Block Module.
21 21
  */
22 22
 class WelcomeBlockModule extends AbstractModule
23
-    implements ModuleBlockInterface
23
+	implements ModuleBlockInterface
24 24
 {
25
-    /** @var string For custom modules - link for support, upgrades, etc. */
26
-    const CUSTOM_WEBSITE = 'https://github.com/jon48/webtrees-lib';
25
+	/** @var string For custom modules - link for support, upgrades, etc. */
26
+	const CUSTOM_WEBSITE = 'https://github.com/jon48/webtrees-lib';
27 27
         
28
-    /**
29
-     * {@inhericDoc}
30
-     */
31
-    public function getTitle() {
32
-        return /* I18N: Name of the “WelcomeBlock” module */ I18N::translate('MyArtJaub Welcome Block');
33
-    }
28
+	/**
29
+	 * {@inhericDoc}
30
+	 */
31
+	public function getTitle() {
32
+		return /* I18N: Name of the “WelcomeBlock” module */ I18N::translate('MyArtJaub Welcome Block');
33
+	}
34 34
     
35
-    /**
36
-     * {@inhericDoc}
37
-     */
38
-    public function getDescription() {
39
-        return /* I18N: Description of the “WelcomeBlock” module */ I18N::translate('The MyArtJaub Welcome block welcomes the visitor to the site, allows a quick login to the site, and displays statistics on visits.');
40
-    }
35
+	/**
36
+	 * {@inhericDoc}
37
+	 */
38
+	public function getDescription() {
39
+		return /* I18N: Description of the “WelcomeBlock” module */ I18N::translate('The MyArtJaub Welcome block welcomes the visitor to the site, allows a quick login to the site, and displays statistics on visits.');
40
+	}
41 41
     
42
-    /**
43
-     * {@inhericDoc}
44
-     */
45
-    public function modAction($mod_action) {
46
-        \MyArtJaub\Webtrees\Mvc\Dispatcher::getInstance()->handle($this, $mod_action);
47
-    }
42
+	/**
43
+	 * {@inhericDoc}
44
+	 */
45
+	public function modAction($mod_action) {
46
+		\MyArtJaub\Webtrees\Mvc\Dispatcher::getInstance()->handle($this, $mod_action);
47
+	}
48 48
     
49
-    /**
50
-     * {@inhericDoc}
51
-     * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::getBlock()
52
-     */
49
+	/**
50
+	 * {@inhericDoc}
51
+	 * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::getBlock()
52
+	 */
53 53
 	public function getBlock($block_id, $template = true, $cfg = array()) {
54
-        global $controller, $WT_TREE;
54
+		global $controller, $WT_TREE;
55 55
         
56
-        $wb_controller = new WelcomeBlockController($this);           
57
-        return $wb_controller->index($controller, $WT_TREE, $block_id, $template);
58
-    }
56
+		$wb_controller = new WelcomeBlockController($this);           
57
+		return $wb_controller->index($controller, $WT_TREE, $block_id, $template);
58
+	}
59 59
     
60
-    /**
61
-     * {@inhericDoc}
62
-     * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::loadAjax()
63
-     */
64
-    public function loadAjax() {
65
-        return false;
66
-    }
60
+	/**
61
+	 * {@inhericDoc}
62
+	 * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::loadAjax()
63
+	 */
64
+	public function loadAjax() {
65
+		return false;
66
+	}
67 67
     
68
-    /**
69
-     * {@inhericDoc}
70
-     * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::isUserBlock()
71
-     */
72
-    public function isUserBlock() {
73
-        return false;
74
-    }
68
+	/**
69
+	 * {@inhericDoc}
70
+	 * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::isUserBlock()
71
+	 */
72
+	public function isUserBlock() {
73
+		return false;
74
+	}
75 75
     
76
-    /**
77
-     * {@inhericDoc}
78
-     * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::isGedcomBlock()
79
-     */
80
-    public function isGedcomBlock() {
81
-        return true;
82
-    }
76
+	/**
77
+	 * {@inhericDoc}
78
+	 * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::isGedcomBlock()
79
+	 */
80
+	public function isGedcomBlock() {
81
+		return true;
82
+	}
83 83
     
84
-    /**
85
-     * {@inhericDoc}
86
-     * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::configureBlock()
87
-     */
88
-    public function configureBlock($block_id) {
89
-        $wb_controller = new WelcomeBlockController($this);
90
-        try {
91
-            return $wb_controller->config($block_id);
92
-        }
93
-        catch (MvcException $ex) {
94
-            if($ex->getHttpCode() != 200) throw $ex;
95
-            return;
96
-        }     
97
-    }
84
+	/**
85
+	 * {@inhericDoc}
86
+	 * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::configureBlock()
87
+	 */
88
+	public function configureBlock($block_id) {
89
+		$wb_controller = new WelcomeBlockController($this);
90
+		try {
91
+			return $wb_controller->config($block_id);
92
+		}
93
+		catch (MvcException $ex) {
94
+			if($ex->getHttpCode() != 200) throw $ex;
95
+			return;
96
+		}     
97
+	}
98 98
 
99 99
 }
100 100
  
101 101
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@
 block discarded – undo
91 91
             return $wb_controller->config($block_id);
92 92
         }
93 93
         catch (MvcException $ex) {
94
-            if($ex->getHttpCode() != 200) throw $ex;
94
+            if ($ex->getHttpCode() != 200) throw $ex;
95 95
             return;
96 96
         }     
97 97
     }
Please login to merge, or discard this patch.
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -89,9 +89,10 @@
 block discarded – undo
89 89
         $wb_controller = new WelcomeBlockController($this);
90 90
         try {
91 91
             return $wb_controller->config($block_id);
92
-        }
93
-        catch (MvcException $ex) {
94
-            if($ex->getHttpCode() != 200) throw $ex;
92
+        } catch (MvcException $ex) {
93
+            if($ex->getHttpCode() != 200) {
94
+            	throw $ex;
95
+            }
95 96
             return;
96 97
         }     
97 98
     }
Please login to merge, or discard this patch.
src/Webtrees/Module/WelcomeBlock/WelcomeBlockController.php 3 patches
Indentation   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -29,30 +29,30 @@  discard block
 block discarded – undo
29 29
 class WelcomeBlockController extends MvcController
30 30
 {   
31 31
     
32
-    /**
33
-     * Pages
34
-     */
32
+	/**
33
+	 * Pages
34
+	 */
35 35
         
36
-    /**
37
-     * WelcomeBlock@index
38
-     * 
39
-     * @param PageController $parent_controller
40
-     * @param Tree $tree
41
-     * @param string $block_id
42
-     * @param string $template
43
-     * @return $string
44
-     */
45
-    public function index(PageController $parent_controller, Tree $tree, $block_id, $template) {        
46
-        $view_bag = new ViewBag();
36
+	/**
37
+	 * WelcomeBlock@index
38
+	 * 
39
+	 * @param PageController $parent_controller
40
+	 * @param Tree $tree
41
+	 * @param string $block_id
42
+	 * @param string $template
43
+	 * @return $string
44
+	 */
45
+	public function index(PageController $parent_controller, Tree $tree, $block_id, $template) {        
46
+		$view_bag = new ViewBag();
47 47
         
48
-        if($parent_controller && $tree) {
48
+		if($parent_controller && $tree) {
49 49
         
50
-            $view_bag->set('tree', $tree);
51
-            $view_bag->set('indi', $parent_controller->getSignificantIndividual());
50
+			$view_bag->set('tree', $tree);
51
+			$view_bag->set('indi', $parent_controller->getSignificantIndividual());
52 52
         
53
-            $id = $this->module->getName().$block_id;
54
-            $class = $this->module->getName().'_block';
55
-            $parent_controller->addInlineJavascript('
53
+			$id = $this->module->getName().$block_id;
54
+			$class = $this->module->getName().'_block';
55
+			$parent_controller->addInlineJavascript('
56 56
                 jQuery("#maj-new_passwd").hide();
57 57
                 jQuery("#maj-passwd_click").click(function()
58 58
                 {
@@ -63,65 +63,65 @@  discard block
 block discarded – undo
63 63
     				  });
64 64
     			');
65 65
     
66
-            if (Auth::isAdmin()) {
67
-                $title='<a class="icon-admin" title="'.I18N::translate('Configure').'" href="block_edit.php?block_id='.$block_id.'&amp;ged=' . $tree->getNameHtml() . '&amp;ctype=gedcom"></a>';
68
-            } else {
69
-                $title='';
70
-            }
71
-            $title .='<span dir="auto">'.$tree->getTitleHtml().'</span>';
66
+			if (Auth::isAdmin()) {
67
+				$title='<a class="icon-admin" title="'.I18N::translate('Configure').'" href="block_edit.php?block_id='.$block_id.'&amp;ged=' . $tree->getNameHtml() . '&amp;ctype=gedcom"></a>';
68
+			} else {
69
+				$title='';
70
+			}
71
+			$title .='<span dir="auto">'.$tree->getTitleHtml().'</span>';
72 72
     
73
-            $piwik_enabled = $this->module->getBlockSetting($block_id, 'piwik_enabled', false);
74
-            $view_bag->set('piwik_enabled', $piwik_enabled);
75
-            if($piwik_enabled) {
76
-                $parent_controller->addInlineJavascript(
77
-                    '$("#piwik_stats")
73
+			$piwik_enabled = $this->module->getBlockSetting($block_id, 'piwik_enabled', false);
74
+			$view_bag->set('piwik_enabled', $piwik_enabled);
75
+			if($piwik_enabled) {
76
+				$parent_controller->addInlineJavascript(
77
+					'$("#piwik_stats")
78 78
                         .load("module.php?mod='.$this->module->getName().'&mod_action=Piwik&block_id='.$block_id.'");'
79
-                );
80
-            }
79
+				);
80
+			}
81 81
     
82
-            $content = ViewFactory::make('WelcomeBlock', $this,  new BaseController(), $view_bag)->getHtmlPartial();   
82
+			$content = ViewFactory::make('WelcomeBlock', $this,  new BaseController(), $view_bag)->getHtmlPartial();   
83 83
             
84
-            if ($template) {
85
-                return Theme::theme()->formatBlock($id, $title, $class, $content);
86
-            } else {
87
-                return $content;
88
-            }
89
-        }
90
-    }
84
+			if ($template) {
85
+				return Theme::theme()->formatBlock($id, $title, $class, $content);
86
+			} else {
87
+				return $content;
88
+			}
89
+		}
90
+	}
91 91
     
92 92
     
93 93
     
94
-    /**
95
-     * WelcomeBlock@config
96
-     * 
97
-     * @param string $block_id
98
-     */
99
-    public function config($block_id = null) {
94
+	/**
95
+	 * WelcomeBlock@config
96
+	 * 
97
+	 * @param string $block_id
98
+	 */
99
+	public function config($block_id = null) {
100 100
         
101
-        if(empty($block_id)) throw new MvcException(404);
101
+		if(empty($block_id)) throw new MvcException(404);
102 102
 
103
-        if (Filter::postBool('save') && Filter::checkCsrf()) {
104
-            $this->module->setBlockSetting($block_id, 'piwik_enabled', Filter::postBool('piwik_enabled'));
105
-            $this->module->setBlockSetting($block_id, 'piwik_url', trim(Filter::postUrl('piwik_url')));
106
-            $this->module->setBlockSetting($block_id, 'piwik_siteid', trim(Filter::post('piwik_siteid')));
107
-            $this->module->setBlockSetting($block_id, 'piwik_token', trim(Filter::post('piwik_token'))); 
108
-            Cache::delete('piwikCountYear', $this->module);          
109
-            throw new MvcException(200); // Use this instead of exit
110
-        }
103
+		if (Filter::postBool('save') && Filter::checkCsrf()) {
104
+			$this->module->setBlockSetting($block_id, 'piwik_enabled', Filter::postBool('piwik_enabled'));
105
+			$this->module->setBlockSetting($block_id, 'piwik_url', trim(Filter::postUrl('piwik_url')));
106
+			$this->module->setBlockSetting($block_id, 'piwik_siteid', trim(Filter::post('piwik_siteid')));
107
+			$this->module->setBlockSetting($block_id, 'piwik_token', trim(Filter::post('piwik_token'))); 
108
+			Cache::delete('piwikCountYear', $this->module);          
109
+			throw new MvcException(200); // Use this instead of exit
110
+		}
111 111
         
112
-        $view_bag = new ViewBag();
112
+		$view_bag = new ViewBag();
113 113
         
114
-        // Is Piwik Statistic Enabled ?
115
-        $view_bag->set('piwik_enabled', $this->module->getBlockSetting($block_id, 'piwik_enabled', '0'));
116
-        //Piwik Root Url
117
-        $view_bag->set('piwik_url', $this->module->getBlockSetting($block_id, 'piwik_url', ''));
118
-        // Piwik token
119
-        $view_bag->set('piwik_token', $this->module->getBlockSetting($block_id, 'piwik_token', ''));
120
-        // Piwik side id
121
-        $view_bag->set('piwik_siteid', $this->module->getBlockSetting($block_id, 'piwik_siteid', ''));
114
+		// Is Piwik Statistic Enabled ?
115
+		$view_bag->set('piwik_enabled', $this->module->getBlockSetting($block_id, 'piwik_enabled', '0'));
116
+		//Piwik Root Url
117
+		$view_bag->set('piwik_url', $this->module->getBlockSetting($block_id, 'piwik_url', ''));
118
+		// Piwik token
119
+		$view_bag->set('piwik_token', $this->module->getBlockSetting($block_id, 'piwik_token', ''));
120
+		// Piwik side id
121
+		$view_bag->set('piwik_siteid', $this->module->getBlockSetting($block_id, 'piwik_siteid', ''));
122 122
         
123
-        return ViewFactory::make('WelcomeBlockConfig', $this, new BaseController(), $view_bag)->getHtmlPartial();
124
-    }
123
+		return ViewFactory::make('WelcomeBlockConfig', $this, new BaseController(), $view_bag)->getHtmlPartial();
124
+	}
125 125
     
126 126
     
127 127
     
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
     public function index(PageController $parent_controller, Tree $tree, $block_id, $template) {        
46 46
         $view_bag = new ViewBag();
47 47
         
48
-        if($parent_controller && $tree) {
48
+        if ($parent_controller && $tree) {
49 49
         
50 50
             $view_bag->set('tree', $tree);
51 51
             $view_bag->set('indi', $parent_controller->getSignificantIndividual());
@@ -64,22 +64,22 @@  discard block
 block discarded – undo
64 64
     			');
65 65
     
66 66
             if (Auth::isAdmin()) {
67
-                $title='<a class="icon-admin" title="'.I18N::translate('Configure').'" href="block_edit.php?block_id='.$block_id.'&amp;ged=' . $tree->getNameHtml() . '&amp;ctype=gedcom"></a>';
67
+                $title = '<a class="icon-admin" title="'.I18N::translate('Configure').'" href="block_edit.php?block_id='.$block_id.'&amp;ged='.$tree->getNameHtml().'&amp;ctype=gedcom"></a>';
68 68
             } else {
69
-                $title='';
69
+                $title = '';
70 70
             }
71
-            $title .='<span dir="auto">'.$tree->getTitleHtml().'</span>';
71
+            $title .= '<span dir="auto">'.$tree->getTitleHtml().'</span>';
72 72
     
73 73
             $piwik_enabled = $this->module->getBlockSetting($block_id, 'piwik_enabled', false);
74 74
             $view_bag->set('piwik_enabled', $piwik_enabled);
75
-            if($piwik_enabled) {
75
+            if ($piwik_enabled) {
76 76
                 $parent_controller->addInlineJavascript(
77 77
                     '$("#piwik_stats")
78 78
                         .load("module.php?mod='.$this->module->getName().'&mod_action=Piwik&block_id='.$block_id.'");'
79 79
                 );
80 80
             }
81 81
     
82
-            $content = ViewFactory::make('WelcomeBlock', $this,  new BaseController(), $view_bag)->getHtmlPartial();   
82
+            $content = ViewFactory::make('WelcomeBlock', $this, new BaseController(), $view_bag)->getHtmlPartial();   
83 83
             
84 84
             if ($template) {
85 85
                 return Theme::theme()->formatBlock($id, $title, $class, $content);
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
      */
99 99
     public function config($block_id = null) {
100 100
         
101
-        if(empty($block_id)) throw new MvcException(404);
101
+        if (empty($block_id)) throw new MvcException(404);
102 102
 
103 103
         if (Filter::postBool('save') && Filter::checkCsrf()) {
104 104
             $this->module->setBlockSetting($block_id, 'piwik_enabled', Filter::postBool('piwik_enabled'));
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -98,7 +98,9 @@
 block discarded – undo
98 98
      */
99 99
     public function config($block_id = null) {
100 100
         
101
-        if(empty($block_id)) throw new MvcException(404);
101
+        if(empty($block_id)) {
102
+        	throw new MvcException(404);
103
+        }
102 104
 
103 105
         if (Filter::postBool('save') && Filter::checkCsrf()) {
104 106
             $this->module->setBlockSetting($block_id, 'piwik_enabled', Filter::postBool('piwik_enabled'));
Please login to merge, or discard this patch.
src/Webtrees/Mvc/View/AbstractView.php 1 patch
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -15,66 +15,66 @@
 block discarded – undo
15 15
  */
16 16
 abstract class AbstractView {
17 17
     
18
-    /**
19
-     * Reference controller
20
-     * @var \Fisharebest\Webtrees\Controller\BaseController $ctrl
21
-     */
22
-    protected $ctrl;
18
+	/**
19
+	 * Reference controller
20
+	 * @var \Fisharebest\Webtrees\Controller\BaseController $ctrl
21
+	 */
22
+	protected $ctrl;
23 23
     
24
-    /**
25
-     * Structure containing the data of the view
26
-     * @var ViewBag $data
27
-     */
28
-    protected $data;
24
+	/**
25
+	 * Structure containing the data of the view
26
+	 * @var ViewBag $data
27
+	 */
28
+	protected $data;
29 29
     
30
-    /**
31
-     * Constructor 
32
-     * @param \Fisharebest\Webtrees\Controller\BaseController $ctrl Controller
33
-     * @param ViewBag $data ViewBag holding view data
34
-     */
35
-    public function __construct(\Fisharebest\Webtrees\Controller\BaseController $ctrl, ViewBag $data) {
36
-        $this->ctrl = $ctrl;
37
-        $this->data = $data;
38
-    }
30
+	/**
31
+	 * Constructor 
32
+	 * @param \Fisharebest\Webtrees\Controller\BaseController $ctrl Controller
33
+	 * @param ViewBag $data ViewBag holding view data
34
+	 */
35
+	public function __construct(\Fisharebest\Webtrees\Controller\BaseController $ctrl, ViewBag $data) {
36
+		$this->ctrl = $ctrl;
37
+		$this->data = $data;
38
+	}
39 39
     
40
-    /**
41
-     * Render the view to the page, including header.
42
-     * 
43
-     * @throws \Exception
44
-     */
45
-    public function render() {
40
+	/**
41
+	 * Render the view to the page, including header.
42
+	 * 
43
+	 * @throws \Exception
44
+	 */
45
+	public function render() {
46 46
 		global $controller;
47 47
 		
48
-        if(!$this->ctrl) throw new \Exception('Controller not initialised');
48
+		if(!$this->ctrl) throw new \Exception('Controller not initialised');
49 49
         
50 50
 		$controller = $this->ctrl;
51
-        $this->ctrl->pageHeader();
51
+		$this->ctrl->pageHeader();
52 52
         
53
-        echo $this->renderContent();
54
-    }
53
+		echo $this->renderContent();
54
+	}
55 55
     
56
-    /**
57
-     * Render the view to the page, without any header
58
-     */
59
-    public function renderPartial() {
60
-        echo $this->getHtmlPartial();
61
-    }
56
+	/**
57
+	 * Render the view to the page, without any header
58
+	 */
59
+	public function renderPartial() {
60
+		echo $this->getHtmlPartial();
61
+	}
62 62
     
63
-    /**
64
-     * Return the HTML code generated by the view, without any header
65
-     */
66
-    public function getHtmlPartial() {
67
-        ob_start();
68
-        $html_render = $this->renderContent();
69
-        $html_buffer = ob_get_clean();        
63
+	/**
64
+	 * Return the HTML code generated by the view, without any header
65
+	 */
66
+	public function getHtmlPartial() {
67
+		ob_start();
68
+		$html_render = $this->renderContent();
69
+		$html_buffer = ob_get_clean();        
70 70
         
71
-        return empty($html_render) ? $html_buffer : $html_render;
72
-    }
71
+		return empty($html_render) ? $html_buffer : $html_render;
72
+	}
73 73
     
74
-    /**
75
-     * Abstract method containing the details of the view.
76
-     */
77
-    abstract protected function renderContent();
74
+	/**
75
+	 * Abstract method containing the details of the view.
76
+	 */
77
+	abstract protected function renderContent();
78 78
     
79 79
 }
80 80
  
81 81
\ No newline at end of file
Please login to merge, or discard this patch.