Skip to content

Commit c30da62

Browse files
authored
Merge pull request #148 from ggoffy/master
code cleaning
2 parents 123922d + a9dd00d commit c30da62

80 files changed

Lines changed: 235 additions & 213 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

_TODO.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,16 @@ rate.php:
2525
this file currently is not rating
2626

2727

28+
29+
30+
*****************************
31+
Open questions:
32+
***************
33+
Addfiles:
34+
are the files class/Addfiles.php and Addfileshandler.php still needed?
35+
2836
search.php:
37+
what should this file do, additionally to regular search?
2938
UserSearch has to be adapted
3039

3140

class/AddFilesHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ public function getAllAddFilesByModuleId($modId, $start = 0, $limit = 0, $sort =
149149
* @param $limit
150150
* @param $sort
151151
* @param $order
152-
* @return
152+
* @return mixed
153153
*/
154154
private function getAddFilesCriteria($criteriaAddFiles, $start, $limit, $sort, $order)
155155
{

class/Common/Resizer.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,10 @@ public function resizeImage()
5454
return 'Unsupported format';
5555
}
5656

57-
$width = imagesx($img);
58-
$height = imagesy($img);
57+
$width = imagesx($img);
58+
$height = imagesy($img);
59+
$new_width = 0;
60+
$new_height = 0;
5961

6062
if ($width > $this->maxWidth || $height > $this->maxHeight) {
6163
// recalc image size based on this->maxWidth/this->maxHeight

class/Common/VersionChecks.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ trait VersionChecks
2323
* Verifies XOOPS version meets minimum requirements for this module
2424
* @static
2525
*
26+
* @param \XoopsModule|null $module
2627
* @param null|string $requiredVer
2728
* @return bool true if meets requirements, false if not
2829
*/
@@ -55,6 +56,7 @@ public static function checkVerXoops(\XoopsModule $module = null, $requiredVer =
5556
* Verifies PHP version meets minimum requirements for this module
5657
* @static
5758
*
59+
* @param \XoopsModule|null $module
5860
* @return bool true if meets requirements, false if not
5961
*/
6062
public static function checkVerPhp(\XoopsModule $module = null)

class/FieldElementsHandler.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,8 @@ private function getFieldElementsCriteria($crFieldElemsCriteria, $start, $limit,
138138
public function getFieldElementsList($crFieldElemsCriteria, $start = 0, $limit = 0, $sort = 'fieldelement_sort', $order = 'ASC')
139139
{
140140
$crFieldElems = $this->getFieldElementsCriteria($crFieldElemsCriteria, $start, $limit, $sort, $order);
141-
$fieldeleArr = $this->getAll($crFieldElems);
141+
$fieldeleArr = $this->getAll($crFieldElems);
142+
$fieldele = [];
142143
foreach (array_keys($fieldeleArr) as $i) {
143144
$stuFeName = mb_strtoupper($fieldeleArr[$i]->getVar('fieldelement_name'));
144145
if (1 == $i) {

class/Fields.php

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,10 @@ public static function getInstance()
9797
* @private function getHeaderForm
9898
*
9999
* @param bool $action
100+
* @param $prefix
100101
* @return Tdmcreate\Form\ThemeForm
101102
*/
102-
private function getHeaderForm($action = false, $prefix)
103+
private function getHeaderForm($prefix, $action = false)
103104
{
104105
if (false === $action) {
105106
$action = \Xmf\Request::getString('REQUEST_URI', '', 'SERVER');
@@ -113,7 +114,7 @@ private function getHeaderForm($action = false, $prefix)
113114

114115
// New Object HtmlTable
115116
$form->addElement(new Tdmcreate\Html\FormLabel(str_replace('%s', $prefix, _AM_TDMCREATE_FIELD_RECOMMENDED)));
116-
$form->addElement(new Tdmcreate\Html\FormLabel('<table cellspacing="1" class="outer width100">'));
117+
$form->addElement(new Tdmcreate\Html\FormLabel('<table style="border-spacing:5px;" class="outer width100">'));
117118
$form->addElement(new Tdmcreate\Html\FormLabel('<thead class="center">'));
118119
$form->addElement(new Tdmcreate\Html\FormLabel('<tr class="head"><th colspan="10">' . $title . '</th></tr>'));
119120
$form->addElement(new Tdmcreate\Html\FormLabel('<tr class="head width5">'));
@@ -147,11 +148,11 @@ public function getFormNew($fieldMid = null, $fieldTid = null, $fieldNumb = null
147148
{
148149
$helper = Tdmcreate\Helper::getInstance();
149150
// Get handler tables
150-
$tableObj = $helper->getHandler('Tables');
151+
$tableObj = $helper->getHandler('Tables');
151152
// Header function class
152153
$fieldsForm = self::getInstance();
153154
$prefix = $tableObj->get($fieldTid)->getVar('table_fieldname');
154-
$form = $fieldsForm->getHeaderForm($action, $prefix);
155+
$form = $fieldsForm->getHeaderForm($prefix, $action);
155156
$tableAutoincrement = $tableObj->get($fieldTid)->getVar('table_autoincrement');
156157
// Loop for fields number
157158
$class = 'even';
@@ -320,13 +321,13 @@ private function getFormNewLine($form, $class, $i, $fieldMid, $fieldTid, $fName,
320321
*/
321322
public function getFormEdit($fieldMid = null, $fieldTid = null, $action = false)
322323
{
323-
$helper = Tdmcreate\Helper::getInstance();
324-
$tablesHandler = $helper->getHandler('Tables');
325-
$tables = $tablesHandler->get($fieldTid);
326-
$prefix = $tables->getVar('table_fieldname');
324+
$helper = Tdmcreate\Helper::getInstance();
325+
$tablesHandler = $helper->getHandler('Tables');
326+
$tables = $tablesHandler->get($fieldTid);
327+
$prefix = $tables->getVar('table_fieldname');
327328
// Header function class
328329
$fieldsForm = self::getInstance();
329-
$form = $fieldsForm->getHeaderForm($action, $prefix);
330+
$form = $fieldsForm->getHeaderForm($prefix, $action);
330331

331332
$class = 'even';
332333
$tableAutoincrement = $tables->getVar('table_autoincrement');

class/Files/Admin/AdminHeader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ public function render()
158158
$module = $this->getModule();
159159
$filename = $this->getFileName();
160160
$moduleDirname = $module->getVar('mod_dirname');
161-
$content = $this->getHeaderFilesComments($module, $filename);
161+
$content = $this->getHeaderFilesComments($module);
162162
$content .= $this->getAdminHeader($moduleDirname);
163163

164164
$this->create($moduleDirname, 'admin', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED);

class/Files/Admin/AdminIndex.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ public function render()
159159
$module = $this->getModule();
160160
$moduleDirname = $module->getVar('mod_dirname');
161161
$filename = $this->getFileName();
162-
$content = $this->getHeaderFilesComments($module, $filename);
162+
$content = $this->getHeaderFilesComments($module);
163163
$content .= $this->getAdminIndex($module);
164164

165165
$this->create($moduleDirname, 'admin', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED);

class/Files/Admin/AdminMenu.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,8 @@ public function write($module, $filename)
6868

6969
/**
7070
* @private function getAdminMenuArray
71-
* @param $param
72-
* @param $adminObject
73-
* @param $ref
74-
*
71+
* @param array $param
72+
* @param bool $adminObject
7573
* @return string
7674
*/
7775
private function getAdminMenuArray($param = [], $adminObject = false)
@@ -206,7 +204,7 @@ public function render()
206204
$language = $this->getLanguage($moduleDirname, 'MI', 'ADMENU');
207205
$langAbout = $this->getLanguage($moduleDirname, 'MI', 'ABOUT');
208206
$menu = 1;
209-
$content = $this->getHeaderFilesComments($module, $filename);
207+
$content = $this->getHeaderFilesComments($module);
210208
$content .= $this->getAdminMenuHeader();
211209
$content .= $this->getAdminMenuDashboard($language, $menu);
212210
$content .= $this->getAdminMenuList($module, $language, $langAbout, $menu);

class/Files/Admin/AdminPermissions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ public function render()
249249
$filename = $this->getFileName();
250250
$moduleDirname = $module->getVar('mod_dirname');
251251
$language = $this->getLanguage($moduleDirname, 'AM');
252-
$content = $this->getHeaderFilesComments($module, $filename);
252+
$content = $this->getHeaderFilesComments($module);
253253
$content .= $this->getPermissionsHeader($module, $language);
254254
$content .= $this->getPermissionsSwitch($module, $language);
255255
$content .= $this->getPermissionsBody($module, $language);

0 commit comments

Comments
 (0)