Completed
Push — master ( 532db1...f541a6 )
by Gino
06:07 queued 03:01
created

LanguageModinfo   B

Complexity

Total Complexity 37

Size/Duplication

Total Lines 377
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 2

Importance

Changes 1
Bugs 1 Features 0
Metric Value
wmc 37
c 1
b 1
f 0
lcom 2
cbo 2
dl 0
loc 377
rs 8.6

14 Methods

Rating   Name   Duplication   Size   Complexity  
A getLanguageSubmenu() 0 19 4
A __construct() 0 5 1
A getInstance() 0 9 2
A write() 0 7 1
A getLanguageMain() 0 8 1
A getLanguageMenu() 0 21 3
A getLanguageAdmin() 0 8 1
B getLanguageBlocks() 0 35 4
A getLanguageUser() 0 8 1
D getLanguageConfig() 0 45 9
A getLanguageNotifications() 0 11 2
A getLanguagePermissionsGroups() 0 10 1
A getLanguageFooter() 0 6 1
B render() 0 36 6
1
<?php
2
3
/*
4
 You may not change or alter any portion of this comment or credits
5
 of supporting developers from this source code or any supporting source code
6
 which is considered copyrighted (c) material of the original comment or credit authors.
7
8
 This program is distributed in the hope that it will be useful,
9
 but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11
 */
12
/**
13
 * tdmcreate module.
14
 *
15
 * @copyright       The XOOPS Project http://sourceforge.net/projects/xoops/
16
 * @license         GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
17
 *
18
 * @since           2.5.0
19
 *
20
 * @author          Txmod Xoops http://www.txmodxoops.org
21
 *
22
 * @version         $Id: LanguageModinfo.php 12258 2014-01-02 09:33:29Z timgno $
23
 */
24
25
/**
26
 * Class LanguageModinfo.
27
 */
