@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | * @file config/config.inc.php |
| 8 | 8 | * @author NAVER ([email protected]) |
| 9 | 9 | */ |
| 10 | -if(version_compare(PHP_VERSION, '5.4.0', '<')) |
|
| 10 | +if (version_compare(PHP_VERSION, '5.4.0', '<')) |
|
| 11 | 11 | { |
| 12 | 12 | @error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED ^ E_WARNING); |
| 13 | 13 | } |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | @error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED ^ E_WARNING ^ E_STRICT); |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | -if(!defined('__XE__')) |
|
| 19 | +if (!defined('__XE__')) |
|
| 20 | 20 | { |
| 21 | 21 | exit(); |
| 22 | 22 | } |
@@ -52,9 +52,9 @@ discard block |
||
| 52 | 52 | // Set can use other method instead cookie to store session id(for file upload) |
| 53 | 53 | ini_set('session.use_only_cookies', 0); |
| 54 | 54 | |
| 55 | -if(file_exists(_XE_PATH_ . 'config/package.inc.php')) |
|
| 55 | +if (file_exists(_XE_PATH_.'config/package.inc.php')) |
|
| 56 | 56 | { |
| 57 | - require _XE_PATH_ . 'config/package.inc.php'; |
|
| 57 | + require _XE_PATH_.'config/package.inc.php'; |
|
| 58 | 58 | } |
| 59 | 59 | else |
| 60 | 60 | { |
@@ -96,12 +96,12 @@ discard block |
||
| 96 | 96 | * define('__ENABLE_PHPUNIT_TEST__', 0); |
| 97 | 97 | * define('__PROXY_SERVER__', 'http://domain:port/path'); |
| 98 | 98 | */ |
| 99 | -if(file_exists(_XE_PATH_ . 'config/config.user.inc.php')) |
|
| 99 | +if (file_exists(_XE_PATH_.'config/config.user.inc.php')) |
|
| 100 | 100 | { |
| 101 | - require _XE_PATH_ . 'config/config.user.inc.php'; |
|
| 101 | + require _XE_PATH_.'config/config.user.inc.php'; |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | -if(!defined('__DEBUG__')) |
|
| 104 | +if (!defined('__DEBUG__')) |
|
| 105 | 105 | { |
| 106 | 106 | /** |
| 107 | 107 | * output debug message(bit value) |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | define('__DEBUG__', 0); |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | -if(!defined('__DEBUG_OUTPUT__')) |
|
| 119 | +if (!defined('__DEBUG_OUTPUT__')) |
|
| 120 | 120 | { |
| 121 | 121 | /** |
| 122 | 122 | * output location of debug message |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | define('__DEBUG_OUTPUT__', 0); |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | -if(!defined('__DEBUG_PROTECT__')) |
|
| 133 | +if (!defined('__DEBUG_PROTECT__')) |
|
| 134 | 134 | { |
| 135 | 135 | /** |
| 136 | 136 | * output comments of the firePHP console and browser |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | define('__DEBUG_PROTECT__', 1); |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | -if(!defined('__DEBUG_PROTECT_IP__')) |
|
| 146 | +if (!defined('__DEBUG_PROTECT_IP__')) |
|
| 147 | 147 | { |
| 148 | 148 | /** |
| 149 | 149 | * Set a ip address to allow debug |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | define('__DEBUG_PROTECT_IP__', '127.0.0.1'); |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | -if(!defined('__DEBUG_DB_OUTPUT__')) |
|
| 154 | +if (!defined('__DEBUG_DB_OUTPUT__')) |
|
| 155 | 155 | { |
| 156 | 156 | /** |
| 157 | 157 | * DB error message definition |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | define('__DEBUG_DB_OUTPUT__', 0); |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | -if(!defined('__LOG_SLOW_QUERY__')) |
|
| 167 | +if (!defined('__LOG_SLOW_QUERY__')) |
|
| 168 | 168 | { |
| 169 | 169 | /** |
| 170 | 170 | * Query log for only timeout query among DB queries |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | define('__LOG_SLOW_QUERY__', 0); |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | -if(!defined('__LOG_SLOW_TRIGGER__')) |
|
| 181 | +if (!defined('__LOG_SLOW_TRIGGER__')) |
|
| 182 | 182 | { |
| 183 | 183 | /** |
| 184 | 184 | * Trigger excute time log |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | define('__LOG_SLOW_TRIGGER__', 0); |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | -if(!defined('__LOG_SLOW_ADDON__')) |
|
| 195 | +if (!defined('__LOG_SLOW_ADDON__')) |
|
| 196 | 196 | { |
| 197 | 197 | /** |
| 198 | 198 | * Addon excute time log |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | define('__LOG_SLOW_ADDON__', 0); |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | -if(!defined('__LOG_SLOW_WIDGET__')) |
|
| 209 | +if (!defined('__LOG_SLOW_WIDGET__')) |
|
| 210 | 210 | { |
| 211 | 211 | /** |
| 212 | 212 | * Widget excute time log |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | define('__LOG_SLOW_WIDGET__', 0); |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | -if(!defined('__DEBUG_QUERY__')) |
|
| 223 | +if (!defined('__DEBUG_QUERY__')) |
|
| 224 | 224 | { |
| 225 | 225 | /** |
| 226 | 226 | * Leave DB query information |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | define('__DEBUG_QUERY__', 0); |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | -if(!defined('__OB_GZHANDLER_ENABLE__')) |
|
| 236 | +if (!defined('__OB_GZHANDLER_ENABLE__')) |
|
| 237 | 237 | { |
| 238 | 238 | /** |
| 239 | 239 | * option to enable/disable a compression feature using ob_gzhandler |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | define('__OB_GZHANDLER_ENABLE__', 1); |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | -if(!defined('__ENABLE_PHPUNIT_TEST__')) |
|
| 250 | +if (!defined('__ENABLE_PHPUNIT_TEST__')) |
|
| 251 | 251 | { |
| 252 | 252 | /** |
| 253 | 253 | * decide to use/not use the php unit test (Path/tests/index.php) |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | define('__ENABLE_PHPUNIT_TEST__', 0); |
| 261 | 261 | } |
| 262 | 262 | |
| 263 | -if(!defined('__PROXY_SERVER__')) |
|
| 263 | +if (!defined('__PROXY_SERVER__')) |
|
| 264 | 264 | { |
| 265 | 265 | /** |
| 266 | 266 | * __PROXY_SERVER__ has server information to request to the external through the target server |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | define('__PROXY_SERVER__', NULL); |
| 270 | 270 | } |
| 271 | 271 | |
| 272 | -if(!defined('__ERROR_LOG__')) |
|
| 272 | +if (!defined('__ERROR_LOG__')) |
|
| 273 | 273 | { |
| 274 | 274 | /** |
| 275 | 275 | * __ERROR_LOG__ 는 PHP의 에러로그를 출력하는 기능입니다. 개발시 워닝에러이상의 에러부터 잡기 시작합니다. |
@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | define('__ERROR_LOG__', 0); |
| 281 | 281 | } |
| 282 | 282 | |
| 283 | -if(!defined('__DISABLE_DEFAULT_CSS__')) |
|
| 283 | +if (!defined('__DISABLE_DEFAULT_CSS__')) |
|
| 284 | 284 | { |
| 285 | 285 | /** |
| 286 | 286 | * XE의 기본 CSS 스타일을 로드하지 않도록 합니다. |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | define('__DISABLE_DEFAULT_CSS__', 0); |
| 296 | 296 | } |
| 297 | 297 | |
| 298 | -if(!defined('__AUTO_OPCACHE_INVALIDATE__')) |
|
| 298 | +if (!defined('__AUTO_OPCACHE_INVALIDATE__')) |
|
| 299 | 299 | { |
| 300 | 300 | /** |
| 301 | 301 | * 업데이트 시 주요 파일의 OPcache를 자동 초기화 옵션 |
@@ -310,13 +310,13 @@ discard block |
||
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | // Require specific files when using Firebug console output |
| 313 | -if((__DEBUG_OUTPUT__ == 2) && version_compare(PHP_VERSION, '6.0.0') === -1) |
|
| 313 | +if ((__DEBUG_OUTPUT__ == 2) && version_compare(PHP_VERSION, '6.0.0') === -1) |
|
| 314 | 314 | { |
| 315 | - require _XE_PATH_ . 'libs/FirePHPCore/FirePHP.class.php'; |
|
| 315 | + require _XE_PATH_.'libs/FirePHPCore/FirePHP.class.php'; |
|
| 316 | 316 | } |
| 317 | 317 | |
| 318 | 318 | // Set Timezone as server time |
| 319 | -if(version_compare(PHP_VERSION, '5.3.0') >= 0) |
|
| 319 | +if (version_compare(PHP_VERSION, '5.3.0') >= 0) |
|
| 320 | 320 | { |
| 321 | 321 | date_default_timezone_set(@date_default_timezone_get()); |
| 322 | 322 | } |
@@ -422,8 +422,8 @@ discard block |
||
| 422 | 422 | * Invalidates a cached script of OPcache when version is changed. |
| 423 | 423 | * @see https://github.com/xpressengine/xe-core/issues/2189 |
| 424 | 424 | **/ |
| 425 | -$cache_path = _XE_PATH_ . 'files/cache/store/' . __XE_VERSION__; |
|
| 426 | -if( |
|
| 425 | +$cache_path = _XE_PATH_.'files/cache/store/'.__XE_VERSION__; |
|
| 426 | +if ( |
|
| 427 | 427 | __AUTO_OPCACHE_INVALIDATE__ === 1 |
| 428 | 428 | && !is_dir($cache_path) |
| 429 | 429 | && function_exists('opcache_get_status') |
@@ -433,62 +433,62 @@ discard block |
||
| 433 | 433 | @mkdir($cache_path, 0755, TRUE); |
| 434 | 434 | @chmod($cache_path, 0755); |
| 435 | 435 | |
| 436 | - foreach($GLOBALS['__xe_autoload_file_map'] as $script) { |
|
| 437 | - opcache_invalidate(_XE_PATH_ . $script, true); |
|
| 436 | + foreach ($GLOBALS['__xe_autoload_file_map'] as $script) { |
|
| 437 | + opcache_invalidate(_XE_PATH_.$script, true); |
|
| 438 | 438 | } |
| 439 | - opcache_invalidate(_XE_PATH_ . 'config/func.inc.php', true); |
|
| 439 | + opcache_invalidate(_XE_PATH_.'config/func.inc.php', true); |
|
| 440 | 440 | } |
| 441 | 441 | |
| 442 | 442 | // Require a function-defined-file for simple use |
| 443 | -require(_XE_PATH_ . 'config/func.inc.php'); |
|
| 443 | +require(_XE_PATH_.'config/func.inc.php'); |
|
| 444 | 444 | |
| 445 | -if(__DEBUG__) { |
|
| 445 | +if (__DEBUG__) { |
|
| 446 | 446 | define('__StartTime__', getMicroTime()); |
| 447 | 447 | } |
| 448 | 448 | |
| 449 | -if(__DEBUG__) { |
|
| 449 | +if (__DEBUG__) { |
|
| 450 | 450 | $GLOBALS['__elapsed_class_load__'] = 0; |
| 451 | 451 | } |
| 452 | 452 | |
| 453 | 453 | function __xe_autoload($class_name) |
| 454 | 454 | { |
| 455 | - if(__DEBUG__) { |
|
| 455 | + if (__DEBUG__) { |
|
| 456 | 456 | $time_at = getMicroTime(); |
| 457 | 457 | } |
| 458 | 458 | |
| 459 | - if(isset($GLOBALS['__xe_autoload_file_map'][strtolower($class_name)])) |
|
| 459 | + if (isset($GLOBALS['__xe_autoload_file_map'][strtolower($class_name)])) |
|
| 460 | 460 | { |
| 461 | - require _XE_PATH_ . $GLOBALS['__xe_autoload_file_map'][strtolower($class_name)]; |
|
| 461 | + require _XE_PATH_.$GLOBALS['__xe_autoload_file_map'][strtolower($class_name)]; |
|
| 462 | 462 | } |
| 463 | - elseif(preg_match('/^([a-zA-Z0-9_]+?)(Admin)?(View|Controller|Model|Api|Wap|Mobile)?$/', $class_name, $matches)) |
|
| 463 | + elseif (preg_match('/^([a-zA-Z0-9_]+?)(Admin)?(View|Controller|Model|Api|Wap|Mobile)?$/', $class_name, $matches)) |
|
| 464 | 464 | { |
| 465 | 465 | $candidate_filename = array(); |
| 466 | - $candidate_filename[] = 'modules/' . $matches[1] . '/' . $matches[1]; |
|
| 467 | - if(isset($matches[2]) && $matches[2]) $candidate_filename[] = 'admin'; |
|
| 466 | + $candidate_filename[] = 'modules/'.$matches[1].'/'.$matches[1]; |
|
| 467 | + if (isset($matches[2]) && $matches[2]) $candidate_filename[] = 'admin'; |
|
| 468 | 468 | $candidate_filename[] = (isset($matches[3]) && $matches[3]) ? strtolower($matches[3]) : 'class'; |
| 469 | 469 | $candidate_filename[] = 'php'; |
| 470 | 470 | |
| 471 | 471 | $candidate_filename = implode('.', $candidate_filename); |
| 472 | 472 | |
| 473 | - if(file_exists(_XE_PATH_ . $candidate_filename)) |
|
| 473 | + if (file_exists(_XE_PATH_.$candidate_filename)) |
|
| 474 | 474 | { |
| 475 | - require _XE_PATH_ . $candidate_filename; |
|
| 475 | + require _XE_PATH_.$candidate_filename; |
|
| 476 | 476 | } |
| 477 | 477 | } |
| 478 | 478 | |
| 479 | - if(__DEBUG__) { |
|
| 479 | + if (__DEBUG__) { |
|
| 480 | 480 | $GLOBALS['__elapsed_class_load__'] += getMicroTime() - $time_at; |
| 481 | 481 | } |
| 482 | 482 | } |
| 483 | 483 | spl_autoload_register('__xe_autoload'); |
| 484 | 484 | |
| 485 | -if(version_compare(PHP_VERSION, '7.2', '<')) |
|
| 485 | +if (version_compare(PHP_VERSION, '7.2', '<')) |
|
| 486 | 486 | { |
| 487 | 487 | class_alias('BaseObject', 'Object', true); |
| 488 | 488 | } |
| 489 | 489 | |
| 490 | -if(file_exists(_XE_PATH_ . '/vendor/autoload.php')) { |
|
| 491 | - require _XE_PATH_ . '/vendor/autoload.php'; |
|
| 490 | +if (file_exists(_XE_PATH_.'/vendor/autoload.php')) { |
|
| 491 | + require _XE_PATH_.'/vendor/autoload.php'; |
|
| 492 | 492 | } |
| 493 | 493 | /* End of file config.inc.php */ |
| 494 | 494 | /* Location: ./config/config.inc.php */ |
@@ -31,21 +31,21 @@ discard block |
||
| 31 | 31 | * @param array $columnList |
| 32 | 32 | * @return array layout lists in site |
| 33 | 33 | */ |
| 34 | - function getLayoutList($site_srl = 0, $layout_type="P", $columnList = array()) |
|
| 34 | + function getLayoutList($site_srl = 0, $layout_type = "P", $columnList = array()) |
|
| 35 | 35 | { |
| 36 | - if(!$site_srl) |
|
| 36 | + if (!$site_srl) |
|
| 37 | 37 | { |
| 38 | 38 | $site_module_info = Context::get('site_module_info'); |
| 39 | - $site_srl = (int)$site_module_info->site_srl; |
|
| 39 | + $site_srl = (int) $site_module_info->site_srl; |
|
| 40 | 40 | } |
| 41 | 41 | $args = new stdClass(); |
| 42 | 42 | $args->site_srl = $site_srl; |
| 43 | 43 | $args->layout_type = $layout_type; |
| 44 | 44 | $output = executeQueryArray('layout.getLayoutList', $args, $columnList); |
| 45 | 45 | |
| 46 | - foreach($output->data as $no => &$val) |
|
| 46 | + foreach ($output->data as $no => &$val) |
|
| 47 | 47 | { |
| 48 | - if(!$this->isExistsLayoutFile($val->layout, $layout_type)) |
|
| 48 | + if (!$this->isExistsLayoutFile($val->layout, $layout_type)) |
|
| 49 | 49 | { |
| 50 | 50 | unset($output->data[$no]); |
| 51 | 51 | } |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | $oLayoutAdminModel = getAdminModel('layout'); |
| 55 | 55 | $siteDefaultLayoutSrl = $oLayoutAdminModel->getSiteDefaultLayout($layout_type, $site_srl); |
| 56 | - if($siteDefaultLayoutSrl) |
|
| 56 | + if ($siteDefaultLayoutSrl) |
|
| 57 | 57 | { |
| 58 | 58 | $siteDefaultLayoutInfo = $this->getlayout($siteDefaultLayoutSrl); |
| 59 | 59 | $newLayout = sprintf('%s, %s', $siteDefaultLayoutInfo->title, $siteDefaultLayoutInfo->layout); |
@@ -80,24 +80,24 @@ discard block |
||
| 80 | 80 | $layoutList = $this->getLayoutInstanceList($siteSrl, $layoutType); |
| 81 | 81 | $thumbs = array(); |
| 82 | 82 | |
| 83 | - foreach($layoutList as $key => $val) |
|
| 83 | + foreach ($layoutList as $key => $val) |
|
| 84 | 84 | { |
| 85 | - if($thumbs[$val->layouts]) |
|
| 85 | + if ($thumbs[$val->layouts]) |
|
| 86 | 86 | { |
| 87 | 87 | $val->thumbnail = $thumbs[$val->layouts]; |
| 88 | 88 | continue; |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | $token = explode('|@|', $val->layout); |
| 92 | - if(count($token) == 2) |
|
| 92 | + if (count($token) == 2) |
|
| 93 | 93 | { |
| 94 | - $thumbnailPath = sprintf('./themes/%s/layouts/%s/thumbnail.png' , $token[0], $token[1]); |
|
| 94 | + $thumbnailPath = sprintf('./themes/%s/layouts/%s/thumbnail.png', $token[0], $token[1]); |
|
| 95 | 95 | } |
| 96 | 96 | else |
| 97 | 97 | { |
| 98 | - $thumbnailPath = sprintf('./layouts/%s/thumbnail.png' , $val->layout); |
|
| 98 | + $thumbnailPath = sprintf('./layouts/%s/thumbnail.png', $val->layout); |
|
| 99 | 99 | } |
| 100 | - if(is_readable($thumbnailPath)) |
|
| 100 | + if (is_readable($thumbnailPath)) |
|
| 101 | 101 | { |
| 102 | 102 | $val->thumbnail = $thumbnailPath; |
| 103 | 103 | } |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | if (!$siteSrl) |
| 124 | 124 | { |
| 125 | 125 | $siteModuleInfo = Context::get('site_module_info'); |
| 126 | - $siteSrl = (int)$siteModuleInfo->site_srl; |
|
| 126 | + $siteSrl = (int) $siteModuleInfo->site_srl; |
|
| 127 | 127 | } |
| 128 | 128 | $args = new stdClass(); |
| 129 | 129 | $args->site_srl = $siteSrl; |
@@ -133,11 +133,11 @@ discard block |
||
| 133 | 133 | |
| 134 | 134 | // Create instance name list |
| 135 | 135 | $instanceList = array(); |
| 136 | - if(is_array($output->data)) |
|
| 136 | + if (is_array($output->data)) |
|
| 137 | 137 | { |
| 138 | - foreach($output->data as $no => $iInfo) |
|
| 138 | + foreach ($output->data as $no => $iInfo) |
|
| 139 | 139 | { |
| 140 | - if($this->isExistsLayoutFile($iInfo->layout, $layoutType)) |
|
| 140 | + if ($this->isExistsLayoutFile($iInfo->layout, $layoutType)) |
|
| 141 | 141 | { |
| 142 | 142 | $instanceList[] = $iInfo->layout; |
| 143 | 143 | } |
@@ -152,18 +152,18 @@ discard block |
||
| 152 | 152 | $downloadedList = array(); |
| 153 | 153 | $titleList = array(); |
| 154 | 154 | $_downloadedList = $this->getDownloadedLayoutList($layoutType); |
| 155 | - if(is_array($_downloadedList)) |
|
| 155 | + if (is_array($_downloadedList)) |
|
| 156 | 156 | { |
| 157 | - foreach($_downloadedList as $dLayoutInfo) |
|
| 157 | + foreach ($_downloadedList as $dLayoutInfo) |
|
| 158 | 158 | { |
| 159 | 159 | $downloadedList[$dLayoutInfo->layout] = $dLayoutInfo->layout; |
| 160 | 160 | $titleList[$dLayoutInfo->layout] = $dLayoutInfo->title; |
| 161 | 161 | } |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | - if($layout) |
|
| 164 | + if ($layout) |
|
| 165 | 165 | { |
| 166 | - if(count($instanceList) < 1 && $downloadedList[$layout]) |
|
| 166 | + if (count($instanceList) < 1 && $downloadedList[$layout]) |
|
| 167 | 167 | { |
| 168 | 168 | $insertArgs = new stdClass(); |
| 169 | 169 | $insertArgs->site_srl = $siteSrl; |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | { |
| 182 | 182 | // Get downloaded name list have no instance |
| 183 | 183 | $noInstanceList = array_diff($downloadedList, $instanceList); |
| 184 | - foreach($noInstanceList as $layoutName) |
|
| 184 | + foreach ($noInstanceList as $layoutName) |
|
| 185 | 185 | { |
| 186 | 186 | $insertArgs = new stdClass(); |
| 187 | 187 | $insertArgs->site_srl = $siteSrl; |
@@ -197,15 +197,15 @@ discard block |
||
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | // If create layout instance, reload instance list |
| 200 | - if($isCreateInstance) |
|
| 200 | + if ($isCreateInstance) |
|
| 201 | 201 | { |
| 202 | 202 | $output = executeQueryArray('layout.getLayoutList', $args, $columnList); |
| 203 | 203 | |
| 204 | - if(is_array($output->data)) |
|
| 204 | + if (is_array($output->data)) |
|
| 205 | 205 | { |
| 206 | - foreach($output->data as $no => $iInfo) |
|
| 206 | + foreach ($output->data as $no => $iInfo) |
|
| 207 | 207 | { |
| 208 | - if(!$this->isExistsLayoutFile($iInfo->layout, $layoutType)) |
|
| 208 | + if (!$this->isExistsLayoutFile($iInfo->layout, $layoutType)) |
|
| 209 | 209 | { |
| 210 | 210 | unset($output->data[$no]); |
| 211 | 211 | } |
@@ -226,28 +226,28 @@ discard block |
||
| 226 | 226 | function isExistsLayoutFile($layout, $layoutType) |
| 227 | 227 | { |
| 228 | 228 | //TODO If remove a support themes, remove this codes also. |
| 229 | - if($layoutType == 'P') |
|
| 229 | + if ($layoutType == 'P') |
|
| 230 | 230 | { |
| 231 | - $pathPrefix = _XE_PATH_ . 'layouts/'; |
|
| 232 | - $themePathFormat = _XE_PATH_ . 'themes/%s/layouts/%s'; |
|
| 231 | + $pathPrefix = _XE_PATH_.'layouts/'; |
|
| 232 | + $themePathFormat = _XE_PATH_.'themes/%s/layouts/%s'; |
|
| 233 | 233 | } |
| 234 | 234 | else |
| 235 | 235 | { |
| 236 | - $pathPrefix = _XE_PATH_ . 'm.layouts/'; |
|
| 237 | - $themePathFormat = _XE_PATH_ . 'themes/%s/m.layouts/%s'; |
|
| 236 | + $pathPrefix = _XE_PATH_.'m.layouts/'; |
|
| 237 | + $themePathFormat = _XE_PATH_.'themes/%s/m.layouts/%s'; |
|
| 238 | 238 | } |
| 239 | 239 | |
| 240 | - if(strpos($layout, '|@|') !== FALSE) |
|
| 240 | + if (strpos($layout, '|@|') !== FALSE) |
|
| 241 | 241 | { |
| 242 | 242 | list($themeName, $layoutName) = explode('|@|', $layout); |
| 243 | 243 | $path = sprintf($themePathFormat, $themeName, $layoutName); |
| 244 | 244 | } |
| 245 | 245 | else |
| 246 | 246 | { |
| 247 | - $path = $pathPrefix . $layout; |
|
| 247 | + $path = $pathPrefix.$layout; |
|
| 248 | 248 | } |
| 249 | 249 | |
| 250 | - return is_readable($path . '/layout.html'); |
|
| 250 | + return is_readable($path.'/layout.html'); |
|
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | /** |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | $args = new stdClass(); |
| 263 | 263 | $args->layout_srl = $layout_srl; |
| 264 | 264 | $output = executeQuery('layout.getLayout', $args); |
| 265 | - if(!$output->data) return; |
|
| 265 | + if (!$output->data) return; |
|
| 266 | 266 | |
| 267 | 267 | // Return xml file informaton after listing up the layout and extra_vars |
| 268 | 268 | $layout_info = $this->getLayoutInfo($layout, $output->data, $output->data->layout_type); |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | $args = new stdClass(); |
| 276 | 276 | $args->layout_srl = $layout_srl; |
| 277 | 277 | $output = executeQuery('layout.getLayout', $args, $columnList); |
| 278 | - if(!$output->toBool()) |
|
| 278 | + if (!$output->toBool()) |
|
| 279 | 279 | { |
| 280 | 280 | return; |
| 281 | 281 | } |
@@ -292,15 +292,15 @@ discard block |
||
| 292 | 292 | function getLayoutPath($layout_name = "", $layout_type = "P") |
| 293 | 293 | { |
| 294 | 294 | $layout_parse = explode('|@|', $layout_name); |
| 295 | - if(count($layout_parse) > 1) |
|
| 295 | + if (count($layout_parse) > 1) |
|
| 296 | 296 | { |
| 297 | 297 | $class_path = './themes/'.$layout_parse[0].'/layouts/'.$layout_parse[1].'/'; |
| 298 | 298 | } |
| 299 | - else if($layout_name == 'faceoff') |
|
| 299 | + else if ($layout_name == 'faceoff') |
|
| 300 | 300 | { |
| 301 | 301 | $class_path = './modules/layout/faceoff/'; |
| 302 | 302 | } |
| 303 | - else if($layout_type == "M") |
|
| 303 | + else if ($layout_type == "M") |
|
| 304 | 304 | { |
| 305 | 305 | $class_path = sprintf("./m.layouts/%s/", $layout_name); |
| 306 | 306 | } |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | { |
| 309 | 309 | $class_path = sprintf('./layouts/%s/', $layout_name); |
| 310 | 310 | } |
| 311 | - if(is_dir($class_path)) return $class_path; |
|
| 311 | + if (is_dir($class_path)) return $class_path; |
|
| 312 | 312 | return ""; |
| 313 | 313 | } |
| 314 | 314 | |
@@ -326,24 +326,24 @@ discard block |
||
| 326 | 326 | // Get a list of downloaded layout and installed layout |
| 327 | 327 | $searched_list = $this->_getInstalledLayoutDirectories($layout_type); |
| 328 | 328 | $searched_count = count($searched_list); |
| 329 | - if(!$searched_count) return; |
|
| 329 | + if (!$searched_count) return; |
|
| 330 | 330 | |
| 331 | 331 | // natcasesort($searched_list); |
| 332 | 332 | // Return information for looping searched list of layouts |
| 333 | 333 | $list = array(); |
| 334 | - for($i=0;$i<$searched_count;$i++) |
|
| 334 | + for ($i = 0; $i < $searched_count; $i++) |
|
| 335 | 335 | { |
| 336 | 336 | // Name of the layout |
| 337 | 337 | $layout = $searched_list[$i]; |
| 338 | 338 | // Get information of the layout |
| 339 | 339 | $layout_info = $this->getLayoutInfo($layout, null, $layout_type); |
| 340 | 340 | |
| 341 | - if(!$layout_info) |
|
| 341 | + if (!$layout_info) |
|
| 342 | 342 | { |
| 343 | 343 | continue; |
| 344 | 344 | } |
| 345 | 345 | |
| 346 | - if($withAutoinstallInfo) |
|
| 346 | + if ($withAutoinstallInfo) |
|
| 347 | 347 | { |
| 348 | 348 | // get easyinstall remove url |
| 349 | 349 | $packageSrl = $oAutoinstallModel->getPackageSrlByPath($layout_info->path); |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | $layout_info->need_update = $package[$packageSrl]->need_update; |
| 355 | 355 | |
| 356 | 356 | // get easyinstall update url |
| 357 | - if($layout_info->need_update) |
|
| 357 | + if ($layout_info->need_update) |
|
| 358 | 358 | { |
| 359 | 359 | $layout_info->update_url = $oAutoinstallModel->getUpdateUrlByPackageSrl($packageSrl); |
| 360 | 360 | } |
@@ -371,12 +371,12 @@ discard block |
||
| 371 | 371 | */ |
| 372 | 372 | function sortLayoutByTitle($a, $b) |
| 373 | 373 | { |
| 374 | - if(!$a->title) |
|
| 374 | + if (!$a->title) |
|
| 375 | 375 | { |
| 376 | 376 | $a->title = $a->layout; |
| 377 | 377 | } |
| 378 | 378 | |
| 379 | - if(!$b->title) |
|
| 379 | + if (!$b->title) |
|
| 380 | 380 | { |
| 381 | 381 | $b->title = $b->layout; |
| 382 | 382 | } |
@@ -384,7 +384,7 @@ discard block |
||
| 384 | 384 | $aTitle = strtolower($a->title); |
| 385 | 385 | $bTitle = strtolower($b->title); |
| 386 | 386 | |
| 387 | - if($aTitle == $bTitle) |
|
| 387 | + if ($aTitle == $bTitle) |
|
| 388 | 388 | { |
| 389 | 389 | return 0; |
| 390 | 390 | } |
@@ -410,7 +410,7 @@ discard block |
||
| 410 | 410 | */ |
| 411 | 411 | function _getInstalledLayoutDirectories($layoutType = 'P') |
| 412 | 412 | { |
| 413 | - if($layoutType == 'M') |
|
| 413 | + if ($layoutType == 'M') |
|
| 414 | 414 | { |
| 415 | 415 | $directory = './m.layouts'; |
| 416 | 416 | $globalValueKey = 'MOBILE_LAYOUT_DIRECTOIES'; |
@@ -421,7 +421,7 @@ discard block |
||
| 421 | 421 | $globalValueKey = 'PC_LAYOUT_DIRECTORIES'; |
| 422 | 422 | } |
| 423 | 423 | |
| 424 | - if($GLOBALS[$globalValueKey]) return $GLOBALS[$globalValueKey]; |
|
| 424 | + if ($GLOBALS[$globalValueKey]) return $GLOBALS[$globalValueKey]; |
|
| 425 | 425 | |
| 426 | 426 | $searchedList = FileHandler::readDir($directory); |
| 427 | 427 | if (!$searchedList) $searchedList = array(); |
@@ -440,7 +440,7 @@ discard block |
||
| 440 | 440 | */ |
| 441 | 441 | function getLayoutInfo($layout, $info = null, $layout_type = "P") |
| 442 | 442 | { |
| 443 | - if($info) |
|
| 443 | + if ($info) |
|
| 444 | 444 | { |
| 445 | 445 | $layout_title = $info->title; |
| 446 | 446 | $layout = $info->layout; |
@@ -448,35 +448,35 @@ discard block |
||
| 448 | 448 | $site_srl = $info->site_srl; |
| 449 | 449 | $vars = unserialize($info->extra_vars); |
| 450 | 450 | |
| 451 | - if($info->module_srl) |
|
| 451 | + if ($info->module_srl) |
|
| 452 | 452 | { |
| 453 | - $layout_path = preg_replace('/([a-zA-Z0-9\_\.]+)(\.html)$/','',$info->layout_path); |
|
| 453 | + $layout_path = preg_replace('/([a-zA-Z0-9\_\.]+)(\.html)$/', '', $info->layout_path); |
|
| 454 | 454 | $xml_file = sprintf('%sskin.xml', $layout_path); |
| 455 | 455 | } |
| 456 | 456 | } |
| 457 | 457 | |
| 458 | 458 | // Get a path of the requested module. Return if not exists. |
| 459 | - if(!$layout_path) $layout_path = $this->getLayoutPath($layout, $layout_type); |
|
| 460 | - if(!is_dir($layout_path)) return; |
|
| 459 | + if (!$layout_path) $layout_path = $this->getLayoutPath($layout, $layout_type); |
|
| 460 | + if (!is_dir($layout_path)) return; |
|
| 461 | 461 | |
| 462 | 462 | // Read the xml file for module skin information |
| 463 | - if(!$xml_file) $xml_file = sprintf("%sconf/info.xml", $layout_path); |
|
| 464 | - if(!file_exists($xml_file)) |
|
| 463 | + if (!$xml_file) $xml_file = sprintf("%sconf/info.xml", $layout_path); |
|
| 464 | + if (!file_exists($xml_file)) |
|
| 465 | 465 | { |
| 466 | 466 | $layout_info = new stdClass; |
| 467 | 467 | $layout_info->title = $layout; |
| 468 | 468 | $layout_info->layout = $layout; |
| 469 | 469 | $layout_info->path = $layout_path; |
| 470 | 470 | $layout_info->layout_title = $layout_title; |
| 471 | - if(!$layout_info->layout_type) |
|
| 471 | + if (!$layout_info->layout_type) |
|
| 472 | 472 | { |
| 473 | - $layout_info->layout_type = $layout_type; |
|
| 473 | + $layout_info->layout_type = $layout_type; |
|
| 474 | 474 | } |
| 475 | 475 | return $layout_info; |
| 476 | 476 | } |
| 477 | 477 | |
| 478 | 478 | // Include the cache file if it is valid and then return $layout_info variable |
| 479 | - if(!$layout_srl) |
|
| 479 | + if (!$layout_srl) |
|
| 480 | 480 | { |
| 481 | 481 | $cache_file = $this->getLayoutCache($layout, Context::getLangType(), $layout_type); |
| 482 | 482 | } |
@@ -485,22 +485,22 @@ discard block |
||
| 485 | 485 | $cache_file = $this->getUserLayoutCache($layout_srl, Context::getLangType()); |
| 486 | 486 | } |
| 487 | 487 | |
| 488 | - if(file_exists($cache_file)&&filemtime($cache_file)>filemtime($xml_file)) |
|
| 488 | + if (file_exists($cache_file) && filemtime($cache_file) > filemtime($xml_file)) |
|
| 489 | 489 | { |
| 490 | 490 | include($cache_file); |
| 491 | 491 | |
| 492 | - if($layout_info->extra_var && $vars) |
|
| 492 | + if ($layout_info->extra_var && $vars) |
|
| 493 | 493 | { |
| 494 | - foreach($vars as $key => $value) |
|
| 494 | + foreach ($vars as $key => $value) |
|
| 495 | 495 | { |
| 496 | - if(!$layout_info->extra_var->{$key} && !$layout_info->{$key}) |
|
| 496 | + if (!$layout_info->extra_var->{$key} && !$layout_info->{$key}) |
|
| 497 | 497 | { |
| 498 | 498 | $layout_info->{$key} = $value; |
| 499 | 499 | } |
| 500 | 500 | } |
| 501 | 501 | } |
| 502 | 502 | |
| 503 | - if(!$layout_info->title) |
|
| 503 | + if (!$layout_info->title) |
|
| 504 | 504 | { |
| 505 | 505 | $layout_info->title = $layout; |
| 506 | 506 | } |
@@ -511,16 +511,16 @@ discard block |
||
| 511 | 511 | $oXmlParser = new XmlParser(); |
| 512 | 512 | $tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file); |
| 513 | 513 | |
| 514 | - if($tmp_xml_obj->layout) $xml_obj = $tmp_xml_obj->layout; |
|
| 515 | - elseif($tmp_xml_obj->skin) $xml_obj = $tmp_xml_obj->skin; |
|
| 514 | + if ($tmp_xml_obj->layout) $xml_obj = $tmp_xml_obj->layout; |
|
| 515 | + elseif ($tmp_xml_obj->skin) $xml_obj = $tmp_xml_obj->skin; |
|
| 516 | 516 | |
| 517 | - if(!$xml_obj) return; |
|
| 517 | + if (!$xml_obj) return; |
|
| 518 | 518 | |
| 519 | 519 | $buff = array(); |
| 520 | 520 | $buff[] = '$layout_info = new stdClass;'; |
| 521 | 521 | $buff[] = sprintf('$layout_info->site_srl = "%s";', $site_srl); |
| 522 | 522 | |
| 523 | - if($xml_obj->version && $xml_obj->attrs->version == '0.2') |
|
| 523 | + if ($xml_obj->version && $xml_obj->attrs->version == '0.2') |
|
| 524 | 524 | { |
| 525 | 525 | // Layout title, version and other information |
| 526 | 526 | sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d); |
@@ -540,11 +540,11 @@ discard block |
||
| 540 | 540 | $buff[] = sprintf('$layout_info->layout_type = "%s";', $layout_type); |
| 541 | 541 | |
| 542 | 542 | // Author information |
| 543 | - if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author; |
|
| 543 | + if (!is_array($xml_obj->author)) $author_list[] = $xml_obj->author; |
|
| 544 | 544 | else $author_list = $xml_obj->author; |
| 545 | 545 | |
| 546 | 546 | $buff[] = '$layout_info->author = array();'; |
| 547 | - for($i=0, $c=count($author_list); $i<$c; $i++) |
|
| 547 | + for ($i = 0, $c = count($author_list); $i < $c; $i++) |
|
| 548 | 548 | { |
| 549 | 549 | $buff[] = sprintf('$layout_info->author[%d] = new stdClass;', $i); |
| 550 | 550 | $buff[] = sprintf('$layout_info->author[%d]->name = "%s";', $i, $author_list[$i]->name->body); |
@@ -554,22 +554,22 @@ discard block |
||
| 554 | 554 | |
| 555 | 555 | // Extra vars (user defined variables to use in a template) |
| 556 | 556 | $extra_var_groups = $xml_obj->extra_vars->group; |
| 557 | - if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
| 558 | - if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
| 557 | + if (!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
| 558 | + if (!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
| 559 | 559 | |
| 560 | 560 | $buff[] = '$layout_info->extra_var = new stdClass;'; |
| 561 | 561 | $extra_var_count = 0; |
| 562 | - foreach($extra_var_groups as $group) |
|
| 562 | + foreach ($extra_var_groups as $group) |
|
| 563 | 563 | { |
| 564 | 564 | $extra_vars = $group->var; |
| 565 | - if($extra_vars) |
|
| 565 | + if ($extra_vars) |
|
| 566 | 566 | { |
| 567 | - if(!is_array($extra_vars)) $extra_vars = array($extra_vars); |
|
| 567 | + if (!is_array($extra_vars)) $extra_vars = array($extra_vars); |
|
| 568 | 568 | |
| 569 | 569 | $count = count($extra_vars); |
| 570 | 570 | $extra_var_count += $count; |
| 571 | 571 | |
| 572 | - for($i=0;$i<$count;$i++) |
|
| 572 | + for ($i = 0; $i < $count; $i++) |
|
| 573 | 573 | { |
| 574 | 574 | unset($var, $options); |
| 575 | 575 | $var = $extra_vars[$i]; |
@@ -580,26 +580,26 @@ discard block |
||
| 580 | 580 | $buff[] = sprintf('$layout_info->extra_var->%s->title = "%s";', $name, $var->title->body); |
| 581 | 581 | $buff[] = sprintf('$layout_info->extra_var->%s->type = "%s";', $name, $var->attrs->type); |
| 582 | 582 | $buff[] = sprintf('$layout_info->extra_var->%s->value = $vars->%s;', $name, $name); |
| 583 | - $buff[] = sprintf('$layout_info->extra_var->%s->description = "%s";', $name, str_replace('"','\"',$var->description->body)); |
|
| 583 | + $buff[] = sprintf('$layout_info->extra_var->%s->description = "%s";', $name, str_replace('"', '\"', $var->description->body)); |
|
| 584 | 584 | |
| 585 | 585 | $options = $var->options; |
| 586 | - if(!$options) continue; |
|
| 587 | - if(!is_array($options)) $options = array($options); |
|
| 586 | + if (!$options) continue; |
|
| 587 | + if (!is_array($options)) $options = array($options); |
|
| 588 | 588 | |
| 589 | 589 | $buff[] = sprintf('$layout_info->extra_var->%s->options = array();', $var->attrs->name); |
| 590 | 590 | $options_count = count($options); |
| 591 | 591 | $thumbnail_exist = false; |
| 592 | - for($j=0; $j < $options_count; $j++) |
|
| 592 | + for ($j = 0; $j < $options_count; $j++) |
|
| 593 | 593 | { |
| 594 | 594 | $buff[] = sprintf('$layout_info->extra_var->%s->options["%s"] = new stdClass;', $var->attrs->name, $options[$j]->attrs->value); |
| 595 | 595 | $thumbnail = $options[$j]->attrs->src; |
| 596 | - if($thumbnail) |
|
| 596 | + if ($thumbnail) |
|
| 597 | 597 | { |
| 598 | 598 | $thumbnail = $layout_path.$thumbnail; |
| 599 | - if(file_exists($thumbnail)) |
|
| 599 | + if (file_exists($thumbnail)) |
|
| 600 | 600 | { |
| 601 | 601 | $buff[] = sprintf('$layout_info->extra_var->%s->options["%s"]->thumbnail = "%s";', $var->attrs->name, $options[$j]->attrs->value, $thumbnail); |
| 602 | - if(!$thumbnail_exist) |
|
| 602 | + if (!$thumbnail_exist) |
|
| 603 | 603 | { |
| 604 | 604 | $buff[] = sprintf('$layout_info->extra_var->%s->thumbnail_exist = true;', $var->attrs->name); |
| 605 | 605 | $thumbnail_exist = true; |
@@ -613,26 +613,26 @@ discard block |
||
| 613 | 613 | } |
| 614 | 614 | $buff[] = sprintf('$layout_info->extra_var_count = "%s";', $extra_var_count); |
| 615 | 615 | // Menu |
| 616 | - if($xml_obj->menus->menu) |
|
| 616 | + if ($xml_obj->menus->menu) |
|
| 617 | 617 | { |
| 618 | 618 | $menus = $xml_obj->menus->menu; |
| 619 | - if(!is_array($menus)) $menus = array($menus); |
|
| 619 | + if (!is_array($menus)) $menus = array($menus); |
|
| 620 | 620 | |
| 621 | 621 | $menu_count = count($menus); |
| 622 | 622 | $buff[] = sprintf('$layout_info->menu_count = "%s";', $menu_count); |
| 623 | 623 | $buff[] = '$layout_info->menu = new stdClass;'; |
| 624 | - for($i=0;$i<$menu_count;$i++) |
|
| 624 | + for ($i = 0; $i < $menu_count; $i++) |
|
| 625 | 625 | { |
| 626 | 626 | $name = $menus[$i]->attrs->name; |
| 627 | - if($menus[$i]->attrs->default == "true") $buff[] = sprintf('$layout_info->default_menu = "%s";', $name); |
|
| 627 | + if ($menus[$i]->attrs->default == "true") $buff[] = sprintf('$layout_info->default_menu = "%s";', $name); |
|
| 628 | 628 | $buff[] = sprintf('$layout_info->menu->%s = new stdClass;', $name); |
| 629 | - $buff[] = sprintf('$layout_info->menu->%s->name = "%s";',$name, $menus[$i]->attrs->name); |
|
| 630 | - $buff[] = sprintf('$layout_info->menu->%s->title = "%s";',$name, $menus[$i]->title->body); |
|
| 631 | - $buff[] = sprintf('$layout_info->menu->%s->maxdepth = "%s";',$name, $menus[$i]->attrs->maxdepth); |
|
| 629 | + $buff[] = sprintf('$layout_info->menu->%s->name = "%s";', $name, $menus[$i]->attrs->name); |
|
| 630 | + $buff[] = sprintf('$layout_info->menu->%s->title = "%s";', $name, $menus[$i]->title->body); |
|
| 631 | + $buff[] = sprintf('$layout_info->menu->%s->maxdepth = "%s";', $name, $menus[$i]->attrs->maxdepth); |
|
| 632 | 632 | |
| 633 | 633 | $buff[] = sprintf('$layout_info->menu->%s->menu_srl = $vars->%s;', $name, $name); |
| 634 | - $buff[] = sprintf('$layout_info->menu->%s->xml_file = "./files/cache/menu/".$vars->%s.".xml.php";',$name, $name); |
|
| 635 | - $buff[] = sprintf('$layout_info->menu->%s->php_file = "./files/cache/menu/".$vars->%s.".php";',$name, $name); |
|
| 634 | + $buff[] = sprintf('$layout_info->menu->%s->xml_file = "./files/cache/menu/".$vars->%s.".xml.php";', $name, $name); |
|
| 635 | + $buff[] = sprintf('$layout_info->menu->%s->php_file = "./files/cache/menu/".$vars->%s.".php";', $name, $name); |
|
| 636 | 636 | } |
| 637 | 637 | } |
| 638 | 638 | } |
@@ -655,19 +655,19 @@ discard block |
||
| 655 | 655 | $buff[] = sprintf('$layout_info->author[0]->homepage = "%s";', $xml_obj->author->attrs->link); |
| 656 | 656 | // Extra vars (user defined variables to use in a template) |
| 657 | 657 | $extra_var_groups = $xml_obj->extra_vars->group; |
| 658 | - if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
| 659 | - if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
| 660 | - foreach($extra_var_groups as $group) |
|
| 658 | + if (!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
| 659 | + if (!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
| 660 | + foreach ($extra_var_groups as $group) |
|
| 661 | 661 | { |
| 662 | 662 | $extra_vars = $group->var; |
| 663 | - if($extra_vars) |
|
| 663 | + if ($extra_vars) |
|
| 664 | 664 | { |
| 665 | - if(!is_array($extra_vars)) $extra_vars = array($extra_vars); |
|
| 665 | + if (!is_array($extra_vars)) $extra_vars = array($extra_vars); |
|
| 666 | 666 | |
| 667 | 667 | $extra_var_count = count($extra_vars); |
| 668 | 668 | |
| 669 | 669 | $buff[] = sprintf('$layout_info->extra_var_count = "%s";', $extra_var_count); |
| 670 | - for($i=0;$i<$extra_var_count;$i++) |
|
| 670 | + for ($i = 0; $i < $extra_var_count; $i++) |
|
| 671 | 671 | { |
| 672 | 672 | unset($var, $options); |
| 673 | 673 | $var = $extra_vars[$i]; |
@@ -677,14 +677,14 @@ discard block |
||
| 677 | 677 | $buff[] = sprintf('$layout_info->extra_var->%s->title = "%s";', $name, $var->title->body); |
| 678 | 678 | $buff[] = sprintf('$layout_info->extra_var->%s->type = "%s";', $name, $var->attrs->type); |
| 679 | 679 | $buff[] = sprintf('$layout_info->extra_var->%s->value = $vars->%s;', $name, $name); |
| 680 | - $buff[] = sprintf('$layout_info->extra_var->%s->description = "%s";', $name, str_replace('"','\"',$var->description->body)); |
|
| 680 | + $buff[] = sprintf('$layout_info->extra_var->%s->description = "%s";', $name, str_replace('"', '\"', $var->description->body)); |
|
| 681 | 681 | |
| 682 | 682 | $options = $var->options; |
| 683 | - if(!$options) continue; |
|
| 683 | + if (!$options) continue; |
|
| 684 | 684 | |
| 685 | - if(!is_array($options)) $options = array($options); |
|
| 685 | + if (!is_array($options)) $options = array($options); |
|
| 686 | 686 | $options_count = count($options); |
| 687 | - for($j=0;$j<$options_count;$j++) |
|
| 687 | + for ($j = 0; $j < $options_count; $j++) |
|
| 688 | 688 | { |
| 689 | 689 | $buff[] = sprintf('$layout_info->extra_var->%s->options["%s"]->val = "%s";', $var->attrs->name, $options[$j]->value->body, $options[$j]->title->body); |
| 690 | 690 | } |
@@ -692,23 +692,23 @@ discard block |
||
| 692 | 692 | } |
| 693 | 693 | } |
| 694 | 694 | // Menu |
| 695 | - if($xml_obj->menus->menu) |
|
| 695 | + if ($xml_obj->menus->menu) |
|
| 696 | 696 | { |
| 697 | 697 | $menus = $xml_obj->menus->menu; |
| 698 | - if(!is_array($menus)) $menus = array($menus); |
|
| 698 | + if (!is_array($menus)) $menus = array($menus); |
|
| 699 | 699 | |
| 700 | 700 | $menu_count = count($menus); |
| 701 | 701 | $buff[] = sprintf('$layout_info->menu_count = "%s";', $menu_count); |
| 702 | - for($i=0;$i<$menu_count;$i++) |
|
| 702 | + for ($i = 0; $i < $menu_count; $i++) |
|
| 703 | 703 | { |
| 704 | 704 | $name = $menus[$i]->attrs->name; |
| 705 | - if($menus[$i]->attrs->default == "true") $buff[] = sprintf('$layout_info->default_menu = "%s";', $name); |
|
| 706 | - $buff[] = sprintf('$layout_info->menu->%s->name = "%s";',$name, $name); |
|
| 707 | - $buff[] = sprintf('$layout_info->menu->%s->title = "%s";',$name, $menus[$i]->title->body); |
|
| 708 | - $buff[] = sprintf('$layout_info->menu->%s->maxdepth = "%s";',$name, $menus[$i]->maxdepth->body); |
|
| 705 | + if ($menus[$i]->attrs->default == "true") $buff[] = sprintf('$layout_info->default_menu = "%s";', $name); |
|
| 706 | + $buff[] = sprintf('$layout_info->menu->%s->name = "%s";', $name, $name); |
|
| 707 | + $buff[] = sprintf('$layout_info->menu->%s->title = "%s";', $name, $menus[$i]->title->body); |
|
| 708 | + $buff[] = sprintf('$layout_info->menu->%s->maxdepth = "%s";', $name, $menus[$i]->maxdepth->body); |
|
| 709 | 709 | $buff[] = sprintf('$layout_info->menu->%s->menu_srl = $vars->%s;', $name, $name); |
| 710 | - $buff[] = sprintf('$layout_info->menu->%s->xml_file = "./files/cache/menu/".$vars->%s.".xml.php";',$name, $name); |
|
| 711 | - $buff[] = sprintf('$layout_info->menu->%s->php_file = "./files/cache/menu/".$vars->%s.".php";',$name, $name); |
|
| 710 | + $buff[] = sprintf('$layout_info->menu->%s->xml_file = "./files/cache/menu/".$vars->%s.".xml.php";', $name, $name); |
|
| 711 | + $buff[] = sprintf('$layout_info->menu->%s->php_file = "./files/cache/menu/".$vars->%s.".php";', $name, $name); |
|
| 712 | 712 | } |
| 713 | 713 | } |
| 714 | 714 | } |
@@ -718,15 +718,15 @@ discard block |
||
| 718 | 718 | $layout_config = $oModuleModel->getModulePartConfig('layout', $layout_srl); |
| 719 | 719 | $header_script = trim($layout_config->header_script); |
| 720 | 720 | |
| 721 | - if($header_script) |
|
| 721 | + if ($header_script) |
|
| 722 | 722 | { |
| 723 | 723 | $buff[] = sprintf(' $layout_info->header_script = %s; ', var_export($header_script, true)); |
| 724 | 724 | } |
| 725 | 725 | |
| 726 | - FileHandler::writeFile($cache_file, '<?php if(!defined("__XE__")) exit(); ' . join(PHP_EOL, $buff)); |
|
| 727 | - if(FileHandler::exists($cache_file)) include($cache_file); |
|
| 726 | + FileHandler::writeFile($cache_file, '<?php if(!defined("__XE__")) exit(); '.join(PHP_EOL, $buff)); |
|
| 727 | + if (FileHandler::exists($cache_file)) include($cache_file); |
|
| 728 | 728 | |
| 729 | - if(!$layout_info->title) |
|
| 729 | + if (!$layout_info->title) |
|
| 730 | 730 | { |
| 731 | 731 | $layout_info->title = $layout; |
| 732 | 732 | } |
@@ -750,12 +750,12 @@ discard block |
||
| 750 | 750 | * @param string $layout_name |
| 751 | 751 | * @return array |
| 752 | 752 | */ |
| 753 | - function getUserLayoutIniConfig($layout_srl, $layout_name=null) |
|
| 753 | + function getUserLayoutIniConfig($layout_srl, $layout_name = null) |
|
| 754 | 754 | { |
| 755 | 755 | $file = $this->getUserLayoutIni($layout_srl); |
| 756 | - if($layout_name && FileHandler::exists($file) === FALSE) |
|
| 756 | + if ($layout_name && FileHandler::exists($file) === FALSE) |
|
| 757 | 757 | { |
| 758 | - FileHandler::copyFile($this->getDefaultLayoutIni($layout_name),$this->getUserLayoutIni($layout_srl)); |
|
| 758 | + FileHandler::copyFile($this->getDefaultLayoutIni($layout_name), $this->getUserLayoutIni($layout_srl)); |
|
| 759 | 759 | } |
| 760 | 760 | |
| 761 | 761 | return FileHandler::readIniFile($file); |
@@ -768,7 +768,7 @@ discard block |
||
| 768 | 768 | */ |
| 769 | 769 | function getUserLayoutPath($layout_srl) |
| 770 | 770 | { |
| 771 | - return sprintf("./files/faceOff/%s", getNumberingPath($layout_srl,3)); |
|
| 771 | + return sprintf("./files/faceOff/%s", getNumberingPath($layout_srl, 3)); |
|
| 772 | 772 | } |
| 773 | 773 | |
| 774 | 774 | /** |
@@ -778,7 +778,7 @@ discard block |
||
| 778 | 778 | */ |
| 779 | 779 | function getUserLayoutImagePath($layout_srl) |
| 780 | 780 | { |
| 781 | - return $this->getUserLayoutPath($layout_srl). 'images/'; |
|
| 781 | + return $this->getUserLayoutPath($layout_srl).'images/'; |
|
| 782 | 782 | } |
| 783 | 783 | |
| 784 | 784 | /** |
@@ -788,7 +788,7 @@ discard block |
||
| 788 | 788 | */ |
| 789 | 789 | function getUserLayoutCss($layout_srl) |
| 790 | 790 | { |
| 791 | - return $this->getUserLayoutPath($layout_srl). 'layout.css'; |
|
| 791 | + return $this->getUserLayoutPath($layout_srl).'layout.css'; |
|
| 792 | 792 | } |
| 793 | 793 | |
| 794 | 794 | /** |
@@ -798,7 +798,7 @@ discard block |
||
| 798 | 798 | */ |
| 799 | 799 | function getUserLayoutFaceOffCss($layout_srl) |
| 800 | 800 | { |
| 801 | - if($this->useUserLayoutTemp == 'temp') return; |
|
| 801 | + if ($this->useUserLayoutTemp == 'temp') return; |
|
| 802 | 802 | return $this->_getUserLayoutFaceOffCss($layout_srl); |
| 803 | 803 | } |
| 804 | 804 | |
@@ -809,7 +809,7 @@ discard block |
||
| 809 | 809 | */ |
| 810 | 810 | function _getUserLayoutFaceOffCss($layout_srl) |
| 811 | 811 | { |
| 812 | - return $this->getUserLayoutPath($layout_srl). 'faceoff.css'; |
|
| 812 | + return $this->getUserLayoutPath($layout_srl).'faceoff.css'; |
|
| 813 | 813 | } |
| 814 | 814 | |
| 815 | 815 | /** |
@@ -819,7 +819,7 @@ discard block |
||
| 819 | 819 | */ |
| 820 | 820 | function getUserLayoutTempFaceOffCss($layout_srl) |
| 821 | 821 | { |
| 822 | - return $this->getUserLayoutPath($layout_srl). 'tmp.faceoff.css'; |
|
| 822 | + return $this->getUserLayoutPath($layout_srl).'tmp.faceoff.css'; |
|
| 823 | 823 | } |
| 824 | 824 | |
| 825 | 825 | /** |
@@ -829,11 +829,11 @@ discard block |
||
| 829 | 829 | */ |
| 830 | 830 | function getUserLayoutHtml($layout_srl) |
| 831 | 831 | { |
| 832 | - $src = $this->getUserLayoutPath($layout_srl). 'layout.html'; |
|
| 833 | - if($this->useUserLayoutTemp == 'temp') |
|
| 832 | + $src = $this->getUserLayoutPath($layout_srl).'layout.html'; |
|
| 833 | + if ($this->useUserLayoutTemp == 'temp') |
|
| 834 | 834 | { |
| 835 | 835 | $temp = $this->getUserLayoutTempHtml($layout_srl); |
| 836 | - if(FileHandler::exists($temp) === FALSE) FileHandler::copyFile($src,$temp); |
|
| 836 | + if (FileHandler::exists($temp) === FALSE) FileHandler::copyFile($src, $temp); |
|
| 837 | 837 | return $temp; |
| 838 | 838 | } |
| 839 | 839 | |
@@ -847,7 +847,7 @@ discard block |
||
| 847 | 847 | */ |
| 848 | 848 | function getUserLayoutTempHtml($layout_srl) |
| 849 | 849 | { |
| 850 | - return $this->getUserLayoutPath($layout_srl). 'tmp.layout.html'; |
|
| 850 | + return $this->getUserLayoutPath($layout_srl).'tmp.layout.html'; |
|
| 851 | 851 | } |
| 852 | 852 | |
| 853 | 853 | /** |
@@ -857,11 +857,11 @@ discard block |
||
| 857 | 857 | */ |
| 858 | 858 | function getUserLayoutIni($layout_srl) |
| 859 | 859 | { |
| 860 | - $src = $this->getUserLayoutPath($layout_srl). 'layout.ini'; |
|
| 861 | - if($this->useUserLayoutTemp == 'temp') |
|
| 860 | + $src = $this->getUserLayoutPath($layout_srl).'layout.ini'; |
|
| 861 | + if ($this->useUserLayoutTemp == 'temp') |
|
| 862 | 862 | { |
| 863 | 863 | $temp = $this->getUserLayoutTempIni($layout_srl); |
| 864 | - if(!file_exists(FileHandler::getRealPath($temp))) FileHandler::copyFile($src,$temp); |
|
| 864 | + if (!file_exists(FileHandler::getRealPath($temp))) FileHandler::copyFile($src, $temp); |
|
| 865 | 865 | return $temp; |
| 866 | 866 | } |
| 867 | 867 | |
@@ -875,7 +875,7 @@ discard block |
||
| 875 | 875 | */ |
| 876 | 876 | function getUserLayoutTempIni($layout_srl) |
| 877 | 877 | { |
| 878 | - return $this->getUserLayoutPath($layout_srl). 'tmp.layout.ini'; |
|
| 878 | + return $this->getUserLayoutPath($layout_srl).'tmp.layout.ini'; |
|
| 879 | 879 | } |
| 880 | 880 | |
| 881 | 881 | /** |
@@ -885,9 +885,9 @@ discard block |
||
| 885 | 885 | * @param string $lang_type |
| 886 | 886 | * @return string |
| 887 | 887 | */ |
| 888 | - function getUserLayoutCache($layout_srl,$lang_type) |
|
| 888 | + function getUserLayoutCache($layout_srl, $lang_type) |
|
| 889 | 889 | { |
| 890 | - return $this->getUserLayoutPath($layout_srl). "{$lang_type}.cache.php"; |
|
| 890 | + return $this->getUserLayoutPath($layout_srl)."{$lang_type}.cache.php"; |
|
| 891 | 891 | } |
| 892 | 892 | |
| 893 | 893 | /** |
@@ -896,15 +896,15 @@ discard block |
||
| 896 | 896 | * @param string $lang_type |
| 897 | 897 | * @return string |
| 898 | 898 | */ |
| 899 | - function getLayoutCache($layout_name,$lang_type,$layout_type='P') |
|
| 899 | + function getLayoutCache($layout_name, $lang_type, $layout_type = 'P') |
|
| 900 | 900 | { |
| 901 | - if($layout_type=='P') |
|
| 901 | + if ($layout_type == 'P') |
|
| 902 | 902 | { |
| 903 | - return sprintf("%sfiles/cache/layout/%s.%s.cache.php", _XE_PATH_, $layout_name,$lang_type); |
|
| 903 | + return sprintf("%sfiles/cache/layout/%s.%s.cache.php", _XE_PATH_, $layout_name, $lang_type); |
|
| 904 | 904 | } |
| 905 | 905 | else |
| 906 | 906 | { |
| 907 | - return sprintf("%sfiles/cache/layout/m.%s.%s.cache.php", _XE_PATH_, $layout_name,$lang_type); |
|
| 907 | + return sprintf("%sfiles/cache/layout/m.%s.%s.cache.php", _XE_PATH_, $layout_name, $lang_type); |
|
| 908 | 908 | } |
| 909 | 909 | } |
| 910 | 910 | |
@@ -915,7 +915,7 @@ discard block |
||
| 915 | 915 | */ |
| 916 | 916 | function getDefaultLayoutIni($layout_name) |
| 917 | 917 | { |
| 918 | - return $this->getDefaultLayoutPath($layout_name). 'layout.ini'; |
|
| 918 | + return $this->getDefaultLayoutPath($layout_name).'layout.ini'; |
|
| 919 | 919 | } |
| 920 | 920 | |
| 921 | 921 | /** |
@@ -925,7 +925,7 @@ discard block |
||
| 925 | 925 | */ |
| 926 | 926 | function getDefaultLayoutHtml($layout_name) |
| 927 | 927 | { |
| 928 | - return $this->getDefaultLayoutPath($layout_name). 'layout.html'; |
|
| 928 | + return $this->getDefaultLayoutPath($layout_name).'layout.html'; |
|
| 929 | 929 | } |
| 930 | 930 | |
| 931 | 931 | /** |
@@ -935,7 +935,7 @@ discard block |
||
| 935 | 935 | */ |
| 936 | 936 | function getDefaultLayoutCss($layout_name) |
| 937 | 937 | { |
| 938 | - return $this->getDefaultLayoutPath($layout_name). 'css/layout.css'; |
|
| 938 | + return $this->getDefaultLayoutPath($layout_name).'css/layout.css'; |
|
| 939 | 939 | } |
| 940 | 940 | |
| 941 | 941 | /** |
@@ -964,7 +964,7 @@ discard block |
||
| 964 | 964 | * @param string $flag (default 'temp') |
| 965 | 965 | * @return void |
| 966 | 966 | */ |
| 967 | - function setUseUserLayoutTemp($flag='temp') |
|
| 967 | + function setUseUserLayoutTemp($flag = 'temp') |
|
| 968 | 968 | { |
| 969 | 969 | $this->useUserLayoutTemp = $flag; |
| 970 | 970 | } |
@@ -998,11 +998,11 @@ discard block |
||
| 998 | 998 | ); |
| 999 | 999 | |
| 1000 | 1000 | $image_path = $this->getUserLayoutImagePath($layout_srl); |
| 1001 | - $image_list = FileHandler::readDir($image_path,'/(.*(?:jpg|jpeg|gif|bmp|png)$)/i'); |
|
| 1001 | + $image_list = FileHandler::readDir($image_path, '/(.*(?:jpg|jpeg|gif|bmp|png)$)/i'); |
|
| 1002 | 1002 | |
| 1003 | - foreach($image_list as $image) |
|
| 1003 | + foreach ($image_list as $image) |
|
| 1004 | 1004 | { |
| 1005 | - $file_list[] = 'images/' . $image; |
|
| 1005 | + $file_list[] = 'images/'.$image; |
|
| 1006 | 1006 | } |
| 1007 | 1007 | return $file_list; |
| 1008 | 1008 | } |
@@ -1020,20 +1020,20 @@ discard block |
||
| 1020 | 1020 | Context::addCSSFile($this->getDefaultLayoutCss($layout_info->layout)); |
| 1021 | 1021 | // CSS generated in the layout manager |
| 1022 | 1022 | $faceoff_layout_css = $this->getUserLayoutFaceOffCss($layout_info->layout_srl); |
| 1023 | - if($faceoff_layout_css) Context::addCSSFile($faceoff_layout_css); |
|
| 1023 | + if ($faceoff_layout_css) Context::addCSSFile($faceoff_layout_css); |
|
| 1024 | 1024 | // CSS output for the widget |
| 1025 | 1025 | Context::loadFile($this->module_path.'/tpl/css/widget.css', true); |
| 1026 | - if($layout_info->extra_var->colorset->value == 'black') Context::loadFile($this->module_path.'/tpl/css/[email protected]', true); |
|
| 1026 | + if ($layout_info->extra_var->colorset->value == 'black') Context::loadFile($this->module_path.'/tpl/css/[email protected]', true); |
|
| 1027 | 1027 | else Context::loadFile($this->module_path.'/tpl/css/[email protected]', true); |
| 1028 | 1028 | // Different page displayed upon user's permission |
| 1029 | 1029 | $logged_info = Context::get('logged_info'); |
| 1030 | 1030 | // Display edit button for faceoff layout |
| 1031 | - if(Context::get('module')!='admin' && strpos(Context::get('act'),'Admin')===false && ($logged_info->is_admin == 'Y' || $logged_info->is_site_admin)) |
|
| 1031 | + if (Context::get('module') != 'admin' && strpos(Context::get('act'), 'Admin') === false && ($logged_info->is_admin == 'Y' || $logged_info->is_site_admin)) |
|
| 1032 | 1032 | { |
| 1033 | - Context::addHtmlFooter('<div class="faceOffManager" style="height: 23px; position: fixed; right: 3px; top: 3px;"><a href="'.getUrl('','mid',Context::get('mid'),'act','dispLayoutAdminLayoutModify','delete_tmp','Y').'">'.Context::getLang('cmd_layout_edit').'</a></div>'); |
|
| 1033 | + Context::addHtmlFooter('<div class="faceOffManager" style="height: 23px; position: fixed; right: 3px; top: 3px;"><a href="'.getUrl('', 'mid', Context::get('mid'), 'act', 'dispLayoutAdminLayoutModify', 'delete_tmp', 'Y').'">'.Context::getLang('cmd_layout_edit').'</a></div>'); |
|
| 1034 | 1034 | } |
| 1035 | 1035 | // Display menu when editing the faceOff page |
| 1036 | - if(Context::get('act')=='dispLayoutAdminLayoutModify' && ($logged_info->is_admin == 'Y' || $logged_info->is_site_admin)) |
|
| 1036 | + if (Context::get('act') == 'dispLayoutAdminLayoutModify' && ($logged_info->is_admin == 'Y' || $logged_info->is_site_admin)) |
|
| 1037 | 1037 | { |
| 1038 | 1038 | $oTemplate = &TemplateHandler::getInstance(); |
| 1039 | 1039 | Context::addBodyHeader($oTemplate->compile($this->module_path.'/tpl', 'faceoff_layout_menu')); |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | private $path = NULL; ///< target directory |
| 17 | 17 | private $filename = NULL; ///< target filename |
| 18 | 18 | private $file = NULL; ///< target file (fullpath) |
| 19 | - private $xe_path = NULL; ///< XpressEngine base path |
|
| 19 | + private $xe_path = NULL; ///< XpressEngine base path |
|
| 20 | 20 | private $web_path = NULL; ///< tpl file web path |
| 21 | 21 | private $compiled_file = NULL; ///< tpl file web path |
| 22 | 22 | private $config = NULL; |
@@ -33,18 +33,18 @@ discard block |
||
| 33 | 33 | { |
| 34 | 34 | ini_set('pcre.jit', "0"); |
| 35 | 35 | $this->xe_path = rtrim(getScriptPath(), '/'); |
| 36 | - $this->compiled_path = _XE_PATH_ . $this->compiled_path; |
|
| 36 | + $this->compiled_path = _XE_PATH_.$this->compiled_path; |
|
| 37 | 37 | $this->config = new stdClass(); |
| 38 | 38 | |
| 39 | 39 | $this->ignoreEscape = array( |
| 40 | - 'functions' => function ($m) { |
|
| 40 | + 'functions' => function($m) { |
|
| 41 | 41 | $list = array( |
| 42 | 42 | 'htmlspecialchars', |
| 43 | 43 | 'nl2br', |
| 44 | 44 | ); |
| 45 | - return preg_match('/^(' . implode('|', $list) . ')\(/', $m[1]); |
|
| 45 | + return preg_match('/^('.implode('|', $list).')\(/', $m[1]); |
|
| 46 | 46 | }, |
| 47 | - 'lang' => function ($m) { |
|
| 47 | + 'lang' => function($m) { |
|
| 48 | 48 | // 다국어 |
| 49 | 49 | return preg_match('/^\$lang\-\>/', trim($m[1])); |
| 50 | 50 | } |
@@ -61,9 +61,9 @@ discard block |
||
| 61 | 61 | { |
| 62 | 62 | static $oTemplate = NULL; |
| 63 | 63 | |
| 64 | - if(__DEBUG__ == 3) |
|
| 64 | + if (__DEBUG__ == 3) |
|
| 65 | 65 | { |
| 66 | - if(!isset($GLOBALS['__TemplateHandlerCalled__'])) |
|
| 66 | + if (!isset($GLOBALS['__TemplateHandlerCalled__'])) |
|
| 67 | 67 | { |
| 68 | 68 | $GLOBALS['__TemplateHandlerCalled__'] = 1; |
| 69 | 69 | } |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - if(!$oTemplate) |
|
| 76 | + if (!$oTemplate) |
|
| 77 | 77 | { |
| 78 | 78 | $oTemplate = new TemplateHandler(); |
| 79 | 79 | } |
@@ -91,23 +91,23 @@ discard block |
||
| 91 | 91 | protected function init($tpl_path, $tpl_filename, $tpl_file = '') |
| 92 | 92 | { |
| 93 | 93 | // verify arguments |
| 94 | - if(substr($tpl_path, -1) != '/') |
|
| 94 | + if (substr($tpl_path, -1) != '/') |
|
| 95 | 95 | { |
| 96 | 96 | $tpl_path .= '/'; |
| 97 | 97 | } |
| 98 | - if(!is_dir($tpl_path)) |
|
| 98 | + if (!is_dir($tpl_path)) |
|
| 99 | 99 | { |
| 100 | 100 | return; |
| 101 | 101 | } |
| 102 | - if(!file_exists($tpl_path . $tpl_filename) && file_exists($tpl_path . $tpl_filename . '.html')) |
|
| 102 | + if (!file_exists($tpl_path.$tpl_filename) && file_exists($tpl_path.$tpl_filename.'.html')) |
|
| 103 | 103 | { |
| 104 | 104 | $tpl_filename .= '.html'; |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | // create tpl_file variable |
| 108 | - if(!$tpl_file) |
|
| 108 | + if (!$tpl_file) |
|
| 109 | 109 | { |
| 110 | - $tpl_file = $tpl_path . $tpl_filename; |
|
| 110 | + $tpl_file = $tpl_path.$tpl_filename; |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | // set template file infos. |
@@ -115,10 +115,10 @@ discard block |
||
| 115 | 115 | $this->filename = $tpl_filename; |
| 116 | 116 | $this->file = $tpl_file; |
| 117 | 117 | |
| 118 | - $this->web_path = $this->xe_path . '/' . ltrim(preg_replace('@^' . preg_quote(_XE_PATH_, '@') . '|\./@', '', $this->path), '/'); |
|
| 118 | + $this->web_path = $this->xe_path.'/'.ltrim(preg_replace('@^'.preg_quote(_XE_PATH_, '@').'|\./@', '', $this->path), '/'); |
|
| 119 | 119 | |
| 120 | 120 | // get compiled file name |
| 121 | - $hash = md5($this->file . __XE_VERSION__); |
|
| 121 | + $hash = md5($this->file.__XE_VERSION__); |
|
| 122 | 122 | $this->compiled_file = "{$this->compiled_path}{$hash}.compiled.php"; |
| 123 | 123 | |
| 124 | 124 | $this->autoescape = $this->isAutoescape(); |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | $buff = false; |
| 142 | 142 | |
| 143 | 143 | // store the starting time for debug information |
| 144 | - if(__DEBUG__ == 3) |
|
| 144 | + if (__DEBUG__ == 3) |
|
| 145 | 145 | { |
| 146 | 146 | $start = getMicroTime(); |
| 147 | 147 | } |
@@ -150,13 +150,13 @@ discard block |
||
| 150 | 150 | $this->init($tpl_path, $tpl_filename, $tpl_file); |
| 151 | 151 | |
| 152 | 152 | // if target file does not exist exit |
| 153 | - if(!$this->file || !file_exists($this->file)) |
|
| 153 | + if (!$this->file || !file_exists($this->file)) |
|
| 154 | 154 | { |
| 155 | 155 | return "Err : '{$this->file}' template file does not exists."; |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | // for backward compatibility |
| 159 | - if(is_null(self::$rootTpl)) |
|
| 159 | + if (is_null(self::$rootTpl)) |
|
| 160 | 160 | { |
| 161 | 161 | self::$rootTpl = $this->file; |
| 162 | 162 | } |
@@ -168,23 +168,23 @@ discard block |
||
| 168 | 168 | $oCacheHandler = CacheHandler::getInstance('template'); |
| 169 | 169 | |
| 170 | 170 | // get cached buff |
| 171 | - if($oCacheHandler->isSupport()) |
|
| 171 | + if ($oCacheHandler->isSupport()) |
|
| 172 | 172 | { |
| 173 | - $cache_key = 'template:' . $this->file; |
|
| 173 | + $cache_key = 'template:'.$this->file; |
|
| 174 | 174 | $buff = $oCacheHandler->get($cache_key, $latest_mtime); |
| 175 | 175 | } |
| 176 | 176 | else |
| 177 | 177 | { |
| 178 | - if(is_readable($this->compiled_file) && filemtime($this->compiled_file) > $latest_mtime && filesize($this->compiled_file)) |
|
| 178 | + if (is_readable($this->compiled_file) && filemtime($this->compiled_file) > $latest_mtime && filesize($this->compiled_file)) |
|
| 179 | 179 | { |
| 180 | - $buff = 'file://' . $this->compiled_file; |
|
| 180 | + $buff = 'file://'.$this->compiled_file; |
|
| 181 | 181 | } |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | - if($buff === FALSE) |
|
| 184 | + if ($buff === FALSE) |
|
| 185 | 185 | { |
| 186 | 186 | $buff = $this->parse(); |
| 187 | - if($oCacheHandler->isSupport()) |
|
| 187 | + if ($oCacheHandler->isSupport()) |
|
| 188 | 188 | { |
| 189 | 189 | $oCacheHandler->put($cache_key, $buff); |
| 190 | 190 | } |
@@ -196,13 +196,13 @@ discard block |
||
| 196 | 196 | |
| 197 | 197 | $output = $this->_fetch($buff); |
| 198 | 198 | |
| 199 | - if($__templatehandler_root_tpl == $this->file) |
|
| 199 | + if ($__templatehandler_root_tpl == $this->file) |
|
| 200 | 200 | { |
| 201 | 201 | $__templatehandler_root_tpl = null; |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | // store the ending time for debug information |
| 205 | - if(__DEBUG__ == 3) |
|
| 205 | + if (__DEBUG__ == 3) |
|
| 206 | 206 | { |
| 207 | 207 | $GLOBALS['__template_elapsed__'] += getMicroTime() - $start; |
| 208 | 208 | } |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | $this->init($tpl_path, $tpl_filename, null); |
| 222 | 222 | |
| 223 | 223 | // if target file does not exist exit |
| 224 | - if(!$this->file || !file_exists($this->file)) |
|
| 224 | + if (!$this->file || !file_exists($this->file)) |
|
| 225 | 225 | { |
| 226 | 226 | Context::close(); |
| 227 | 227 | exit("Cannot find the template file: '{$this->file}'"); |
@@ -237,9 +237,9 @@ discard block |
||
| 237 | 237 | */ |
| 238 | 238 | protected function parse($buff = null) |
| 239 | 239 | { |
| 240 | - if(is_null($buff)) |
|
| 240 | + if (is_null($buff)) |
|
| 241 | 241 | { |
| 242 | - if(!is_readable($this->file)) |
|
| 242 | + if (!is_readable($this->file)) |
|
| 243 | 243 | { |
| 244 | 244 | return; |
| 245 | 245 | } |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | // HTML tags to skip |
| 252 | - if(is_null($this->skipTags)) |
|
| 252 | + if (is_null($this->skipTags)) |
|
| 253 | 253 | { |
| 254 | 254 | $this->skipTags = array('marquee'); |
| 255 | 255 | } |
@@ -259,13 +259,13 @@ discard block |
||
| 259 | 259 | $this->config = new stdClass(); |
| 260 | 260 | $this->config->autoescape = null; |
| 261 | 261 | |
| 262 | - if(preg_match('/\<config( [^\>\/]+)/', $buff, $config_match)) |
|
| 262 | + if (preg_match('/\<config( [^\>\/]+)/', $buff, $config_match)) |
|
| 263 | 263 | { |
| 264 | - if(preg_match_all('@ (?<name>\w+)="(?<value>[^"]+)"@', $config_match[1], $config_matches, PREG_SET_ORDER)) |
|
| 264 | + if (preg_match_all('@ (?<name>\w+)="(?<value>[^"]+)"@', $config_match[1], $config_matches, PREG_SET_ORDER)) |
|
| 265 | 265 | { |
| 266 | - foreach($config_matches as $config_match) |
|
| 266 | + foreach ($config_matches as $config_match) |
|
| 267 | 267 | { |
| 268 | - if($config_match['name'] === 'autoescape') |
|
| 268 | + if ($config_match['name'] === 'autoescape') |
|
| 269 | 269 | { |
| 270 | 270 | $this->config->autoescape = $config_match['value']; |
| 271 | 271 | } |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | } |
| 274 | 274 | } |
| 275 | 275 | |
| 276 | - if($this->config->autoescape === 'on') $this->autoescape = true; |
|
| 276 | + if ($this->config->autoescape === 'on') $this->autoescape = true; |
|
| 277 | 277 | |
| 278 | 278 | // replace comments |
| 279 | 279 | $buff = preg_replace('@<!--//.*?-->@s', '', $buff); |
@@ -292,13 +292,13 @@ discard block |
||
| 292 | 292 | |
| 293 | 293 | // form auto generation |
| 294 | 294 | $temp = preg_replace_callback('/(<form(?:<\?php.+?\?>|[^<>]+)*?>)(.*?)(<\/form>)/is', array($this, '_compileFormAuthGeneration'), $buff); |
| 295 | - if($temp) |
|
| 295 | + if ($temp) |
|
| 296 | 296 | { |
| 297 | 297 | $buff = $temp; |
| 298 | 298 | } |
| 299 | 299 | |
| 300 | 300 | // prevent from calling directly before writing into file |
| 301 | - $buff = '<?php if(!defined("__XE__"))exit;?>' . $buff; |
|
| 301 | + $buff = '<?php if(!defined("__XE__"))exit;?>'.$buff; |
|
| 302 | 302 | |
| 303 | 303 | // remove php script reopening |
| 304 | 304 | $buff = preg_replace(array('/(\n|\r\n)+/', '/(;)?( )*\?\>\<\?php([\n\t ]+)?/'), array("\n", ";\n"), $buff); |
@@ -321,40 +321,40 @@ discard block |
||
| 321 | 321 | private function _compileFormAuthGeneration($matches) |
| 322 | 322 | { |
| 323 | 323 | // form ruleset attribute move to hidden tag |
| 324 | - if($matches[1]) |
|
| 324 | + if ($matches[1]) |
|
| 325 | 325 | { |
| 326 | 326 | preg_match('/ruleset="([^"]*?)"/is', $matches[1], $m); |
| 327 | - if($m[0]) |
|
| 327 | + if ($m[0]) |
|
| 328 | 328 | { |
| 329 | - $matches[1] = preg_replace('/' . addcslashes($m[0], '?$') . '/i', '', $matches[1]); |
|
| 329 | + $matches[1] = preg_replace('/'.addcslashes($m[0], '?$').'/i', '', $matches[1]); |
|
| 330 | 330 | |
| 331 | - if(strpos($m[1], '@') !== FALSE) |
|
| 331 | + if (strpos($m[1], '@') !== FALSE) |
|
| 332 | 332 | { |
| 333 | 333 | $path = str_replace('@', '', $m[1]); |
| 334 | - $path = './files/ruleset/' . $path . '.xml'; |
|
| 334 | + $path = './files/ruleset/'.$path.'.xml'; |
|
| 335 | 335 | } |
| 336 | - else if(strpos($m[1], '#') !== FALSE) |
|
| 336 | + else if (strpos($m[1], '#') !== FALSE) |
|
| 337 | 337 | { |
| 338 | 338 | $fileName = str_replace('#', '', $m[1]); |
| 339 | 339 | $fileName = str_replace('<?php echo ', '', $fileName); |
| 340 | 340 | $fileName = str_replace(' ?>', '', $fileName); |
| 341 | - $path = '#./files/ruleset/' . $fileName . '.xml'; |
|
| 341 | + $path = '#./files/ruleset/'.$fileName.'.xml'; |
|
| 342 | 342 | |
| 343 | 343 | preg_match('@(?:^|\.?/)(modules/[\w-]+)@', $this->path, $mm); |
| 344 | 344 | $module_path = $mm[1]; |
| 345 | 345 | list($rulsetFile) = explode('.', $fileName); |
| 346 | - $autoPath = $module_path . '/ruleset/' . $rulsetFile . '.xml'; |
|
| 346 | + $autoPath = $module_path.'/ruleset/'.$rulsetFile.'.xml'; |
|
| 347 | 347 | $m[1] = $rulsetFile; |
| 348 | 348 | } |
| 349 | - else if(preg_match('@(?:^|\.?/)(modules/[\w-]+)@', $this->path, $mm)) |
|
| 349 | + else if (preg_match('@(?:^|\.?/)(modules/[\w-]+)@', $this->path, $mm)) |
|
| 350 | 350 | { |
| 351 | 351 | $module_path = $mm[1]; |
| 352 | - $path = $module_path . '/ruleset/' . $m[1] . '.xml'; |
|
| 352 | + $path = $module_path.'/ruleset/'.$m[1].'.xml'; |
|
| 353 | 353 | } |
| 354 | 354 | |
| 355 | - $matches[2] = '<input type="hidden" name="ruleset" value="' . $m[1] . '" />' . $matches[2]; |
|
| 355 | + $matches[2] = '<input type="hidden" name="ruleset" value="'.$m[1].'" />'.$matches[2]; |
|
| 356 | 356 | //assign to addJsFile method for js dynamic recache |
| 357 | - $matches[1] = '<?php Context::addJsFile("' . $path . '", FALSE, "", 0, "body", TRUE, "' . $autoPath . '") ?' . '>' . $matches[1]; |
|
| 357 | + $matches[1] = '<?php Context::addJsFile("'.$path.'", FALSE, "", 0, "body", TRUE, "'.$autoPath.'") ?'.'>'.$matches[1]; |
|
| 358 | 358 | } |
| 359 | 359 | } |
| 360 | 360 | |
@@ -362,22 +362,22 @@ discard block |
||
| 362 | 362 | preg_match_all('/<input[^>]* name="(act|mid|vid)"/is', $matches[2], $m2); |
| 363 | 363 | $checkVar = array('act', 'mid', 'vid'); |
| 364 | 364 | $resultArray = array_diff($checkVar, $m2[1]); |
| 365 | - if(is_array($resultArray)) |
|
| 365 | + if (is_array($resultArray)) |
|
| 366 | 366 | { |
| 367 | 367 | $generatedHidden = ''; |
| 368 | - foreach($resultArray AS $key => $value) |
|
| 368 | + foreach ($resultArray AS $key => $value) |
|
| 369 | 369 | { |
| 370 | - $generatedHidden .= '<input type="hidden" name="' . $value . '" value="<?php echo $__Context->' . $value . ' ?>" />'; |
|
| 370 | + $generatedHidden .= '<input type="hidden" name="'.$value.'" value="<?php echo $__Context->'.$value.' ?>" />'; |
|
| 371 | 371 | } |
| 372 | - $matches[2] = $generatedHidden . $matches[2]; |
|
| 372 | + $matches[2] = $generatedHidden.$matches[2]; |
|
| 373 | 373 | } |
| 374 | 374 | |
| 375 | 375 | // return url generate |
| 376 | - if(!preg_match('/no-error-return-url="true"/i', $matches[1])) |
|
| 376 | + if (!preg_match('/no-error-return-url="true"/i', $matches[1])) |
|
| 377 | 377 | { |
| 378 | 378 | preg_match('/<input[^>]*name="error_return_url"[^>]*>/is', $matches[2], $m3); |
| 379 | - if(!$m3[0]) |
|
| 380 | - $matches[2] = '<input type="hidden" name="error_return_url" value="<?php echo htmlspecialchars(getRequestUriByServerEnviroment(), ENT_COMPAT | ENT_HTML401, \'UTF-8\', false) ?>" />' . $matches[2]; |
|
| 379 | + if (!$m3[0]) |
|
| 380 | + $matches[2] = '<input type="hidden" name="error_return_url" value="<?php echo htmlspecialchars(getRequestUriByServerEnviroment(), ENT_COMPAT | ENT_HTML401, \'UTF-8\', false) ?>" />'.$matches[2]; |
|
| 381 | 381 | } |
| 382 | 382 | else |
| 383 | 383 | { |
@@ -395,7 +395,7 @@ discard block |
||
| 395 | 395 | */ |
| 396 | 396 | private function _fetch($buff) |
| 397 | 397 | { |
| 398 | - if(!$buff) |
|
| 398 | + if (!$buff) |
|
| 399 | 399 | { |
| 400 | 400 | return; |
| 401 | 401 | } |
@@ -403,20 +403,20 @@ discard block |
||
| 403 | 403 | $__Context = &$GLOBALS['__Context__']; |
| 404 | 404 | $__Context->tpl_path = $this->path; |
| 405 | 405 | |
| 406 | - if($_SESSION['is_logged']) |
|
| 406 | + if ($_SESSION['is_logged']) |
|
| 407 | 407 | { |
| 408 | 408 | $__Context->logged_info = Context::get('logged_info'); |
| 409 | 409 | } |
| 410 | 410 | |
| 411 | 411 | $level = ob_get_level(); |
| 412 | 412 | ob_start(); |
| 413 | - if(substr($buff, 0, 7) == 'file://') |
|
| 413 | + if (substr($buff, 0, 7) == 'file://') |
|
| 414 | 414 | { |
| 415 | - if(__DEBUG__) |
|
| 415 | + if (__DEBUG__) |
|
| 416 | 416 | { |
| 417 | 417 | //load cache file from disk |
| 418 | 418 | $eval_str = FileHandler::readFile(substr($buff, 7)); |
| 419 | - $eval_str_buffed = "?>" . $eval_str; |
|
| 419 | + $eval_str_buffed = "?>".$eval_str; |
|
| 420 | 420 | @eval($eval_str_buffed); |
| 421 | 421 | $error_info = error_get_last(); |
| 422 | 422 | //parse error |
@@ -432,7 +432,7 @@ discard block |
||
| 432 | 432 | } |
| 433 | 433 | else |
| 434 | 434 | { |
| 435 | - $eval_str = "?>" . $buff; |
|
| 435 | + $eval_str = "?>".$buff; |
|
| 436 | 436 | @eval($eval_str); |
| 437 | 437 | $error_info = error_get_last(); |
| 438 | 438 | //parse error |
@@ -461,31 +461,31 @@ discard block |
||
| 461 | 461 | private function _replacePath($match) |
| 462 | 462 | { |
| 463 | 463 | //return origin conde when src value started '${'. |
| 464 | - if(preg_match('@^\${@', $match[1])) |
|
| 464 | + if (preg_match('@^\${@', $match[1])) |
|
| 465 | 465 | { |
| 466 | 466 | return $match[0]; |
| 467 | 467 | } |
| 468 | 468 | |
| 469 | 469 | //return origin code when src value include variable. |
| 470 | - if(preg_match('@^[\'|"]\s*\.\s*\$@', $match[1])) |
|
| 470 | + if (preg_match('@^[\'|"]\s*\.\s*\$@', $match[1])) |
|
| 471 | 471 | { |
| 472 | 472 | return $match[0]; |
| 473 | 473 | } |
| 474 | 474 | |
| 475 | 475 | $src = preg_replace('@^(\./)+@', '', trim($match[1])); |
| 476 | 476 | |
| 477 | - $src = $this->web_path . $src; |
|
| 477 | + $src = $this->web_path.$src; |
|
| 478 | 478 | $src = str_replace('/./', '/', $src); |
| 479 | 479 | |
| 480 | 480 | // for backward compatibility |
| 481 | 481 | $src = preg_replace('@/((?:[\w-]+/)+)\1@', '/\1', $src); |
| 482 | 482 | |
| 483 | - while(($tmp = preg_replace('@[^/]+/\.\./@', '', $src, 1)) !== $src) |
|
| 483 | + while (($tmp = preg_replace('@[^/]+/\.\./@', '', $src, 1)) !== $src) |
|
| 484 | 484 | { |
| 485 | 485 | $src = $tmp; |
| 486 | 486 | } |
| 487 | 487 | |
| 488 | - return substr($match[0], 0, -strlen($match[1]) - 6) . "src=\"{$src}\""; |
|
| 488 | + return substr($match[0], 0, -strlen($match[1]) - 6)."src=\"{$src}\""; |
|
| 489 | 489 | } |
| 490 | 490 | |
| 491 | 491 | /** |
@@ -495,19 +495,19 @@ discard block |
||
| 495 | 495 | */ |
| 496 | 496 | private function _parseInline($buff) |
| 497 | 497 | { |
| 498 | - if(!preg_match_all('/<([a-zA-Z]+\d?)(?:\s)/', $buff, $match)) |
|
| 498 | + if (!preg_match_all('/<([a-zA-Z]+\d?)(?:\s)/', $buff, $match)) |
|
| 499 | 499 | { |
| 500 | 500 | return $buff; |
| 501 | 501 | } |
| 502 | 502 | |
| 503 | 503 | $tags = array_diff(array_unique($match[1]), $this->skipTags); |
| 504 | 504 | |
| 505 | - if(!count($tags)) |
|
| 505 | + if (!count($tags)) |
|
| 506 | 506 | { |
| 507 | 507 | return $buff; |
| 508 | 508 | } |
| 509 | 509 | |
| 510 | - $tags = '(?:' . implode('|', $tags) . ')'; |
|
| 510 | + $tags = '(?:'.implode('|', $tags).')'; |
|
| 511 | 511 | $split_regex = "@(<(?>/?{$tags})(?>[^<>\{\}\"']+|<!--.*?-->|{[^}]+}|\".*?\"|'.*?'|.)*?>)@s"; |
| 512 | 512 | |
| 513 | 513 | $nodes = preg_split($split_regex, $buff, -1, PREG_SPLIT_DELIM_CAPTURE); |
@@ -515,14 +515,14 @@ discard block |
||
| 515 | 515 | // list of self closing tags |
| 516 | 516 | $self_closing = array('area' => 1, 'base' => 1, 'basefont' => 1, 'br' => 1, 'hr' => 1, 'input' => 1, 'img' => 1, 'link' => 1, 'meta' => 1, 'param' => 1, 'frame' => 1, 'col' => 1); |
| 517 | 517 | |
| 518 | - for($idx = 1, $node_len = count($nodes); $idx < $node_len; $idx+=2) |
|
| 518 | + for ($idx = 1, $node_len = count($nodes); $idx < $node_len; $idx += 2) |
|
| 519 | 519 | { |
| 520 | - if(!($node = $nodes[$idx])) |
|
| 520 | + if (!($node = $nodes[$idx])) |
|
| 521 | 521 | { |
| 522 | 522 | continue; |
| 523 | 523 | } |
| 524 | 524 | |
| 525 | - if(preg_match_all('@\s(loop|cond)="([^"]+)"@', $node, $matches)) |
|
| 525 | + if (preg_match_all('@\s(loop|cond)="([^"]+)"@', $node, $matches)) |
|
| 526 | 526 | { |
| 527 | 527 | // this tag |
| 528 | 528 | $tag = substr($node, 1, strpos($node, ' ') - 1); |
@@ -531,37 +531,37 @@ discard block |
||
| 531 | 531 | $closing = 0; |
| 532 | 532 | |
| 533 | 533 | // process opening tag |
| 534 | - foreach($matches[1] as $n => $stmt) |
|
| 534 | + foreach ($matches[1] as $n => $stmt) |
|
| 535 | 535 | { |
| 536 | 536 | $expr = $matches[2][$n]; |
| 537 | 537 | $expr = $this->_replaceVar($expr); |
| 538 | 538 | $closing++; |
| 539 | 539 | |
| 540 | - switch($stmt) |
|
| 540 | + switch ($stmt) |
|
| 541 | 541 | { |
| 542 | 542 | case 'cond': |
| 543 | 543 | $nodes[$idx - 1] .= "<?php if({$expr}){ ?>"; |
| 544 | 544 | break; |
| 545 | 545 | case 'loop': |
| 546 | - if(!preg_match('@^(?:(.+?)=>(.+?)(?:,(.+?))?|(.*?;.*?;.*?)|(.+?)\s*=\s*(.+?))$@', $expr, $expr_m)) |
|
| 546 | + if (!preg_match('@^(?:(.+?)=>(.+?)(?:,(.+?))?|(.*?;.*?;.*?)|(.+?)\s*=\s*(.+?))$@', $expr, $expr_m)) |
|
| 547 | 547 | { |
| 548 | 548 | break; |
| 549 | 549 | } |
| 550 | - if($expr_m[1]) |
|
| 550 | + if ($expr_m[1]) |
|
| 551 | 551 | { |
| 552 | 552 | $expr_m[1] = trim($expr_m[1]); |
| 553 | 553 | $expr_m[2] = trim($expr_m[2]); |
| 554 | - if($expr_m[3]) |
|
| 554 | + if ($expr_m[3]) |
|
| 555 | 555 | { |
| 556 | - $expr_m[2] .= '=>' . trim($expr_m[3]); |
|
| 556 | + $expr_m[2] .= '=>'.trim($expr_m[3]); |
|
| 557 | 557 | } |
| 558 | 558 | $nodes[$idx - 1] .= "<?php if({$expr_m[1]}&&count({$expr_m[1]}))foreach({$expr_m[1]} as {$expr_m[2]}){ ?>"; |
| 559 | 559 | } |
| 560 | - elseif($expr_m[4]) |
|
| 560 | + elseif ($expr_m[4]) |
|
| 561 | 561 | { |
| 562 | 562 | $nodes[$idx - 1] .= "<?php for({$expr_m[4]}){ ?>"; |
| 563 | 563 | } |
| 564 | - elseif($expr_m[5]) |
|
| 564 | + elseif ($expr_m[5]) |
|
| 565 | 565 | { |
| 566 | 566 | $nodes[$idx - 1] .= "<?php while({$expr_m[5]}={$expr_m[6]}){ ?>"; |
| 567 | 567 | } |
@@ -571,28 +571,28 @@ discard block |
||
| 571 | 571 | $node = preg_replace('@\s(loop|cond)="([^"]+)"@', '', $node); |
| 572 | 572 | |
| 573 | 573 | // find closing tag |
| 574 | - $close_php = '<?php ' . str_repeat('}', $closing) . ' ?>'; |
|
| 574 | + $close_php = '<?php '.str_repeat('}', $closing).' ?>'; |
|
| 575 | 575 | // self closing tag |
| 576 | - if($node{1} == '!' || substr($node, -2, 1) == '/' || isset($self_closing[$tag])) |
|
| 576 | + if ($node{1} == '!' || substr($node, -2, 1) == '/' || isset($self_closing[$tag])) |
|
| 577 | 577 | { |
| 578 | - $nodes[$idx + 1] = $close_php . $nodes[$idx + 1]; |
|
| 578 | + $nodes[$idx + 1] = $close_php.$nodes[$idx + 1]; |
|
| 579 | 579 | } |
| 580 | 580 | else |
| 581 | 581 | { |
| 582 | 582 | $depth = 1; |
| 583 | - for($i = $idx + 2; $i < $node_len; $i+=2) |
|
| 583 | + for ($i = $idx + 2; $i < $node_len; $i += 2) |
|
| 584 | 584 | { |
| 585 | 585 | $nd = $nodes[$i]; |
| 586 | - if(strpos($nd, $tag) === 1) |
|
| 586 | + if (strpos($nd, $tag) === 1) |
|
| 587 | 587 | { |
| 588 | 588 | $depth++; |
| 589 | 589 | } |
| 590 | - elseif(strpos($nd, '/' . $tag) === 1) |
|
| 590 | + elseif (strpos($nd, '/'.$tag) === 1) |
|
| 591 | 591 | { |
| 592 | 592 | $depth--; |
| 593 | - if(!$depth) |
|
| 593 | + if (!$depth) |
|
| 594 | 594 | { |
| 595 | - $nodes[$i - 1] .= $nodes[$i] . $close_php; |
|
| 595 | + $nodes[$i - 1] .= $nodes[$i].$close_php; |
|
| 596 | 596 | $nodes[$i] = ''; |
| 597 | 597 | break; |
| 598 | 598 | } |
@@ -601,13 +601,13 @@ discard block |
||
| 601 | 601 | } |
| 602 | 602 | } |
| 603 | 603 | |
| 604 | - if(strpos($node, '|cond="') !== false) |
|
| 604 | + if (strpos($node, '|cond="') !== false) |
|
| 605 | 605 | { |
| 606 | 606 | $node = preg_replace('@(\s[-\w:]+(?:="[^"]+?")?)\|cond="(.+?)"@s', '<?php if($2){ ?>$1<?php } ?>', $node); |
| 607 | 607 | $node = $this->_replaceVar($node); |
| 608 | 608 | } |
| 609 | 609 | |
| 610 | - if($nodes[$idx] != $node) |
|
| 610 | + if ($nodes[$idx] != $node) |
|
| 611 | 611 | { |
| 612 | 612 | $nodes[$idx] = $node; |
| 613 | 613 | } |
@@ -628,7 +628,7 @@ discard block |
||
| 628 | 628 | { |
| 629 | 629 | $escape_option = 'noescape'; |
| 630 | 630 | |
| 631 | - if($this->autoescape) |
|
| 631 | + if ($this->autoescape) |
|
| 632 | 632 | { |
| 633 | 633 | $escape_option = 'autoescape'; |
| 634 | 634 | } |
@@ -639,14 +639,14 @@ discard block |
||
| 639 | 639 | } |
| 640 | 640 | |
| 641 | 641 | // {@ ... } or {$var} or {func(...)} |
| 642 | - if($m[1]) |
|
| 642 | + if ($m[1]) |
|
| 643 | 643 | { |
| 644 | - if(preg_match('@^(\w+)\(@', $m[1], $mm) && !function_exists($mm[1])) |
|
| 644 | + if (preg_match('@^(\w+)\(@', $m[1], $mm) && !function_exists($mm[1])) |
|
| 645 | 645 | { |
| 646 | 646 | return $m[0]; |
| 647 | 647 | } |
| 648 | 648 | |
| 649 | - if($m[1]{0} == '@') |
|
| 649 | + if ($m[1]{0} == '@') |
|
| 650 | 650 | { |
| 651 | 651 | $m[1] = $this->_replaceVar(substr($m[1], 1)); |
| 652 | 652 | return "<?php {$m[1]} ?>"; |
@@ -656,7 +656,7 @@ discard block |
||
| 656 | 656 | // Get escape options. |
| 657 | 657 | foreach ($this->ignoreEscape as $key => $value) |
| 658 | 658 | { |
| 659 | - if($this->ignoreEscape[$key]($m)) |
|
| 659 | + if ($this->ignoreEscape[$key]($m)) |
|
| 660 | 660 | { |
| 661 | 661 | $escape_option = 'noescape'; |
| 662 | 662 | break; |
@@ -687,7 +687,7 @@ discard block |
||
| 687 | 687 | $filter_option = $matches[2]; |
| 688 | 688 | if (!self::_isVar($filter_option) && !preg_match("/^'.*'$/", $filter_option) && !preg_match('/^".*"$/', $filter_option)) |
| 689 | 689 | { |
| 690 | - $filter_option = "'" . escape_sqstr($filter_option) . "'"; |
|
| 690 | + $filter_option = "'".escape_sqstr($filter_option)."'"; |
|
| 691 | 691 | } |
| 692 | 692 | else |
| 693 | 693 | { |
@@ -784,18 +784,18 @@ discard block |
||
| 784 | 784 | } |
| 785 | 785 | |
| 786 | 786 | // Apply the escape option and return. |
| 787 | - return '<?php echo ' . $this->_applyEscapeOption($var, $escape_option) . ' ?>'; |
|
| 787 | + return '<?php echo '.$this->_applyEscapeOption($var, $escape_option).' ?>'; |
|
| 788 | 788 | } |
| 789 | 789 | } |
| 790 | 790 | |
| 791 | - if($m[3]) |
|
| 791 | + if ($m[3]) |
|
| 792 | 792 | { |
| 793 | 793 | $attr = array(); |
| 794 | - if($m[5]) |
|
| 794 | + if ($m[5]) |
|
| 795 | 795 | { |
| 796 | - if(preg_match_all('@,(\w+)="([^"]+)"@', $m[6], $mm)) |
|
| 796 | + if (preg_match_all('@,(\w+)="([^"]+)"@', $m[6], $mm)) |
|
| 797 | 797 | { |
| 798 | - foreach($mm[1] as $idx => $name) |
|
| 798 | + foreach ($mm[1] as $idx => $name) |
|
| 799 | 799 | { |
| 800 | 800 | $attr[$name] = $mm[2][$idx]; |
| 801 | 801 | } |
@@ -804,21 +804,21 @@ discard block |
||
| 804 | 804 | } |
| 805 | 805 | else |
| 806 | 806 | { |
| 807 | - if(!preg_match_all('@ (\w+)="([^"]+)"@', $m[6], $mm)) |
|
| 807 | + if (!preg_match_all('@ (\w+)="([^"]+)"@', $m[6], $mm)) |
|
| 808 | 808 | { |
| 809 | 809 | return $m[0]; |
| 810 | 810 | } |
| 811 | - foreach($mm[1] as $idx => $name) |
|
| 811 | + foreach ($mm[1] as $idx => $name) |
|
| 812 | 812 | { |
| 813 | 813 | $attr[$name] = $mm[2][$idx]; |
| 814 | 814 | } |
| 815 | 815 | } |
| 816 | 816 | |
| 817 | - switch($m[3]) |
|
| 817 | + switch ($m[3]) |
|
| 818 | 818 | { |
| 819 | 819 | // <!--#include--> or <include ..> |
| 820 | 820 | case 'include': |
| 821 | - if(!$this->file || !$attr['target']) |
|
| 821 | + if (!$this->file || !$attr['target']) |
|
| 822 | 822 | { |
| 823 | 823 | return ''; |
| 824 | 824 | } |
@@ -826,7 +826,7 @@ discard block |
||
| 826 | 826 | $pathinfo = pathinfo($attr['target']); |
| 827 | 827 | $fileDir = $this->_getRelativeDir($pathinfo['dirname']); |
| 828 | 828 | |
| 829 | - if(!$fileDir) |
|
| 829 | + if (!$fileDir) |
|
| 830 | 830 | { |
| 831 | 831 | return ''; |
| 832 | 832 | } |
@@ -836,7 +836,7 @@ discard block |
||
| 836 | 836 | case 'load_js_plugin': |
| 837 | 837 | $plugin = $this->_replaceVar($m[5]); |
| 838 | 838 | $s = "<!--#JSPLUGIN:{$plugin}-->"; |
| 839 | - if(strpos($plugin, '$__Context') === false) |
|
| 839 | + if (strpos($plugin, '$__Context') === false) |
|
| 840 | 840 | { |
| 841 | 841 | $plugin = "'{$plugin}'"; |
| 842 | 842 | } |
@@ -852,13 +852,13 @@ discard block |
||
| 852 | 852 | $doUnload = ($m[3] === 'unload'); |
| 853 | 853 | $isRemote = !!preg_match('@^(https?:)?//@i', $attr['target']); |
| 854 | 854 | |
| 855 | - if(!$isRemote) |
|
| 855 | + if (!$isRemote) |
|
| 856 | 856 | { |
| 857 | - if(!preg_match('@^\.?/@', $attr['target'])) |
|
| 857 | + if (!preg_match('@^\.?/@', $attr['target'])) |
|
| 858 | 858 | { |
| 859 | - $attr['target'] = './' . $attr['target']; |
|
| 859 | + $attr['target'] = './'.$attr['target']; |
|
| 860 | 860 | } |
| 861 | - if(substr($attr['target'], -5) == '/lang') |
|
| 861 | + if (substr($attr['target'], -5) == '/lang') |
|
| 862 | 862 | { |
| 863 | 863 | $pathinfo['dirname'] .= '/lang'; |
| 864 | 864 | $pathinfo['basename'] = ''; |
@@ -867,18 +867,18 @@ discard block |
||
| 867 | 867 | |
| 868 | 868 | $relativeDir = $this->_getRelativeDir($pathinfo['dirname']); |
| 869 | 869 | |
| 870 | - $attr['target'] = $relativeDir . '/' . $pathinfo['basename']; |
|
| 870 | + $attr['target'] = $relativeDir.'/'.$pathinfo['basename']; |
|
| 871 | 871 | } |
| 872 | 872 | |
| 873 | - switch($pathinfo['extension']) |
|
| 873 | + switch ($pathinfo['extension']) |
|
| 874 | 874 | { |
| 875 | 875 | case 'xml': |
| 876 | - if($isRemote || $doUnload) |
|
| 876 | + if ($isRemote || $doUnload) |
|
| 877 | 877 | { |
| 878 | 878 | return ''; |
| 879 | 879 | } |
| 880 | 880 | // language file? |
| 881 | - if($pathinfo['basename'] == 'lang.xml' || substr($pathinfo['dirname'], -5) == '/lang') |
|
| 881 | + if ($pathinfo['basename'] == 'lang.xml' || substr($pathinfo['dirname'], -5) == '/lang') |
|
| 882 | 882 | { |
| 883 | 883 | $result = "Context::loadLang('{$relativeDir}');"; |
| 884 | 884 | } |
@@ -888,7 +888,7 @@ discard block |
||
| 888 | 888 | } |
| 889 | 889 | break; |
| 890 | 890 | case 'js': |
| 891 | - if($doUnload) |
|
| 891 | + if ($doUnload) |
|
| 892 | 892 | { |
| 893 | 893 | $result = "Context::unloadFile('{$attr['target']}','{$attr['targetie']}');"; |
| 894 | 894 | } |
@@ -899,7 +899,7 @@ discard block |
||
| 899 | 899 | } |
| 900 | 900 | break; |
| 901 | 901 | case 'css': |
| 902 | - if($doUnload) |
|
| 902 | + if ($doUnload) |
|
| 903 | 903 | { |
| 904 | 904 | $result = "Context::unloadFile('{$attr['target']}','{$attr['targetie']}','{$attr['media']}');"; |
| 905 | 905 | } |
@@ -912,20 +912,20 @@ discard block |
||
| 912 | 912 | } |
| 913 | 913 | |
| 914 | 914 | $result = "<?php {$result} ?>"; |
| 915 | - if($metafile) |
|
| 915 | + if ($metafile) |
|
| 916 | 916 | { |
| 917 | - $result = "<!--#Meta:{$metafile}-->" . $result; |
|
| 917 | + $result = "<!--#Meta:{$metafile}-->".$result; |
|
| 918 | 918 | } |
| 919 | 919 | |
| 920 | 920 | return $result; |
| 921 | 921 | // <config ...> |
| 922 | 922 | case 'config': |
| 923 | 923 | $result = ''; |
| 924 | - if(preg_match_all('@ (\w+)="([^"]+)"@', $m[6], $config_matches, PREG_SET_ORDER)) |
|
| 924 | + if (preg_match_all('@ (\w+)="([^"]+)"@', $m[6], $config_matches, PREG_SET_ORDER)) |
|
| 925 | 925 | { |
| 926 | - foreach($config_matches as $config_match) |
|
| 926 | + foreach ($config_matches as $config_match) |
|
| 927 | 927 | { |
| 928 | - $result .= "\$this->config->{$config_match[1]} = '" . trim(strtolower($config_match[2])) . "';"; |
|
| 928 | + $result .= "\$this->config->{$config_match[1]} = '".trim(strtolower($config_match[2]))."';"; |
|
| 929 | 929 | } |
| 930 | 930 | } |
| 931 | 931 | return "<?php {$result} ?>"; |
@@ -933,45 +933,45 @@ discard block |
||
| 933 | 933 | } |
| 934 | 934 | |
| 935 | 935 | // <[email protected]> such as <!--@if($cond)-->, <!--@else-->, <!--@end--> |
| 936 | - if($m[7]) |
|
| 936 | + if ($m[7]) |
|
| 937 | 937 | { |
| 938 | 938 | $m[7] = substr($m[7], 1); |
| 939 | - if(!$m[7]) |
|
| 939 | + if (!$m[7]) |
|
| 940 | 940 | { |
| 941 | - return '<?php ' . $this->_replaceVar($m[8]) . '{ ?>' . $m[9]; |
|
| 941 | + return '<?php '.$this->_replaceVar($m[8]).'{ ?>'.$m[9]; |
|
| 942 | 942 | } |
| 943 | - if(!preg_match('/^(?:((?:end)?(?:if|switch|for(?:each)?|while)|end)|(else(?:if)?)|(break@)?(case|default)|(break))$/', $m[7], $mm)) |
|
| 943 | + if (!preg_match('/^(?:((?:end)?(?:if|switch|for(?:each)?|while)|end)|(else(?:if)?)|(break@)?(case|default)|(break))$/', $m[7], $mm)) |
|
| 944 | 944 | { |
| 945 | 945 | return ''; |
| 946 | 946 | } |
| 947 | - if($mm[1]) |
|
| 947 | + if ($mm[1]) |
|
| 948 | 948 | { |
| 949 | - if($mm[1]{0} == 'e') |
|
| 949 | + if ($mm[1]{0} == 'e') |
|
| 950 | 950 | { |
| 951 | - return '<?php } ?>' . $m[9]; |
|
| 951 | + return '<?php } ?>'.$m[9]; |
|
| 952 | 952 | } |
| 953 | 953 | |
| 954 | 954 | $precheck = ''; |
| 955 | - if($mm[1] == 'switch') |
|
| 955 | + if ($mm[1] == 'switch') |
|
| 956 | 956 | { |
| 957 | 957 | $m[9] = ''; |
| 958 | 958 | } |
| 959 | - elseif($mm[1] == 'foreach') |
|
| 959 | + elseif ($mm[1] == 'foreach') |
|
| 960 | 960 | { |
| 961 | 961 | $var = preg_replace('/^\s*\(\s*(.+?) .*$/', '$1', $m[8]); |
| 962 | 962 | $precheck = "if({$var}&&count({$var}))"; |
| 963 | 963 | } |
| 964 | - return '<?php ' . $this->_replaceVar($precheck . $m[7] . $m[8]) . '{ ?>' . $m[9]; |
|
| 964 | + return '<?php '.$this->_replaceVar($precheck.$m[7].$m[8]).'{ ?>'.$m[9]; |
|
| 965 | 965 | } |
| 966 | - if($mm[2]) |
|
| 966 | + if ($mm[2]) |
|
| 967 | 967 | { |
| 968 | - return "<?php }{$m[7]}" . $this->_replaceVar($m[8]) . "{ ?>" . $m[9]; |
|
| 968 | + return "<?php }{$m[7]}".$this->_replaceVar($m[8])."{ ?>".$m[9]; |
|
| 969 | 969 | } |
| 970 | - if($mm[4]) |
|
| 970 | + if ($mm[4]) |
|
| 971 | 971 | { |
| 972 | - return "<?php " . ($mm[3] ? 'break;' : '') . "{$m[7]} " . trim($m[8], '()') . ": ?>" . $m[9]; |
|
| 972 | + return "<?php ".($mm[3] ? 'break;' : '')."{$m[7]} ".trim($m[8], '()').": ?>".$m[9]; |
|
| 973 | 973 | } |
| 974 | - if($mm[5]) |
|
| 974 | + if ($mm[5]) |
|
| 975 | 975 | { |
| 976 | 976 | return "<?php break; ?>"; |
| 977 | 977 | } |
@@ -985,7 +985,7 @@ discard block |
||
| 985 | 985 | */ |
| 986 | 986 | private function _applyEscapeOption($str, $escape_option = 'noescape') |
| 987 | 987 | { |
| 988 | - switch($escape_option) |
|
| 988 | + switch ($escape_option) |
|
| 989 | 989 | { |
| 990 | 990 | case 'escape': |
| 991 | 991 | return "escape({$str}, true)"; |
@@ -1009,30 +1009,30 @@ discard block |
||
| 1009 | 1009 | $_path = $path; |
| 1010 | 1010 | |
| 1011 | 1011 | $fileDir = strtr(realpath($this->path), '\\', '/'); |
| 1012 | - if($path{0} != '/') |
|
| 1012 | + if ($path{0} != '/') |
|
| 1013 | 1013 | { |
| 1014 | - $path = strtr(realpath($fileDir . '/' . $path), '\\', '/'); |
|
| 1014 | + $path = strtr(realpath($fileDir.'/'.$path), '\\', '/'); |
|
| 1015 | 1015 | } |
| 1016 | 1016 | |
| 1017 | 1017 | // for backward compatibility |
| 1018 | - if(!$path) |
|
| 1018 | + if (!$path) |
|
| 1019 | 1019 | { |
| 1020 | 1020 | $dirs = explode('/', $fileDir); |
| 1021 | 1021 | $paths = explode('/', $_path); |
| 1022 | 1022 | $idx = array_search($paths[0], $dirs); |
| 1023 | 1023 | |
| 1024 | - if($idx !== false) |
|
| 1024 | + if ($idx !== false) |
|
| 1025 | 1025 | { |
| 1026 | - while($dirs[$idx] && $dirs[$idx] === $paths[0]) |
|
| 1026 | + while ($dirs[$idx] && $dirs[$idx] === $paths[0]) |
|
| 1027 | 1027 | { |
| 1028 | 1028 | array_splice($dirs, $idx, 1); |
| 1029 | 1029 | array_shift($paths); |
| 1030 | 1030 | } |
| 1031 | - $path = strtr(realpath($fileDir . '/' . implode('/', $paths)), '\\', '/'); |
|
| 1031 | + $path = strtr(realpath($fileDir.'/'.implode('/', $paths)), '\\', '/'); |
|
| 1032 | 1032 | } |
| 1033 | 1033 | } |
| 1034 | 1034 | |
| 1035 | - $path = preg_replace('/^' . preg_quote(_XE_PATH_, '/') . '/', '', $path); |
|
| 1035 | + $path = preg_replace('/^'.preg_quote(_XE_PATH_, '/').'/', '', $path); |
|
| 1036 | 1036 | |
| 1037 | 1037 | return $path; |
| 1038 | 1038 | } |
@@ -1055,7 +1055,7 @@ discard block |
||
| 1055 | 1055 | */ |
| 1056 | 1056 | function _replaceVar($php) |
| 1057 | 1057 | { |
| 1058 | - if(!strlen($php)) |
|
| 1058 | + if (!strlen($php)) |
|
| 1059 | 1059 | { |
| 1060 | 1060 | return ''; |
| 1061 | 1061 | } |
@@ -1069,13 +1069,13 @@ discard block |
||
| 1069 | 1069 | $dirSkins = '(layouts\/default|layouts\/user_layout|layouts\/xedition|layouts\/xedition\/demo|m\.layouts\/colorCode|m\.layouts\/default|m\.layouts\/simpleGray|modules\/board\/m\.skins\/default|modules\/board\/m\.skins\/simpleGray|modules\/board\/skins\/default|modules\/board\/skins\/xedition|modules\/communication\/m\.skins\/default|modules\/communication\/skins\/default|modules\/editor\/skins\/ckeditor|modules\/editor\/skins\/xpresseditor|modules\/integration_search\/skins\/default|modules\/layout\/faceoff|modules\/member\/m\.skins\/default|modules\/member\/skins\/default|modules\/message\/m\.skins\/default|modules\/message\/skins\/default|modules\/message\/skins\/xedition|modules\/page\/m\.skins\/default|modules\/page\/skins\/default|modules\/poll\/skins\/default|modules\/poll\/skins\/simple|widgets\/content\/skins\/default|widgets\/counter_status\/skins\/default|widgets\/language_select\/skins\/default|widgets\/login_info\/skins\/default|widgets\/mcontent\/skins\/default|widgetstyles\/simple)'; |
| 1070 | 1070 | |
| 1071 | 1071 | // 'tpl' |
| 1072 | - if(preg_match('/^(\.\/)?(modules\/' . $dirTpl . '|common)\/tpl\//', $absPath)) |
|
| 1072 | + if (preg_match('/^(\.\/)?(modules\/'.$dirTpl.'|common)\/tpl\//', $absPath)) |
|
| 1073 | 1073 | { |
| 1074 | 1074 | return true; |
| 1075 | 1075 | } |
| 1076 | 1076 | |
| 1077 | 1077 | // skin, layout |
| 1078 | - if(preg_match('/^(\.\/)?\(' . $dirSkin . '\//', $absPath)) |
|
| 1078 | + if (preg_match('/^(\.\/)?\('.$dirSkin.'\//', $absPath)) |
|
| 1079 | 1079 | { |
| 1080 | 1080 | return true; |
| 1081 | 1081 | } |