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 (#1930)
by
unknown
13:51
created

HTMLDisplayHandler::_preserveTextAreaValue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 1
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/* Copyright (C) NAVER <http://www.navercorp.com> */
3
4
class HTMLDisplayHandler
5
{
6
7
	/**
8
	 * Produce HTML compliant content given a module object.\n
9
	 * @param ModuleObject $oModule the module object
10
	 * @return string compiled template string
11
	 */
12
	function toDoc(&$oModule)
13
	{
14
		$oTemplate = TemplateHandler::getInstance();
15
16
		// compile module tpl
17
		// deprecated themes skin
18
19
		$template_path = $oModule->getTemplatePath();
20
21
		if(!is_dir($template_path))
22
		{
23
			if($oModule->module_info->module == $oModule->module)
0 ignored issues
show
Bug introduced by
The property module_info cannot be accessed from this context as it is declared private in class ModuleObject.

This check looks for access to properties that are not accessible from the current context.

If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class.

Loading history...
Bug introduced by
The property module cannot be accessed from this context as it is declared private in class ModuleObject.

This check looks for access to properties that are not accessible from the current context.

If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class.

Loading history...
24
			{
25
				$skin = $oModule->origin_module_info->skin;
0 ignored issues
show
Bug introduced by
The property origin_module_info cannot be accessed from this context as it is declared private in class ModuleObject.

This check looks for access to properties that are not accessible from the current context.

If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class.

Loading history...
26
			}
27
			else
28
			{
29
				$skin = $oModule->module_config->skin;
0 ignored issues
show
Bug introduced by
The property module_config cannot be accessed from this context as it is declared private in class ModuleObject.

This check looks for access to properties that are not accessible from the current context.

If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class.

Loading history...
30
			}
31
32
			if(Context::get('module') != 'admin' && strpos(Context::get('act'), 'Admin') === false)
33
			{
34
				if($skin && is_string($skin))
35
				{
36
					$theme_skin = explode('|@|', $skin);
37
					$template_path = $oModule->getTemplatePath();
38
					if(count($theme_skin) == 2)
39
					{
40
						$theme_path = sprintf('./themes/%s', $theme_skin[0]);
41
						// FIXME $theme_path $theme_path $theme_path ??
42
						if(substr($theme_path, 0, strlen($theme_path)) != $theme_path)
43
						{
44
							$template_path = sprintf('%s/modules/%s/', $theme_path, $theme_skin[1]);
45
						}
46
					}
47
				}
48
				else
49
				{
50
					$template_path = $oModule->getTemplatePath();
51
				}
52
			}
53
			else
54
			{
55
				$template_path = $oModule->getTemplatePath();
56
			}
57
		}
58
59
		$tpl_file = $oModule->getTemplateFile();
60
61
		$output = $oTemplate->compile($template_path, $tpl_file);
62
63
		// SECISSUE https://github.com/xpressengine/xe-core/issues/1583
64
		$oSecurity = new Security();
65
		$oSecurity->encodeHTML('is_keyword');
66
67
		// add .x div for adminitration pages
68
		if(Context::getResponseMethod() == 'HTML')
69
		{
70
			if(Context::get('module') != 'admin' && strpos(Context::get('act'), 'Admin') > 0 && Context::get('act') != 'dispPageAdminContentModify' && Context::get('act') != 'dispPageAdminMobileContentModify')
71
			{
72
				$output = '<div class="x">' . $output . '</div>';
73
			}
74
75
			if(Context::get('layout') != 'none')
76
			{
77
				if(__DEBUG__ == 3)
78
				{
79
					$start = getMicroTime();
80
				}
81
82
				Context::set('content', $output, false);
0 ignored issues
show
Documentation introduced by
false is of type boolean, but the function expects a integer.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
83
84
				$layout_path = $oModule->getLayoutPath();
85
				$layout_file = $oModule->getLayoutFile();
86
87
				$edited_layout_file = $oModule->getEditedLayoutFile();
88
89
				// get the layout information currently requested
90
				$oLayoutModel = getModel('layout');
91
				$layout_info = Context::get('layout_info');
92
				$layout_srl = $layout_info->layout_srl;
93
94
				// compile if connected to the layout
95
				if($layout_srl > 0)
96
				{
97
98
					// handle separately if the layout is faceoff
99
					if($layout_info && $layout_info->type == 'faceoff')
100
					{
101
						$oLayoutModel->doActivateFaceOff($layout_info);
102
						Context::set('layout_info', $layout_info);
103
					}
104
105
					// search if the changes CSS exists in the admin layout edit window
106
					$edited_layout_css = $oLayoutModel->getUserLayoutCss($layout_srl);
107
108
					if(FileHandler::exists($edited_layout_css))
0 ignored issues
show
Bug Best Practice introduced by
The expression \FileHandler::exists($edited_layout_css) of type string|false is loosely compared to true; this is ambiguous if the string can be empty. You might want to explicitly use !== false instead.

In PHP, under loose comparison (like ==, or !=, or switch conditions), values of different types might be equal.

For string values, the empty string '' is a special case, in particular the following results might be unexpected:

''   == false // true
''   == null  // true
'ab' == false // false
'ab' == null  // false

// It is often better to use strict comparison
'' === false // false
'' === null  // false
Loading history...
109
					{
110
						Context::loadFile(array($edited_layout_css, 'all', '', 100));
111
					}
112
				}
113
				if(!$layout_path)
114
				{
115
					$layout_path = './common/tpl';
116
				}
117
				if(!$layout_file)
118
				{
119
					$layout_file = 'default_layout';
120
				}
121
				$output = $oTemplate->compile($layout_path, $layout_file, $edited_layout_file);
122
123
				// if popup_layout, remove admin bar.
124
				$realLayoutPath = FileHandler::getRealPath($layout_path);
125
				if(substr_compare($realLayoutPath, '/', -1) !== 0)
126
				{
127
					$realLayoutPath .= '/';
128
				}
129
130
				$pathInfo = pathinfo($layout_file);
131
				$onlyLayoutFile = $pathInfo['filename'];
0 ignored issues
show
Unused Code introduced by
$onlyLayoutFile is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
132
133
				if(__DEBUG__ == 3)
134
				{
135
					$GLOBALS['__layout_compile_elapsed__'] = getMicroTime() - $start;
0 ignored issues
show
Bug introduced by
The variable $start does not seem to be defined for all execution paths leading up to this point.

If you define a variable conditionally, it can happen that it is not defined for all execution paths.

Let’s take a look at an example:

function myFunction($a) {
    switch ($a) {
        case 'foo':
            $x = 1;
            break;

        case 'bar':
            $x = 2;
            break;
    }

    // $x is potentially undefined here.
    echo $x;
}

In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined.

Available Fixes

  1. Check for existence of the variable explicitly:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        if (isset($x)) { // Make sure it's always set.
            echo $x;
        }
    }
    
  2. Define a default value for the variable:

    function myFunction($a) {
        $x = ''; // Set a default which gets overridden for certain paths.
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        echo $x;
    }
    
  3. Add a value for the missing path:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
    
            // We add support for the missing case.
            default:
                $x = '';
                break;
        }
    
        echo $x;
    }
    
Loading history...
136
				}
137
138
				if(stripos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE && (Context::get('_use_ssl') == 'optional' || Context::get('_use_ssl') == 'always'))
139
				{
140
					Context::addHtmlFooter('<iframe id="xeTmpIframe" name="xeTmpIframe" style="width:1px;height:1px;position:absolute;top:-2px;left:-2px;"></iframe>');
141
				}
142
			}
143
		}
