@@ -8,8 +8,8 @@ discard block |
||
8 | 8 | |
9 | 9 | require 'config.php'; |
10 | 10 | |
11 | -define ('VERSION', '1.1.2'); |
|
12 | -define ('DB', 'db'); |
|
11 | +define('VERSION', '1.1.2'); |
|
12 | +define('DB', 'db'); |
|
13 | 13 | date_default_timezone_set($config['default_timezone']); |
14 | 14 | |
15 | 15 | |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | function serverSideRender($data) |
23 | 23 | { |
24 | 24 | // Get the templates |
25 | - $theme = getCurrentTemplate (); |
|
25 | + $theme = getCurrentTemplate(); |
|
26 | 26 | $header = file_get_contents('templates/' . $theme . '/header.html'); |
27 | 27 | $footer = file_get_contents('templates/' . $theme . '/footer.html'); |
28 | 28 | $main = file_get_contents('templates/' . $theme . '/main.html'); |
@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | $page = file_get_contents('templates/' . $theme . '/page.html'); |
31 | 31 | |
32 | 32 | // Generate the function for the template |
33 | - $template = new doT (); |
|
34 | - $dot = $template->template ($page, array ('bookdetail' => $bookdetail, |
|
33 | + $template = new doT(); |
|
34 | + $dot = $template->template($page, array('bookdetail' => $bookdetail, |
|
35 | 35 | 'header' => $header, |
36 | 36 | 'footer' => $footer, |
37 | 37 | 'main' => $main)); |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | } |
43 | 43 | // Execute the template |
44 | 44 | if (!empty ($data)) { |
45 | - return $dot ($data); |
|
45 | + return $dot($data); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | return NULL; |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | |
59 | 59 | function notFound() |
60 | 60 | { |
61 | - header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found'); |
|
61 | + header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found'); |
|
62 | 62 | header('Status: 404 Not Found'); |
63 | 63 | |
64 | 64 | $_SERVER['REDIRECT_STATUS'] = 404; |
@@ -76,8 +76,8 @@ discard block |
||
76 | 76 | { |
77 | 77 | global $config; |
78 | 78 | if (isset($_COOKIE[$option])) { |
79 | - if (isset($config ['cops_' . $option]) && is_array ($config ['cops_' . $option])) { |
|
80 | - return explode (',', $_COOKIE[$option]); |
|
79 | + if (isset($config ['cops_' . $option]) && is_array($config ['cops_' . $option])) { |
|
80 | + return explode(',', $_COOKIE[$option]); |
|
81 | 81 | } else { |
82 | 82 | return $_COOKIE[$option]; |
83 | 83 | } |
@@ -91,12 +91,12 @@ discard block |
||
91 | 91 | |
92 | 92 | function getCurrentCss() |
93 | 93 | { |
94 | - return 'templates/' . getCurrentTemplate () . '/styles/style-' . getCurrentOption('style') . '.css'; |
|
94 | + return 'templates/' . getCurrentTemplate() . '/styles/style-' . getCurrentOption('style') . '.css'; |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | function getCurrentTemplate() |
98 | 98 | { |
99 | - return getCurrentOption ('template'); |
|
99 | + return getCurrentOption('template'); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | function getUrlWithVersion($url) |
@@ -160,10 +160,10 @@ discard block |
||
160 | 160 | libxml_use_internal_errors(true); |
161 | 161 | |
162 | 162 | $doc->loadHTML('<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body>' . |
163 | - $html . '</body></html>'); // Load the HTML |
|
163 | + $html . '</body></html>'); // Load the HTML |
|
164 | 164 | $output = $doc->saveXML($doc->documentElement); // Transform to an Ansi xml stream |
165 | 165 | $output = xml2xhtml($output); |
166 | - if (preg_match ('#<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></meta></head><body>(.*)</body></html>#ms', $output, $matches)) { |
|
166 | + if (preg_match('#<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></meta></head><body>(.*)</body></html>#ms', $output, $matches)) { |
|
167 | 167 | $output = $matches [1]; // Remove <html><body> |
168 | 168 | } |
169 | 169 | /* |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | } |
176 | 176 | */ |
177 | 177 | |
178 | - if (!are_libxml_errors_ok ()) $output = 'HTML code not valid.'; |
|
178 | + if (!are_libxml_errors_ok()) $output = 'HTML code not valid.'; |
|
179 | 179 | |
180 | 180 | libxml_use_internal_errors(false); |
181 | 181 | return $output; |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | //echo var_dump($langs); |
265 | 265 | $lang_file = NULL; |
266 | 266 | foreach ($langs as $language => $val) { |
267 | - $temp_file = dirname(__FILE__). '/lang/Localization_' . $language . '.json'; |
|
267 | + $temp_file = dirname(__FILE__) . '/lang/Localization_' . $language . '.json'; |
|
268 | 268 | if (file_exists($temp_file)) { |
269 | 269 | $lang = $language; |
270 | 270 | $lang_file = $temp_file; |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | } |
273 | 273 | } |
274 | 274 | if (empty ($lang_file)) { |
275 | - $lang_file = dirname(__FILE__). '/lang/Localization_' . $lang . '.json'; |
|
275 | + $lang_file = dirname(__FILE__) . '/lang/Localization_' . $lang . '.json'; |
|
276 | 276 | } |
277 | 277 | return array($lang, $lang_file); |
278 | 278 | } |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | * This method is based on this page |
282 | 282 | * http://www.mind-it.info/2010/02/22/a-simple-approach-to-localization-in-php/ |
283 | 283 | */ |
284 | -function localize($phrase, $count=-1, $reset=false) |
|
284 | +function localize($phrase, $count = -1, $reset = false) |
|
285 | 285 | { |
286 | 286 | global $config; |
287 | 287 | if ($count == 0) |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | $lang_file_en = NULL; |
302 | 302 | list ($lang, $lang_file) = getLangAndTranslationFile(); |
303 | 303 | if ($lang != 'en') { |
304 | - $lang_file_en = dirname(__FILE__). '/lang/' . 'Localization_en.json'; |
|
304 | + $lang_file_en = dirname(__FILE__) . '/lang/' . 'Localization_en.json'; |
|
305 | 305 | } |
306 | 306 | |
307 | 307 | $lang_file_content = file_get_contents($lang_file); |
@@ -309,18 +309,18 @@ discard block |
||
309 | 309 | $translations = json_decode($lang_file_content, true); |
310 | 310 | |
311 | 311 | /* Clean the array of all unfinished translations */ |
312 | - foreach (array_keys ($translations) as $key) { |
|
313 | - if (preg_match ('/^##TODO##/', $key)) { |
|
312 | + foreach (array_keys($translations) as $key) { |
|
313 | + if (preg_match('/^##TODO##/', $key)) { |
|
314 | 314 | unset ($translations [$key]); |
315 | 315 | } |
316 | 316 | } |
317 | 317 | if (!is_null($lang_file_en)) { |
318 | 318 | $lang_file_content = file_get_contents($lang_file_en); |
319 | 319 | $translations_en = json_decode($lang_file_content, true); |
320 | - $translations = array_merge ($translations_en, $translations); |
|
320 | + $translations = array_merge($translations_en, $translations); |
|
321 | 321 | } |
322 | 322 | } |
323 | - if (array_key_exists ($phrase, $translations)) { |
|
323 | + if (array_key_exists($phrase, $translations)) { |
|
324 | 324 | return $translations[$phrase]; |
325 | 325 | } |
326 | 326 | return $phrase; |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | $urlParams = ''; |
333 | 333 | } |
334 | 334 | $start = ''; |
335 | - if (preg_match ('#^\?(.*)#', $urlParams, $matches)) { |
|
335 | + if (preg_match('#^\?(.*)#', $urlParams, $matches)) { |
|
336 | 336 | $start = '?'; |
337 | 337 | $urlParams = $matches[1]; |
338 | 338 | } |