e107inc/e107

View on GitHub
e107_handlers/e_parse_class.php

Summary

Maintainability
F
5 days
Test Coverage
B
80%

File e_parse_class.php has 3508 lines of code (exceeds 2000 allowed). Consider refactoring.
Open

<?php
/*
* e107 website system
*
* Copyright (C) 2008-2016 e107 Inc (e107.org)
Severity: Major
Found in e107_handlers/e_parse_class.php - About 4 days to fix

    Avoid deeply nested control flow statements.
    Open

                                            if (strpos($lbrks, $matches[1][$i]) !== false)
                                            {
                                                break;
                                            }
    Severity: Major
    Found in e107_handlers/e_parse_class.php - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                                          if (strpos($lbrks, $sp[$i - 1]) !== false)
                                          {
                                              break;
                                          }
      Severity: Major
      Found in e107_handlers/e_parse_class.php - About 45 mins to fix

        Consider simplifying this complex logical expression.
        Open

                if (strpos($file, 'http') === 0)
                {
                    $path = $file;
                }
                elseif (strpos($file, 'e_MEDIA') !== false || strpos($file, 'e_THEME') !== false || strpos($file, 'e_PLUGIN') !== false || strpos($file, '{e_IMAGE}') !== false) //v2.x path.
        Severity: Major
        Found in e107_handlers/e_parse_class.php - About 40 mins to fix

          Avoid too many return statements within this method.
          Open

                          return $file;
          Severity: Major
          Found in e107_handlers/e_parse_class.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                    return $text;
            Severity: Major
            Found in e107_handlers/e_parse_class.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                                  return $thumb;
              Severity: Major
              Found in e107_handlers/e_parse_class.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                                return "<img class='img-responsive img-fluid' src='" . $thumbSrc . "' alt='" . LAN_YOUTUBE_PLAYLIST . "' style='width:" . vartrue($parm['w'], '80') . "px'/>";
                Severity: Major
                Found in e107_handlers/e_parse_class.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                              return '
                              <div class="video-responsive">
                              <video width="' . $width . '" height="' . $height . '" controls>
                                <source src="' . $file . '" type="' . $mime . '">
                          
                  Severity: Major
                  Found in e107_handlers/e_parse_class.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                return '<div class="' . $defClass . ' ' . vartrue($parm['class']) . '">' . $video . '</div>';
                    Severity: Major
                    Found in e107_handlers/e_parse_class.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                              return false;
                      Severity: Major
                      Found in e107_handlers/e_parse_class.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                    return '<div class="' . $defClass . ' ' . vartrue($parm['class']) . '">' . $video . '</div>';
                        Severity: Major
                        Found in e107_handlers/e_parse_class.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                          return e_IMAGE_ABS . 'generic/playlist_120.png';
                          Severity: Major
                          Found in e107_handlers/e_parse_class.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                            return '<div class="' . $defClass . ' video-thumbnail thumbnail">' . $video . '</div>';
                            Severity: Major
                            Found in e107_handlers/e_parse_class.php - About 30 mins to fix

                              Argument 1 (haystack) is false but \strpos() takes string
                              Open

                                          if (($this->isHtml($data)) && strpos($mod, 'no_html') === false)
                              Severity: Minor
                              Found in e107_handlers/e_parse_class.php by phan

                              Argument 1 (text) is ?array|?string|?string[] but \e_parse_shortcode::parseCodes() takes string defined at /code/e107_handlers/shortcode_handler.php:817
                              Open

                                      return e107::getScParser()->parseCodes($text, $parseSCFiles, $extraCodes, $eVars);
                              Severity: Minor
                              Found in e107_handlers/e_parse_class.php by phan

                              Argument 1 (text) is null but \e_parse_shortcode::parseCodes() takes string defined at /code/e107_handlers/shortcode_handler.php:817
                              Open

                                      return e107::getScParser()->parseCodes($text, $parseSCFiles, $extraCodes, $eVars);
                              Severity: Minor
                              Found in e107_handlers/e_parse_class.php by phan

                              Argument 2 (subject) is string[] but \preg_split() takes string
                              Open

                                      $content = preg_split('#(<.*?' . '>)#mis', $str, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
                              Severity: Minor
                              Found in e107_handlers/e_parse_class.php by phan

                              Argument 2 (needle) is '&' but \e_parse::ustrrpos() takes int defined at /code/e107_handlers/e_parse_class.php:436
                              Open

                                      $leftAmp = $this->ustrrpos($this->usubstr($ret, -8), '&');
                              Severity: Minor
                              Found in e107_handlers/e_parse_class.php by phan

                              Suspicious type \Returns of a variable or expression used to build a string. (Expected type to be able to cast to a string)
                              Open

                                          $html = '<html><body>' . $html . '</body></html>';
                              Severity: Minor
                              Found in e107_handlers/e_parse_class.php by phan

                              Invalid offset "mode" of array type array{}
                              Open

                                      $mode = varset($parm['mode'], false); // tag, url
                              Severity: Minor
                              Found in e107_handlers/e_parse_class.php by phan

                              Argument 3 (subject) is ?array|?string|?string[]|?true but \str_replace() takes array|string
                              Open

                                      $text = str_replace("\n\n\n", "\n\n", $text);
                              Severity: Minor
                              Found in e107_handlers/e_parse_class.php by phan

                              Returning type null but thumbDimensions() is declared to return string
                              Open

                                      return null;
                              Severity: Minor
                              Found in e107_handlers/e_parse_class.php by phan

                              Returning type false but thumbUrlSEF() is declared to return string
                              Open

                                          return false;
                              Severity: Minor
                              Found in e107_handlers/e_parse_class.php by phan

                              Invalid offset "w" of array type array{}
                              Open

                                          $width = varset($parm['w'], 320);
                              Severity: Minor
                              Found in e107_handlers/e_parse_class.php by phan

                              Returning type null but toDate() is declared to return string
                              Open

                                          return null;
                              Severity: Minor
                              Found in e107_handlers/e_parse_class.php by phan

                              Invalid offset "default" of array type array{}
                              Open

                                          foreach ($this->allowedAttributes['default'] as $def)
                              Severity: Minor
                              Found in e107_handlers/e_parse_class.php by phan

                              Argument 1 (text) is ?array|?string but \e_parse_shortcode::parseCodes() takes string defined at /code/e107_handlers/shortcode_handler.php:817
                              Open

                                      return e107::getScParser()->parseCodes($text, $parseSCFiles, $extraCodes, $eVars);
                              Severity: Minor
                              Found in e107_handlers/e_parse_class.php by phan

                              Argument 2 (needle) is ' ' but \e_parse::ustrrpos() takes int defined at /code/e107_handlers/e_parse_class.php:436
                              Open

                                          $spacepos = $this->ustrrpos($truncate, ' ');
                              Severity: Minor
                              Found in e107_handlers/e_parse_class.php by phan

                              Argument 6 (postID) is string but \e_parse::processModifiers() takes int defined at /code/e107_handlers/e_parse_class.php:5611
                              Open

                                                      $sub_blk = $this->processModifiers($opts, $sub_blk, $convertNL, $parseBB, $modifiers, $postID);
                              Severity: Minor
                              Found in e107_handlers/e_parse_class.php by phan

                              Reference to undeclared constant \e_HTTP_STATIC
                              Open

                                          $this->staticUrl = e_HTTP_STATIC;
                              Severity: Minor
                              Found in e107_handlers/e_parse_class.php by phan

                              Argument 2 (options) is string but \e_parse::thumbUrl() takes array defined at /code/e107_handlers/e_parse_class.php:2531
                              Open

                                      $genericImg = $tp->thumbUrl($genericFile, 'w=' . $width . '&h=' . $height, true, $full);
                              Severity: Minor
                              Found in e107_handlers/e_parse_class.php by phan

                              Argument 1 (options) is null but \debug_backtrace() takes bool|int
                              Open

                                              $log->addDebug('Broken Icon Path: ' . $icon . "\n" . print_r(debug_backtrace(null, 2), true), false)->save('IMALAN_00');
                              Severity: Minor
                              Found in e107_handlers/e_parse_class.php by phan

                              Invalid offset "class" of array type array{}
                              Open

                                          return '<div class="' . $defClass . ' ' . vartrue($parm['class']) . '">' . $video . '</div>';
                              Severity: Minor
                              Found in e107_handlers/e_parse_class.php by phan

                              Invalid offset "class" of array type array{}
                              Open

                                          return '<div class="' . $defClass . ' ' . vartrue($parm['class']) . '">' . $video . '</div>';
                              Severity: Minor
                              Found in e107_handlers/e_parse_class.php by phan

                              Invalid offset "mime" of array type array{}
                              Open

                                          $mime = varset($parm['mime'], 'video/mp4');
                              Severity: Minor
                              Found in e107_handlers/e_parse_class.php by phan

                              Argument 3 (subject) is ?array|?string|?string[]|?true but \str_replace() takes array|string
                              Open

                                          $text = str_replace(E_NL, $nl_replace, $text);
                              Severity: Minor
                              Found in e107_handlers/e_parse_class.php by phan

                              Argument 1 (text) is array but \e_parse_shortcode::parseCodes() takes string defined at /code/e107_handlers/shortcode_handler.php:817
                              Open

                                      return e107::getScParser()->parseCodes($text, $parseSCFiles, $extraCodes, $eVars);
                              Severity: Minor
                              Found in e107_handlers/e_parse_class.php by phan

                              Argument 2 (mode) is 'mix' but \e_parse::createConstants() takes int defined at /code/e107_handlers/e_parse_class.php:3255
                              Open

                                          $url = $this->createConstants($url, 'mix');
                              Severity: Minor
                              Found in e107_handlers/e_parse_class.php by phan

                              Invalid offset "mime" of array type array{}
                              Open

                                      $mime = varset($parm['mime'], 'audio/mpeg');
                              Severity: Minor
                              Found in e107_handlers/e_parse_class.php by phan

                              Suspicious array access to ?float|?int|?mixed|?string
                              Open

                                              'type'     => $parm['type'],
                              Severity: Minor
                              Found in e107_handlers/e_parse_class.php by phan

                              Argument 2 (subject) is ?array|?string|?string[]|?true but \preg_match_all() takes string
                              Open

                                      preg_match_all('#<[^>]+>#', $text, $tags);
                              Severity: Minor
                              Found in e107_handlers/e_parse_class.php by phan

                              Returning type null but setMultibyte() is declared to return void
                              Open

                                          return null;
                              Severity: Minor
                              Found in e107_handlers/e_parse_class.php by phan

                              Argument 2 (options) is string but \e_parse::thumbUrl() takes array defined at /code/e107_handlers/e_parse_class.php:2531
                              Open

                                              $url = $tp->thumbUrl($file, 'w=' . $width . '&h=' . $height . '&crop=' . $crop, false, $full);
                              Severity: Minor
                              Found in e107_handlers/e_parse_class.php by phan

                              Returning type null but toImage() is declared to return string
                              Open

                                              return null;
                              Severity: Minor
                              Found in e107_handlers/e_parse_class.php by phan

                              Argument 2 (needle) is int but \mb_strrpos() takes string
                              Open

                                          return mb_strrpos($haystack, $needle, $offset);
                              Severity: Minor
                              Found in e107_handlers/e_parse_class.php by phan

                              Returning type null but toImage() is declared to return string
                              Open

                                          return null;
                              Severity: Minor
                              Found in e107_handlers/e_parse_class.php by phan

                              Assigning false to property but \e_parse->multibyte is int
                              Open

                                  private $multibyte = false; // previously $utfAction
                              Severity: Minor
                              Found in e107_handlers/e_parse_class.php by phan

                              Argument 2 (needle) is int but \mb_strpos() takes string
                              Open

                                          return mb_strpos($haystack, $needle, $offset);
                              Severity: Minor
                              Found in e107_handlers/e_parse_class.php by phan

                              Call to deprecated function \e_parse::html_truncate() defined at /code/e107_handlers/e_parse_class.php:1183
                              Open

                                          return $this->html_truncate($text, $length, $ending);
                              Severity: Minor
                              Found in e107_handlers/e_parse_class.php by phan

                              Argument 2 (options) is string but \e_parse::thumbCacheFile() takes array defined at /code/e107_handlers/e_parse_class.php:2299
                              Open

                                          $staticFile = $this->thumbCacheFile($url, $opts);
                              Severity: Minor
                              Found in e107_handlers/e_parse_class.php by phan

                              Argument 3 (subject) is ?array|?string|?string[]|?true but \preg_replace() takes array|string
                              Open

                                      $text = preg_replace('#<[^>]+>#', '<|>', $text);
                              Severity: Minor
                              Found in e107_handlers/e_parse_class.php by phan

                              Invalid offset "h" of array type array{}
                              Open

                                          $height = varset($parm['h'], 240);
                              Severity: Minor
                              Found in e107_handlers/e_parse_class.php by phan

                              Suspicious array access to ?float|?int|?mixed|?string
                              Open

                                              'field'    => $parm['field']
                              Severity: Minor
                              Found in e107_handlers/e_parse_class.php by phan

                              Returning type string[] but htmlwrap() is declared to return string
                              Open

                                          return $str;
                              Severity: Minor
                              Found in e107_handlers/e_parse_class.php by phan

                              Saw possibly unextractable annotation for a fragment of comment '* @param string': after string, did not see an element name (will guess based on comment order)
                              Open

                                   * @param string
                              Severity: Info
                              Found in e107_handlers/e_parse_class.php by phan

                              Invalid offset "w" of array type array{}
                              Open

                                              return "<img class='img-responsive img-fluid' src='" . $thumbSrc . "' alt='Youtube Video' style='width:" . vartrue($parm['w'], '80') . "px'/>";
                              Severity: Minor
                              Found in e107_handlers/e_parse_class.php by phan

                              null passed to foreach instead of array
                              Open

                                          foreach ($this->allowedAttributes['default'] as $def)
                              Severity: Minor
                              Found in e107_handlers/e_parse_class.php by phan

                              Call to deprecated function \e_parse::text_truncate() defined at /code/e107_handlers/e_parse_class.php:1286
                              Open

                                      return $this->text_truncate($text, $length, $ending);
                              Severity: Minor
                              Found in e107_handlers/e_parse_class.php by phan

                              Returning type null but toImage() is declared to return string
                              Open

                                          return null;
                              Severity: Minor
                              Found in e107_handlers/e_parse_class.php by phan

                              Invalid offset "w" of array type array{}
                              Open

                                              return "<img class='img-responsive img-fluid' src='" . $thumbSrc . "' alt='" . LAN_YOUTUBE_PLAYLIST . "' style='width:" . vartrue($parm['w'], '80') . "px'/>";
                              Severity: Minor
                              Found in e107_handlers/e_parse_class.php by phan

                              Default value for bool $posted can't be string
                              Open

                                  public function toEmail($text, $posted = '', $mods = 'parse_sc, no_make_clickable')
                              Severity: Minor
                              Found in e107_handlers/e_parse_class.php by phan

                              When fetching an array index from a value of type array{0:'x',1:'y',2:'z'}, found an array index of type string, but expected the index to be of type int
                              Open

                                              $k = $defaults[$k];
                              Severity: Minor
                              Found in e107_handlers/e_parse_class.php by phan

                              Argument 2 (options) is string but \e_parse::thumbUrl() takes array defined at /code/e107_handlers/e_parse_class.php:2531
                              Open

                                                  $url = $tp->thumbUrl($file, 'w=' . $width . '&h=' . $height . '&crop=' . $crop, false, $full);
                              Severity: Minor
                              Found in e107_handlers/e_parse_class.php by phan

                              Invalid offset "thumb" of array type array{}
                              Open

                                      $thumb = vartrue($parm['thumb']);
                              Severity: Minor
                              Found in e107_handlers/e_parse_class.php by phan

                              There are no issues that match your filters.

                              Category
                              Status