144
		return $output;
145
	}
146
147
	/**
148
	 * when display mode is HTML, prepare code before print.
149
	 * @param string $output compiled template string
150
	 * @return void
151
	 */
152
	function prepareToPrint(&$output)
153
	{
154
		if(Context::getResponseMethod() != 'HTML')
155
		{
156
			return;
157
		}
158
159
		if(__DEBUG__ == 3)
160
		{
161
			$start = getMicroTime();
162
		}
163
164
		// move <style ..></style> in body to the header
165
		$output = preg_replace_callback('!<style(.*?)>(.*?)<\/style>!is', array($this, '_moveStyleToHeader'), $output);
166
167
		// move <link ..></link> in body to the header
168
		$output = preg_replace_callback('!<link(.*?)/>!is', array($this, '_moveLinkToHeader'), $output);
169
170
		// move <meta ../> in body to the header
171
		$output = preg_replace_callback('!<meta(.*?)(?:\/|)>!is', array($this, '_moveMetaToHeader'), $output);
172
173
		// change a meta fine(widget often put the tag like <!--Meta:path--> to the content because of caching)
174
		$output = preg_replace_callback('/<!--(#)?Meta:([a-z0-9\_\-\/\.\@\:]+)-->/is', array($this, '_transMeta'), $output);
175
176
		// handles a relative path generated by using the rewrite module
177
		if(Context::isAllowRewrite())
178
		{
179
			$url = parse_url(Context::getRequestUri());
180
			$real_path = $url['path'];
181
182
			$pattern = '/src=("|\'){1}(\.\/)?(files\/attach|files\/cache|files\/faceOff|files\/member_extra_info|modules|common|widgets|widgetstyle|layouts|addons)\/([^"\']+)\.(jpg|jpeg|png|gif)("|\'){1}/s';
183
			$output = preg_replace($pattern, 'src=$1' . $real_path . '$3/$4.$5$6', $output);
184
185
			$pattern = '/href=("|\'){1}(\?[^"\']+)/s';
186
			$output = preg_replace($pattern, 'href=$1' . $real_path . '$2', $output);
187
188
			if(Context::get('vid'))
189
			{
190
				$pattern = '/\/' . Context::get('vid') . '\?([^=]+)=/is';
191
				$output = preg_replace($pattern, '/?$1=', $output);
192
			}
193
		}
194
195
		// prevent the 2nd request due to url(none) of the background-image
196
		$output = preg_replace('/url\((["\']?)none(["\']?)\)/is', 'none', $output);
197
198
		if(is_array(Context::get('INPUT_ERROR')))
199
		{
200
			$INPUT_ERROR = Context::get('INPUT_ERROR');
201
			$keys = array_keys($INPUT_ERROR);
202
			$keys = '(' . implode('|', $keys) . ')';
203
204
			$output = preg_replace_callback('@(<input)([^>]*?)\sname="' . $keys . '"([^>]*?)/?>@is', array(&$this, '_preserveValue'), $output);
205
			$output = preg_replace_callback('@<select[^>]*\sname="' . $keys . '".+</select>@isU', array(&$this, '_preserveSelectValue'), $output);
206
			$output = preg_replace_callback('@<textarea[^>]*\sname="' . $keys . '".+</textarea>@isU', array(&$this, '_preserveTextAreaValue'), $output);
207
		}
208
209
		if(__DEBUG__ == 3)
210
		{
211
			$GLOBALS['__trans_content_elapsed__'] = getMicroTime() - $start;
0 ignored issues
show
Bug introduced by
The variable $start does not seem to be defined for all execution paths leading up to this point.

If you define a variable conditionally, it can happen that it is not defined for all execution paths.

Let’s take a look at an example:

function myFunction($a) {
    switch ($a) {
        case 'foo':
            $x = 1;
            break;

        case 'bar':
            $x = 2;
            break;
    }

    // $x is potentially undefined here.
    echo $x;
}

In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined.

Available Fixes

  1. Check for existence of the variable explicitly:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        if (isset($x)) { // Make sure it's always set.
            echo $x;
        }
    }
    
  2. Define a default value for the variable:

    function myFunction($a) {
        $x = ''; // Set a default which gets overridden for certain paths.
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        echo $x;
    }
    
  3. Add a value for the missing path:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
    
            // We add support for the missing case.
            default:
                $x = '';
                break;
        }
    
        echo $x;
    }
    
