@@ -35,7 +35,7 @@ |
||
35 | 35 | * |
36 | 36 | * Do not use this directly. You can use getInstance() instead. |
37 | 37 | * @param string $url url of memcache |
38 | - * @return void |
|
38 | + * @return false|null |
|
39 | 39 | */ |
40 | 40 | function CacheMemcache($url) |
41 | 41 | { |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | */ |
24 | 24 | function getInstance($url) |
25 | 25 | { |
26 | - if(!$GLOBALS['__CacheMemcache__']) |
|
26 | + if (!$GLOBALS['__CacheMemcache__']) |
|
27 | 27 | { |
28 | 28 | $GLOBALS['__CacheMemcache__'] = new CacheMemcache($url); |
29 | 29 | } |
@@ -41,12 +41,12 @@ discard block |
||
41 | 41 | { |
42 | 42 | //$config['url'] = array('memcache://localhost:11211'); |
43 | 43 | $config['url'] = is_array($url) ? $url : array($url); |
44 | - if(class_exists('Memcached')) |
|
44 | + if (class_exists('Memcached')) |
|
45 | 45 | { |
46 | 46 | $this->Memcache = new Memcached; |
47 | 47 | $this->SelectedExtension = 'Memcached'; |
48 | 48 | } |
49 | - elseif(class_exists('Memcache')) |
|
49 | + elseif (class_exists('Memcache')) |
|
50 | 50 | { |
51 | 51 | $this->Memcache = new Memcache; |
52 | 52 | $this->SelectedExtension = 'Memcache'; |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | return false; |
57 | 57 | } |
58 | 58 | |
59 | - foreach($config['url'] as $url) |
|
59 | + foreach ($config['url'] as $url) |
|
60 | 60 | { |
61 | 61 | $info = parse_url($url); |
62 | 62 | $this->Memcache->addServer($info['host'], $info['port']); |
@@ -70,15 +70,15 @@ discard block |
||
70 | 70 | */ |
71 | 71 | function isSupport() |
72 | 72 | { |
73 | - if(isset($GLOBALS['XE_MEMCACHE_SUPPORT'])) |
|
73 | + if (isset($GLOBALS['XE_MEMCACHE_SUPPORT'])) |
|
74 | 74 | { |
75 | 75 | return $GLOBALS['XE_MEMCACHE_SUPPORT']; |
76 | 76 | } |
77 | - if($this->SelectedExtension === 'Memcached') |
|
77 | + if ($this->SelectedExtension === 'Memcached') |
|
78 | 78 | { |
79 | 79 | return $GLOBALS['XE_MEMCACHE_SUPPORT'] = $this->Memcache->set('xe', 'xe', 1); |
80 | 80 | } |
81 | - elseif($this->SelectedExtension === 'Memcache') |
|
81 | + elseif ($this->SelectedExtension === 'Memcache') |
|
82 | 82 | { |
83 | 83 | return $GLOBALS['XE_MEMCACHE_SUPPORT'] = $this->Memcache->set('xe', 'xe', MEMCACHE_COMPRESSED, 1); |
84 | 84 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | */ |
97 | 97 | function getKey($key) |
98 | 98 | { |
99 | - return md5(_XE_PATH_ . $key); |
|
99 | + return md5(_XE_PATH_.$key); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | /** |
@@ -118,11 +118,11 @@ discard block |
||
118 | 118 | */ |
119 | 119 | function put($key, $buff, $valid_time = 0) |
120 | 120 | { |
121 | - if($valid_time == 0) |
|
121 | + if ($valid_time == 0) |
|
122 | 122 | { |
123 | 123 | $valid_time = $this->valid_time; |
124 | 124 | } |
125 | - if($this->SelectedExtension === 'Memcached') |
|
125 | + if ($this->SelectedExtension === 'Memcached') |
|
126 | 126 | { |
127 | 127 | return $this->Memcache->set($this->getKey($key), array($_SERVER['REQUEST_TIME'], $buff), $valid_time); |
128 | 128 | } |
@@ -145,13 +145,13 @@ discard block |
||
145 | 145 | $_key = $this->getKey($key); |
146 | 146 | |
147 | 147 | $obj = $this->Memcache->get($_key); |
148 | - if(!$obj || !is_array($obj)) |
|
148 | + if (!$obj || !is_array($obj)) |
|
149 | 149 | { |
150 | 150 | return false; |
151 | 151 | } |
152 | 152 | unset($obj[1]); |
153 | 153 | |
154 | - if($modified_time > 0 && $modified_time > $obj[0]) |
|
154 | + if ($modified_time > 0 && $modified_time > $obj[0]) |
|
155 | 155 | { |
156 | 156 | $this->_delete($_key); |
157 | 157 | return false; |
@@ -174,12 +174,12 @@ discard block |
||
174 | 174 | { |
175 | 175 | $_key = $this->getKey($key); |
176 | 176 | $obj = $this->Memcache->get($_key); |
177 | - if(!$obj || !is_array($obj)) |
|
177 | + if (!$obj || !is_array($obj)) |
|
178 | 178 | { |
179 | 179 | return false; |
180 | 180 | } |
181 | 181 | |
182 | - if($modified_time > 0 && $modified_time > $obj[0]) |
|
182 | + if ($modified_time > 0 && $modified_time > $obj[0]) |
|
183 | 183 | { |
184 | 184 | $this->_delete($_key); |
185 | 185 | return false; |
@@ -45,13 +45,11 @@ discard block |
||
45 | 45 | { |
46 | 46 | $this->Memcache = new Memcached; |
47 | 47 | $this->SelectedExtension = 'Memcached'; |
48 | - } |
|
49 | - elseif(class_exists('Memcache')) |
|
48 | + } elseif(class_exists('Memcache')) |
|
50 | 49 | { |
51 | 50 | $this->Memcache = new Memcache; |
52 | 51 | $this->SelectedExtension = 'Memcache'; |
53 | - } |
|
54 | - else |
|
52 | + } else |
|
55 | 53 | { |
56 | 54 | return false; |
57 | 55 | } |
@@ -77,12 +75,10 @@ discard block |
||
77 | 75 | if($this->SelectedExtension === 'Memcached') |
78 | 76 | { |
79 | 77 | return $GLOBALS['XE_MEMCACHE_SUPPORT'] = $this->Memcache->set('xe', 'xe', 1); |
80 | - } |
|
81 | - elseif($this->SelectedExtension === 'Memcache') |
|
78 | + } elseif($this->SelectedExtension === 'Memcache') |
|
82 | 79 | { |
83 | 80 | return $GLOBALS['XE_MEMCACHE_SUPPORT'] = $this->Memcache->set('xe', 'xe', MEMCACHE_COMPRESSED, 1); |
84 | - } |
|
85 | - else |
|
81 | + } else |
|
86 | 82 | { |
87 | 83 | return $GLOBALS['XE_MEMCACHE_SUPPORT'] = false; |
88 | 84 | } |
@@ -125,8 +121,7 @@ discard block |
||
125 | 121 | if($this->SelectedExtension === 'Memcached') |
126 | 122 | { |
127 | 123 | return $this->Memcache->set($this->getKey($key), array($_SERVER['REQUEST_TIME'], $buff), $valid_time); |
128 | - } |
|
129 | - else |
|
124 | + } else |
|
130 | 125 | { |
131 | 126 | return $this->Memcache->set($this->getKey($key), array($_SERVER['REQUEST_TIME'], $buff), MEMCACHE_COMPRESSED, $valid_time); |
132 | 127 | } |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | function printContent(&$oModule) |
26 | 26 | { |
27 | 27 | // Check if the gzip encoding supported |
28 | - if( |
|
28 | + if ( |
|
29 | 29 | (defined('__OB_GZHANDLER_ENABLE__') && __OB_GZHANDLER_ENABLE__ == 1) && |
30 | 30 | strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== FALSE && |
31 | 31 | extension_loaded('zlib') && |
@@ -36,23 +36,23 @@ discard block |
||
36 | 36 | } |
37 | 37 | |
38 | 38 | // Extract contents to display by the request method |
39 | - if(Context::get('xeVirtualRequestMethod') == 'xml') |
|
39 | + if (Context::get('xeVirtualRequestMethod') == 'xml') |
|
40 | 40 | { |
41 | 41 | $handler = new VirtualXMLDisplayHandler(); |
42 | 42 | } |
43 | - else if(Context::getRequestMethod() == 'XMLRPC') |
|
43 | + else if (Context::getRequestMethod() == 'XMLRPC') |
|
44 | 44 | { |
45 | 45 | $handler = new XMLDisplayHandler(); |
46 | - if(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE) |
|
46 | + if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE) |
|
47 | 47 | { |
48 | 48 | $this->gz_enabled = FALSE; |
49 | 49 | } |
50 | 50 | } |
51 | - else if(Context::getRequestMethod() == 'JSON') |
|
51 | + else if (Context::getRequestMethod() == 'JSON') |
|
52 | 52 | { |
53 | 53 | $handler = new JSONDisplayHandler(); |
54 | 54 | } |
55 | - else if(Context::getRequestMethod() == 'JS_CALLBACK') |
|
55 | + else if (Context::getRequestMethod() == 'JS_CALLBACK') |
|
56 | 56 | { |
57 | 57 | $handler = new JSCallbackDisplayHandler(); |
58 | 58 | } |
@@ -70,9 +70,9 @@ discard block |
||
70 | 70 | $called_position = 'before_display_content'; |
71 | 71 | $oAddonController = getController('addon'); |
72 | 72 | $addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? "mobile" : "pc"); |
73 | - if(file_exists($addon_file)) include($addon_file); |
|
73 | + if (file_exists($addon_file)) include($addon_file); |
|
74 | 74 | |
75 | - if(method_exists($handler, "prepareToPrint")) |
|
75 | + if (method_exists($handler, "prepareToPrint")) |
|
76 | 76 | { |
77 | 77 | $handler->prepareToPrint($output); |
78 | 78 | } |
@@ -80,17 +80,17 @@ discard block |
||
80 | 80 | // header output |
81 | 81 | |
82 | 82 | $httpStatusCode = $oModule->getHttpStatusCode(); |
83 | - if($httpStatusCode && $httpStatusCode != 200) |
|
83 | + if ($httpStatusCode && $httpStatusCode != 200) |
|
84 | 84 | { |
85 | 85 | $this->_printHttpStatusCode($httpStatusCode); |
86 | 86 | } |
87 | 87 | else |
88 | 88 | { |
89 | - if(Context::getResponseMethod() == 'JSON' || Context::getResponseMethod() == 'JS_CALLBACK') |
|
89 | + if (Context::getResponseMethod() == 'JSON' || Context::getResponseMethod() == 'JS_CALLBACK') |
|
90 | 90 | { |
91 | 91 | $this->_printJSONHeader(); |
92 | 92 | } |
93 | - else if(Context::getResponseMethod() != 'HTML') |
|
93 | + else if (Context::getResponseMethod() != 'HTML') |
|
94 | 94 | { |
95 | 95 | $this->_printXMLHeader(); |
96 | 96 | } |
@@ -106,13 +106,13 @@ discard block |
||
106 | 106 | |
107 | 107 | // disable gzip if output already exists |
108 | 108 | ob_flush(); |
109 | - if(headers_sent()) |
|
109 | + if (headers_sent()) |
|
110 | 110 | { |
111 | 111 | $this->gz_enabled = FALSE; |
112 | 112 | } |
113 | 113 | |
114 | 114 | // enable gzip using zlib extension |
115 | - if($this->gz_enabled) |
|
115 | + if ($this->gz_enabled) |
|
116 | 116 | { |
117 | 117 | ini_set('zlib.output_compression', true); |
118 | 118 | } |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | */ |
134 | 134 | function _debugOutput() |
135 | 135 | { |
136 | - if(!__DEBUG__) |
|
136 | + if (!__DEBUG__) |
|
137 | 137 | { |
138 | 138 | return; |
139 | 139 | } |
@@ -141,32 +141,32 @@ discard block |
||
141 | 141 | $end = getMicroTime(); |
142 | 142 | |
143 | 143 | // Firebug console output |
144 | - if(__DEBUG_OUTPUT__ == 2 && version_compare(PHP_VERSION, '6.0.0') === -1) |
|
144 | + if (__DEBUG_OUTPUT__ == 2 && version_compare(PHP_VERSION, '6.0.0') === -1) |
|
145 | 145 | { |
146 | 146 | static $firephp; |
147 | - if(!isset($firephp)) |
|
147 | + if (!isset($firephp)) |
|
148 | 148 | { |
149 | 149 | $firephp = FirePHP::getInstance(true); |
150 | 150 | } |
151 | 151 | |
152 | - if(__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
152 | + if (__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
153 | 153 | { |
154 | 154 | $firephp->fb('Change the value of __DEBUG_PROTECT_IP__ into your IP address in config/config.user.inc.php or config/config.inc.php', 'The IP address is not allowed.'); |
155 | 155 | return; |
156 | 156 | } |
157 | 157 | // display total execution time and Request/Response info |
158 | - if(__DEBUG__ & 2) |
|
158 | + if (__DEBUG__ & 2) |
|
159 | 159 | { |
160 | 160 | $firephp->fb( |
161 | 161 | array( |
162 | - 'Request / Response info >>> ' . $_SERVER['REQUEST_METHOD'] . ' / ' . Context::getResponseMethod(), |
|
162 | + 'Request / Response info >>> '.$_SERVER['REQUEST_METHOD'].' / '.Context::getResponseMethod(), |
|
163 | 163 | array( |
164 | 164 | array('Request URI', 'Request method', 'Response method', 'Response contents size', 'Memory peak usage'), |
165 | 165 | array( |
166 | 166 | sprintf("%s:%s%s%s%s", $_SERVER['SERVER_NAME'], $_SERVER['SERVER_PORT'], $_SERVER['PHP_SELF'], $_SERVER['QUERY_STRING'] ? '?' : '', $_SERVER['QUERY_STRING']), |
167 | 167 | $_SERVER['REQUEST_METHOD'], |
168 | 168 | Context::getResponseMethod(), |
169 | - $this->content_size . ' byte', |
|
169 | + $this->content_size.' byte', |
|
170 | 170 | FileHandler::filesize(memory_get_peak_usage()) |
171 | 171 | ) |
172 | 172 | ) |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | ); |
176 | 176 | $firephp->fb( |
177 | 177 | array( |
178 | - 'Elapsed time >>> Total : ' . sprintf('%0.5f sec', $end - __StartTime__), |
|
178 | + 'Elapsed time >>> Total : '.sprintf('%0.5f sec', $end - __StartTime__), |
|
179 | 179 | array(array('DB queries', 'class file load', 'Template compile', 'XmlParse compile', 'PHP', 'Widgets', 'Trans Content'), |
180 | 180 | array( |
181 | 181 | sprintf('%0.5f sec', $GLOBALS['__db_elapsed_time__']), |
@@ -193,16 +193,16 @@ discard block |
||
193 | 193 | } |
194 | 194 | |
195 | 195 | // display DB query history |
196 | - if((__DEBUG__ & 4) && $GLOBALS['__db_queries__']) |
|
196 | + if ((__DEBUG__ & 4) && $GLOBALS['__db_queries__']) |
|
197 | 197 | { |
198 | 198 | $queries_output = array(array('Result/'.PHP_EOL.'Elapsed time', 'Query ID', 'Query')); |
199 | - foreach($GLOBALS['__db_queries__'] as $query) |
|
199 | + foreach ($GLOBALS['__db_queries__'] as $query) |
|
200 | 200 | { |
201 | - $queries_output[] = array($query['result'] . PHP_EOL . sprintf('%0.5f', $query['elapsed_time']), str_replace(_XE_PATH_, '', $query['called_file']) . PHP_EOL . $query['called_method'] . '()' . PHP_EOL . $query['query_id'], $query['query']); |
|
201 | + $queries_output[] = array($query['result'].PHP_EOL.sprintf('%0.5f', $query['elapsed_time']), str_replace(_XE_PATH_, '', $query['called_file']).PHP_EOL.$query['called_method'].'()'.PHP_EOL.$query['query_id'], $query['query']); |
|
202 | 202 | } |
203 | 203 | $firephp->fb( |
204 | 204 | array( |
205 | - 'DB Queries >>> ' . count($GLOBALS['__db_queries__']) . ' Queries, ' . sprintf('%0.5f sec', $GLOBALS['__db_elapsed_time__']), |
|
205 | + 'DB Queries >>> '.count($GLOBALS['__db_queries__']).' Queries, '.sprintf('%0.5f sec', $GLOBALS['__db_elapsed_time__']), |
|
206 | 206 | $queries_output |
207 | 207 | ), |
208 | 208 | 'TABLE' |
@@ -215,9 +215,9 @@ discard block |
||
215 | 215 | |
216 | 216 | $buff = array(); |
217 | 217 | // display total execution time and Request/Response info |
218 | - if(__DEBUG__ & 2) |
|
218 | + if (__DEBUG__ & 2) |
|
219 | 219 | { |
220 | - if(__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
220 | + if (__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
221 | 221 | { |
222 | 222 | return; |
223 | 223 | } |
@@ -248,21 +248,21 @@ discard block |
||
248 | 248 | $buff[] = sprintf("\tTrans Content \t\t\t\t\t: %0.5f sec", $GLOBALS['__trans_content_elapsed__']); |
249 | 249 | } |
250 | 250 | // DB Logging |
251 | - if(__DEBUG__ & 4) |
|
251 | + if (__DEBUG__ & 4) |
|
252 | 252 | { |
253 | - if(__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
253 | + if (__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
254 | 254 | { |
255 | 255 | return; |
256 | 256 | } |
257 | 257 | |
258 | - if($GLOBALS['__db_queries__']) |
|
258 | + if ($GLOBALS['__db_queries__']) |
|
259 | 259 | { |
260 | 260 | $buff[] = sprintf("\n- DB Queries : %d Queries. %0.5f sec", count($GLOBALS['__db_queries__']), $GLOBALS['__db_elapsed_time__']); |
261 | 261 | $num = 0; |
262 | 262 | |
263 | - foreach($GLOBALS['__db_queries__'] as $query) |
|
263 | + foreach ($GLOBALS['__db_queries__'] as $query) |
|
264 | 264 | { |
265 | - if($query['result'] == 'Success') |
|
265 | + if ($query['result'] == 'Success') |
|
266 | 266 | { |
267 | 267 | $query_result = "Query Success"; |
268 | 268 | } |
@@ -279,30 +279,30 @@ discard block |
||
279 | 279 | } |
280 | 280 | |
281 | 281 | // Output in HTML comments |
282 | - if($buff && __DEBUG_OUTPUT__ == 1 && Context::getResponseMethod() == 'HTML') |
|
282 | + if ($buff && __DEBUG_OUTPUT__ == 1 && Context::getResponseMethod() == 'HTML') |
|
283 | 283 | { |
284 | 284 | $buff = implode("\r\n", $buff); |
285 | 285 | $buff = sprintf("[%s %s:%d]\r\n%s", date('Y-m-d H:i:s'), $file_name, $line_num, print_r($buff, true)); |
286 | 286 | |
287 | - if(__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
287 | + if (__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
288 | 288 | { |
289 | 289 | $buff = 'The IP address is not allowed. Change the value of __DEBUG_PROTECT_IP__ into your IP address in config/config.user.inc.php or config/config.inc.php'; |
290 | 290 | } |
291 | 291 | |
292 | - return "<!--\r\n" . $buff . "\r\n-->"; |
|
292 | + return "<!--\r\n".$buff."\r\n-->"; |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | // Output to a file |
296 | - if($buff && __DEBUG_OUTPUT__ == 0) |
|
296 | + if ($buff && __DEBUG_OUTPUT__ == 0) |
|
297 | 297 | { |
298 | - $debug_file = _XE_PATH_ . 'files/_debug_message.php'; |
|
298 | + $debug_file = _XE_PATH_.'files/_debug_message.php'; |
|
299 | 299 | $buff = implode(PHP_EOL, $buff); |
300 | 300 | $buff = sprintf("[%s]\n%s", date('Y-m-d H:i:s'), print_r($buff, true)); |
301 | 301 | |
302 | - $buff = str_repeat('=', 80) . "\n" . $buff . "\n" . str_repeat('-', 80); |
|
303 | - $buff = "\n<?php\n/*" . $buff . "*/\n?>\n"; |
|
302 | + $buff = str_repeat('=', 80)."\n".$buff."\n".str_repeat('-', 80); |
|
303 | + $buff = "\n<?php\n/*".$buff."*/\n?>\n"; |
|
304 | 304 | |
305 | - if (!@file_put_contents($debug_file, $buff, FILE_APPEND|LOCK_EX)) |
|
305 | + if (!@file_put_contents($debug_file, $buff, FILE_APPEND | LOCK_EX)) |
|
306 | 306 | { |
307 | 307 | return; |
308 | 308 | } |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | { |
319 | 319 | header("Content-Type: text/xml; charset=UTF-8"); |
320 | 320 | header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); |
321 | - header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); |
|
321 | + header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); |
|
322 | 322 | header("Cache-Control: no-store, no-cache, must-revalidate"); |
323 | 323 | header("Cache-Control: post-check=0, pre-check=0", false); |
324 | 324 | header("Pragma: no-cache"); |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | { |
333 | 333 | header("Content-Type: text/html; charset=UTF-8"); |
334 | 334 | header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); |
335 | - header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); |
|
335 | + header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); |
|
336 | 336 | header("Cache-Control: no-store, no-cache, must-revalidate"); |
337 | 337 | header("Cache-Control: post-check=0, pre-check=0", false); |
338 | 338 | header("Pragma: no-cache"); |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | { |
347 | 347 | header("Content-Type: text/html; charset=UTF-8"); |
348 | 348 | header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); |
349 | - header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); |
|
349 | + header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); |
|
350 | 350 | header("Cache-Control: no-store, no-cache, must-revalidate"); |
351 | 351 | header("Cache-Control: post-check=0, pre-check=0", false); |
352 | 352 | header("Pragma: no-cache"); |
@@ -39,24 +39,20 @@ discard block |
||
39 | 39 | if(Context::get('xeVirtualRequestMethod') == 'xml') |
40 | 40 | { |
41 | 41 | $handler = new VirtualXMLDisplayHandler(); |
42 | - } |
|
43 | - else if(Context::getRequestMethod() == 'XMLRPC') |
|
42 | + } else if(Context::getRequestMethod() == 'XMLRPC') |
|
44 | 43 | { |
45 | 44 | $handler = new XMLDisplayHandler(); |
46 | 45 | if(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE) |
47 | 46 | { |
48 | 47 | $this->gz_enabled = FALSE; |
49 | 48 | } |
50 | - } |
|
51 | - else if(Context::getRequestMethod() == 'JSON') |
|
49 | + } else if(Context::getRequestMethod() == 'JSON') |
|
52 | 50 | { |
53 | 51 | $handler = new JSONDisplayHandler(); |
54 | - } |
|
55 | - else if(Context::getRequestMethod() == 'JS_CALLBACK') |
|
52 | + } else if(Context::getRequestMethod() == 'JS_CALLBACK') |
|
56 | 53 | { |
57 | 54 | $handler = new JSCallbackDisplayHandler(); |
58 | - } |
|
59 | - else |
|
55 | + } else |
|
60 | 56 | { |
61 | 57 | $handler = new HTMLDisplayHandler(); |
62 | 58 | } |
@@ -70,7 +66,9 @@ discard block |
||
70 | 66 | $called_position = 'before_display_content'; |
71 | 67 | $oAddonController = getController('addon'); |
72 | 68 | $addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? "mobile" : "pc"); |
73 | - if(file_exists($addon_file)) include($addon_file); |
|
69 | + if(file_exists($addon_file)) { |
|
70 | + include($addon_file); |
|
71 | + } |
|
74 | 72 | |
75 | 73 | if(method_exists($handler, "prepareToPrint")) |
76 | 74 | { |
@@ -83,18 +81,15 @@ discard block |
||
83 | 81 | if($httpStatusCode && $httpStatusCode != 200) |
84 | 82 | { |
85 | 83 | $this->_printHttpStatusCode($httpStatusCode); |
86 | - } |
|
87 | - else |
|
84 | + } else |
|
88 | 85 | { |
89 | 86 | if(Context::getResponseMethod() == 'JSON' || Context::getResponseMethod() == 'JS_CALLBACK') |
90 | 87 | { |
91 | 88 | $this->_printJSONHeader(); |
92 | - } |
|
93 | - else if(Context::getResponseMethod() != 'HTML') |
|
89 | + } else if(Context::getResponseMethod() != 'HTML') |
|
94 | 90 | { |
95 | 91 | $this->_printXMLHeader(); |
96 | - } |
|
97 | - else |
|
92 | + } else |
|
98 | 93 | { |
99 | 94 | $this->_printHTMLHeader(); |
100 | 95 | } |
@@ -209,8 +204,7 @@ discard block |
||
209 | 204 | ); |
210 | 205 | } |
211 | 206 | // dislpay the file and HTML comments |
212 | - } |
|
213 | - else |
|
207 | + } else |
|
214 | 208 | { |
215 | 209 | |
216 | 210 | $buff = array(); |
@@ -265,8 +259,7 @@ discard block |
||
265 | 259 | if($query['result'] == 'Success') |
266 | 260 | { |
267 | 261 | $query_result = "Query Success"; |
268 | - } |
|
269 | - else |
|
262 | + } else |
|
270 | 263 | { |
271 | 264 | $query_result = sprintf("Query $s : %d\n\t\t\t %s", $query['result'], $query['errno'], $query['errstr']); |
272 | 265 | } |