|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace XoopsModules\Xoosocialnetwork\Form; |
|
4
|
|
|
|
|
5
|
|
|
/** |
|
6
|
|
|
* Xoosocialnetwork module |
|
7
|
|
|
* |
|
8
|
|
|
* You may not change or alter any portion of this comment or credits |
|
9
|
|
|
* of supporting developers from this source code or any supporting source code |
|
10
|
|
|
* which is considered copyrighted (c) material of the original comment or credit authors. |
|
11
|
|
|
* This program is distributed in the hope that it will be useful, |
|
12
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
14
|
|
|
* |
|
15
|
|
|
* @copyright XOOPS Project (https://xoops.org) |
|
16
|
|
|
* @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) |
|
17
|
|
|
* @package Xoosocialnetwork |
|
18
|
|
|
* @since 2.6.0 |
|
19
|
|
|
* @author Laurent JEN (Aka DuGris) |
|
20
|
|
|
|
|
21
|
|
|
*/ |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* Class SocialnetworkForm |
|
25
|
|
|
*/ |
|
26
|
|
|
class SocialnetworkForm extends \Xoops\Form\ThemeForm |
|
27
|
|
|
{ |
|
28
|
|
|
/** |
|
29
|
|
|
* @param \XooSocialNetworkSocialnetwork|\XoopsObject $obj |
|
|
|
|
|
|
30
|
|
|
*/ |
|
31
|
|
|
public function __construct($obj = null) |
|
32
|
|
|
{ |
|
33
|
|
|
$this->xoopsObject = $obj; |
|
|
|
|
|
|
34
|
|
|
|
|
35
|
|
|
$helper = \XoopsModules\Xoosocialnetwork\Helper::getInstance(); |
|
36
|
|
|
$socialnetworkHandler = $helper->getHandler('Socialnetwork'); |
|
|
|
|
|
|
37
|
|
|
|
|
38
|
|
|
if ($this->xoopsObject->isNew()) { |
|
|
|
|
|
|
39
|
|
|
parent::__construct('', 'form_socialnetwork', 'index.php', 'post', true); |
|
40
|
|
|
} else { |
|
41
|
|
|
parent::__construct('', 'form_socialnetwork', 'index.php', 'post', true); |
|
42
|
|
|
} |
|
43
|
|
|
$this->setExtra('enctype="multipart/form-data"'); |
|
44
|
|
|
|
|
45
|
|
|
// Title |
|
46
|
|
|
$this->addElement(new \Xoops\Form\Text(_AM_XOO_SN_TITLE, 'xoosocialnetwork_title', 5, 255, $this->xoopsObject->getVar('xoosocialnetwork_title')), true); |
|
|
|
|
|
|
47
|
|
|
|
|
48
|
|
|
// Url |
|
49
|
|
|
$this->addElement(new \Xoops\Form\Text(_AM_XOO_SN_URL, 'xoosocialnetwork_url', 7, 255, $this->xoopsObject->getVar('xoosocialnetwork_url')), true); |
|
50
|
|
|
|
|
51
|
|
|
// Query string URL |
|
52
|
|
|
$queryUrl = new \Xoops\Form\Text(_AM_XOO_SN_QUERY_URL, 'xoosocialnetwork_query_url', 5, 20, $this->xoopsObject->getVar('xoosocialnetwork_query_url')); |
|
53
|
|
|
$queryUrl->setDatalist([ |
|
54
|
|
|
'u', |
|
55
|
|
|
'url', ]); |
|
56
|
|
|
$this->addElement($queryUrl, true); |
|
57
|
|
|
|
|
58
|
|
|
// Query string title |
|
59
|
|
|
$queryString = new \Xoops\Form\Text(_AM_XOO_SN_QUERY_TITLE, 'xoosocialnetwork_query_title', 5, 20, $this->xoopsObject->getVar('xoosocialnetwork_query_title')); |
|
60
|
|
|
$queryString->setDatalist([ |
|
61
|
|
|
't', |
|
62
|
|
|
'title', ]); |
|
63
|
|
|
$this->addElement($queryString); |
|
64
|
|
|
|
|
65
|
|
|
// image |
|
66
|
|
|
$xoops = \Xoops::getInstance(); |
|
67
|
|
|
$imageTray = new \Xoops\Form\ElementTray(_AM_XOO_SN_IMAGE, ''); |
|
68
|
|
|
$imageArray = \XoopsLists::getImgListAsArray($xoops->path('modules/xoosocialnetwork/assets/icons/Default')); |
|
69
|
|
|
$imageSelect = new \Xoops\Form\Select('', 'xoosocialnetwork_image', $this->xoopsObject->getVar('xoosocialnetwork_image')); |
|
70
|
|
|
$imageSelect->addOptionArray($imageArray); |
|
71
|
|
|
$imageSelect->setExtra("onchange='showImgSelected(\"select_image\", \"xoosocialnetwork_image\", \"" . '/' . '", "", "' . $xoops->url('modules/xoosocialnetwork/assets/icons/Default') . "\")'"); |
|
|
|
|
|
|
72
|
|
|
$imageTray->addElement($imageSelect); |
|
73
|
|
|
$imageTray->addElement(new \Xoops\Form\Label('', "<br><img src='" . $xoops->url('modules/xoosocialnetwork/assets/icons/Default/') . $this->xoopsObject->getVar('xoosocialnetwork_image') . "' name='select_image' id='select_image' alt=''>")); |
|
74
|
|
|
$this->addElement($imageTray); |
|
75
|
|
|
|
|
76
|
|
|
// order |
|
77
|
|
|
$this->addElement(new \Xoops\Form\Text(_AM_XOO_SN_ORDER, 'xoosocialnetwork_order', 1, 3, $this->xoopsObject->getVar('xoosocialnetwork_order'))); |
|
78
|
|
|
|
|
79
|
|
|
// display |
|
80
|
|
|
$this->addElement(new \Xoops\Form\RadioYesNo(_AM_XOO_SN_DISPLAY, 'xoosocialnetwork_display', $this->xoopsObject->getVar('xoosocialnetwork_display'))); |
|
|
|
|
|
|
81
|
|
|
|
|
82
|
|
|
// hidden |
|
83
|
|
|
$this->addElement(new \Xoops\Form\Hidden('xoosocialnetwork_id', $this->xoopsObject->getVar('xoosocialnetwork_id'))); |
|
|
|
|
|
|
84
|
|
|
|
|
85
|
|
|
// button |
|
86
|
|
|
$buttonTray = new \Xoops\Form\ElementTray('', ''); |
|
87
|
|
|
$buttonTray->addElement(new \Xoops\Form\Hidden('op', 'save')); |
|
88
|
|
|
$buttonTray->addElement(new \Xoops\Form\Button('', 'submit', \XoopsLocale::A_SUBMIT, 'submit')); |
|
89
|
|
|
$buttonTray->addElement(new \Xoops\Form\Button('', 'reset', \XoopsLocale::A_RESET, 'reset')); |
|
90
|
|
|
$buttonCancelSend = new \Xoops\Form\Button('', 'cancel', \XoopsLocale::A_CANCEL, 'button'); |
|
91
|
|
|
$buttonCancelSend->setExtra("onclick='javascript:history.go(-1);'"); |
|
|
|
|
|
|
92
|
|
|
$buttonTray->addElement($buttonCancelSend); |
|
93
|
|
|
$this->addElement($buttonTray); |
|
94
|
|
|
} |
|
95
|
|
|
|
|
96
|
|
|
/** |
|
97
|
|
|
* @param $msg |
|
98
|
|
|
* @param string $title |
|
99
|
|
|
* @param string $class |
|
100
|
|
|
* @return string |
|
101
|
|
|
*/ |
|
102
|
|
|
public function message($msg, $title = '', $class = 'errorMsg') |
|
103
|
|
|
{ |
|
104
|
|
|
$ret = "<div class='" . $class . "'>"; |
|
105
|
|
|
if ('' != $title) { |
|
106
|
|
|
$ret .= '<strong>' . $title . '</strong>'; |
|
107
|
|
|
} |
|
108
|
|
|
if (is_array($msg) || is_object($msg)) { |
|
109
|
|
|
$ret .= implode('<br>', $msg); |
|
|
|
|
|
|
110
|
|
|
} else { |
|
111
|
|
|
$ret .= $msg; |
|
112
|
|
|
} |
|
113
|
|
|
$ret .= '</div>'; |
|
114
|
|
|
|
|
115
|
|
|
return $ret; |
|
116
|
|
|
} |
|
117
|
|
|
} |
|
118
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths