1
|
|
|
<?php |
|
|
|
|
2
|
|
|
/** |
3
|
|
|
* |
4
|
|
|
* Module: Lexikon - glossary module |
5
|
|
|
* Version: v 1.00 |
6
|
|
|
* Release Date: 8 May 2004 |
7
|
|
|
* Author: adapted from AMS |
8
|
|
|
* Licence: GNU |
9
|
|
|
*/ |
10
|
|
|
defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* @param $options |
14
|
|
|
* @return array |
15
|
|
|
*/ |
16
|
|
|
function b_lx_author_show($options) |
17
|
|
|
{ |
18
|
|
|
$myts = MyTextSanitizer::getInstance(); |
|
|
|
|
19
|
|
|
/** @var XoopsModuleHandler $moduleHandler */ |
20
|
|
|
$moduleHandler = xoops_getHandler('module'); |
21
|
|
|
$lexikon = $moduleHandler->getByDirname('lexikon'); |
22
|
|
View Code Duplication |
if (!isset($lxConfig)) { |
|
|
|
|
23
|
|
|
$configHandler = xoops_getHandler('config'); |
24
|
|
|
$lxConfig = $configHandler->getConfigsByCat(0, $lexikon->getVar('mid')); |
25
|
|
|
} |
26
|
|
|
include_once XOOPS_ROOT_PATH . '/modules/lexikon/class/Utility.php'; |
27
|
|
|
|
28
|
|
|
$block = array(); |
29
|
|
|
if (!isset($options[3])) { |
30
|
|
|
$options[3] = 'average'; |
31
|
|
|
} |
32
|
|
|
$authors = LexikonUtility::getBlockAuthors($options[1], $options[0], $options[2], $options[3]); |
33
|
|
|
if (is_array($authors) && count($authors) > 0) { |
34
|
|
|
$block['authors'] = $authors; |
35
|
|
|
} |
36
|
|
|
$block['profile'] = ($lxConfig['authorprofile'] == 1) ? 1 : 0; |
37
|
|
|
|
38
|
|
|
return $block; |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @param $options |
43
|
|
|
* @return string |
44
|
|
|
*/ |
45
|
|
|
function b_lx_author_edit($options) |
46
|
|
|
{ |
47
|
|
|
include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
48
|
|
|
$form = new XoopsFormElementTray('', '<br>'); |
49
|
|
|
|
50
|
|
|
$sort_select = new XoopsFormSelect(_MB_LEXIKON_ORDER, 'options[0]', $options[0]); |
51
|
|
|
$sort_select->addOption('count', _MB_LEXIKON_TERMSCOUNT); |
52
|
|
|
$sort_select->addOption('read', _MB_LEXIKON_HITS); |
53
|
|
|
$form->addElement($sort_select); |
54
|
|
|
|
55
|
|
|
$form->addElement(new XoopsFormText(_MB_LEXIKON_DISP, 'options[1]', 20, 15, $options[1])); |
56
|
|
|
|
57
|
|
|
$name_select = new XoopsFormSelect(_MB_LEXIKON_DISPLAYNAME, 'options[2]', $options[2]); |
58
|
|
|
$name_select->addOption('uname', _MB_LEXIKON_USERNAME); |
59
|
|
|
$name_select->addOption('name', _MB_LEXIKON_REALNAME); |
60
|
|
|
$form->addElement($name_select); |
61
|
|
|
|
62
|
|
|
$average_select = new XoopsFormSelect(_MB_LEXIKON_COMPUTING, 'options[3]', $options[3]); |
63
|
|
|
$average_select->addOption('average', _MB_LEXIKON_AVERAGE); |
64
|
|
|
$average_select->addOption('total', _MB_LEXIKON_TOTALS); |
65
|
|
|
$form->addElement($average_select); |
66
|
|
|
|
67
|
|
|
return $form->render(); |
68
|
|
|
} |
69
|
|
|
|
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.