admin/myblockform.php
check_browser_can_use_spaw accesses the super-global variable $_SERVER. Open
Open
function check_browser_can_use_spaw()
{
$browser = $_SERVER['HTTP_USER_AGENT'];
// check if msie
if (preg_match('/MSIE[^;]*/i', $browser, $msie)) {
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
Function check_browser_can_use_spaw
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
function check_browser_can_use_spaw()
{
$browser = $_SERVER['HTTP_USER_AGENT'];
// check if msie
if (preg_match('/MSIE[^;]*/i', $browser, $msie)) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 142 and the first side effect is on line 21. Open
Open
<?php
- Exclude checks
Blank line found at start of control structure Open
Open
if ($block['is_custom']) {
- Exclude checks
Only one argument is allowed per line in a multi-line function call Open
Open
$notice_for_tags = '<span style="font-size:x-small;font-weight:bold;">' . _AM_USEFULTAGS . '</span><br><span style="font-size:x-small;font-weight:normal;">' . sprintf(_AM_BLOCKTAG1, '{X_SITEURL}',
- Exclude checks
Line exceeds 120 characters; contains 124 characters Open
Open
$textarea = new XoopsFormDhtmlTextArea(_AM_CONTENT, 'bcontent', $myts->htmlSpecialChars($block['content']), 15, 70);
- Exclude checks
Line exceeds 120 characters; contains 194 characters Open
Open
$form->addElement(new XoopsFormLabel(_AM_CONTENT, '<a href="mytplsform.php?tpl_file=' . $btemplate2[0]->getVar('tpl_file') . '&tpl_tplset=default">' . _AM_EDITTPL . '</a>'));
- Exclude checks
Line exceeds 120 characters; contains 200 characters Open
Open
XOOPS_URL . '/') . '</span>';
- Exclude checks
Line exceeds 120 characters; contains 133 characters Open
Open
$uri_to_myself = XOOPS_URL . "/modules/blocksadmin/admin/admin.php?fct=blocksadmin&op=$current_op&bid={$block['bid']}";
- Exclude checks
Line exceeds 120 characters; contains 200 characters Open
Open
$notice_for_tags = '<span style="font-size:x-small;font-weight:bold;">' . _AM_USEFULTAGS . '</span><br><span style="font-size:x-small;font-weight:normal;">' . sprintf(_AM_BLOCKTAG1, '{X_SITEURL}',
- Exclude checks
Line exceeds 120 characters; contains 133 characters Open
Open
. htmlspecialchars($GLOBALS['xoopsConfig']['template_set'], ENT_QUOTES)
- Exclude checks
Closing parenthesis of a multi-line function call must be on a line by itself Open
Open
XOOPS_URL . '/') . '</span>';
- Exclude checks
Opening parenthesis of a multi-line function call must be the last content on the line Open
Open
$notice_for_tags = '<span style="font-size:x-small;font-weight:bold;">' . _AM_USEFULTAGS . '</span><br><span style="font-size:x-small;font-weight:normal;">' . sprintf(_AM_BLOCKTAG1, '{X_SITEURL}',
- Exclude checks
Multi-line function call not indented correctly; expected 4 spaces but found 171 Open
Open
XOOPS_URL . '/') . '</span>';
- Exclude checks