Loading history...
212
		}
213
214
		// Remove unnecessary information
215
		$output = preg_replace('/member\_\-([0-9]+)/s', 'member_0', $output);
216
217
		// set icon
218
		$oAdminModel = getAdminModel('admin');
219
		$favicon_url = $oAdminModel->getFaviconUrl(false);
220
		$mobicon_url = $oAdminModel->getMobileIconUrl(false);
221
		Context::set('favicon_url', $favicon_url);
222
		Context::set('mobicon_url', $mobicon_url);
223
224
		// convert the final layout
225
		Context::set('content', $output);
226
		$oTemplate = TemplateHandler::getInstance();
227
		if(Mobile::isFromMobilePhone())
228
		{
229
			$this->_loadMobileJSCSS();
230
			$output = $oTemplate->compile('./common/tpl', 'mobile_layout');
231
		}
232
		else
233
		{
234
			$this->_loadJSCSS();
235
			$output = $oTemplate->compile('./common/tpl', 'common_layout');
236
		}
237
238
		// replace the user-defined-language
239
		$oModuleController = getController('module');
240
		$oModuleController->replaceDefinedLangCode($output);
241
	}
242
243
	/**
244
	 * when display mode is HTML, prepare code before print about <input> tag value.
245
	 * @param array $match input value.
246
	 * @return string input value.
247
	 */