28
class LanguageModinfo extends TDMCreateFile
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
29
{
30
    /*
31
    *  @public function constructor
32
    *  @param null
33
    */
34
    /**
35
     *
36
     */
37
    public function __construct()
38
    {
39
        parent::__construct();
40
        $this->defines = LanguageDefines::getInstance();
0 ignored issues
show
Bug introduced by
The property defines does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
41
    }
42
43
    /*
44
    *  @static function &getInstance
45
    *  @param null
46
    */
47
    /**
48
     * @return LanguageModinfo
49
     */
50
    public static function &getInstance()
51
    {
52
        static $instance = false;
53
        if (!$instance) {
54
            $instance = new self();
55
        }
56
57
        return $instance;
58
    }
59
60
    /*
61
    *  @public function write
62
    *  @param string $module
63
    *  @param mixed $table
64
    *  @param mixed $tables
65
    *  @param string $filename
66
    */
67
    /**
68
     * @param $module
69
     * @param $table
70
     * @param $tables
71
     * @param $filename
72
     */
73
    public function write($module, $table, $tables, $filename)
74
    {
75
        $this->setModule($module);
76
        $this->setTable($table);
77
        $this->setTables($tables);
78
        $this->setFileName($filename);
79
    }
80
81
    /*
82
    *  @private function getLanguageMain
83
    *  @param string $language
84
    *  @param string $module
85
    */
86
    /**
87
     * @param $language
88
     * @param $module
89
     *
90
     * @return string
91
     */
92
    private function getLanguageMain($language, $module)
93
    {
94
        $ret = $this->defines->getAboveHeadDefines('Admin Main');
95
        $ret .= $this->defines->getDefine($language, 'NAME', "{$module->getVar('mod_name')}");
96
        $ret .= $this->defines->getDefine($language, 'DESC', "{$module->getVar('mod_description')}");
97
98
        return $ret;
99
    }
100
101
    /*
102
    *  @private function getLanguageMenu
103
    *  @param string $language
104
    *  @param array $table
105
    */
106
    /**
107
     * @param $language
108
     * @param $table
109
     *
110
     * @return string
111
     */
112
    private function getLanguageMenu($module, $language, $table)
0 ignored issues
show
Unused Code introduced by
The parameter $table is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
113
    {
114
        $tables = $this->getTableTables($module->getVar('mod_id'), 'table_order');
115
        $menu = 1;
116
        $ret = $this->defines->getAboveHeadDefines('Admin Menu');
117
        $ret .= $this->defines->getDefine($language, "ADMENU{$menu}", 'Dashboard');
118
        foreach (array_keys($tables) as $i) {
119
            ++$menu;
120
            $tablePermissions[] = $tables[$i]->getVar('table_permissions');
0 ignored issues
show
Coding Style Comprehensibility introduced by
$tablePermissions was never initialized. Although not strictly required by PHP, it is generally a good practice to add $tablePermissions = array(); before regardless.

Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code.

Let’s take a look at an example:

foreach ($collection as $item) {
    $myArray['foo'] = $item->getFoo();

    if ($item->hasBar()) {
        $myArray['bar'] = $item->getBar();
    }

    // do something with $myArray
}

As you can see in this example, the array $myArray is initialized the first time when the foreach loop is entered. You can also see that the value of the bar key is only written conditionally; thus, its value might result from a previous iteration.

This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop.

Loading history...
121
            $ucfTableName = ucfirst($tables[$i]->getVar('table_name'));
122
            $ret .= $this->defines->getDefine($language, "ADMENU{$menu}", "{$ucfTableName}");
123
        }
124
        if (in_array(1, $tablePermissions)) {
0 ignored issues
show
Bug introduced by
The variable $tablePermissions does not seem to be defined for all execution paths leading up to this point.

If you define a variable conditionally, it can happen that it is not defined for all execution paths.

Let’s take a look at an example:

function myFunction($a) {
    switch ($a) {
        case 'foo':
            $x = 1;
            break;

        case 'bar':
            $x = 2;
            break;
    }

    // $x is potentially undefined here.
    echo $x;
}

In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined.

Available Fixes

  1. Check for existence of the variable explicitly:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        if (isset($x)) { // Make sure it's always set.
            echo $x;
        }
    }
    
  2. Define a default value for the variable:

    function myFunction($a) {
        $x = ''; // Set a default which gets overridden for certain paths.
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        echo $x;
    }
    
  3. Add a value for the missing path:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
    
            // We add support for the missing case.
            default:
                $x = '';
                break;
        }
    
        echo $x;
    }
    
Loading history...
125
            ++$menu;
126
            $ret .= $this->defines->getDefine($language, "ADMENU{$menu}", 'Permissions');
127
        }
128
        $ret .= $this->defines->getDefine($language, 'ABOUT', 'About');
129
        unset($menu);
130
131
        return $ret;
132
    }
133
134
    /*
135
    *  @private function getLanguageAdmin
136
    *  @param string $language
137
    */
138
    /**
139
     * @param $language
140
     *
141
     * @return string
142
     */
143
    private function getLanguageAdmin($language)
144
    {
145
        $ret = $this->defines->getAboveHeadDefines('Admin Nav');
146
        $ret .= $this->defines->getDefine($language, 'ADMIN_PAGER', 'Admin pager');
147
        $ret .= $this->defines->getDefine($language, 'ADMIN_PAGER_DESC', 'Admin per page list');
148
149
        return $ret;
150
    }
151
152
    /*
153
    *  @private function getLanguageSubmenu
154
    *  @param string $language
155
    *  @param array $tables
156
    */
157
    /**
158
     * @param $language
159
     * @param $tables
160
     *
161
     * @return string
162
     */
163
    private function getLanguageSubmenu($language, $tables)
