XXX found Open
// <th class='center width5'>".AM_ADSLIGHT_FORM_ACTION."XXX</th>
- Exclude checks
Similar blocks of code found in 2 locations. Consider refactoring. Open
if ($uploader->fetchMedia(Request::getArray('xoops_upload_file', '', 'POST')[0])) {
//$extension = preg_replace( '/^.+\.([^.]+)$/sU' , '' , $_FILES['attachedfile']['name']);
//$imgName = str_replace(' ', '', $_POST['img']).'.'.$extension;
$uploader->setPrefix('img_');
- Read upRead up
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 142.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
There must be one USE keyword per declaration Open
use XoopsModules\Adslight\{
- Exclude checks
There must be one blank line after the last USE statement; 0 found; Open
use XoopsModules\Adslight\{
- Exclude checks
Line exceeds 120 characters; contains 456 characters Open
// $fields = explode('|', cid:int:11::NOT NULL::primary:ID:0|pid:int:5:unsigned:NOT NULL:0::Parent:1|title:varchar:50::NOT NULL:::Title:2|cat_desc:text:200::NOT NULL:::Desc:3|cat_keywords:varchar:1000::NOT NULL:::Keywords:4|img:varchar:150::NOT NULL:default.png::Image:5|cat_order:int:5::NOT NULL:0::Order:6|affprice:int:5::NOT NULL:1::Price:7|cat_moderate:int:5::NOT NULL:1::CatModerator:8|moderate_subcat:int:5::NOT NULL:1::SubcatModerator:9);
- Exclude checks
Line exceeds 120 characters; contains 140 characters Open
$categoriesArray['cat_moderate'] = strip_tags(\XoopsUser::getUnameFromId($categoriesTempArray[$i]->getVar('cat_moderate')));
- Exclude checks
Line exceeds 120 characters; contains 146 characters Open
$categoriesArray['moderate_subcat'] = strip_tags(\XoopsUser::getUnameFromId($categoriesTempArray[$i]->getVar('moderate_subcat')));
- Exclude checks
Line exceeds 120 characters; contains 155 characters Open
<a href='categories.php?op=delete&cid=" . $i . "'><img src=" . $pathIcon16 . "/delete.png alt='" . _DELETE . "' title='" . _DELETE . "'></a>
- Exclude checks
Line exceeds 120 characters; contains 141 characters Open
XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['xoopsModule']->getVar('dirname') . '/templates/admin/adslight_admin_categories.tpl'
- Exclude checks
Line exceeds 120 characters; contains 150 characters Open
// <a href='categories.php?op=edit&cid=".$i."'><img src=".$pathIcon16."/edit.png alt='"._EDIT."' title='"._EDIT."'></a>
- Exclude checks
Line exceeds 120 characters; contains 158 characters Open
// <a href='categories.php?op=delete&cid=".$i."'><img src=".$pathIcon16."/delete.png alt='"._DELETE."' title='"._DELETE."'></a>
- Exclude checks
Line exceeds 120 characters; contains 187 characters Open
$categoriesArray['edit_delete'] = "<a href='categories.php?op=edit&cid=" . $i . "'><img src=" . $pathIcon16 . "/edit.png alt='" . _EDIT . "' title='" . _EDIT . "'></a>
- Exclude checks
Line exceeds 120 characters; contains 213 characters Open
xoops_confirm(['ok' => 1, 'cid' => Request::getString('cid', ''), 'op' => 'delete'], Request::getUrl('REQUEST_URI', '', 'SERVER'), sprintf(AM_ADSLIGHT_FORMSUREDEL, $categoriesObject->getVar('title')));
- Exclude checks
Line exceeds 120 characters; contains 186 characters Open
$categoriesArray['img'] = "<img src='" . $uploadUrl . $categoriesTempArray[$i]->getVar('img') . "' name='" . 'name' . "' id=" . 'id' . " alt='' style='max-width:100px'>";
- Exclude checks
Line exceeds 120 characters; contains 156 characters Open
<a href='categories.php?op=clone&cid=" . $i . "'><img src=" . $pathIcon16 . "/editcopy.png alt='" . _CLONE . "' title='" . _CLONE . "'></a>";
- Exclude checks
Line exceeds 120 characters; contains 137 characters Open
// $categoriesObj = $helper->getHandler('Categories')->getCategories($helper->getConfig('idxcat_perpage'), $startcategory, 0);
- Exclude checks