XoopsModules25x/apcal

View on GitHub
admin/myblockform.php

Summary

Maintainability
A
1 hr
Test Coverage

check_browser_can_use_spaw accesses the super-global variable $_SERVER.
Open

function check_browser_can_use_spaw()
{
    $browser = $_SERVER['HTTP_USER_AGENT'];
    // check if msie
    if (preg_match('/MSIE[^;]*/i', $browser, $msie)) {
Severity: Minor
Found in admin/myblockform.php by phpmd

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

function check_browser_can_use_spaw()
{
    $browser = $_SERVER['HTTP_USER_AGENT'];
    // check if msie
    if (preg_match('/MSIE[^;]*/i', $browser, $msie)) {
Severity: Minor
Found in admin/myblockform.php - About 1 hr to fix

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

<?php
Severity: Minor
Found in admin/myblockform.php by phpcodesniffer

Blank line found at start of control structure
Open

if ($block['is_custom']) {
Severity: Minor
Found in admin/myblockform.php by phpcodesniffer

Only one argument is allowed per line in a multi-line function call
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}',
Severity: Minor
Found in admin/myblockform.php by phpcodesniffer

Line exceeds 120 characters; contains 124 characters
Open

        $textarea = new XoopsFormDhtmlTextArea(_AM_CONTENT, 'bcontent', $myts->htmlSpecialChars($block['content']), 15, 70);
Severity: Minor
Found in admin/myblockform.php by phpcodesniffer

Line exceeds 120 characters; contains 194 characters
Open

                $form->addElement(new XoopsFormLabel(_AM_CONTENT, '<a href="mytplsform.php?tpl_file=' . $btemplate2[0]->getVar('tpl_file') . '&amp;tpl_tplset=default">' . _AM_EDITTPL . '</a>'));
Severity: Minor
Found in admin/myblockform.php by phpcodesniffer

Line exceeds 120 characters; contains 200 characters
Open

                                                                                                                                                                           XOOPS_URL . '/') . '</span>';
Severity: Minor
Found in admin/myblockform.php by phpcodesniffer

Line exceeds 120 characters; contains 133 characters
Open

    $uri_to_myself   = XOOPS_URL . "/modules/blocksadmin/admin/admin.php?fct=blocksadmin&amp;op=$current_op&amp;bid={$block['bid']}";
Severity: Minor
Found in admin/myblockform.php by phpcodesniffer

Line exceeds 120 characters; contains 200 characters
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}',
Severity: Minor
Found in admin/myblockform.php by phpcodesniffer

Line exceeds 120 characters; contains 133 characters
Open

                                                              . htmlspecialchars($GLOBALS['xoopsConfig']['template_set'], ENT_QUOTES)
Severity: Minor
Found in admin/myblockform.php by phpcodesniffer

Closing parenthesis of a multi-line function call must be on a line by itself
Open

                                                                                                                                                                           XOOPS_URL . '/') . '</span>';
Severity: Minor
Found in admin/myblockform.php by phpcodesniffer

Opening parenthesis of a multi-line function call must be the last content on the line
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}',
Severity: Minor
Found in admin/myblockform.php by phpcodesniffer

Multi-line function call not indented correctly; expected 4 spaces but found 171
Open

                                                                                                                                                                           XOOPS_URL . '/') . '</span>';
Severity: Minor
Found in admin/myblockform.php by phpcodesniffer

There are no issues that match your filters.

Category
Status