164
    {
165
        $ret = $this->defines->getAboveDefines('Submenu');
166
        $i = 1;
167
        foreach (array_keys($tables) as $t) {
168
            $tableName = $tables[$t]->getVar('table_name');
169
            $tableSubmit[] = $tables[$t]->getVar('table_submit');
0 ignored issues
show
Coding Style Comprehensibility introduced by
$tableSubmit was never initialized. Although not strictly required by PHP, it is generally a good practice to add $tableSubmit = array(); before regardless.

Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code.

Let’s take a look at an example:

foreach ($collection as $item) {
    $myArray['foo'] = $item->getFoo();

    if ($item->hasBar()) {
        $myArray['bar'] = $item->getBar();
    }

    // do something with $myArray
}

As you can see in this example, the array $myArray is initialized the first time when the foreach loop is entered. You can also see that the value of the bar key is only written conditionally; thus, its value might result from a previous iteration.

This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop.

Loading history...
170
            if (1 == $tables[$t]->getVar('table_submenu')) {
171
                $ret .= $this->defines->getDefine($language, "SMNAME{$i}", "{$tableName}");
172
            }
173
            ++$i;
174
        }
175
        if (in_array(1, $tableSubmit)) {
0 ignored issues
show
Bug introduced by
The variable $tableSubmit does not seem to be defined for all execution paths leading up to this point.

If you define a variable conditionally, it can happen that it is not defined for all execution paths.

Let’s take a look at an example:

function myFunction($a) {
    switch ($a) {
        case 'foo':
            $x = 1;
            break;

        case 'bar':
            $x = 2;
            break;
    }

    // $x is potentially undefined here.
    echo $x;
}

In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined.

Available Fixes

  1. Check for existence of the variable explicitly:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        if (isset($x)) { // Make sure it's always set.
            echo $x;
        }
    }
    
  2. Define a default value for the variable:

    function myFunction($a) {
        $x = ''; // Set a default which gets overridden for certain paths.
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        echo $x;
    }
    
  3. Add a value for the missing path:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
    
            // We add support for the missing case.
            default:
                $x = '';
                break;
        }
    
        echo $x;
    }
    
Loading history...
176
            $ret .= $this->defines->getDefine($language, "SMNAME{$i}", 'Submit');
177
        }
178
        unset($i);
179
180
        return $ret;
181
    }
182
183
    /*
184
    *  @private function getLanguageBlocks
185
    *  @param string $language
186
    *  @param array $tables
187
    */
188
    /**
189
     * @param $language
190
     * @param $tables
191
     *
192
     * @return string
193
     */
194
    private function getLanguageBlocks($tables, $language)