248
	function _preserveValue($match)
249
	{
250
		$INPUT_ERROR = Context::get('INPUT_ERROR');
251
252
		$str = $match[1] . $match[2] . ' name="' . $match[3] . '"' . $match[4];
253
254
		// get type
255
		$type = 'text';
256
		if(preg_match('/\stype="([a-z]+)"/i', $str, $m))
257
		{
258
			$type = strtolower($m[1]);
259
		}
260
261
		switch($type)
262
		{
263
			case 'text':
264
			case 'hidden':
265
			case 'email':
266
			case 'search':
267
			case 'tel':
268
			case 'url':
269
			case 'email':
270
			case 'datetime':
271
			case 'date':
272
			case 'month':
273
			case 'week':
274
			case 'time':
275
			case 'datetime-local':
276
			case 'number':
277
			case 'range':
278
			case 'color':
279
				$str = preg_replace('@\svalue="[^"]*?"@', ' ', $str) . ' value="' . htmlspecialchars($INPUT_ERROR[$match[3]], ENT_COMPAT | ENT_HTML401, 'UTF-8', false) . '"';
280
				break;
281
			case 'password':
282
				$str = preg_replace('@\svalue="[^"]*?"@', ' ', $str);
283
				break;
284
			case 'radio':
285
			case 'checkbox':
286
				$str = preg_replace('@\schecked(="[^"]*?")?@', ' ', $str);
287
				if(@preg_match('@\s(?i:value)="' . $INPUT_ERROR[$match[3]] . '"@', $str))
288
				{
289
					$str .= ' checked="checked"';
290
				}
291
				break;
292
		}
293
294
		return $str . ' />';
295
	}
296
297
	/**
298
	 * when display mode is HTML, prepare code before print about <select> tag value.
299
	 * @param array $matches select tag.
300
	 * @return string select tag.
301
	 */
302
	function _preserveSelectValue($matches)
303
	{
304
		$INPUT_ERROR = Context::get('INPUT_ERROR');
305
		preg_replace('@\sselected(="[^"]*?")?@', ' ', $matches[0]);
306
		preg_match('@<select.*?>@is', $matches[0], $mm);
307
308
		preg_match_all('@<option[^>]*\svalue="([^"]*)".+</option>@isU', $matches[0], $m);
309
310
		$key = array_search($INPUT_ERROR[$matches[1]], $m[1]);
311
		if($key === FALSE)
312
		{
313
			return $matches[0];
314
		}
315
316
		$m[0][$key] = preg_replace('@(\svalue=".*?")@is', '$1 selected="selected"', $m[0][$key]);
317
318
		return $mm[0] . implode('', $m[0]) . '</select>';
319
	}
320
321
	/**
322
	 * when display mode is HTML, prepare code before print about <textarea> tag value.
323
	 * @param array $matches textarea tag information.
324
	 * @return string textarea tag
325
	 */
326
	function _preserveTextAreaValue($matches)
327
	{
328
		$INPUT_ERROR = Context::get('INPUT_ERROR');
329
		preg_match('@<textarea.*?>@is', $matches[0], $mm);
330
		return $mm[0] . $INPUT_ERROR[$matches[1]] . '</textarea>';
331
	}
