XoopsModules25x/news

View on GitHub

Showing 236 of 310 total issues

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

function news_CreateMetaDatas($story = null): void
{
    global $xoopsConfig, $xoTheme, $xoopsTpl;
    $content = '';
    $myts    = \MyTextSanitizer::getInstance();
Severity: Major
Found in include/functions.php - About 2 hrs to fix

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

        public static function truncateHtml($text, $length = 100, $ending = '...', $exact = false, $considerHtml = true)
        {
            if ($considerHtml) {
                // if the plain text is shorter than the maximum length, return the whole text
                if (mb_strlen(\preg_replace('/<.*?' . '>/', '', $text)) <= $length) {
    Severity: Major
    Found in class/Common/SysUtility.php - About 2 hrs to fix

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

      function newSubmissions(): void
      {
          global $dateformat, $pathIcon16;
          $start       = Request::getInt('startnew', 0, 'GET');
          $newsubcount = NewsStory::getAllStoriesCount(3, false);
      Severity: Major
      Found in admin/index.php - About 2 hrs to fix

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

        function b_news_archives_edit($options)
        {
            global $xoopsDB;
            $syear    = $smonth = $eyear = $emonth = $older = $recent = 0;
            $selsyear = $selsmonth = $seleyear = $selemonth = 0;
        Severity: Major
        Found in blocks/news_archives.php - About 2 hrs to fix

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

              public static function createMetaDatas($story = null): void
              {
                  global $xoopsConfig, $xoTheme, $xoopsTpl;
                  $content = '';
                  $myts    = MyTextSanitizer::getInstance();
          Severity: Major
          Found in class/Utility.php - About 2 hrs to fix

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

            function b_news_topicsnav_show($options)
            {
                /** @var Helper $helper */
                if (!class_exists(Helper::class)) {
                    return false;
            Severity: Minor
            Found in blocks/news_topicsnav.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 getBigStory has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

                public function getBigStory(
                    $limit = 0,
                    $start = 0,
                    $checkRight = false,
                    $topic = 0,
            Severity: Minor
            Found in class/NewsStory.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

            XoopsTopic has 22 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class XoopsTopic
            {
                public $db;
                public $table;
                public $topic_id;
            Severity: Minor
            Found in class/XoopsTopic.php - About 2 hrs to fix

              Files has 22 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class Files
              {
                  public $db;
                  public $table;
                  public $fileid;
              Severity: Minor
              Found in class/Files.php - About 2 hrs to fix

                Method news_getWysiwygForm has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function news_getWysiwygForm($caption, $name, $value = '', $width = '100%', $height = '400px', $supplemental = '')
                {
                    $editor_option            = \mb_strtolower(news_getmoduleoption('form_options'));
                    $editor                   = false;
                    $editor_configs           = [];
                Severity: Major
                Found in include/functions.php - About 2 hrs to fix

                  Method getMetagen has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function getMetagen(): void
                  {
                      require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
                      global $xoopsModule, $xoopsConfig, $cfg;
                      $helper = Helper::getInstance();
                  Severity: Major
                  Found in admin/index.php - About 2 hrs to fix

                    Method b_news_randomnews_show has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function b_news_randomnews_show($options)
                    {
                        /** @var Helper $helper */
                        if (!class_exists(Helper::class)) {
                            return false;
                    Severity: Major
                    Found in blocks/news_randomnews.php - About 2 hrs to fix

                      Method getWysiwygForm has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public static function getWysiwygForm($caption, $name, $value = '', $width = '100%', $height = '400px', $supplemental = '')
                          {
                              $editor_option            = \mb_strtolower(static::getModuleOption('form_options'));
                              $editor                   = false;
                              $editor_configs           = [];
                      Severity: Major
                      Found in class/Utility.php - About 2 hrs to fix

                        Method getRandomNews has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function getRandomNews(
                                $limit = 0,
                                $start = 0,
                                $checkRight = false,
                                $topic = 0,
                        Severity: Major
                        Found in class/NewsStory.php - About 2 hrs to fix

                          Method getAllPublished has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public static function getAllPublished(
                                  $limit = 0,
                                  $start = 0,
                                  $checkRight = false,
                                  $topic = 0,
                          Severity: Major
                          Found in class/NewsStory.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): void
                                {
                                    \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

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

                            function launchNewsletter(): void
                            {
                                global $xoopsConfig, $dateformat;
                                xoops_cp_header();
                                $adminObject = Admin::getInstance();
                            Severity: Minor
                            Found in admin/index.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

                            Method xoops_module_update_news has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            function xoops_module_update_news(\XoopsModule $module, $previousVersion = null)
                            {
                                $moduleDirName      = \basename(\dirname(__DIR__));
                                $moduleDirNameUpper = \mb_strtoupper($moduleDirName);
                            
                            
                            Severity: Major
                            Found in include/onupdate.php - About 2 hrs to fix

                              Method expStories has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              function expStories(): void
                              {
                                  global $dateformat, $pathIcon16;
                                  $start        = Request::getInt('startexp', 0, 'GET');
                                  $expiredcount = NewsStory::getAllStoriesCount(1, false);
                              Severity: Major
                              Found in admin/index.php - About 2 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language