195
    {
196
        $ret = $this->defines->getAboveDefines('Blocks');
197
        foreach (array_keys($tables) as $i) {
198
            $tableName = $tables[$i]->getVar('table_name');
199
            $stuTableName = strtoupper($tableName);
200
            $tableSoleName = $tables[$i]->getVar('table_solename');
201
            $stuTableSoleName = strtoupper($tableSoleName);
202
            $ucfTableName = ucfirst($tableName);
203
            $ucfTableSoleName = ucfirst($stuTableSoleName);
204
            if (1 == $tables[$i]->getVar('table_blocks')) {
205
                $ret .= $this->defines->getDefine($language, "{$stuTableName}_BLOCK", "{$ucfTableName} block");
206
                $ret .= $this->defines->getDefine($language, "{$stuTableName}_BLOCK_DESC", "{$ucfTableName} block description");
207
                if ($tables[$i]->getVar('table_category') == 1) {
208
                    $ret .= $this->defines->getDefine($language, "{$stuTableName}_BLOCK_{$stuTableSoleName}", "{$ucfTableName} block {$ucfTableSoleName}");
209
                    $ret .= $this->defines->getDefine($language, "{$stuTableName}_BLOCK_{$stuTableSoleName}_DESC", "{$ucfTableName} block {$ucfTableSoleName} description");
210
                } else {
211
                    $ret .= $this->defines->getDefine($language, "{$stuTableName}_BLOCK_{$stuTableSoleName}", "{$ucfTableName} block  {$ucfTableSoleName}");
212
                    $ret .= $this->defines->getDefine($language, "{$stuTableName}_BLOCK_{$stuTableSoleName}_DESC", "{$ucfTableName} block  {$ucfTableSoleName} description");
213
                    $ret .= $this->defines->getDefine($language, "{$stuTableName}_BLOCK_LAST", "{$ucfTableName} block last");
214
                    $ret .= $this->defines->getDefine($language, "{$stuTableName}_BLOCK_LAST_DESC", "{$ucfTableName} block last description");
215
                    $ret .= $this->defines->getDefine($language, "{$stuTableName}_BLOCK_NEW", "{$ucfTableName} block new");
216
                    $ret .= $this->defines->getDefine($language, "{$stuTableName}_BLOCK_NEW_DESC", "{$ucfTableName} block new description");
217
                    $ret .= $this->defines->getDefine($language, "{$stuTableName}_BLOCK_HITS", "{$ucfTableName} block hits");
218
                    $ret .= $this->defines->getDefine($language, "{$stuTableName}_BLOCK_HITS_DESC", "{$ucfTableName} block hits description");
219
                    $ret .= $this->defines->getDefine($language, "{$stuTableName}_BLOCK_TOP", "{$ucfTableName} block top");
220
                    $ret .= $this->defines->getDefine($language, "{$stuTableName}_BLOCK_TOP_DESC", "{$ucfTableName} block top description");
221
                    $ret .= $this->defines->getDefine($language, "{$stuTableName}_BLOCK_RANDOM", "{$ucfTableName} block random");
222
                    $ret .= $this->defines->getDefine($language, "{$stuTableName}_BLOCK_RANDOM_DESC", "{$ucfTableName} block random description");
223
                }
224
            }
225
        }
226
227
        return $ret;
228
    }
229
230
    /*
231
    *  @private function getLanguageUser
232
    *  @param string $language
233
    */
234
    /**
235
     * @param $language
236
     *
237
     * @return string
238
     */
239
    private function getLanguageUser($language)
240
    {
241
        $ret = $this->defines->getAboveDefines('User');
242
        $ret .= $this->defines->getDefine($language, 'USER_PAGER', 'User pager');
243
        $ret .= $this->defines->getDefine($language, 'USER_PAGER_DESC', 'User per page list');
244
245
        return $ret;
246
    }
247
248
    /*
249
    *  @private function getLanguageConfig
250
    *  @param string $language
251
    *  @param string $table
252
    */
253
    /**
254
     * @param $language
255
     * @param $table
256
     *
257
     * @return string
258
     */
259
    private function getLanguageConfig($language, $table)
260
    {
261
        $ret = $this->defines->getAboveDefines('Config');
262
        if (is_object($table) && $table->getVar('table_image') != '') {
263
            $fields = $this->getTableFields($table->getVar('table_mid'), $table->getVar('table_id'));
264
            foreach (array_keys($fields) as $f) {
265
                $fieldElement[] = $fields[$f]->getVar('field_element');
0 ignored issues
show
Coding Style Comprehensibility introduced by
$fieldElement was never initialized. Although not strictly required by PHP, it is generally a good practice to add $fieldElement = array(); before regardless.

Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code.

Let’s take a look at an example:

foreach ($collection as $item) {
    $myArray['foo'] = $item->getFoo();

    if ($item->hasBar()) {
        $myArray['bar'] = $item->getBar();
    }

    // do something with $myArray
}

As you can see in this example, the array $myArray is initialized the first time when the foreach loop is entered. You can also see that the value of the bar key is only written conditionally; thus, its value might result from a previous iteration.

This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop.

Loading history...
266
                if (in_array(4, $fieldElement)) {
0 ignored issues
show
Bug introduced by
The variable $fieldElement does not seem to be defined for all execution paths leading up to this point.

If you define a variable conditionally, it can happen that it is not defined for all execution paths.

Let’s take a look at an example:

function myFunction($a) {
    switch ($a) {
        case 'foo':
            $x = 1;
            break;

        case 'bar':
            $x = 2;
            break;
    }

    // $x is potentially undefined here.
    echo $x;
}

In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined.

Available Fixes

  1. Check for existence of the variable explicitly:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        if (isset($x)) { // Make sure it's always set.
            echo $x;
        }
    }
    
  2. Define a default value for the variable:

    function myFunction($a) {
        $x = ''; // Set a default which gets overridden for certain paths.
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        echo $x;
    }
    
  3. Add a value for the missing path:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
    
            // We add support for the missing case.
            default:
                $x = '';
                break;
        }
    
        echo $x;
    }
    
Loading history...
267
                    $fieldName = $fields[$f]->getVar('field_name');
268
                    $rpFieldName = $this->getRightString($fieldName);
269
                    $ucfFieldName = ucfirst($rpFieldName);
270
                    $stuFieldName = strtoupper($rpFieldName);
271
                    $ret .= $this->defines->getDefine($language, 'EDITOR_'.$stuFieldName, 'Editor');
272
                    $ret .= $this->defines->getDefine($language, 'EDITOR_'.$stuFieldName.'_DESC', 'Select the Editor '.$ucfFieldName.' to use');
273
                }