332
333
	/**
334
	 * add html style code extracted from html body to Context, which will be
335
	 * printed inside <header></header> later.
336
	 * @param array $matches
337
	 * @return void
338
	 */
339
	function _moveStyleToHeader($matches)
340
	{
341
		if(isset($matches[1]) && stristr($matches[1], 'scoped'))
342
		{
343
			return $matches[0];
344
		}
345
		Context::addHtmlHeader($matches[0]);
346
	}
347
348
	/**
349
	 * add html link code extracted from html body to Context, which will be
350
	 * printed inside <header></header> later.
351
	 * @param array $matches
352
	 * @return void
353
	 */
354
	function _moveLinkToHeader($matches)
355
	{
356
		Context::addHtmlHeader($matches[0]);
357
	}
358
359
	/**
360
	 * add meta code extracted from html body to Context, which will be
361
	 * printed inside <header></header> later.
362
	 * @param array $matches
363
	 * @return void
364
	 */
365
	function _moveMetaToHeader($matches)
366
	{
367
		Context::addHtmlHeader($matches[0]);
368
	}
369
370
	/**
371
	 * add given .css or .js file names in widget code to Context
372
	 * @param array $matches
373
	 * @return void
374
	 */
375
	function _transMeta($matches)
376
	{
377
		if($matches[1])
378
		{
379
			return '';
380
		}
381
		Context::loadFile($matches[2]);
382
	}
383
384
	/**
385
	 * import basic .js files.
386
	 * @return void
387
	 */
388
	function _loadJSCSS()
