GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — develop (#2241)
by
unknown
11:07
created
modules/editor/editor.controller.php 2 patches
Spacing   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -47,28 +47,28 @@  discard block
 block discarded – undo
47 47
 	{
48 48
 		$component = Context::get('component');
49 49
 		$method = Context::get('method');
50
-		if(!$component) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
50
+		if (!$component) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
51 51
 
52 52
 		$oEditorModel = getModel('editor');
53 53
 		$oComponent = &$oEditorModel->getComponentObject($component);
54
-		if(!$oComponent->toBool()) return $oComponent;
54
+		if (!$oComponent->toBool()) return $oComponent;
55 55
 
56
-		if(!method_exists($oComponent, $method)) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
56
+		if (!method_exists($oComponent, $method)) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
57 57
 
58 58
 		//$output = call_user_method($method, $oComponent);
59 59
 		//$output = call_user_func(array($oComponent, $method));
60
-		if(method_exists($oComponent, $method)) $output = $oComponent->{$method}();
61
-		else return new BaseObject(-1,sprintf('%s method is not exists', $method));
60
+		if (method_exists($oComponent, $method)) $output = $oComponent->{$method}();
61
+		else return new BaseObject(-1, sprintf('%s method is not exists', $method));
62 62
 
63
-		if((is_a($output, 'BaseObject') || is_subclass_of($output, 'BaseObject')) && !$output->toBool()) return $output;
63
+		if ((is_a($output, 'BaseObject') || is_subclass_of($output, 'BaseObject')) && !$output->toBool()) return $output;
64 64
 
65 65
 		$this->setError($oComponent->getError());
66 66
 		$this->setMessage($oComponent->getMessage());
67 67
 
68 68
 		$vars = $oComponent->getVariables();
69
-		if(count($vars))
69
+		if (count($vars))
70 70
 		{
71
-			foreach($vars as $key => $val)
71
+			foreach ($vars as $key => $val)
72 72
 			{
73 73
 				$this->add($key, $val);
74 74
 			}
@@ -86,18 +86,18 @@  discard block
 block discarded – undo
86 86
 		$module_srl = array();
87 87
 		$oModuleModel = getModel('module');
88 88
 
89
-		foreach($target_module_srl as $srl)
89
+		foreach ($target_module_srl as $srl)
90 90
 		{
91
-			if(!$srl) continue;
91
+			if (!$srl) continue;
92 92
 
93 93
 			$module_info = $oModuleModel->getModuleInfoByModuleSrl($srl);
94
-			if(!$module_info->module_srl)
94
+			if (!$module_info->module_srl)
95 95
 			{
96 96
 				return new BaseObject(-1, 'msg_invalid_request');
97 97
 			}
98 98
 
99 99
 			$module_grant = $oModuleModel->getGrant($module_info, $logged_info);
100
-			if(!$module_grant->manager)
100
+			if (!$module_grant->manager)
101 101
 			{
102 102
 				return new BaseObject(-1, 'msg_not_permitted');
103 103
 			}
@@ -111,32 +111,32 @@  discard block
 block discarded – undo
111 111
 		$editor_config->content_style = Context::get('content_style');
112 112
 		$editor_config->comment_content_style = Context::get('comment_content_style');
113 113
 		$editor_config->content_font = Context::get('content_font');
114
-		if($editor_config->content_font)
114
+		if ($editor_config->content_font)
115 115
 		{
116 116
 			$font_list = array();
117
-			$fonts = explode(',',$editor_config->content_font);
118
-			for($i=0,$c=count($fonts);$i<$c;$i++)
117
+			$fonts = explode(',', $editor_config->content_font);
118
+			for ($i = 0, $c = count($fonts); $i < $c; $i++)
119 119
 			{
120
-				$font = trim(str_replace(array('"','\''),'',$fonts[$i]));
121
-				if(!$font) continue;
120
+				$font = trim(str_replace(array('"', '\''), '', $fonts[$i]));
121
+				if (!$font) continue;
122 122
 				$font_list[] = $font;
123 123
 			}
124
-			if(count($font_list)) $editor_config->content_font = '"'.implode('","',$font_list).'"';
124
+			if (count($font_list)) $editor_config->content_font = '"'.implode('","', $font_list).'"';
125 125
 		}
126 126
 		$editor_config->content_font_size = Context::get('content_font_size');
127 127
 		$editor_config->sel_editor_colorset = Context::get('sel_editor_colorset');
128 128
 		$editor_config->sel_comment_editor_colorset = Context::get('sel_comment_editor_colorset');
129 129
 
130
-		$grants = array('enable_html_grant','enable_comment_html_grant','upload_file_grant','comment_upload_file_grant','enable_default_component_grant','enable_comment_default_component_grant','enable_component_grant','enable_comment_component_grant');
130
+		$grants = array('enable_html_grant', 'enable_comment_html_grant', 'upload_file_grant', 'comment_upload_file_grant', 'enable_default_component_grant', 'enable_comment_default_component_grant', 'enable_component_grant', 'enable_comment_component_grant');
131 131
 
132
-		foreach($grants as $key)
132
+		foreach ($grants as $key)
133 133
 		{
134 134
 			$grant = Context::get($key);
135
-			if(!$grant)
135
+			if (!$grant)
136 136
 			{
137 137
 				$editor_config->{$key} = array();
138 138
 			}
139
-			else if(is_array($grant))
139
+			else if (is_array($grant))
140 140
 			{
141 141
 				$editor_config->{$key} = $grant;
142 142
 			}
@@ -146,13 +146,13 @@  discard block
 block discarded – undo
146 146
 			}
147 147
 		}
148 148
 
149
-		$editor_config->editor_height = (int)Context::get('editor_height');
150
-		$editor_config->comment_editor_height = (int)Context::get('comment_editor_height');
149
+		$editor_config->editor_height = (int) Context::get('editor_height');
150
+		$editor_config->comment_editor_height = (int) Context::get('comment_editor_height');
151 151
 		$editor_config->enable_autosave = Context::get('enable_autosave');
152
-		if($editor_config->enable_autosave != 'Y') $editor_config->enable_autosave = 'N';
152
+		if ($editor_config->enable_autosave != 'Y') $editor_config->enable_autosave = 'N';
153 153
 
154 154
 		$oModuleController = getController('module');
155
-		foreach($module_srl as $srl)
155
+		foreach ($module_srl as $srl)
156 156
 		{
157 157
 			$oModuleController->insertModulePartConfig('editor', $srl, $editor_config);
158 158
 		}
@@ -169,31 +169,31 @@  discard block
 block discarded – undo
169 169
 	 */
170 170
 	function triggerEditorComponentCompile(&$content)
171 171
 	{
172
-		if(Context::getResponseMethod()!='HTML') return new BaseObject();
172
+		if (Context::getResponseMethod() != 'HTML') return new BaseObject();
173 173
 
174 174
 		$module_info = Context::get('module_info');
175 175
 		$module_srl = $module_info->module_srl;
176
-		if($module_srl)
176
+		if ($module_srl)
177 177
 		{
178 178
 			$oEditorModel = getModel('editor');
179 179
 			$editor_config = $oEditorModel->getEditorConfig($module_srl);
180 180
 			$content_style = $editor_config->content_style;
181
-			if($content_style)
181
+			if ($content_style)
182 182
 			{
183
-				$path = _XE_PATH_ . 'modules/editor/styles/'.$content_style.'/';
184
-				if(is_dir($path) && file_exists($path . 'style.ini'))
183
+				$path = _XE_PATH_.'modules/editor/styles/'.$content_style.'/';
184
+				if (is_dir($path) && file_exists($path.'style.ini'))
185 185
 				{
186 186
 					$ini = file($path.'style.ini');
187
-					for($i = 0, $c = count($ini); $i < $c; $i++)
187
+					for ($i = 0, $c = count($ini); $i < $c; $i++)
188 188
 					{
189 189
 						$file = trim($ini[$i]);
190
-						if(!$file) continue;
190
+						if (!$file) continue;
191 191
 
192
-						if(substr_compare($file, '.css', -4) === 0)
192
+						if (substr_compare($file, '.css', -4) === 0)
193 193
 						{
194 194
 							Context::addCSSFile('./modules/editor/styles/'.$content_style.'/'.$file, false);
195 195
 						}
196
-						elseif(substr_compare($file, '.js', -3) === 0)
196
+						elseif (substr_compare($file, '.js', -3) === 0)
197 197
 						{
198 198
 							Context::addJsFile('./modules/editor/styles/'.$content_style.'/'.$file, false);
199 199
 						}
@@ -202,12 +202,12 @@  discard block
 block discarded – undo
202 202
 			}
203 203
 			$content_font = $editor_config->content_font;
204 204
 			$content_font_size = $editor_config->content_font_size;
205
-			if($content_font || $content_font_size)
205
+			if ($content_font || $content_font_size)
206 206
 			{
207 207
 				$buff = array();
208 208
 				$buff[] = '<style> .xe_content { ';
209
-				if($content_font) $buff[] = 'font-family:'.$content_font.';';
210
-				if($content_font_size) $buff[] = 'font-size:'.$content_font_size.';';
209
+				if ($content_font) $buff[] = 'font-family:'.$content_font.';';
210
+				if ($content_font_size) $buff[] = 'font-size:'.$content_font_size.';';
211 211
 				$buff[] = ' }</style>';
212 212
 				Context::addHtmlHeader(implode('', $buff));
213 213
 			}
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 	 */
223 223
 	function transComponent($content)
224 224
 	{
225
-		$content = preg_replace_callback('!<(?:(div)|img)([^>]*)editor_component=([^>]*)>(?(1)(.*?)</div>)!is', array($this,'transEditorComponent'), $content);
225
+		$content = preg_replace_callback('!<(?:(div)|img)([^>]*)editor_component=([^>]*)>(?(1)(.*?)</div>)!is', array($this, 'transEditorComponent'), $content);
226 226
 		return $content;
227 227
 	}
228 228
 
@@ -237,19 +237,19 @@  discard block
 block discarded – undo
237 237
 
238 238
 		$xml_obj = new stdClass;
239 239
 		$xml_obj->attrs = new stdClass;
240
-		for($i=0,$c=count($m[0]);$i<$c;$i++)
240
+		for ($i = 0, $c = count($m[0]); $i < $c; $i++)
241 241
 		{
242
-			if(!isset($xml_obj->attrs)) $xml_obj->attrs = new stdClass;
242
+			if (!isset($xml_obj->attrs)) $xml_obj->attrs = new stdClass;
243 243
 			$xml_obj->attrs->{$m[1][$i]} = $m[2][$i];
244 244
 		}
245 245
 		$xml_obj->body = $match[4];
246 246
 
247
-		if(!$xml_obj->attrs->editor_component) return $match[0];
247
+		if (!$xml_obj->attrs->editor_component) return $match[0];
248 248
 
249 249
 		// Get converted codes by using component::transHTML()
250 250
 		$oEditorModel = getModel('editor');
251 251
 		$oComponent = &$oEditorModel->getComponentObject($xml_obj->attrs->editor_component, 0);
252
-		if(!is_object($oComponent)||!method_exists($oComponent, 'transHTML')) return $match[0];
252
+		if (!is_object($oComponent) || !method_exists($oComponent, 'transHTML')) return $match[0];
253 253
 
254 254
 		return $oComponent->transHTML($xml_obj);
255 255
 	}
@@ -259,26 +259,26 @@  discard block
 block discarded – undo
259 259
 	 */
260 260
 	function doSaveDoc($args)
261 261
 	{
262
-		if(!$args->document_srl) $args->document_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl;
262
+		if (!$args->document_srl) $args->document_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl;
263 263
 
264 264
 		// Get the current module if module_srl doesn't exist
265
-		if(!$args->module_srl) $args->module_srl = Context::get('module_srl');
266
-		if(!$args->module_srl)
265
+		if (!$args->module_srl) $args->module_srl = Context::get('module_srl');
266
+		if (!$args->module_srl)
267 267
 		{
268 268
 			$current_module_info = Context::get('current_module_info');
269 269
 			$args->module_srl = $current_module_info->module_srl;
270 270
 		}
271 271
 
272
-		if(Context::get('is_logged'))
272
+		if (Context::get('is_logged'))
273 273
 		{
274 274
 			$logged_info = Context::get('logged_info');
275 275
 			$args->member_srl = $logged_info->member_srl;
276 276
 		}
277 277
 		else
278 278
 		{
279
-			$args->certify_key = $_COOKIE['autosave_certify_key_' . $args->module_srl];
280
-			if(!$args->certify_key) $args->certify_key = Password::createSecureSalt(40);
281
-			setcookie('autosave_certify_key_' . $args->module_srl, $args->certify_key, $_SERVER['REQUEST_TIME'] + 3600, '', '', false, true);
279
+			$args->certify_key = $_COOKIE['autosave_certify_key_'.$args->module_srl];
280
+			if (!$args->certify_key) $args->certify_key = Password::createSecureSalt(40);
281
+			setcookie('autosave_certify_key_'.$args->module_srl, $args->certify_key, $_SERVER['REQUEST_TIME'] + 3600, '', '', false, true);
282 282
 		}
283 283
 
284 284
 		return executeQuery('editor.insertSavedDoc', $args);
@@ -324,22 +324,22 @@  discard block
 block discarded – undo
324 324
 		$args->module_srl = Context::get('module_srl');
325 325
 
326 326
 		// Get the current module if module_srl doesn't exist
327
-		if(!$args->module_srl)
327
+		if (!$args->module_srl)
328 328
 		{
329 329
 			$current_module_info = Context::get('current_module_info');
330 330
 			$args->module_srl = $current_module_info->module_srl;
331 331
 		}
332
-		if(Context::get('is_logged'))
332
+		if (Context::get('is_logged'))
333 333
 		{
334 334
 			$logged_info = Context::get('logged_info');
335 335
 			$args->member_srl = $logged_info->member_srl;
336 336
 		}
337 337
 		else
338 338
 		{
339
-			$args->certify_key = $_COOKIE['autosave_certify_key_' . $args->module_srl];
339
+			$args->certify_key = $_COOKIE['autosave_certify_key_'.$args->module_srl];
340 340
 			// @see https://github.com/xpressengine/xe-core/issues/2208
341 341
 			// 변경 이전에 작성된 게시물 호환성 유지
342
-			if(!$args->certify_key) {
342
+			if (!$args->certify_key) {
343 343
 				unset($args->certify_key);
344 344
 				$args->ipaddress = $_SERVER['REMOTE_ADDR'];
345 345
 			}
@@ -347,13 +347,13 @@  discard block
 block discarded – undo
347 347
 		// Check if the auto-saved document already exists
348 348
 		$output = executeQuery('editor.getSavedDocument', $args);
349 349
 		$saved_doc = $output->data;
350
-		if(!$saved_doc) return;
350
+		if (!$saved_doc) return;
351 351
 
352 352
 		$oDocumentModel = getModel('document');
353 353
 		$oSaved = $oDocumentModel->getDocument($saved_doc->document_srl);
354
-		if(!$oSaved->isExists())
354
+		if (!$oSaved->isExists())
355 355
 		{
356
-			if($mode)
356
+			if ($mode)
357 357
 			{
358 358
 				$output = executeQuery('editor.getSavedDocument', $args);
359 359
 				$output = ModuleHandler::triggerCall('editor.deleteSavedDoc', 'after', $saved_doc);
@@ -382,9 +382,9 @@  discard block
 block discarded – undo
382 382
 		$oEditorModel = getModel('editor');
383 383
 		$args = new stdClass;
384 384
 
385
-		if($filter_enabled) $args->enabled = "Y";
385
+		if ($filter_enabled) $args->enabled = "Y";
386 386
 
387
-		if($site_srl)
387
+		if ($site_srl)
388 388
 		{
389 389
 			$args->site_srl = $site_srl;
390 390
 			$output = executeQuery('editor.getSiteComponentList', $args);
@@ -397,10 +397,10 @@  discard block
 block discarded – undo
397 397
 
398 398
 		// Get information about log-in status and its group
399 399
 		$is_logged = Context::get('is_logged');
400
-		if($is_logged)
400
+		if ($is_logged)
401 401
 		{
402 402
 			$logged_info = Context::get('logged_info');
403
-			if($logged_info->group_list && is_array($logged_info->group_list))
403
+			if ($logged_info->group_list && is_array($logged_info->group_list))
404 404
 			{
405 405
 				$group_list = array_keys($logged_info->group_list);
406 406
 			}
@@ -408,30 +408,30 @@  discard block
 block discarded – undo
408 408
 		}
409 409
 
410 410
 		// Get xml information for looping DB list
411
-		if(!is_array($db_list)) $db_list = array($db_list);
411
+		if (!is_array($db_list)) $db_list = array($db_list);
412 412
 		$component_list = new stdClass();
413
-		foreach($db_list as $component)
413
+		foreach ($db_list as $component)
414 414
 		{
415
-			if(in_array($component->component_name, array('colorpicker_text','colorpicker_bg'))) continue;
415
+			if (in_array($component->component_name, array('colorpicker_text', 'colorpicker_bg'))) continue;
416 416
 
417 417
 			$component_name = $component->component_name;
418
-			if(!$component_name) continue;
418
+			if (!$component_name) continue;
419 419
 
420
-			if(!in_array($component_name, $downloaded_list)) continue;
420
+			if (!in_array($component_name, $downloaded_list)) continue;
421 421
 
422 422
 			unset($xml_info);
423 423
 			$xml_info = $oEditorModel->getComponentXmlInfo($component_name);
424 424
 			$xml_info->enabled = $component->enabled;
425 425
 
426
-			if($component->extra_vars)
426
+			if ($component->extra_vars)
427 427
 			{
428 428
 				$extra_vars = unserialize($component->extra_vars);
429
-				if($extra_vars->target_group)
429
+				if ($extra_vars->target_group)
430 430
 				{
431 431
 					$xml_info->target_group = $extra_vars->target_group;
432 432
 				}
433 433
 
434
-				if($extra_vars->mid_list && count($extra_vars->mid_list))
434
+				if ($extra_vars->mid_list && count($extra_vars->mid_list))
435 435
 				{
436 436
 					$xml_info->mid_list = $extra_vars->mid_list;
437 437
 				}
@@ -458,9 +458,9 @@  discard block
 block discarded – undo
458 458
 				if(!in_array(Context::get('mid'), $extra_vars->mid_list)) continue;
459 459
 				}*/
460 460
 				// Check the configuration of the editor component
461
-				if($xml_info->extra_vars)
461
+				if ($xml_info->extra_vars)
462 462
 				{
463
-					foreach($xml_info->extra_vars as $key => $val)
463
+					foreach ($xml_info->extra_vars as $key => $val)
464 464
 					{
465 465
 						$xml_info->extra_vars->{$key}->value = $extra_vars->{$key};
466 466
 					}
@@ -471,26 +471,26 @@  discard block
 block discarded – undo
471 471
 			// Get buttons, icons, images
472 472
 			$icon_file = _XE_PATH_.'modules/editor/components/'.$component_name.'/icon.gif';
473 473
 			$component_icon_file = _XE_PATH_.'modules/editor/components/'.$component_name.'/component_icon.gif';
474
-			if(file_exists($icon_file)) $component_list->{$component_name}->icon = true;
475
-			if(file_exists($component_icon_file)) $component_list->{$component_name}->component_icon = true;
474
+			if (file_exists($icon_file)) $component_list->{$component_name}->icon = true;
475
+			if (file_exists($component_icon_file)) $component_list->{$component_name}->component_icon = true;
476 476
 		}
477 477
 
478 478
 		// Return if it checks enabled only
479
-		if($filter_enabled)
479
+		if ($filter_enabled)
480 480
 		{
481 481
 			$cache_file = $oEditorModel->getCacheFile($filter_enabled, $site_srl);
482
-			$buff = sprintf('<?php if(!defined("__XE__")) exit(); $component_list = unserialize("%s"); ?>', str_replace('"','\\"',serialize($component_list)));
482
+			$buff = sprintf('<?php if(!defined("__XE__")) exit(); $component_list = unserialize("%s"); ?>', str_replace('"', '\\"', serialize($component_list)));
483 483
 			FileHandler::writeFile($cache_file, $buff);
484 484
 			return $component_list;
485 485
 		}
486 486
 
487 487
 		// Get xml_info of downloaded list
488
-		foreach($downloaded_list as $component_name)
488
+		foreach ($downloaded_list as $component_name)
489 489
 		{
490
-			if(!is_dir(_XE_PATH_.'modules/editor/components/'.$component_name)) continue;
491
-			if(in_array($component_name, array('colorpicker_text','colorpicker_bg'))) continue;
490
+			if (!is_dir(_XE_PATH_.'modules/editor/components/'.$component_name)) continue;
491
+			if (in_array($component_name, array('colorpicker_text', 'colorpicker_bg'))) continue;
492 492
 			// Pass if configured
493
-			if($component_list->{$component_name}) continue;
493
+			if ($component_list->{$component_name}) continue;
494 494
 			// Insert data into the DB
495 495
 			$oEditorController = getAdminController('editor');
496 496
 			$oEditorController->insertComponent($component_name, false, $site_srl);
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
 		}
504 504
 
505 505
 		$cache_file = $oEditorModel->getCacheFile($filter_enabled, $site_srl);
506
-		$buff = sprintf('<?php if(!defined("__XE__")) exit(); $component_list = unserialize("%s"); ?>', str_replace('"','\\"',serialize($component_list)));
506
+		$buff = sprintf('<?php if(!defined("__XE__")) exit(); $component_list = unserialize("%s"); ?>', str_replace('"', '\\"', serialize($component_list)));
507 507
 		FileHandler::writeFile($cache_file, $buff);
508 508
 
509 509
 		return $component_list;
@@ -525,9 +525,9 @@  discard block
 block discarded – undo
525 525
 		$editorConfig = $oModuleModel->getModulePartConfig('editor', $obj->originModuleSrl);
526 526
 
527 527
 		$oModuleController = getController('module');
528
-		if(is_array($obj->moduleSrlList))
528
+		if (is_array($obj->moduleSrlList))
529 529
 		{
530
-			foreach($obj->moduleSrlList AS $key=>$moduleSrl)
530
+			foreach ($obj->moduleSrlList AS $key=>$moduleSrl)
531 531
 			{
532 532
 				$oModuleController->insertModulePartConfig('editor', $moduleSrl, $editorConfig);
533 533
 			}
Please login to merge, or discard this patch.
Braces   +101 added lines, -43 removed lines patch added patch discarded remove patch
@@ -47,20 +47,31 @@  discard block
 block discarded – undo
47 47
 	{
48 48
 		$component = Context::get('component');
49 49
 		$method = Context::get('method');
50
-		if(!$component) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
50
+		if(!$component) {
51
+			return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
52
+		}
51 53
 
52 54
 		$oEditorModel = getModel('editor');
53 55
 		$oComponent = &$oEditorModel->getComponentObject($component);
54
-		if(!$oComponent->toBool()) return $oComponent;
56
+		if(!$oComponent->toBool()) {
57
+			return $oComponent;
58
+		}
55 59
 
56
-		if(!method_exists($oComponent, $method)) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
60
+		if(!method_exists($oComponent, $method)) {
61
+			return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
62
+		}
57 63
 
58 64
 		//$output = call_user_method($method, $oComponent);
59 65
 		//$output = call_user_func(array($oComponent, $method));
60
-		if(method_exists($oComponent, $method)) $output = $oComponent->{$method}();
61
-		else return new BaseObject(-1,sprintf('%s method is not exists', $method));
66
+		if(method_exists($oComponent, $method)) {
67
+			$output = $oComponent->{$method}();
68
+		} else {
69
+			return new BaseObject(-1,sprintf('%s method is not exists', $method));
70
+		}
62 71
 
63
-		if((is_a($output, 'BaseObject') || is_subclass_of($output, 'BaseObject')) && !$output->toBool()) return $output;
72
+		if((is_a($output, 'BaseObject') || is_subclass_of($output, 'BaseObject')) && !$output->toBool()) {
73
+			return $output;
74
+		}
64 75
 
65 76
 		$this->setError($oComponent->getError());
66 77
 		$this->setMessage($oComponent->getMessage());
@@ -88,7 +99,9 @@  discard block
 block discarded – undo
88 99
 
89 100
 		foreach($target_module_srl as $srl)
90 101
 		{
91
-			if(!$srl) continue;
102
+			if(!$srl) {
103
+				continue;
104
+			}
92 105
 
93 106
 			$module_info = $oModuleModel->getModuleInfoByModuleSrl($srl);
94 107
 			if(!$module_info->module_srl)
@@ -118,10 +131,14 @@  discard block
 block discarded – undo
118 131
 			for($i=0,$c=count($fonts);$i<$c;$i++)
119 132
 			{
120 133
 				$font = trim(str_replace(array('"','\''),'',$fonts[$i]));
121
-				if(!$font) continue;
134
+				if(!$font) {
135
+					continue;
136
+				}
122 137
 				$font_list[] = $font;
123 138
 			}
124
-			if(count($font_list)) $editor_config->content_font = '"'.implode('","',$font_list).'"';
139
+			if(count($font_list)) {
140
+				$editor_config->content_font = '"'.implode('","',$font_list).'"';
141
+			}
125 142
 		}
126 143
 		$editor_config->content_font_size = Context::get('content_font_size');
127 144
 		$editor_config->sel_editor_colorset = Context::get('sel_editor_colorset');
@@ -135,12 +152,10 @@  discard block
 block discarded – undo
135 152
 			if(!$grant)
136 153
 			{
137 154
 				$editor_config->{$key} = array();
138
-			}
139
-			else if(is_array($grant))
155
+			} else if(is_array($grant))
140 156
 			{
141 157
 				$editor_config->{$key} = $grant;
142
-			}
143
-			else
158
+			} else
144 159
 			{
145 160
 				$editor_config->{$key} = explode('|@|', $grant);
146 161
 			}
@@ -149,7 +164,9 @@  discard block
 block discarded – undo
149 164
 		$editor_config->editor_height = (int)Context::get('editor_height');
150 165
 		$editor_config->comment_editor_height = (int)Context::get('comment_editor_height');
151 166
 		$editor_config->enable_autosave = Context::get('enable_autosave');
152
-		if($editor_config->enable_autosave != 'Y') $editor_config->enable_autosave = 'N';
167
+		if($editor_config->enable_autosave != 'Y') {
168
+			$editor_config->enable_autosave = 'N';
169
+		}
153 170
 
154 171
 		$oModuleController = getController('module');
155 172
 		foreach($module_srl as $srl)
@@ -169,7 +186,9 @@  discard block
 block discarded – undo
169 186
 	 */
170 187
 	function triggerEditorComponentCompile(&$content)
171 188
 	{
172
-		if(Context::getResponseMethod()!='HTML') return new BaseObject();
189
+		if(Context::getResponseMethod()!='HTML') {
190
+			return new BaseObject();
191
+		}
173 192
 
174 193
 		$module_info = Context::get('module_info');
175 194
 		$module_srl = $module_info->module_srl;
@@ -187,13 +206,14 @@  discard block
 block discarded – undo
187 206
 					for($i = 0, $c = count($ini); $i < $c; $i++)
188 207
 					{
189 208
 						$file = trim($ini[$i]);
190
-						if(!$file) continue;
209
+						if(!$file) {
210
+							continue;
211
+						}
191 212
 
192 213
 						if(substr_compare($file, '.css', -4) === 0)
193 214
 						{
194 215
 							Context::addCSSFile('./modules/editor/styles/'.$content_style.'/'.$file, false);
195
-						}
196
-						elseif(substr_compare($file, '.js', -3) === 0)
216
+						} elseif(substr_compare($file, '.js', -3) === 0)
197 217
 						{
198 218
 							Context::addJsFile('./modules/editor/styles/'.$content_style.'/'.$file, false);
199 219
 						}
@@ -206,8 +226,12 @@  discard block
 block discarded – undo
206 226
 			{
207 227
 				$buff = array();
208 228
 				$buff[] = '<style> .xe_content { ';
209
-				if($content_font) $buff[] = 'font-family:'.$content_font.';';
210
-				if($content_font_size) $buff[] = 'font-size:'.$content_font_size.';';
229
+				if($content_font) {
230
+					$buff[] = 'font-family:'.$content_font.';';
231
+				}
232
+				if($content_font_size) {
233
+					$buff[] = 'font-size:'.$content_font_size.';';
234
+				}
211 235
 				$buff[] = ' }</style>';
212 236
 				Context::addHtmlHeader(implode('', $buff));
213 237
 			}
@@ -239,17 +263,23 @@  discard block
 block discarded – undo
239 263
 		$xml_obj->attrs = new stdClass;
240 264
 		for($i=0,$c=count($m[0]);$i<$c;$i++)
241 265
 		{
242
-			if(!isset($xml_obj->attrs)) $xml_obj->attrs = new stdClass;
266
+			if(!isset($xml_obj->attrs)) {
267
+				$xml_obj->attrs = new stdClass;
268
+			}
243 269
 			$xml_obj->attrs->{$m[1][$i]} = $m[2][$i];
244 270
 		}
245 271
 		$xml_obj->body = $match[4];
246 272
 
247
-		if(!$xml_obj->attrs->editor_component) return $match[0];
273
+		if(!$xml_obj->attrs->editor_component) {
274
+			return $match[0];
275
+		}
248 276
 
249 277
 		// Get converted codes by using component::transHTML()
250 278
 		$oEditorModel = getModel('editor');
251 279
 		$oComponent = &$oEditorModel->getComponentObject($xml_obj->attrs->editor_component, 0);
252
-		if(!is_object($oComponent)||!method_exists($oComponent, 'transHTML')) return $match[0];
280
+		if(!is_object($oComponent)||!method_exists($oComponent, 'transHTML')) {
281
+			return $match[0];
282
+		}
253 283
 
254 284
 		return $oComponent->transHTML($xml_obj);
255 285
 	}
@@ -259,10 +289,14 @@  discard block
 block discarded – undo
259 289
 	 */
260 290
 	function doSaveDoc($args)
261 291
 	{
262
-		if(!$args->document_srl) $args->document_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl;
292
+		if(!$args->document_srl) {
293
+			$args->document_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl;
294
+		}
263 295
 
264 296
 		// Get the current module if module_srl doesn't exist
265
-		if(!$args->module_srl) $args->module_srl = Context::get('module_srl');
297
+		if(!$args->module_srl) {
298
+			$args->module_srl = Context::get('module_srl');
299
+		}
266 300
 		if(!$args->module_srl)
267 301
 		{
268 302
 			$current_module_info = Context::get('current_module_info');
@@ -273,11 +307,12 @@  discard block
 block discarded – undo
273 307
 		{
274 308
 			$logged_info = Context::get('logged_info');
275 309
 			$args->member_srl = $logged_info->member_srl;
276
-		}
277
-		else
310
+		} else
278 311
 		{
279 312
 			$args->certify_key = $_COOKIE['autosave_certify_key_' . $args->module_srl];
280
-			if(!$args->certify_key) $args->certify_key = Password::createSecureSalt(40);
313
+			if(!$args->certify_key) {
314
+				$args->certify_key = Password::createSecureSalt(40);
315
+			}
281 316
 			setcookie('autosave_certify_key_' . $args->module_srl, $args->certify_key, $_SERVER['REQUEST_TIME'] + 3600, '', '', false, true);
282 317
 		}
283 318
 
@@ -333,8 +368,7 @@  discard block
 block discarded – undo
333 368
 		{
334 369
 			$logged_info = Context::get('logged_info');
335 370
 			$args->member_srl = $logged_info->member_srl;
336
-		}
337
-		else
371
+		} else
338 372
 		{
339 373
 			$args->certify_key = $_COOKIE['autosave_certify_key_' . $args->module_srl];
340 374
 			// @see https://github.com/xpressengine/xe-core/issues/2208
@@ -347,7 +381,9 @@  discard block
 block discarded – undo
347 381
 		// Check if the auto-saved document already exists
348 382
 		$output = executeQuery('editor.getSavedDocument', $args);
349 383
 		$saved_doc = $output->data;
350
-		if(!$saved_doc) return;
384
+		if(!$saved_doc) {
385
+			return;
386
+		}
351 387
 
352 388
 		$oDocumentModel = getModel('document');
353 389
 		$oSaved = $oDocumentModel->getDocument($saved_doc->document_srl);
@@ -382,14 +418,17 @@  discard block
 block discarded – undo
382 418
 		$oEditorModel = getModel('editor');
383 419
 		$args = new stdClass;
384 420
 
385
-		if($filter_enabled) $args->enabled = "Y";
421
+		if($filter_enabled) {
422
+			$args->enabled = "Y";
423
+		}
386 424
 
387 425
 		if($site_srl)
388 426
 		{
389 427
 			$args->site_srl = $site_srl;
390 428
 			$output = executeQuery('editor.getSiteComponentList', $args);
429
+		} else {
430
+			$output = executeQuery('editor.getComponentList', $args);
391 431
 		}
392
-		else $output = executeQuery('editor.getComponentList', $args);
393 432
 		$db_list = $output->data;
394 433
 
395 434
 		// Get a list of files
@@ -403,21 +442,30 @@  discard block
 block discarded – undo
403 442
 			if($logged_info->group_list && is_array($logged_info->group_list))
404 443
 			{
405 444
 				$group_list = array_keys($logged_info->group_list);
445
+			} else {
446
+				$group_list = array();
406 447
 			}
407
-			else $group_list = array();
408 448
 		}
409 449
 
410 450
 		// Get xml information for looping DB list
411
-		if(!is_array($db_list)) $db_list = array($db_list);
451
+		if(!is_array($db_list)) {
452
+			$db_list = array($db_list);
453
+		}
412 454
 		$component_list = new stdClass();
413 455
 		foreach($db_list as $component)
414 456
 		{
415
-			if(in_array($component->component_name, array('colorpicker_text','colorpicker_bg'))) continue;
457
+			if(in_array($component->component_name, array('colorpicker_text','colorpicker_bg'))) {
458
+				continue;
459
+			}
416 460
 
417 461
 			$component_name = $component->component_name;
418
-			if(!$component_name) continue;
462
+			if(!$component_name) {
463
+				continue;
464
+			}
419 465
 
420
-			if(!in_array($component_name, $downloaded_list)) continue;
466
+			if(!in_array($component_name, $downloaded_list)) {
467
+				continue;
468
+			}
421 469
 
422 470
 			unset($xml_info);
423 471
 			$xml_info = $oEditorModel->getComponentXmlInfo($component_name);
@@ -471,8 +519,12 @@  discard block
 block discarded – undo
471 519
 			// Get buttons, icons, images
472 520
 			$icon_file = _XE_PATH_.'modules/editor/components/'.$component_name.'/icon.gif';
473 521
 			$component_icon_file = _XE_PATH_.'modules/editor/components/'.$component_name.'/component_icon.gif';
474
-			if(file_exists($icon_file)) $component_list->{$component_name}->icon = true;
475
-			if(file_exists($component_icon_file)) $component_list->{$component_name}->component_icon = true;
522
+			if(file_exists($icon_file)) {
523
+				$component_list->{$component_name}->icon = true;
524
+			}
525
+			if(file_exists($component_icon_file)) {
526
+				$component_list->{$component_name}->component_icon = true;
527
+			}
476 528
 		}
477 529
 
478 530
 		// Return if it checks enabled only
@@ -487,10 +539,16 @@  discard block
 block discarded – undo
487 539
 		// Get xml_info of downloaded list
488 540
 		foreach($downloaded_list as $component_name)
489 541
 		{
490
-			if(!is_dir(_XE_PATH_.'modules/editor/components/'.$component_name)) continue;
491
-			if(in_array($component_name, array('colorpicker_text','colorpicker_bg'))) continue;
542
+			if(!is_dir(_XE_PATH_.'modules/editor/components/'.$component_name)) {
543
+				continue;
544
+			}
545
+			if(in_array($component_name, array('colorpicker_text','colorpicker_bg'))) {
546
+				continue;
547
+			}
492 548
 			// Pass if configured
493
-			if($component_list->{$component_name}) continue;
549
+			if($component_list->{$component_name}) {
550
+				continue;
551
+			}
494 552
 			// Insert data into the DB
495 553
 			$oEditorController = getAdminController('editor');
496 554
 			$oEditorController->insertComponent($component_name, false, $site_srl);
Please login to merge, or discard this patch.