274
            }
275
        }
276
        $ret .= $this->defines->getDefine($language, 'KEYWORDS', 'Keywords');
277
        $ret .= $this->defines->getDefine($language, 'KEYWORDS_DESC', 'Insert here the keywords (separate by comma)');
278
        if (is_object($table)) {
279
            /*if ($table->getVar('table_permissions') != 0) {
0 ignored issues
show
Unused Code Comprehensibility introduced by
59% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
280
                $ret .= $this->defines->getDefine($language, "GROUPS", "Groups");
281
                $ret .= $this->defines->getDefine($language, "GROUPS_DESC", "Groups to have permissions");
282
                $ret .= $this->defines->getDefine($language, "ADMIN_GROUPS", "Admin Groups");
283
                $ret .= $this->defines->getDefine($language, "ADMIN_GROUPS_DESC", "Admin Groups to have permissions access");
284
            }*/
285
            if ($table->getVar('table_image') != '') {
286
                $ret .= $this->defines->getDefine($language, 'MAXSIZE', 'Max size');
287
                $ret .= $this->defines->getDefine($language, 'MAXSIZE_DESC', 'Set a number of max size uploads file in byte');
288
                $ret .= $this->defines->getDefine($language, 'MIMETYPES', 'Mime Types');
289
                $ret .= $this->defines->getDefine($language, 'MIMETYPES_DESC', 'Set the mime types selected');
290
            }
291
            if ($table->getVar('table_tag') != 0) {
292
                $ret .= $this->defines->getDefine($language, 'USE_TAG', 'Use TAG');
293
                $ret .= $this->defines->getDefine($language, 'USE_TAG_DESC', 'If you use tag module, check this option to yes');
294
            }
295
        }
296
        $getDefinesConf = array('NUMB_COL' => 'Number Columns', 'NUMB_COL_DESC' => 'Number Columns to View.', 'DIVIDEBY' => 'Divide By', 'DIVIDEBY_DESC' => 'Divide by columns number.',
297
                                'TABLE_TYPE' => 'Table Type', 'TABLE_TYPE_DESC' => 'Table Type is the bootstrap html table.', 'PANEL_TYPE' => 'Panel Type', 'PANEL_TYPE_DESC' => 'Panel Type is the bootstrap html div.', 'IDPAYPAL' => 'Paypal ID', 'IDPAYPAL_DESC' => 'Insert here your PayPal ID for donactions.', 'ADVERTISE' => 'Advertisement Code', 'ADVERTISE_DESC' => 'Insert here the advertisement code', 'MAINTAINEDBY' => 'Maintained By', 'MAINTAINEDBY_DESC' => 'Allow url of support site or community', 'BOOKMARKS' => 'Social Bookmarks', 'BOOKMARKS_DESC' => 'Show Social Bookmarks in the single page', 'FACEBOOK_COMMENTS' => 'Facebook comments', 'FACEBOOK_COMMENTS_DESC' => 'Allow Facebook comments in the single page', 'DISQUS_COMMENTS' => 'Disqus comments', 'DISQUS_COMMENTS_DESC' => 'Allow Disqus comments in the single page', );
