|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* ExtGallery functions |
|
5
|
|
|
* |
|
6
|
|
|
* You may not change or alter any portion of this comment or credits |
|
7
|
|
|
* of supporting developers from this source code or any supporting source code |
|
8
|
|
|
* which is considered copyrighted (c) material of the original comment or credit authors. |
|
9
|
|
|
* This program is distributed in the hope that it will be useful, |
|
10
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
12
|
|
|
* |
|
13
|
|
|
* @copyright {@link https://xoops.org/ XOOPS Project} |
|
14
|
|
|
* @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) |
|
15
|
|
|
* @author Zoullou (http://www.zoullou.net) |
|
16
|
|
|
* @package ExtGallery |
|
17
|
|
|
* @param $option |
|
18
|
|
|
* @return bool |
|
19
|
|
|
*/ |
|
20
|
|
|
function gal_getmoduleoption($option) |
|
21
|
|
|
{ |
|
22
|
|
|
global $xoopsModuleConfig, $xoopsModule; |
|
23
|
|
|
static $tbloptions = []; |
|
24
|
|
|
if (is_array($tbloptions) && array_key_exists($option, $tbloptions)) { |
|
25
|
|
|
return $tbloptions[$option]; |
|
26
|
|
|
} |
|
27
|
|
|
|
|
28
|
|
|
$retval = false; |
|
29
|
|
|
if (isset($xoopsModuleConfig) |
|
30
|
|
|
&& (is_object($xoopsModule) && 'extgallery' === $xoopsModule->getVar('dirname') |
|
31
|
|
|
&& $xoopsModule->getVar('isactive'))) { |
|
32
|
|
|
if (isset($xoopsModuleConfig[$option])) { |
|
33
|
|
|
$retval = $xoopsModuleConfig[$option]; |
|
34
|
|
|
} |
|
35
|
|
|
} else { |
|
36
|
|
|
/** @var \XoopsModuleHandler $moduleHandler */ |
|
37
|
|
|
$moduleHandler = xoops_getHandler('module'); |
|
38
|
|
|
$module = $moduleHandler->getByDirname('extgallery'); |
|
39
|
|
|
|
|
40
|
|
|
/** @var \XoopsModuleHandler $moduleHandler */ |
|
41
|
|
|
/** @var \XoopsConfigHandler $configHandler */ |
|
42
|
|
|
$configHandler = xoops_getHandler('config'); |
|
43
|
|
|
if ($module) { |
|
44
|
|
|
$moduleConfig = $configHandler->getConfigsByCat(0, $module->getVar('mid')); |
|
45
|
|
|
if (isset($moduleConfig[$option])) { |
|
46
|
|
|
$retval = $moduleConfig[$option]; |
|
47
|
|
|
} |
|
48
|
|
|
} |
|
49
|
|
|
} |
|
50
|
|
|
$tbloptions[$option] = $retval; |
|
51
|
|
|
|
|
52
|
|
|
return $retval; |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
/** |
|
56
|
|
|
* @param $caption |
|
57
|
|
|
* @param $name |
|
58
|
|
|
* @param $value |
|
59
|
|
|
* @param $rows |
|
60
|
|
|
* @param $cols |
|
61
|
|
|
* @param $width |
|
62
|
|
|
* @param $height |
|
63
|
|
|
* @param $supplemental |
|
64
|
|
|
* |
|
65
|
|
|
* @return bool|\XoopsFormEditor |
|
66
|
|
|
*/ |
|
67
|
|
|
function gal_getWysiwygForm($caption, $name, $value, $rows, $cols, $width, $height, $supplemental) |
|
68
|
|
|
{ |
|
69
|
|
|
$editor_option = mb_strtolower(gal_getmoduleoption('form_options')); |
|
|
|
|
|
|
70
|
|
|
$editor = false; |
|
71
|
|
|
$editor_configs = []; |
|
72
|
|
|
$editor_configs['name'] = $name; |
|
73
|
|
|
$editor_configs['value'] = $value; |
|
74
|
|
|
$editor_configs['rows'] = $rows; |
|
75
|
|
|
$editor_configs['cols'] = $cols; |
|
76
|
|
|
$editor_configs['width'] = $width; |
|
77
|
|
|
$editor_configs['height'] = $height; |
|
78
|
|
|
$editor_configs['editor'] = $editor_option; |
|
79
|
|
|
|
|
80
|
|
|
$editor = new \XoopsFormEditor($caption, $name, $editor_configs); |
|
81
|
|
|
|
|
82
|
|
|
return $editor; |
|
83
|
|
|
} |
|
84
|
|
|
|