Completed
Push — master ( 4d8164...78ec00 )
by Hadi
28:47
created
pixelegg/inc/class.pixelegg_framework.inc.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -41,12 +41,12 @@  discard block
 block discarded – undo
41 41
 	 *
42 42
 	 * @param string $template ='pixelegg' name of the template
43 43
 	 */
44
-	function __construct($template=self::APP)
44
+	function __construct($template = self::APP)
45 45
 	{
46
-		parent::__construct($template);		// call the constructor of the extended class
46
+		parent::__construct($template); // call the constructor of the extended class
47 47
 
48 48
 		// search 'mobile' dirs first
49
-		if (Api\Header\UserAgent::mobile()) array_unshift ($this->template_dirs, 'mobile');
49
+		if (Api\Header\UserAgent::mobile()) array_unshift($this->template_dirs, 'mobile');
50 50
 	}
51 51
 
52 52
 	/**
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	 * @param array $extra
58 58
 	 * @return type
59 59
 	 */
60
-	function header(array $extra=array())
60
+	function header(array $extra = array())
61 61
 	{
62 62
 		// load our slider.js, but only if framework requested
63 63
 		if (!self::$header_done && $_GET['cd'] === 'yes' &&
@@ -79,9 +79,9 @@  discard block
 block discarded – undo
79 79
 	{
80 80
 		if ($color[0] == '#') $color = ltrim($color, '#');
81 81
 
82
-		$R = hexdec(substr($color,0,2));
83
-		$G = hexdec(substr($color,2,2));
84
-		$B = hexdec(substr($color,4,2));
82
+		$R = hexdec(substr($color, 0, 2));
83
+		$G = hexdec(substr($color, 2, 2));
84
+		$B = hexdec(substr($color, 4, 2));
85 85
 
86 86
 		$Rs = round($R * (100 + $percent) / 100);
87 87
 		$Gs = round($G * (100 + $percent) / 100);
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 	{
105 105
 		$ret = parent::_get_css();
106 106
 		// color to use
107
-		$color = str_replace('custom',$GLOBALS['egw_info']['user']['preferences']['common']['template_custom_color'],
107
+		$color = str_replace('custom', $GLOBALS['egw_info']['user']['preferences']['common']['template_custom_color'],
108 108
 			$GLOBALS['egw_info']['user']['preferences']['common']['template_color']);
109 109
 
110 110
 		// Create a dark variant of the color
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 			$loginbox_color = $color_darker;
130 130
 		}
131 131
 
132
-		if (preg_match('/^(#[0-9A-F]+|[A-Z]+)$/i',$color) || preg_match('/^(#[0-9A-F]+|[A-Z]+)$/i',$loginbox_color))	// a little xss check
132
+		if (preg_match('/^(#[0-9A-F]+|[A-Z]+)$/i', $color) || preg_match('/^(#[0-9A-F]+|[A-Z]+)$/i', $loginbox_color))	// a little xss check
133 133
 		{
134 134
 			if (!Api\Header\UserAgent::mobile())
135 135
 			{
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 	 * @param string $extra_vars for login url
205 205
 	 * @param string $change_passwd =null string with message to render input fields for password change
206 206
 	 */
207
-	function login_screen($extra_vars, $change_passwd=null)
207
+	function login_screen($extra_vars, $change_passwd = null)
208 208
 	{
209 209
 		if (empty($GLOBALS['loginscreenmessage']))
210 210
 		{
Please login to merge, or discard this patch.
Braces   +24 added lines, -6 removed lines patch added patch discarded remove patch
@@ -46,7 +46,10 @@  discard block
 block discarded – undo
46 46
 		parent::__construct($template);		// call the constructor of the extended class
47 47
 
48 48
 		// search 'mobile' dirs first
49
-		if (Api\Header\UserAgent::mobile()) array_unshift ($this->template_dirs, 'mobile');
49
+		if (Api\Header\UserAgent::mobile())
50
+		{
51
+			array_unshift ($this->template_dirs, 'mobile');
52
+		}
50 53
 	}
51 54
 
52 55
 	/**
@@ -77,7 +80,10 @@  discard block
 block discarded – undo
77 80
 	 */
78 81
 	function _color_shader($color, $percent)
79 82
 	{
80
-		if ($color[0] == '#') $color = ltrim($color, '#');
83
+		if ($color[0] == '#')
84
+		{
85
+			$color = ltrim($color, '#');
86
+		}
81 87
 
82 88
 		$R = hexdec(substr($color,0,2));
83 89
 		$G = hexdec(substr($color,2,2));
@@ -87,9 +93,18 @@  discard block
 block discarded – undo
87 93
 		$Gs = round($G * (100 + $percent) / 100);
88 94
 		$Bs = round($B * (100 + $percent) / 100);
89 95
 
90
-		if ($Rs > 255) $Rs = 255;
91
-		if ($Gs > 255) $Gs = 255;
92
-		if ($Bs > 255) $Bs = 255;
96
+		if ($Rs > 255)
97
+		{
98
+			$Rs = 255;
99
+		}
100
+		if ($Gs > 255)
101
+		{
102
+			$Gs = 255;
103
+		}
104
+		if ($Bs > 255)
105
+		{
106
+			$Bs = 255;
107
+		}
93 108
 
94 109
 		return '#'.sprintf('%02X%02X%02X', $Rs, $Gs, $Bs);
95 110
 	}
@@ -129,7 +144,9 @@  discard block
 block discarded – undo
129 144
 			$loginbox_color = $color_darker;
130 145
 		}
131 146
 
132
-		if (preg_match('/^(#[0-9A-F]+|[A-Z]+)$/i',$color) || preg_match('/^(#[0-9A-F]+|[A-Z]+)$/i',$loginbox_color))	// a little xss check
147
+		if (preg_match('/^(#[0-9A-F]+|[A-Z]+)$/i',$color) || preg_match('/^(#[0-9A-F]+|[A-Z]+)$/i',$loginbox_color))
148
+		{
149
+			// a little xss check
133 150
 		{
134 151
 			if (!Api\Header\UserAgent::mobile())
135 152
 			{
@@ -170,6 +187,7 @@  discard block
 block discarded – undo
170 187
 .ui-datepicker div.ui-timepicker-div div.ui_tpicker_hour_slider span.ui-slider-handle,
171 188
 .ui-widget-header {background-color: $sidebox_color;}
172 189
 ";
190
+		}
173 191
 			}
174 192
 			else
175 193
 			/* Mobile theme custom colors*/
Please login to merge, or discard this patch.