298
        foreach ($getDefinesConf as $defc => $descc) {
299
            $ret .= $this->defines->getDefine($language, $defc, $descc);
300
        }
301
302
        return $ret;
303
    }
304
305
    /*
306
    *  @private function getLanguageNotifications
307
    *  @param string $language
308
    *  @param mixed $table
309
    */
310
    /**
311
     * @param $language
312
     *
313
     * @return string
314
     */
315
    private function getLanguageNotifications($language)
316
    {
317
        $ret = $this->defines->getAboveDefines('Notifications');
318
        $getDefinesNotif = array('GLOBAL_NOTIFY' => 'Global notify', 'GLOBAL_NOTIFY_DESC' => 'Global notify desc', 'CATEGORY_NOTIFY' => 'Category notify',
319
                                'CATEGORY_NOTIFY_DESC' => 'Category notify desc', 'FILE_NOTIFY' => 'File notify', 'FILE_NOTIFY_DESC' => 'File notify desc', 'GLOBAL_NEWCATEGORY_NOTIFY' => 'Global newcategory notify', 'GLOBAL_NEWCATEGORY_NOTIFY_CAPTION' => 'Global newcategory notify caption', 'GLOBAL_NEWCATEGORY_NOTIFY_DESC' => 'Global newcategory notify desc', 'GLOBAL_NEWCATEGORY_NOTIFY_SUBJECT' => 'Global newcategory notify subject', 'GLOBAL_FILEMODIFY_NOTIFY' => 'Global filemodify notify', 'GLOBAL_FILEMODIFY_NOTIFY_CAPTION' => 'Global filemodify notify caption', 'GLOBAL_FILEMODIFY_NOTIFY_DESC' => 'Global filemodify notify desc', 'GLOBAL_FILEMODIFY_NOTIFY_SUBJECT' => 'Global filemodify notify subject', 'GLOBAL_FILEBROKEN_NOTIFY' => 'Global filebroken notify', 'GLOBAL_FILEBROKEN_NOTIFY_CAPTION' => 'Global filebroken notify caption', 'GLOBAL_FILEBROKEN_NOTIFY_DESC' => 'Global filebroken notify desc', 'GLOBAL_FILEBROKEN_NOTIFY_SUBJECT' => 'Global filebroken notify subject', 'GLOBAL_FILESUBMIT_NOTIFY' => 'Global filesubmit notify', 'GLOBAL_FILESUBMIT_NOTIFY_CAPTION' => 'Global filesubmit notify caption', 'GLOBAL_FILESUBMIT_NOTIFY_DESC' => 'Global filesubmit notify desc', 'GLOBAL_FILESUBMIT_NOTIFY_SUBJECT' => 'Global filesubmit notify subject', 'GLOBAL_NEWFILE_NOTIFY' => 'Global newfile notify', 'GLOBAL_NEWFILE_NOTIFY_CAPTION' => 'Global newfile notify caption', 'GLOBAL_NEWFILE_NOTIFY_DESC' => 'Global newfile notify desc', 'GLOBAL_NEWFILE_NOTIFY_SUBJECT' => 'Global newfile notify subject', 'CATEGORY_FILESUBMIT_NOTIFY' => 'Category filesubmit notify', 'CATEGORY_FILESUBMIT_NOTIFY_CAPTION' => 'Category filesubmit notify caption', 'CATEGORY_FILESUBMIT_NOTIFY_DESC' => 'Category filesubmit notify desc', 'CATEGORY_FILESUBMIT_NOTIFY_SUBJECT' => 'Category filesubmit notify subject', 'CATEGORY_NEWFILE_NOTIFY' => 'Category newfile notify', 'CATEGORY_NEWFILE_NOTIFY_CAPTION' => 'Category newfile notify caption', 'CATEGORY_NEWFILE_NOTIFY_DESC' => 'Category newfile notify desc', 'CATEGORY_NEWFILE_NOTIFY_SUBJECT' => 'Category newfile notify subject', 'FILE_APPROVE_NOTIFY' => 'File approve notify', 'FILE_APPROVE_NOTIFY_CAPTION' => 'File approve notify caption', 'FILE_APPROVE_NOTIFY_DESC' => 'File approve notify desc', 'FILE_APPROVE_NOTIFY_SUBJECT' => 'File approve notify subject', );
320
        foreach ($getDefinesNotif as $defn => $descn) {
321
            $ret .= $this->defines->getDefine($language, $defn, $descn);
322
        }
323
324
        return $ret;
325
    }