389
	{
390
		$oContext = Context::getInstance();
391
		$lang_type = Context::getLangType();
392
393
		// add common JS/CSS files
394 View Code Duplication
		if(__DEBUG__ || !__XE_VERSION_STABLE__)
395
		{
396
			$oContext->loadFile(array('./common/js/jquery-1.x.js', 'head', 'lt IE 9', -111000), true);
0 ignored issues
show
Unused Code introduced by
The call to Context::loadFile() has too many arguments starting with true.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
397
			$oContext->loadFile(array('./common/js/jquery.js', 'head', 'gte IE 9', -110000), true);
0 ignored issues
show
Unused Code introduced by
The call to Context::loadFile() has too many arguments starting with true.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
398
			$oContext->loadFile(array('./common/js/modernizr.js', 'head', '', -100000), true);
0 ignored issues
show
Unused Code introduced by
The call to Context::loadFile() has too many arguments starting with true.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
399
			$oContext->loadFile(array('./common/js/x.js', 'head', '', -100000), true);
0 ignored issues
show
Unused Code introduced by
The call to Context::loadFile() has too many arguments starting with true.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
400
			$oContext->loadFile(array('./common/js/common.js', 'head', '', -100000), true);
0 ignored issues
show
Unused Code introduced by
The call to Context::loadFile() has too many arguments starting with true.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
401
			$oContext->loadFile(array('./common/js/js_app.js', 'head', '', -100000), true);
0 ignored issues
show
Unused Code introduced by
The call to Context::loadFile() has too many arguments starting with true.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
402
			$oContext->loadFile(array('./common/js/xml_handler.js', 'head', '', -100000), true);
0 ignored issues
show
Unused Code introduced by
The call to Context::loadFile() has too many arguments starting with true.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
403
			$oContext->loadFile(array('./common/js/xml_js_filter.js', 'head', '', -100000), true);
0 ignored issues
show
Unused Code introduced by
The call to Context::loadFile() has too many arguments starting with true.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
404
			$oContext->loadFile(array('./common/css/xe.css', '', '', -1000000), true);
0 ignored issues
show
Unused Code introduced by
The call to Context::loadFile() has too many arguments starting with true.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
405
		}
406
		else
407
		{
408
			$oContext->loadFile(array('./common/js/jquery-1.x.min.js', 'head', 'lt IE 9', -111000), true);
0 ignored issues
show
Unused Code introduced by
The call to Context::loadFile() has too many arguments starting with true.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
409
			$oContext->loadFile(array('./common/js/jquery.min.js', 'head', 'gte IE 9', -110000), true);
0 ignored issues
show
Unused Code introduced by
The call to Context::loadFile() has too many arguments starting with true.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
410
			$oContext->loadFile(array('./common/js/x.min.js', 'head', '', -100000), true);
0 ignored issues
show
Unused Code introduced by
The call to Context::loadFile() has too many arguments starting with true.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
411
			$oContext->loadFile(array('./common/js/xe.min.js', 'head', '', -100000), true);
0 ignored issues
show
Unused Code introduced by
The call to Context::loadFile() has too many arguments starting with true.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
412
			$oContext->loadFile(array('./common/css/xe.min.css', '', '', -1000000), true);
0 ignored issues
show
Unused Code introduced by
The call to Context::loadFile() has too many arguments starting with true.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
413
		}
414
415
		// for admin page, add admin css
416
		if(Context::get('module') == 'admin' || strpos(Context::get('act'), 'Admin') > 0)
417
		{
418
			if(__DEBUG__ || !__XE_VERSION_STABLE__)
419
			{
420
				$oContext->loadFile(array('./modules/admin/tpl/css/admin.css', '', '', 10), true);
0 ignored issues
show
Unused Code introduced by
The call to Context::loadFile() has too many arguments starting with true.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
421
				$oContext->loadFile(array("./modules/admin/tpl/css/admin_{$lang_type}.css", '', '', 10), true);
0 ignored issues
show
Unused Code introduced by
The call to Context::loadFile() has too many arguments starting with true.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
422
				$oContext->loadFile(array("./modules/admin/tpl/css/admin.iefix.css", '', 'ie', 10), true);
0 ignored issues
show
Unused Code introduced by
The call to Context::loadFile() has too many arguments starting with true.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
423
				$oContext->loadFile('./modules/admin/tpl/js/admin.js', true);
0 ignored issues
show
Documentation introduced by
'./modules/admin/tpl/js/admin.js' is of type string, but the function expects a array.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
Unused Code introduced by
The call to Context::loadFile() has too many arguments starting with true.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
424
				$oContext->loadFile(array('./modules/admin/tpl/css/admin.bootstrap.css', '', '', 1), true);
0 ignored issues
show
Unused Code introduced by
The call to Context::loadFile() has too many arguments starting with true.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
425
				$oContext->loadFile(array('./modules/admin/tpl/js/jquery.tmpl.js', '', '', 1), true);
0 ignored issues
show
Unused Code introduced by
The call to Context::loadFile() has too many arguments starting with true.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
426
				$oContext->loadFile(array('./modules/admin/tpl/js/jquery.jstree.js', '', '', 1), true);
0 ignored issues
show
Unused Code introduced by
The call to Context::loadFile() has too many arguments starting with true.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
427
			}
428
			else
429
			{
430
				$oContext->loadFile(array('./modules/admin/tpl/css/admin.min.css', '', '', 10), true);
0 ignored issues
show
Unused Code introduced by
The call to Context::loadFile() has too many arguments starting with true.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
431
				$oContext->loadFile(array("./modules/admin/tpl/css/admin_{$lang_type}.css", '', '', 10), true);
0 ignored issues
show
Unused Code introduced by
The call to Context::loadFile() has too many arguments starting with true.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
432
				$oContext->loadFile(array("./modules/admin/tpl/css/admin.iefix.css", '', 'ie', 10), true);
0 ignored issues
show
Unused Code introduced by
The call to Context::loadFile() has too many arguments starting with true.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
433
				$oContext->loadFile('./modules/admin/tpl/js/admin.min.js', true);
0 ignored issues
show
Documentation introduced by
'./modules/admin/tpl/js/admin.min.js' is of type string, but the function expects a array.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
Unused Code introduced by
The call to Context::loadFile() has too many arguments starting with true.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
434
				$oContext->loadFile(array('./modules/admin/tpl/css/admin.bootstrap.min.css', '', '', 1), true);
0 ignored issues
show
Unused Code introduced by
The call to Context::loadFile() has too many arguments starting with true.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
435
				$oContext->loadFile(array('./modules/admin/tpl/js/jquery.tmpl.js', '', '', 1), true);
0 ignored issues
show
Unused Code introduced by
The call to Context::loadFile() has too many arguments starting with true.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
436
				$oContext->loadFile(array('./modules/admin/tpl/js/jquery.jstree.js', '', '', 1), true);
0 ignored issues
show
Unused Code introduced by
The call to Context::loadFile() has too many arguments starting with true.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
437
			}
438
		}
439
	}
