mambax7/publisher

View on GitHub

Showing 3,032 of 3,032 total issues

File CategoryHandler.php has 272 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php declare(strict_types=1);

namespace XoopsModules\Publisher;

/*
Severity: Minor
Found in class/CategoryHandler.php - About 2 hrs to fix

    Function showThumb has 63 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

                function showThumb(i, transition) {
    
                    // optional parameters
                    transition = transition || false;
                    i = i || cur;
    Severity: Major
    Found in assets/js/jquery.popeye-2.1.js - About 2 hrs to fix

      Method truncateHtml has 63 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function truncateHtml(
              string $text,
              ?int $length = 100,
              string $ending = '...',
              bool $exact = false,
      Severity: Major
      Found in class/Common/SysUtility.php - About 2 hrs to fix

        Method generateSeoTitle has 63 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function generateSeoTitle($title = '', $withExt = true)
            {
                // Transformation de la chaine en minuscule
                // Codage de la chaine afin d'éviter les erreurs 500 en cas de caractères imprévus
                $title = \rawurlencode(\mb_strtolower($title));
        Severity: Major
        Found in class/Metagen.php - About 2 hrs to fix

          Method ratingBar has 63 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function ratingBar($itemId)
              {
                  $helper          = Helper::getInstance();
                  $ratingUnitWidth = 30;
                  $units           = 5;
          Severity: Major
          Found in class/Utility.php - About 2 hrs to fix

            Function add has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function add(): void
                {
                    $helper = Helper::getInstance();
                    /** @var MimetypeHandler $mimetypeHandler */
                    $mimetypeHandler = $helper->getHandler('Mimetype');
            Severity: Minor
            Found in class/MimetypesUtility.php - About 2 hrs 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

            Function deleteDirectory has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function deleteDirectory($src)
                {
                    // Only continue if user is a 'global' Admin
                    if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) {
                        return false;
            Severity: Minor
            Found in class/Common/FilesManagement.php - About 2 hrs 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

            Function getBody has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

                public function getBody($maxLength = 0, $format = 'S', $stripTags = '')
                {
                    $ret     = $this->getVar('body', $format);
                    $wrapPos = \mb_strpos($ret, self::PAGEWRAP);
                    if (!(false === $wrapPos)) {
            Severity: Minor
            Found in class/Item.php - About 2 hrs 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

            File ThemeTabForm.php has 265 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php declare(strict_types=1);
            
            namespace XoopsModules\Publisher\Form;
            
            /*
            Severity: Minor
            Found in class/Form/ThemeTabForm.php - About 2 hrs to fix

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                          if ($arrArticle['htmlpage']) {
                              $pagewrap_filename = $GLOBALS['xoops']->path('modules/wfsection/html/' . $arrArticle['htmlpage']);
                              if (file_exists($pagewrap_filename)) {
                                  if (copy($pagewrap_filename, PUBLISHER_UPLOAD_PATH . '/content/' . $arrArticle['htmlpage'])) {
                                      $itemObj->setVar('body', '[pagewrap=' . $arrArticle['htmlpage'] . ']');
              Severity: Major
              Found in admin/import/wfsection.php and 1 other location - About 2 hrs to fix
              admin/import/xfsection.php on lines 192..200

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 128.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                          if ($arrArticle['htmlpage']) {
                              $pagewrap_filename = $GLOBALS['xoops']->path('modules/xfsection/html/' . $arrArticle['htmlpage']);
                              if (file_exists($pagewrap_filename)) {
                                  if (copy($pagewrap_filename, PUBLISHER_UPLOAD_PATH . '/content/' . $arrArticle['htmlpage'])) {
                                      $itemObj->setVar('body', '[pagewrap=' . $arrArticle['htmlpage'] . ']');
              Severity: Major
              Found in admin/import/xfsection.php and 1 other location - About 2 hrs to fix
              admin/import/wfsection.php on lines 194..202

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 128.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Method publisher_search has 58 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function publisher_search($queryArray, $andor, $limit, $offset, $userid, $categories = [], $sortby = 0, $searchin = '', $extra = '')
              {
                  $helper        = Helper::getInstance();
                  $ret           = $item = [];
                  $hightlightKey = '';
              Severity: Major
              Found in include/search.inc.php - About 2 hrs to fix

                Method smarty_modifier_rewrite_url has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function smarty_modifier_rewrite_url($url, $insert_param, $param_value = null, $remove_params_arr = '')
                {
                    //parse $insert_param if it is a query string
                    if (preg_match('/.+=([\w%,-])*/', $insert_param)) {
                        parse_str($insert_param, $insert_arr);
                Severity: Major
                Found in extra/modifier.rewrite_url.php - About 2 hrs to fix

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                      for (var i = (len - 1); i >= 0; i--) {
                          if ((destList.options[i] != null) && (destList.options[i].selected == true)) {
                              destList.options[i] = null;
                          }
                      }
                  Severity: Major
                  Found in assets/js/funcs.js and 1 other location - About 2 hrs to fix
                  assets/js/funcs.js on lines 119..123

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 81.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                      for (var i = maxCnt - 1; i >= 0; i--) {
                          if ((sourceList.options[i] != null) && (sourceList.options[i].selected == true)) {
                              sourceList.options[i] = null;
                          }
                      }
                  Severity: Major
                  Found in assets/js/funcs.js and 1 other location - About 2 hrs to fix
                  assets/js/funcs.js on lines 77..81

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 81.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 3 locations. Consider refactoring.
                  Open

                              case Constants::PUBLISHER_STATUS_PUBLISHED:
                                  $statustxt = _CO_PUBLISHER_PUBLISHED;
                                  $approve   = '';
                                  $modify    = "<a href='item.php?op=mod&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons['edit'] . '</a>&nbsp;';
                                  $delete    = "<a href='item.php?op=del&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons['delete'] . '</a>&nbsp;';
                  Severity: Major
                  Found in admin/main.php and 2 other locations - About 2 hrs to fix
                  admin/main.php on lines 266..273
                  admin/main.php on lines 274..280

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 127.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 3 locations. Consider refactoring.
                  Open

                              case Constants::PUBLISHER_STATUS_OFFLINE:
                                  $statustxt = _CO_PUBLISHER_OFFLINE;
                                  $approve   = '';
                                  $modify    = "<a href='item.php?op=mod&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons['edit'] . '</a>&nbsp;';
                                  $delete    = "<a href='item.php?op=del&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons['delete'] . '</a>&nbsp;';
                  Severity: Major
                  Found in admin/main.php and 2 other locations - About 2 hrs to fix
                  admin/main.php on lines 259..265
                  admin/main.php on lines 274..280

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 127.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 3 locations. Consider refactoring.
                  Open

                              case Constants::PUBLISHER_STATUS_REJECTED:
                                  $statustxt = _CO_PUBLISHER_REJECTED;
                                  $approve   = '';
                                  $modify    = "<a href='item.php?op=mod&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons['rejectededit'] . '</a>&nbsp;';
                                  $delete    = "<a href='item.php?op=del&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons['delete'] . '</a>&nbsp;';
                  Severity: Major
                  Found in admin/main.php and 2 other locations - About 2 hrs to fix
                  admin/main.php on lines 259..265
                  admin/main.php on lines 266..273

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 127.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  File item.php has 261 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  <?php declare(strict_types=1);
                  /*
                   You may not change or alter any portion of this comment or credits
                   of supporting developers from this source code or any supporting source code
                   which is considered copyrighted (c) material of the original comment or credit authors.
                  Severity: Minor
                  Found in item.php - About 2 hrs to fix

                    Function render has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function render(?array $block = null)
                        {
                            \xoops_load('XoopsFormLoader');
                            \xoops_loadLanguage('common', $this->moduleDirNameUpper);
                    
                    
                    Severity: Minor
                    Found in class/Common/Blocksadmin.php - About 2 hrs 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

                    Severity
                    Category
                    Status
                    Source
                    Language