326
327
    /*
328
    *  @private function getLanguagePermissionsGroups
329
    *  @param string $language
330
    */
331
    /**
332
     * @param $language
333
     *
334
     * @return string
335
     */
336
    private function getLanguagePermissionsGroups($language)
337
    {
338
        $ret = $this->defines->getAboveDefines('Permissions Groups');
339
        $ret .= $this->defines->getDefine($language, 'GROUPS', 'Groups access');
340
        $ret .= $this->defines->getDefine($language, 'GROUPS_DESC', 'Select general access permission for groups.');
341
        $ret .= $this->defines->getDefine($language, 'ADMIN_GROUPS', 'Admin Group Permissions');
342
        $ret .= $this->defines->getDefine($language, 'ADMIN_GROUPS_DESC', 'Which groups have access to tools and permissions page');
343
344
        return $ret;
345
    }
346
347
    /*
348
    *  @private function getFooter
349
    *  @param null
350
    */
351
    /**
352
     * @return string
353
     */
354
    private function getLanguageFooter()
355
    {
356
        $ret = $this->defines->getBelowDefines('End');
357
358
        return $ret;
359
    }
360
361
    /*
362
    *  @public function render
363
    *  @param null
364
    */
365
    /**
366
     * @return bool|string
367
     */
368
    public function render()
369
    {
370
        $module = $this->getModule();
371
        $table = $this->getTable();
372
        $tables = $this->getTables();
373
        $filename = $this->getFileName();
374
        $moduleDirname = $module->getVar('mod_dirname');
375
        $language = $this->getLanguage($moduleDirname, 'MI');
376
        $content = $this->getHeaderFilesComments($module, $filename);
377
        $content .= $this->getLanguageMain($language, $module);
378
        $content .= $this->getLanguageMenu($module, $language, $table);
379
        if (1 == $table->getVar('table_admin')) {
380
            $content .= $this->getLanguageAdmin($language);
381
        }
382
        if (1 == $table->getVar('table_user')) {
383
            $content .= $this->getLanguageUser($language);
384
        }
385
        //if (1 == $table->getVar('table_submenu')) {
0 ignored issues
show
Unused Code Comprehensibility introduced by
63% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
386
            $content .= $this->getLanguageSubmenu($language, $tables);
387
        //}
388
        if (1 == $table->getVar('table_blocks')) {
389
            $content .= $this->getLanguageBlocks($tables, $language);
390
        }
391
        $content .= $this->getLanguageConfig($language, $table);
392
        if (1 == $table->getVar('table_notifications')) {
393
            $content .= $this->getLanguageNotifications($language);
394
        }
395
        if (1 == $table->getVar('table_permissions')) {
396
            $content .= $this->getLanguagePermissionsGroups($language);
397
        }
398
        $content .= $this->getLanguageFooter();
399
        //
400
        $this->create($moduleDirname, 'language/'.$GLOBALS['xoopsConfig']['language'], $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED);
401
402
        return $this->renderFile();
403
    }
404
}
405