EXTRA/class/textsanitizer/gallery/MytsGallery.php
Method encode
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function encode($textarea_id)
{
\xoops_loadLanguage('extention', 'extgallery');
/* $code = "<img src='"
The parameter $textarea_id is not named in camelCase. Open
Open
public function encode($textarea_id)
{
\xoops_loadLanguage('extention', 'extgallery');
/* $code = "<img src='"
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
Avoid variables with short names like $ts. Configured minimum length is 3. Open
Open
public function load($ts)
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
There must be one blank line after the last USE statement; 7 found; Open
Open
use MyTextSanitizerExtension;
- Exclude checks
Line exceeds 120 characters; contains 257 characters Open
Open
$ts->replacements[] = '<a href="' . XOOPS_URL . '/modules/extgallery/hook-photo.php?id=\\5" rel="lightbox[\\4]" title="\\2" alt="\\2" target="_blank"><img src="' . XOOPS_URL . '/modules/extgallery/hook-thumb.php?id=\\5" title="\\2" alt="\\2" ></a>';
- Exclude checks
Line exceeds 120 characters; contains 141 characters Open
Open
. "'><span class='fa fa-file-image-o' aria-hidden='true'></span><span style='font-size:75%;'> Gallery</span></button>";
- Exclude checks
Line exceeds 120 characters; contains 133 characters Open
Open
$ts->patterns[] = "/\[gallery title=(['\"]?)([ a-zA-Z0-9]*)\\1 group=(['\"]?)([a-zA-Z0-9]*)\\3]([0-9]*)\[\/gallery\]/sU";
- Exclude checks
Line exceeds 120 characters; contains 215 characters Open
Open
$ts->replacements[] = '<a href="' . XOOPS_URL . '/modules/extgallery/hook-photo.php?id=\\1" rel="lightbox" target="_blank"><img src="' . XOOPS_URL . '/modules/extgallery/hook-thumb.php?id=\\1" alt="" ></a>';
- Exclude checks
Line exceeds 120 characters; contains 133 characters Open
Open
$ts->patterns[] = "/\[gallery group=(['\"]?)([a-zA-Z0-9]*)\\1 title=(['\"]?)([ a-zA-Z0-9]*)\\3]([0-9]*)\[\/gallery\]/sU";
- Exclude checks
Line exceeds 120 characters; contains 252 characters Open
Open
$ts->replacements[] = '<a href="' . XOOPS_URL . '/modules/extgallery/hook-photo.php?id=\\3" rel="lightbox" title="\\2" alt="\\2" target="_blank"><img src="' . XOOPS_URL . '/modules/extgallery/hook-thumb.php?id=\\3" alt="\\2" title="\\2" ></a>';
- Exclude checks
Line exceeds 120 characters; contains 257 characters Open
Open
$ts->replacements[] = '<a href="' . XOOPS_URL . '/modules/extgallery/hook-photo.php?id=\\5" rel="lightbox[\\2]" title="\\4" alt="\\4" target="_blank"><img src="' . XOOPS_URL . '/modules/extgallery/hook-thumb.php?id=\\5" title="\\4" alt="\\4" ></a>';
- Exclude checks
Line exceeds 120 characters; contains 220 characters Open
Open
$ts->replacements[] = '<a href="' . XOOPS_URL . '/modules/extgallery/hook-photo.php?id=\\3" rel="lightbox[\\2]" target="_blank"><img src="' . XOOPS_URL . '/modules/extgallery/hook-thumb.php?id=\\3" alt="" ></a>';
- Exclude checks
The variable $textarea_id is not named in camelCase. Open
Open
public function encode($textarea_id)
{
\xoops_loadLanguage('extention', 'extgallery');
/* $code = "<img src='"
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}