@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * - function-name like set_var to get eg. all assignments or |
33 | 33 | * - handle- / variable-names - if you are only interested in some variables ;-) |
34 | 34 | */ |
35 | - var $debug = False; // array('cat_list','cat_list_t'); |
|
35 | + var $debug = False; // array('cat_list','cat_list_t'); |
|
36 | 36 | |
37 | 37 | /** |
38 | 38 | * $file[handle] = 'filename'; |
@@ -128,9 +128,9 @@ discard block |
||
128 | 128 | */ |
129 | 129 | function set_file($handle, $filename = '') |
130 | 130 | { |
131 | - if ($this->debug && $this->check_debug('set_file',$handle,$filename)) |
|
131 | + if ($this->debug && $this->check_debug('set_file', $handle, $filename)) |
|
132 | 132 | { |
133 | - echo "<p>Template::set_file('".print_r($handle,true)."','$filename')</p>\n"; |
|
133 | + echo "<p>Template::set_file('".print_r($handle, true)."','$filename')</p>\n"; |
|
134 | 134 | } |
135 | 135 | if (!is_array($handle)) |
136 | 136 | { |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | } |
144 | 144 | else |
145 | 145 | { |
146 | - foreach($handle as $h => $f) |
|
146 | + foreach ($handle as $h => $f) |
|
147 | 147 | { |
148 | 148 | $this->file[$h] = $this->filename($f); |
149 | 149 | } |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | */ |
161 | 161 | function set_block($parent, $handle, $name = '') |
162 | 162 | { |
163 | - if ($this->debug && $this->check_debug('set_block',$parent,$handle,$name)) |
|
163 | + if ($this->debug && $this->check_debug('set_block', $parent, $handle, $name)) |
|
164 | 164 | { |
165 | 165 | echo "<p>Template::set_block('$parent','$handle','$name')</p>\n"; |
166 | 166 | } |
@@ -177,14 +177,14 @@ discard block |
||
177 | 177 | $qhandle = preg_quote($handle); |
178 | 178 | $reg = "/<!--\\s+BEGIN $qhandle\\s+-->(.*)\n\\s*<!--\\s+END $qhandle\\s+-->/s"; |
179 | 179 | $match = null; |
180 | - if (!preg_match($reg,$str,$match)) |
|
180 | + if (!preg_match($reg, $str, $match)) |
|
181 | 181 | { |
182 | 182 | // unfortunaly some apps set non-existing blocks, therefor I have to disable this diagnostics again for now |
183 | 183 | $this->halt("set_block: unable to find block '$handle' in '$parent'=<pre>".htmlspecialchars($str)."</pre> this->root=$this->root"); |
184 | 184 | // return False; |
185 | 185 | } |
186 | - $this->set_var($handle,$match[1]); |
|
187 | - $this->set_var($parent,preg_replace($reg, '{' . "$name}",$str)); |
|
186 | + $this->set_var($handle, $match[1]); |
|
187 | + $this->set_var($parent, preg_replace($reg, '{'."$name}", $str)); |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | /* public: set_var(array $values) |
@@ -205,18 +205,18 @@ discard block |
||
205 | 205 | $varname => $value |
206 | 206 | ); |
207 | 207 | } |
208 | - foreach($varname as $k => $v) |
|
208 | + foreach ($varname as $k => $v) |
|
209 | 209 | { |
210 | 210 | if (!empty($k)) |
211 | 211 | { |
212 | - if ($this->debug && $this->check_debug('set_var',$k)) |
|
212 | + if ($this->debug && $this->check_debug('set_var', $k)) |
|
213 | 213 | { |
214 | 214 | echo "<p>Template::set_var('$k','$v')</p>\n"; |
215 | 215 | } |
216 | 216 | $this->varkeys[$k] = $this->varname($k); |
217 | 217 | $this->varvals[$k] = $this->egroupware_hack ? str_replace( |
218 | - array('phpGroupWare','www.phpgroupware.org'), |
|
219 | - array('eGroupWare','www.eGroupWare.org'),$v |
|
218 | + array('phpGroupWare', 'www.phpgroupware.org'), |
|
219 | + array('eGroupWare', 'www.eGroupWare.org'), $v |
|
220 | 220 | ) : $v; |
221 | 221 | } |
222 | 222 | } |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | */ |
231 | 231 | function subst($handle) |
232 | 232 | { |
233 | - if ($this->debug && $this->check_debug('subst',$handle)) |
|
233 | + if ($this->debug && $this->check_debug('subst', $handle)) |
|
234 | 234 | { |
235 | 235 | echo "<p>Template::subst('$handle')</p>\n"; |
236 | 236 | } |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | } |
242 | 242 | |
243 | 243 | $str = $this->get_var($handle); |
244 | - foreach($this->varkeys as $k => $v) |
|
244 | + foreach ($this->varkeys as $k => $v) |
|
245 | 245 | { |
246 | 246 | $str = str_replace($v, $this->varvals[$k], $str); |
247 | 247 | } |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | $str = $this->subst($handle); |
277 | 277 | if ($append) |
278 | 278 | { |
279 | - $this->set_var($target, $this->get_var($target) . $str); |
|
279 | + $this->set_var($target, $this->get_var($target).$str); |
|
280 | 280 | } |
281 | 281 | else |
282 | 282 | { |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | } |
286 | 286 | else |
287 | 287 | { |
288 | - foreach($handle as $h) |
|
288 | + foreach ($handle as $h) |
|
289 | 289 | { |
290 | 290 | $str = $this->subst($h); |
291 | 291 | $this->set_var($target, $str); |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | */ |
333 | 333 | function get_vars() |
334 | 334 | { |
335 | - foreach(array_keys($this->varkeys) as $k) |
|
335 | + foreach (array_keys($this->varkeys) as $k) |
|
336 | 336 | { |
337 | 337 | $result[$k] = $this->varvals[$k]; |
338 | 338 | } |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | } |
354 | 354 | else |
355 | 355 | { |
356 | - foreach(array_keys($varname) as $k) |
|
356 | + foreach (array_keys($varname) as $k) |
|
357 | 357 | { |
358 | 358 | $result[$k] = $this->varvals[$k]; |
359 | 359 | } |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | { |
383 | 383 | return false; |
384 | 384 | } |
385 | - foreach($m as $v) |
|
385 | + foreach ($m as $v) |
|
386 | 386 | { |
387 | 387 | if (!isset($this->varkeys[$v])) |
388 | 388 | { |
@@ -448,15 +448,15 @@ discard block |
||
448 | 448 | * @param string $root ='' default $this->root |
449 | 449 | * @param int $time =1 |
450 | 450 | */ |
451 | - protected function filename($filename,$root='',$time=1) |
|
451 | + protected function filename($filename, $root = '', $time = 1) |
|
452 | 452 | { |
453 | - if($root == '') |
|
453 | + if ($root == '') |
|
454 | 454 | { |
455 | 455 | $root = $this->root; |
456 | 456 | } |
457 | - if(substr($filename, 0, 1) != '/') |
|
457 | + if (substr($filename, 0, 1) != '/') |
|
458 | 458 | { |
459 | - $new_filename = $root . '/' . $filename; |
|
459 | + $new_filename = $root.'/'.$filename; |
|
460 | 460 | } |
461 | 461 | else |
462 | 462 | { |
@@ -465,14 +465,14 @@ discard block |
||
465 | 465 | |
466 | 466 | if (!file_exists($new_filename)) |
467 | 467 | { |
468 | - if($time==2) |
|
468 | + if ($time == 2) |
|
469 | 469 | { |
470 | 470 | $this->halt("filename: file $new_filename does not exist."); |
471 | 471 | } |
472 | 472 | else |
473 | 473 | { |
474 | - $new_root = dirname($root) . DIRECTORY_SEPARATOR . 'default'; |
|
475 | - $new_filename = $this->filename(str_replace($root.'/','',$new_filename),$new_root,2); |
|
474 | + $new_root = dirname($root).DIRECTORY_SEPARATOR.'default'; |
|
475 | + $new_filename = $this->filename(str_replace($root.'/', '', $new_filename), $new_root, 2); |
|
476 | 476 | } |
477 | 477 | } |
478 | 478 | return $new_filename; |
@@ -491,9 +491,9 @@ discard block |
||
491 | 491 | */ |
492 | 492 | function loadfile($handle) |
493 | 493 | { |
494 | - if ($this->debug && $this->check_debug('loadfile',$handle)) |
|
494 | + if ($this->debug && $this->check_debug('loadfile', $handle)) |
|
495 | 495 | { |
496 | - echo "<p>Template::loadfile('$handle') file=<pre>\n".print_r($this->file,True)."</pre>\n"; |
|
496 | + echo "<p>Template::loadfile('$handle') file=<pre>\n".print_r($this->file, True)."</pre>\n"; |
|
497 | 497 | echo "<p>backtrace: ".function_backtrace()."</p>\n"; |
498 | 498 | } |
499 | 499 | if (isset($this->varkeys[$handle]) && !empty($this->varvals[$handle])) |
@@ -502,9 +502,9 @@ discard block |
||
502 | 502 | } |
503 | 503 | if (!isset($this->file[$handle])) |
504 | 504 | { |
505 | - if ($this->debug && $this->check_debug('loadfile',$handle)) |
|
505 | + if ($this->debug && $this->check_debug('loadfile', $handle)) |
|
506 | 506 | { |
507 | - echo "varkeys =<pre>".print_r($this->varkeys,True)."</pre>varvals =<pre>".print_r($this->varvals,True)."</pre>\n"; |
|
507 | + echo "varkeys =<pre>".print_r($this->varkeys, True)."</pre>varvals =<pre>".print_r($this->varvals, True)."</pre>\n"; |
|
508 | 508 | } |
509 | 509 | $this->halt("loadfile: $handle is not a valid handle."); |
510 | 510 | return false; |
@@ -549,10 +549,10 @@ discard block |
||
549 | 549 | { |
550 | 550 | if (!$this->debug) return False; |
551 | 551 | |
552 | - foreach(func_get_args() as $arg) |
|
552 | + foreach (func_get_args() as $arg) |
|
553 | 553 | { |
554 | 554 | if (!is_array($this->debug) && $this->debug === $arg || |
555 | - (is_array($this->debug) && (@$this->debug[$arg] || in_array($arg,$this->debug,True)))) |
|
555 | + (is_array($this->debug) && (@$this->debug[$arg] || in_array($arg, $this->debug, True)))) |
|
556 | 556 | { |
557 | 557 | return True; |
558 | 558 | } |
@@ -601,8 +601,8 @@ discard block |
||
601 | 601 | { |
602 | 602 | $GLOBALS['egw_info']['server']['template_set'] = 'idots'; |
603 | 603 | } |
604 | - $tpldir = EGW_SERVER_ROOT . '/' . $appname . '/templates/' . $GLOBALS['egw_info']['server']['template_set']; |
|
605 | - $tpldir_default = EGW_SERVER_ROOT . '/' . $appname . '/templates/default'; |
|
604 | + $tpldir = EGW_SERVER_ROOT.'/'.$appname.'/templates/'.$GLOBALS['egw_info']['server']['template_set']; |
|
605 | + $tpldir_default = EGW_SERVER_ROOT.'/'.$appname.'/templates/default'; |
|
606 | 606 | |
607 | 607 | if (@is_dir($tpldir)) |
608 | 608 | { |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * @param boolean $clear_includes =false true: clear all previous includes |
35 | 35 | * @return boolean false: css file not found, true: file found |
36 | 36 | */ |
37 | - public static function add($app, $name=null, $append=true, $clear_includes=false) |
|
37 | + public static function add($app, $name = null, $append = true, $clear_includes = false) |
|
38 | 38 | { |
39 | 39 | if ($clear_includes) |
40 | 40 | { |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | |
44 | 44 | if (!is_null($name)) |
45 | 45 | { |
46 | - foreach($GLOBALS['egw']->framework->template_dirs as $dir) |
|
46 | + foreach ($GLOBALS['egw']->framework->template_dirs as $dir) |
|
47 | 47 | { |
48 | 48 | if (file_exists(EGW_SERVER_ROOT.($path = '/'.$app.'/templates/'.$dir.'/'.$name.'.css'))) |
49 | 49 | { |
@@ -55,12 +55,12 @@ discard block |
||
55 | 55 | { |
56 | 56 | $path = $app; |
57 | 57 | } |
58 | - if (!file_exists(EGW_SERVER_ROOT.$path) && !file_exists(EGW_SERVER_ROOT . parse_url($path,PHP_URL_PATH))) |
|
58 | + if (!file_exists(EGW_SERVER_ROOT.$path) && !file_exists(EGW_SERVER_ROOT.parse_url($path, PHP_URL_PATH))) |
|
59 | 59 | { |
60 | 60 | //error_log(__METHOD__."($app,$name) $path NOT found!"); |
61 | 61 | return false; |
62 | 62 | } |
63 | - if (!in_array($path,self::$files)) |
|
63 | + if (!in_array($path, self::$files)) |
|
64 | 64 | { |
65 | 65 | if ($append) |
66 | 66 | { |
@@ -79,16 +79,16 @@ discard block |
||
79 | 79 | * |
80 | 80 | * @return string |
81 | 81 | */ |
82 | - public static function get($resolve=false) |
|
82 | + public static function get($resolve = false) |
|
83 | 83 | { |
84 | 84 | if (!$resolve) |
85 | 85 | { |
86 | 86 | return self::$files; |
87 | 87 | } |
88 | 88 | $files = array(); |
89 | - foreach(self::$files as $path) |
|
89 | + foreach (self::$files as $path) |
|
90 | 90 | { |
91 | - foreach(self::resolve_css_includes($path) as $path) |
|
91 | + foreach (self::resolve_css_includes($path) as $path) |
|
92 | 92 | { |
93 | 93 | $files[] = $path; |
94 | 94 | } |
@@ -109,11 +109,11 @@ discard block |
||
109 | 109 | $base_path = $GLOBALS['egw_info']['server']['webserver_url']; |
110 | 110 | if ($base_path[0] != '/') $base_path = parse_url($base_path, PHP_URL_PATH); |
111 | 111 | $css_files = ''; |
112 | - foreach(self::$files as $path) |
|
112 | + foreach (self::$files as $path) |
|
113 | 113 | { |
114 | - foreach(self::resolve_css_includes($path) as $path) |
|
114 | + foreach (self::resolve_css_includes($path) as $path) |
|
115 | 115 | { |
116 | - list($file,$query) = explode('?',$path,2); |
|
116 | + list($file, $query) = explode('?', $path, 2); |
|
117 | 117 | if (($mod = filemtime(EGW_SERVER_ROOT.$file)) > $max_modified) $max_modified = $mod; |
118 | 118 | |
119 | 119 | // do NOT include app.css or categories.php, as it changes from app to app |
@@ -147,20 +147,20 @@ discard block |
||
147 | 147 | * @param string $path EGroupware relative path eg. /phpgwapi/templates/default/some.css |
148 | 148 | * @return array parsed pathes (EGroupware relative) including $path itself |
149 | 149 | */ |
150 | - protected static function resolve_css_includes($path, &$pathes=array()) |
|
150 | + protected static function resolve_css_includes($path, &$pathes = array()) |
|
151 | 151 | { |
152 | 152 | $matches = null; |
153 | 153 | |
154 | - list($file) = explode('?',$path,2); |
|
155 | - if (($to_check = file_get_contents (EGW_SERVER_ROOT.$file, false, null, -1, 1024)) && |
|
154 | + list($file) = explode('?', $path, 2); |
|
155 | + if (($to_check = file_get_contents(EGW_SERVER_ROOT.$file, false, null, -1, 1024)) && |
|
156 | 156 | stripos($to_check, '/*@import') !== false && preg_match_all('|/\*@import url\("([^"]+)"|i', $to_check, $matches)) |
157 | 157 | { |
158 | - foreach($matches[1] as $import_path) |
|
158 | + foreach ($matches[1] as $import_path) |
|
159 | 159 | { |
160 | 160 | if ($import_path[0] != '/') |
161 | 161 | { |
162 | 162 | $dir = dirname($path); |
163 | - while(substr($import_path,0,3) == '../') |
|
163 | + while (substr($import_path, 0, 3) == '../') |
|
164 | 164 | { |
165 | 165 | $dir = dirname($dir); |
166 | 166 | $import_path = substr($import_path, 3); |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * |
33 | 33 | * @param array $content |
34 | 34 | */ |
35 | - function popup ($content=null) |
|
35 | + function popup($content = null) |
|
36 | 36 | { |
37 | 37 | // check and if not done register tutorial_menu hook |
38 | 38 | if (!Api\Hooks::exists('sidebox_all', 'api') || |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | if (!is_array($content)) |
49 | 49 | { |
50 | 50 | // Get tutorial object id |
51 | - $tuid_indx = explode('-',$_GET['tuid']); |
|
51 | + $tuid_indx = explode('-', $_GET['tuid']); |
|
52 | 52 | $appName = $tuid_indx[0]; |
53 | 53 | $lang = $tuid_indx[1]; |
54 | 54 | $id = $tuid_indx[2]; |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | { |
58 | 58 | $appName = $content['list']['apps']; |
59 | 59 | $lang = $GLOBALS['egw_info']['user']['preferences']['common']['lang']; |
60 | - $id ="0"; |
|
60 | + $id = "0"; |
|
61 | 61 | } |
62 | 62 | // read tutorials json file to fetch data |
63 | 63 | $tutorials = json_decode(self::getJsonData(), true); |
@@ -74,8 +74,7 @@ discard block |
||
74 | 74 | if (in_array($appName, array_keys($GLOBALS['egw_info']['user']['apps'])) || $appName === "introduction") |
75 | 75 | { |
76 | 76 | // fallback to english video |
77 | - $tutorial = $tutorials[$appName][$lang][$id]? $tutorials[$appName][$lang][$id]: |
|
78 | - $tutorials[$appName]['en'][$id]; |
|
77 | + $tutorial = $tutorials[$appName][$lang][$id] ? $tutorials[$appName][$lang][$id] : $tutorials[$appName]['en'][$id]; |
|
79 | 78 | |
80 | 79 | $list = array( |
81 | 80 | 'apps' => $appName, |
@@ -86,7 +85,7 @@ discard block |
||
86 | 85 | $v ['onclick'] = 'app[egw.app_name()].tutorial_videoOnClick("'.$v['src'].'")'; |
87 | 86 | array_push($list, $v); |
88 | 87 | } |
89 | - $content = array ( |
|
88 | + $content = array( |
|
90 | 89 | 'src' => $tutorial['src'], |
91 | 90 | 'title' => $tutorial['title'], |
92 | 91 | 'desc' => $tutorial['desc'], |
@@ -137,13 +136,13 @@ discard block |
||
137 | 136 | public static function tutorial_menu() |
138 | 137 | { |
139 | 138 | if (Api\Header\UserAgent::mobile()) return; |
140 | - $tutorials = json_decode(self::getJsonData(),true); |
|
139 | + $tutorials = json_decode(self::getJsonData(), true); |
|
141 | 140 | $appname = $GLOBALS['egw_info']['flags']['currentapp']; |
142 | 141 | if (!is_array($tutorials[$appname])) return false; |
143 | 142 | if (!$GLOBALS['egw_info']['server']['egw_tutorial_disable'] |
144 | 143 | || $GLOBALS['egw_info']['server']['egw_tutorial_disable'] == 'intro') |
145 | 144 | { |
146 | - $file = Array ( |
|
145 | + $file = Array( |
|
147 | 146 | array( |
148 | 147 | 'text' => '<div id="egw_tutorial_'.$appname.'_sidebox" class="egwTutorial"/>', |
149 | 148 | 'no_lang' => true, |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $bundles = Cache::getTree(__CLASS__, 'bundles', array(__CLASS__, 'all'), array(), 7200); |
52 | 52 | $bundles_ts = $bundles['.ts']; |
53 | 53 | unset($bundles['.ts']); |
54 | - foreach($bundles as $name => $files) |
|
54 | + foreach ($bundles as $name => $files) |
|
55 | 55 | { |
56 | 56 | // to facilitate move to new api/et2 location, can be removed after 16.1 release |
57 | 57 | if ($name == 'et21' && !in_array('/api/js/etemplate/etemplate2.js', $files) || |
@@ -72,9 +72,9 @@ discard block |
||
72 | 72 | } |
73 | 73 | $to_include = $included_bundles = array(); |
74 | 74 | $query = null; |
75 | - foreach($js_includes as $file) |
|
75 | + foreach ($js_includes as $file) |
|
76 | 76 | { |
77 | - if ($file == '/api/js/jsapi/egw.js') continue; // loaded via own tag, and we must not load it twice! |
|
77 | + if ($file == '/api/js/jsapi/egw.js') continue; // loaded via own tag, and we must not load it twice! |
|
78 | 78 | |
79 | 79 | if (!isset($to_include[$file])) |
80 | 80 | { |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | * @param string $minurl =null url of minified bundle, to be used, if existing and recent |
130 | 130 | * @return array js-files (can be more then one, if one of given files can not be bundeled) |
131 | 131 | */ |
132 | - protected static function urls(array $js_includes, &$max_modified=null, $minurl=null) |
|
132 | + protected static function urls(array $js_includes, &$max_modified = null, $minurl = null) |
|
133 | 133 | { |
134 | 134 | $debug_minify = $GLOBALS['egw_info']['server']['debug_minify'] === 'True'; |
135 | 135 | // ignore not existing minurl |
@@ -137,28 +137,28 @@ discard block |
||
137 | 137 | $to_include_first = $to_include = $to_minify = array(); |
138 | 138 | $max_modified = 0; |
139 | 139 | $query = null; |
140 | - foreach($js_includes as $path) |
|
140 | + foreach ($js_includes as $path) |
|
141 | 141 | { |
142 | 142 | if ($path == '/api/js/jsapi/egw.js') continue; // Leave egw.js out of bundle |
143 | 143 | unset($query); |
144 | - list($path,$query) = explode('?',$path,2); |
|
144 | + list($path, $query) = explode('?', $path, 2); |
|
145 | 145 | $mod = filemtime(EGW_SERVER_ROOT.$path); |
146 | 146 | if ($mod > $max_modified) $max_modified = $mod; |
147 | 147 | |
148 | 148 | // ckeditor must be included before bundled files, as they depend on it! |
149 | - if (strpos($path,'/ckeditor/ckeditor.js') !== false) |
|
149 | + if (strpos($path, '/ckeditor/ckeditor.js') !== false) |
|
150 | 150 | { |
151 | - $to_include_first[] = $path . '?' . $mod; |
|
151 | + $to_include_first[] = $path.'?'.$mod; |
|
152 | 152 | } |
153 | 153 | // for now minify does NOT support query parameters, nor php files generating javascript |
154 | 154 | elseif ($debug_minify || $query || substr($path, -3) != '.js' || empty($minurl)) |
155 | 155 | { |
156 | - $path .= '?'. $mod.($query ? '&'.$query : ''); |
|
156 | + $path .= '?'.$mod.($query ? '&'.$query : ''); |
|
157 | 157 | $to_include[] = $path; |
158 | 158 | } |
159 | 159 | else |
160 | 160 | { |
161 | - $to_minify[] = substr($path,1); |
|
161 | + $to_minify[] = substr($path, 1); |
|
162 | 162 | } |
163 | 163 | } |
164 | 164 | if (!$debug_minify && $to_minify) |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | $stock_files = call_user_func_array('array_merge', $bundles); |
247 | 247 | |
248 | 248 | // generate template and app bundles, if installed |
249 | - foreach(array( |
|
249 | + foreach (array( |
|
250 | 250 | 'jdots' => '/jdots/js/fw_jdots.js', |
251 | 251 | 'mobile' => '/pixelegg/js/fw_mobile.js', |
252 | 252 | 'pixelegg' => '/pixelegg/js/fw_pixelegg.js', |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | { |
258 | 258 | if (@file_exists(EGW_SERVER_ROOT.$file)) |
259 | 259 | { |
260 | - $inc_mgr = new IncludeMgr($stock_files); // reset loaded files to stock files |
|
260 | + $inc_mgr = new IncludeMgr($stock_files); // reset loaded files to stock files |
|
261 | 261 | $inc_mgr->include_js_file($file); |
262 | 262 | $bundles[$bundle] = array_diff($inc_mgr->get_included_files(), $stock_files); |
263 | 263 | self::urls($bundles[$bundle], $max_mod[$bundle]); |
@@ -265,12 +265,12 @@ discard block |
||
265 | 265 | } |
266 | 266 | |
267 | 267 | // automatic split bundles with more then MAX_BUNDLE_FILES (=50) files |
268 | - foreach($bundles as $name => $files) |
|
268 | + foreach ($bundles as $name => $files) |
|
269 | 269 | { |
270 | 270 | $n = ''; |
271 | - while (count($files) > self::MAX_BUNDLE_FILES*(int)$n) |
|
271 | + while (count($files) > self::MAX_BUNDLE_FILES * (int)$n) |
|
272 | 272 | { |
273 | - $files80 = array_slice($files, self::MAX_BUNDLE_FILES*(int)$n, self::MAX_BUNDLE_FILES, true); |
|
273 | + $files80 = array_slice($files, self::MAX_BUNDLE_FILES * (int)$n, self::MAX_BUNDLE_FILES, true); |
|
274 | 274 | $bundles[$name.$n++] = $files80; |
275 | 275 | } |
276 | 276 | } |
@@ -54,12 +54,12 @@ discard block |
||
54 | 54 | * @param string $with =null |
55 | 55 | * @param string $msg_type =null 'error', 'warning' or 'success' (default) |
56 | 56 | */ |
57 | - public static function refresh_opener($msg, $app, $id=null, $type=null, $targetapp=null, $replace=null, $with=null, $msg_type=null) |
|
57 | + public static function refresh_opener($msg, $app, $id = null, $type = null, $targetapp = null, $replace = null, $with = null, $msg_type = null) |
|
58 | 58 | { |
59 | 59 | //error_log(__METHOD__.'('.array2string(func_get_args()).')'); |
60 | 60 | self::$extra['refresh-opener'] = func_get_args(); |
61 | 61 | |
62 | - unset($msg, $app, $id, $type, $targetapp, $replace, $with, $msg_type); // used only via func_get_args(); |
|
62 | + unset($msg, $app, $id, $type, $targetapp, $replace, $with, $msg_type); // used only via func_get_args(); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |
@@ -70,11 +70,11 @@ discard block |
||
70 | 70 | * @param string $msg message to show |
71 | 71 | * @param string $type ='success' 'error', 'warning' or 'success' (default) |
72 | 72 | */ |
73 | - public static function message($msg, $type='success') |
|
73 | + public static function message($msg, $type = 'success') |
|
74 | 74 | { |
75 | 75 | self::$extra['message'] = func_get_args(); |
76 | 76 | |
77 | - unset($msg, $type); // used only via func_get_args(); |
|
77 | + unset($msg, $type); // used only via func_get_args(); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
@@ -84,12 +84,12 @@ discard block |
||
84 | 84 | * @param string $target |
85 | 85 | * @param string $popup |
86 | 86 | */ |
87 | - public static function popup($link, $target='_blank', $popup='640x480') |
|
87 | + public static function popup($link, $target = '_blank', $popup = '640x480') |
|
88 | 88 | { |
89 | 89 | // default params are not returned by func_get_args! |
90 | - $args = func_get_args()+array(null, '_blank', '640x480'); |
|
90 | + $args = func_get_args() + array(null, '_blank', '640x480'); |
|
91 | 91 | |
92 | - unset($link, $target, $popup); // used only via func_get_args() |
|
92 | + unset($link, $target, $popup); // used only via func_get_args() |
|
93 | 93 | |
94 | 94 | if (Json\Request::isJSONRequest()) |
95 | 95 | { |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | * |
107 | 107 | * @param string $alert_msg ='' optional message to display as alert, before closing the window |
108 | 108 | */ |
109 | - public static function window_close($alert_msg='') |
|
109 | + public static function window_close($alert_msg = '') |
|
110 | 110 | { |
111 | 111 | //error_log(__METHOD__."()"); |
112 | 112 | self::$extra['window-close'] = $alert_msg ? $alert_msg : true; |
@@ -163,12 +163,12 @@ discard block |
||
163 | 163 | public static function get_extra() |
164 | 164 | { |
165 | 165 | // adding links of refreshed entry, to give others apps more information about necessity to refresh |
166 | - if (isset(self::$extra['refresh-opener']) && count(self::$extra['refresh-opener']) <= 8 && // do not run twice |
|
166 | + if (isset(self::$extra['refresh-opener']) && count(self::$extra['refresh-opener']) <= 8 && // do not run twice |
|
167 | 167 | !empty(self::$extra['refresh-opener'][1]) && !empty(self::$extra['refresh-opener'][2])) // app/id given |
168 | 168 | { |
169 | 169 | $links = Link::get_links(self::$extra['refresh-opener'][1], self::$extra['refresh-opener'][2]); |
170 | 170 | $apps = array(); |
171 | - foreach($links as $link) |
|
171 | + foreach ($links as $link) |
|
172 | 172 | { |
173 | 173 | $apps[$link['app']][] = $link['id']; |
174 | 174 | } |
@@ -33,9 +33,9 @@ discard block |
||
33 | 33 | * @param string $template ='default' name of the template |
34 | 34 | * @return idots_framework |
35 | 35 | */ |
36 | - function __construct($template='default') |
|
36 | + function __construct($template = 'default') |
|
37 | 37 | { |
38 | - parent::__construct($template); // call the constructor of the extended class |
|
38 | + parent::__construct($template); // call the constructor of the extended class |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * @param array $extra =array() extra attributes passed as data-attribute to egw.js |
45 | 45 | * @return string with html |
46 | 46 | */ |
47 | - function header(array $extra=array()) |
|
47 | + function header(array $extra = array()) |
|
48 | 48 | { |
49 | 49 | // make sure header is output only once |
50 | 50 | if (self::$header_done) return ''; |
@@ -66,11 +66,11 @@ discard block |
||
66 | 66 | // as the old Template class has problems if restored from the session (php-restore) |
67 | 67 | $this->tpl = new Template(EGW_SERVER_ROOT.$this->template_dir, 'keep'); |
68 | 68 | $this->tpl->set_file(array('_head' => 'head.tpl')); |
69 | - $this->tpl->set_block('_head','head'); |
|
69 | + $this->tpl->set_block('_head', 'head'); |
|
70 | 70 | |
71 | 71 | $this->tpl->set_var($this->_get_header($extra)); |
72 | 72 | |
73 | - $content .= $this->tpl->fp('out','head'); |
|
73 | + $content .= $this->tpl->fp('out', 'head'); |
|
74 | 74 | |
75 | 75 | return $content; |
76 | 76 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * @return boolean $consider_navbar_not_yet_called_as_true=true |
94 | 94 | * @return boolean |
95 | 95 | */ |
96 | - public function isTop($consider_navbar_not_yet_called_as_true=true) |
|
96 | + public function isTop($consider_navbar_not_yet_called_as_true = true) |
|
97 | 97 | { |
98 | 98 | unset($consider_navbar_not_yet_called_as_true); |
99 | 99 | |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | * @access protected |
110 | 110 | * @return void |
111 | 111 | */ |
112 | - function _add_topmenu_item(array $app_data,$alt_label=null) |
|
112 | + function _add_topmenu_item(array $app_data, $alt_label = null) |
|
113 | 113 | { |
114 | 114 | unset($app_data, $alt_label); |
115 | 115 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | * @access protected |
123 | 123 | * @return void |
124 | 124 | */ |
125 | - function _add_topmenu_info_item($content, $id=null) |
|
125 | + function _add_topmenu_info_item($content, $id = null) |
|
126 | 126 | { |
127 | 127 | unset($content, $id); |
128 | 128 | } |
@@ -134,10 +134,10 @@ discard block |
||
134 | 134 | */ |
135 | 135 | function footer() |
136 | 136 | { |
137 | - static $footer_done=0; |
|
138 | - if ($footer_done++) return; // prevent multiple footers, not sure we still need this (RalfBecker) |
|
137 | + static $footer_done = 0; |
|
138 | + if ($footer_done++) return; // prevent multiple footers, not sure we still need this (RalfBecker) |
|
139 | 139 | |
140 | - return "</body>\n</html>\n"; // close body and html tag, eg. for popups |
|
140 | + return "</body>\n</html>\n"; // close body and html tag, eg. for popups |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | /** |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | * @param array $file |
149 | 149 | * @param string $type =null 'admin', 'preferences', 'favorites', ... |
150 | 150 | */ |
151 | - function sidebox($appname,$menu_title,$file,$type=null) |
|
151 | + function sidebox($appname, $menu_title, $file, $type = null) |
|
152 | 152 | { |
153 | 153 | unset($appname, $menu_title, $file, $type); |
154 | 154 | } |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | * @access public |
165 | 165 | * @return void |
166 | 166 | */ |
167 | - function topmenu_info_icon($id,$icon_src,$iconlink,$blink=false,$tooltip=null) |
|
167 | + function topmenu_info_icon($id, $icon_src, $iconlink, $blink = false, $tooltip = null) |
|
168 | 168 | { |
169 | 169 | unset($id, $icon_src, $iconlink, $blink, $tooltip); |
170 | 170 | } |
@@ -51,8 +51,8 @@ discard block |
||
51 | 51 | list($current, $security) = explode("\n", $remote); |
52 | 52 | if (empty($security)) $security = $current; |
53 | 53 | $versions = array( |
54 | - 'current' => $current, // last maintenance update |
|
55 | - 'security' => $security, // last security update |
|
54 | + 'current' => $current, // last maintenance update |
|
55 | + 'security' => $security, // last security update |
|
56 | 56 | ); |
57 | 57 | } |
58 | 58 | return $versions; |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | */ |
114 | 114 | protected static function update_older($version, $days) |
115 | 115 | { |
116 | - list(,,$date) = explode('.', $version); |
|
116 | + list(,, $date) = explode('.', $version); |
|
117 | 117 | if ($date < 20140000) return false; |
118 | 118 | $version_timestamp = mktime(0, 0, 0, (int)substr($date, 4, 2), (int)substr($date, -2), (int)substr($date, 0, 4)); |
119 | 119 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | * @param string &$changelog on return path to changelog |
127 | 127 | * @return string |
128 | 128 | */ |
129 | - public static function api_version(&$changelog=null) |
|
129 | + public static function api_version(&$changelog = null) |
|
130 | 130 | { |
131 | 131 | $changelog = EGW_SERVER_ROOT.'/doc/rpm-build/debian.changes'; |
132 | 132 |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | */ |
147 | 147 | function supportsObjectClass($_objectClass) |
148 | 148 | { |
149 | - if($this->supportedObjectClasses[strtolower($_objectClass)]) |
|
149 | + if ($this->supportedObjectClasses[strtolower($_objectClass)]) |
|
150 | 150 | { |
151 | 151 | return true; |
152 | 152 | } |
@@ -161,21 +161,21 @@ discard block |
||
161 | 161 | * @param int $version 2 or 3 |
162 | 162 | * @return ldapserverinfo |
163 | 163 | */ |
164 | - public static function get($ds, $host, $version=3) |
|
164 | + public static function get($ds, $host, $version = 3) |
|
165 | 165 | { |
166 | - $filter='(objectclass=*)'; |
|
167 | - $justthese = array('structuralObjectClass','namingContexts','supportedLDAPVersion','subschemaSubentry','vendorname'); |
|
168 | - if(($sr = @ldap_read($ds, '', $filter, $justthese))) |
|
166 | + $filter = '(objectclass=*)'; |
|
167 | + $justthese = array('structuralObjectClass', 'namingContexts', 'supportedLDAPVersion', 'subschemaSubentry', 'vendorname'); |
|
168 | + if (($sr = @ldap_read($ds, '', $filter, $justthese))) |
|
169 | 169 | { |
170 | - if(($info = ldap_get_entries($ds, $sr))) |
|
170 | + if (($info = ldap_get_entries($ds, $sr))) |
|
171 | 171 | { |
172 | 172 | $ldapServerInfo = new ServerInfo($host); |
173 | 173 | $ldapServerInfo->setVersion($version); |
174 | 174 | |
175 | 175 | // check for naming contexts |
176 | - if($info[0]['namingcontexts']) |
|
176 | + if ($info[0]['namingcontexts']) |
|
177 | 177 | { |
178 | - for($i=0; $i<$info[0]['namingcontexts']['count']; $i++) |
|
178 | + for ($i = 0; $i < $info[0]['namingcontexts']['count']; $i++) |
|
179 | 179 | { |
180 | 180 | $namingcontexts[] = $info[0]['namingcontexts'][$i]; |
181 | 181 | } |
@@ -183,9 +183,9 @@ discard block |
||
183 | 183 | } |
184 | 184 | |
185 | 185 | // check for ldap server type |
186 | - if($info[0]['structuralobjectclass']) |
|
186 | + if ($info[0]['structuralobjectclass']) |
|
187 | 187 | { |
188 | - switch($info[0]['structuralobjectclass'][0]) |
|
188 | + switch ($info[0]['structuralobjectclass'][0]) |
|
189 | 189 | { |
190 | 190 | case 'OpenLDAProotDSE': |
191 | 191 | $ldapServerType = OPENLDAP_LDAPSERVER; |
@@ -202,30 +202,30 @@ discard block |
||
202 | 202 | } |
203 | 203 | |
204 | 204 | // check for subschema entry dn |
205 | - if($info[0]['subschemasubentry']) |
|
205 | + if ($info[0]['subschemasubentry']) |
|
206 | 206 | { |
207 | 207 | $subschemasubentry = $info[0]['subschemasubentry'][0]; |
208 | 208 | $ldapServerInfo->setSubSchemaEntry($subschemasubentry); |
209 | 209 | } |
210 | 210 | |
211 | 211 | // create list of supported objetclasses |
212 | - if(!empty($subschemasubentry)) |
|
212 | + if (!empty($subschemasubentry)) |
|
213 | 213 | { |
214 | - $filter='(objectclass=*)'; |
|
214 | + $filter = '(objectclass=*)'; |
|
215 | 215 | $justthese = array('objectClasses'); |
216 | 216 | |
217 | - if(($sr = ldap_read($ds, $subschemasubentry, $filter, $justthese))) |
|
217 | + if (($sr = ldap_read($ds, $subschemasubentry, $filter, $justthese))) |
|
218 | 218 | { |
219 | - if(($info = ldap_get_entries($ds, $sr))) |
|
219 | + if (($info = ldap_get_entries($ds, $sr))) |
|
220 | 220 | { |
221 | - if($info[0]['objectclasses']) { |
|
222 | - for($i=0; $i<$info[0]['objectclasses']['count']; $i++) |
|
221 | + if ($info[0]['objectclasses']) { |
|
222 | + for ($i = 0; $i < $info[0]['objectclasses']['count']; $i++) |
|
223 | 223 | { |
224 | 224 | $matches = null; |
225 | - if(preg_match('/^\( (.*) NAME \'(\w*)\' /', $info[0]['objectclasses'][$i], $matches)) |
|
225 | + if (preg_match('/^\( (.*) NAME \'(\w*)\' /', $info[0]['objectclasses'][$i], $matches)) |
|
226 | 226 | { |
227 | 227 | #_debug_array($matches); |
228 | - if(count($matches) == 3) |
|
228 | + if (count($matches) == 3) |
|
229 | 229 | { |
230 | 230 | $supportedObjectClasses[$matches[1]] = strtolower($matches[2]); |
231 | 231 | } |
@@ -59,7 +59,7 @@ |
||
59 | 59 | { |
60 | 60 | if (!isset(self::$backend)) |
61 | 61 | { |
62 | - foreach(self::$backends as $class) |
|
62 | + foreach (self::$backends as $class) |
|
63 | 63 | { |
64 | 64 | if (class_exists($class)) |
65 | 65 | { |