440
441
	/**
442
	 * import basic .js files for mobile
443
	 */
444
	private function _loadMobileJSCSS()
445
	{
446
		$oContext = Context::getInstance();
447
		$lang_type = Context::getLangType();
0 ignored issues
show
Unused Code introduced by
$lang_type is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
448
449
		// add common JS/CSS files
450 View Code Duplication
		if(__DEBUG__ || !__XE_VERSION_STABLE__)
451
		{
452
			$oContext->loadFile(array('./common/js/jquery.js', 'head', '', -110000), true);
0 ignored issues
show
Unused Code introduced by
The call to Context::loadFile() has too many arguments starting with true.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
453
			$oContext->loadFile(array('./common/js/modernizr.js', 'head', '', -100000), true);
0 ignored issues
show
Unused Code introduced by
The call to Context::loadFile() has too many arguments starting with true.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
454
			$oContext->loadFile(array('./common/js/x.js', 'head', '', -100000), true);
0 ignored issues
show
Unused Code introduced by
The call to Context::loadFile() has too many arguments starting with true.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
455
			$oContext->loadFile(array('./common/js/common.js', 'head', '', -100000), true);
0 ignored issues
show
Unused Code introduced by
The call to Context::loadFile() has too many arguments starting with true.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
456
			$oContext->loadFile(array('./common/js/js_app.js', 'head', '', -100000), true);
0 ignored issues
show
Unused Code introduced by
The call to Context::loadFile() has too many arguments starting with true.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
457
			$oContext->loadFile(array('./common/js/xml_handler.js', 'head', '', -100000), true);
0 ignored issues
show
Unused Code introduced by
The call to Context::loadFile() has too many arguments starting with true.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
458
			$oContext->loadFile(array('./common/js/xml_js_filter.js', 'head', '', -100000), true);
0 ignored issues
show
Unused Code introduced by
The call to Context::loadFile() has too many arguments starting with true.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
459
			$oContext->loadFile(array('./common/css/xe.css', '', '', -1000000), true);
0 ignored issues
show
Unused Code introduced by
The call to Context::loadFile() has too many arguments starting with true.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
460
			$oContext->loadFile(array('./common/css/mobile.css', '', '', -1000000), true);
0 ignored issues
show
Unused Code introduced by
The call to Context::loadFile() has too many arguments starting with true.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
461
		}
462
		else
463
		{
464
			$oContext->loadFile(array('./common/js/jquery.min.js', 'head', '', -110000), true);
0 ignored issues
show
Unused Code introduced by
The call to Context::loadFile() has too many arguments starting with true.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
465
			$oContext->loadFile(array('./common/js/x.min.js', 'head', '', -100000), true);
0 ignored issues
show
Unused Code introduced by
The call to Context::loadFile() has too many arguments starting with true.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
466
			$oContext->loadFile(array('./common/js/xe.min.js', 'head', '', -100000), true);
0 ignored issues
show
Unused Code introduced by
The call to Context::loadFile() has too many arguments starting with true.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
467
			$oContext->loadFile(array('./common/css/xe.min.css', '', '', -1000000), true);
0 ignored issues
show
Unused Code introduced by
The call to Context::loadFile() has too many arguments starting with true.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
468
			$oContext->loadFile(array('./common/css/mobile.min.css', '', '', -1000000), true);
0 ignored issues
show
Unused Code introduced by
The call to Context::loadFile() has too many arguments starting with true.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
469
		}
470
	}
471
472
}
473
/* End of file HTMLDisplayHandler.class.php */
474
/* Location: ./classes/display/HTMLDisplayHandler.class.php */
475