@@ -167,9 +167,9 @@ |
||
167 | 167 | $ret['name'] = $this->getVar('dir_name'); |
168 | 168 | $ret['type'] = $this->getVar('dir_type'); |
169 | 169 | $ret['type_text'] = Constants::DIRECTORY_TYPE_USER == $this->getVar('dir_type') ? \_AM_WGGITHUB_DIRECTORY_TYPE_USER : \_AM_WGGITHUB_DIRECTORY_TYPE_ORG; |
170 | - $ret['autoupdate'] = (int)$this->getVar('dir_autoupdate') > 0 ? _YES : _NO; |
|
171 | - $ret['online'] = (int)$this->getVar('dir_online') > 0 ? _YES : _NO; |
|
172 | - $ret['filterrelease'] = (int)$this->getVar('dir_filterrelease') > 0 ? _YES : _NO; |
|
170 | + $ret['autoupdate'] = (int) $this->getVar('dir_autoupdate') > 0 ? _YES : _NO; |
|
171 | + $ret['online'] = (int) $this->getVar('dir_online') > 0 ? _YES : _NO; |
|
172 | + $ret['filterrelease'] = (int) $this->getVar('dir_filterrelease') > 0 ? _YES : _NO; |
|
173 | 173 | $ret['datecreated'] = \formatTimestamp($this->getVar('dir_datecreated'), 's'); |
174 | 174 | $ret['submitter'] = \XoopsUser::getUnameFromId($this->getVar('dir_submitter')); |
175 | 175 | return $ret; |
@@ -33,74 +33,74 @@ discard block |
||
33 | 33 | */ |
34 | 34 | class Directories extends \XoopsObject |
35 | 35 | { |
36 | - /** |
|
37 | - * Constructor |
|
38 | - * |
|
39 | - * @param null |
|
40 | - */ |
|
41 | - public function __construct() |
|
42 | - { |
|
43 | - $this->initVar('dir_id', \XOBJ_DTYPE_INT); |
|
44 | - $this->initVar('dir_name', \XOBJ_DTYPE_TXTBOX); |
|
45 | - $this->initVar('dir_type', \XOBJ_DTYPE_INT); |
|
36 | + /** |
|
37 | + * Constructor |
|
38 | + * |
|
39 | + * @param null |
|
40 | + */ |
|
41 | + public function __construct() |
|
42 | + { |
|
43 | + $this->initVar('dir_id', \XOBJ_DTYPE_INT); |
|
44 | + $this->initVar('dir_name', \XOBJ_DTYPE_TXTBOX); |
|
45 | + $this->initVar('dir_type', \XOBJ_DTYPE_INT); |
|
46 | 46 | $this->initVar('dir_autoupdate', XOBJ_DTYPE_INT); |
47 | 47 | $this->initVar('dir_online', XOBJ_DTYPE_INT); |
48 | 48 | $this->initVar('dir_filterrelease', XOBJ_DTYPE_INT); |
49 | - $this->initVar('dir_datecreated', \XOBJ_DTYPE_INT); |
|
50 | - $this->initVar('dir_submitter', \XOBJ_DTYPE_INT); |
|
51 | - } |
|
49 | + $this->initVar('dir_datecreated', \XOBJ_DTYPE_INT); |
|
50 | + $this->initVar('dir_submitter', \XOBJ_DTYPE_INT); |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * @static function &getInstance |
|
55 | - * |
|
56 | - * @param null |
|
57 | - */ |
|
58 | - public static function getInstance() |
|
59 | - { |
|
60 | - static $instance = false; |
|
61 | - if (!$instance) { |
|
62 | - $instance = new self(); |
|
63 | - } |
|
64 | - } |
|
53 | + /** |
|
54 | + * @static function &getInstance |
|
55 | + * |
|
56 | + * @param null |
|
57 | + */ |
|
58 | + public static function getInstance() |
|
59 | + { |
|
60 | + static $instance = false; |
|
61 | + if (!$instance) { |
|
62 | + $instance = new self(); |
|
63 | + } |
|
64 | + } |
|
65 | 65 | |
66 | - /** |
|
67 | - * The new inserted $Id |
|
68 | - * @return inserted id |
|
69 | - */ |
|
70 | - public function getNewInsertedIdDirectories() |
|
71 | - { |
|
72 | - $newInsertedId = $GLOBALS['xoopsDB']->getInsertId(); |
|
73 | - return $newInsertedId; |
|
74 | - } |
|
66 | + /** |
|
67 | + * The new inserted $Id |
|
68 | + * @return inserted id |
|
69 | + */ |
|
70 | + public function getNewInsertedIdDirectories() |
|
71 | + { |
|
72 | + $newInsertedId = $GLOBALS['xoopsDB']->getInsertId(); |
|
73 | + return $newInsertedId; |
|
74 | + } |
|
75 | 75 | |
76 | - /** |
|
77 | - * @public function getForm |
|
78 | - * @param bool $action |
|
79 | - * @return \XoopsThemeForm |
|
80 | - */ |
|
81 | - public function getFormDirectories($action = false) |
|
82 | - { |
|
83 | - $helper = \XoopsModules\Wggithub\Helper::getInstance(); |
|
84 | - if (!$action) { |
|
85 | - $action = $_SERVER['REQUEST_URI']; |
|
86 | - } |
|
87 | - $isAdmin = $GLOBALS['xoopsUser']->isAdmin($GLOBALS['xoopsModule']->mid()); |
|
76 | + /** |
|
77 | + * @public function getForm |
|
78 | + * @param bool $action |
|
79 | + * @return \XoopsThemeForm |
|
80 | + */ |
|
81 | + public function getFormDirectories($action = false) |
|
82 | + { |
|
83 | + $helper = \XoopsModules\Wggithub\Helper::getInstance(); |
|
84 | + if (!$action) { |
|
85 | + $action = $_SERVER['REQUEST_URI']; |
|
86 | + } |
|
87 | + $isAdmin = $GLOBALS['xoopsUser']->isAdmin($GLOBALS['xoopsModule']->mid()); |
|
88 | 88 | |
89 | - // Title |
|
90 | - $title = $this->isNew() ? \sprintf(\_AM_WGGITHUB_DIRECTORY_ADD) : \sprintf(\_AM_WGGITHUB_DIRECTORY_EDIT); |
|
91 | - // Get Theme Form |
|
92 | - \xoops_load('XoopsFormLoader'); |
|
93 | - $form = new \XoopsThemeForm($title, 'form', $action, 'post', true); |
|
94 | - $form->setExtra('enctype="multipart/form-data"'); |
|
95 | - // Form Text dirName |
|
96 | - $form->addElement(new \XoopsFormText(\_AM_WGGITHUB_DIRECTORY_NAME, 'dir_name', 50, 255, $this->getVar('dir_name')), true); |
|
97 | - // Directories Handler |
|
98 | - $directoriesHandler = $helper->getHandler('Directories'); |
|
99 | - // Form Select dirType |
|
100 | - $dirTypeSelect = new \XoopsFormSelect(\_AM_WGGITHUB_DIRECTORY_TYPE, 'dir_type', $this->getVar('dir_type'), 5); |
|
101 | - $dirTypeSelect->addOption(Constants::DIRECTORY_TYPE_USER, \_AM_WGGITHUB_DIRECTORY_TYPE_USER); |
|
102 | - $dirTypeSelect->addOption(Constants::DIRECTORY_TYPE_ORG, \_AM_WGGITHUB_DIRECTORY_TYPE_ORG); |
|
103 | - $form->addElement($dirTypeSelect, true); |
|
89 | + // Title |
|
90 | + $title = $this->isNew() ? \sprintf(\_AM_WGGITHUB_DIRECTORY_ADD) : \sprintf(\_AM_WGGITHUB_DIRECTORY_EDIT); |
|
91 | + // Get Theme Form |
|
92 | + \xoops_load('XoopsFormLoader'); |
|
93 | + $form = new \XoopsThemeForm($title, 'form', $action, 'post', true); |
|
94 | + $form->setExtra('enctype="multipart/form-data"'); |
|
95 | + // Form Text dirName |
|
96 | + $form->addElement(new \XoopsFormText(\_AM_WGGITHUB_DIRECTORY_NAME, 'dir_name', 50, 255, $this->getVar('dir_name')), true); |
|
97 | + // Directories Handler |
|
98 | + $directoriesHandler = $helper->getHandler('Directories'); |
|
99 | + // Form Select dirType |
|
100 | + $dirTypeSelect = new \XoopsFormSelect(\_AM_WGGITHUB_DIRECTORY_TYPE, 'dir_type', $this->getVar('dir_type'), 5); |
|
101 | + $dirTypeSelect->addOption(Constants::DIRECTORY_TYPE_USER, \_AM_WGGITHUB_DIRECTORY_TYPE_USER); |
|
102 | + $dirTypeSelect->addOption(Constants::DIRECTORY_TYPE_ORG, \_AM_WGGITHUB_DIRECTORY_TYPE_ORG); |
|
103 | + $form->addElement($dirTypeSelect, true); |
|
104 | 104 | // Form Radio Yes/No dirAutoupdate |
105 | 105 | $dirAutoupdate = $this->isNew() ?: $this->getVar('dir_autoupdate'); |
106 | 106 | $form->addElement(new \XoopsFormRadioYN(_AM_WGGITHUB_DIRECTORY_AUTOUPDATE, 'dir_autoupdate', $dirAutoupdate)); |
@@ -110,51 +110,51 @@ discard block |
||
110 | 110 | // Form Radio Yes/No dirFilterrelease |
111 | 111 | $dirFilterrelease = $this->isNew() ?: $this->getVar('dir_filterrelease'); |
112 | 112 | $form->addElement(new \XoopsFormRadioYN(_AM_WGGITHUB_DIRECTORY_FILTERRELEASE, 'dir_filterrelease', $dirFilterrelease)); |
113 | - // Form Text Date Select dirDatecreated |
|
114 | - $dirDatecreated = $this->isNew() ?: $this->getVar('dir_datecreated'); |
|
115 | - $form->addElement(new \XoopsFormTextDateSelect(\_AM_WGGITHUB_DIRECTORY_DATECREATED, 'dir_datecreated', '', $dirDatecreated)); |
|
116 | - // Form Select User dirSubmitter |
|
117 | - $form->addElement(new \XoopsFormSelectUser(\_AM_WGGITHUB_DIRECTORY_SUBMITTER, 'dir_submitter', false, $this->getVar('dir_submitter'))); |
|
118 | - // To Save |
|
119 | - $form->addElement(new \XoopsFormHidden('op', 'save')); |
|
120 | - $form->addElement(new \XoopsFormButtonTray('', _SUBMIT, 'submit', '', false)); |
|
121 | - return $form; |
|
122 | - } |
|
113 | + // Form Text Date Select dirDatecreated |
|
114 | + $dirDatecreated = $this->isNew() ?: $this->getVar('dir_datecreated'); |
|
115 | + $form->addElement(new \XoopsFormTextDateSelect(\_AM_WGGITHUB_DIRECTORY_DATECREATED, 'dir_datecreated', '', $dirDatecreated)); |
|
116 | + // Form Select User dirSubmitter |
|
117 | + $form->addElement(new \XoopsFormSelectUser(\_AM_WGGITHUB_DIRECTORY_SUBMITTER, 'dir_submitter', false, $this->getVar('dir_submitter'))); |
|
118 | + // To Save |
|
119 | + $form->addElement(new \XoopsFormHidden('op', 'save')); |
|
120 | + $form->addElement(new \XoopsFormButtonTray('', _SUBMIT, 'submit', '', false)); |
|
121 | + return $form; |
|
122 | + } |
|
123 | 123 | |
124 | - /** |
|
125 | - * Get Values |
|
126 | - * @param null $keys |
|
127 | - * @param null $format |
|
128 | - * @param null $maxDepth |
|
129 | - * @return array |
|
130 | - */ |
|
131 | - public function getValuesDirectories($keys = null, $format = null, $maxDepth = null) |
|
132 | - { |
|
133 | - $ret = $this->getValues($keys, $format, $maxDepth); |
|
134 | - $ret['id'] = $this->getVar('dir_id'); |
|
135 | - $ret['name'] = $this->getVar('dir_name'); |
|
136 | - $ret['type'] = $this->getVar('dir_type'); |
|
124 | + /** |
|
125 | + * Get Values |
|
126 | + * @param null $keys |
|
127 | + * @param null $format |
|
128 | + * @param null $maxDepth |
|
129 | + * @return array |
|
130 | + */ |
|
131 | + public function getValuesDirectories($keys = null, $format = null, $maxDepth = null) |
|
132 | + { |
|
133 | + $ret = $this->getValues($keys, $format, $maxDepth); |
|
134 | + $ret['id'] = $this->getVar('dir_id'); |
|
135 | + $ret['name'] = $this->getVar('dir_name'); |
|
136 | + $ret['type'] = $this->getVar('dir_type'); |
|
137 | 137 | $ret['type_text'] = Constants::DIRECTORY_TYPE_USER == $this->getVar('dir_type') ? \_AM_WGGITHUB_DIRECTORY_TYPE_USER : \_AM_WGGITHUB_DIRECTORY_TYPE_ORG; |
138 | 138 | $ret['autoupdate'] = (int)$this->getVar('dir_autoupdate') > 0 ? _YES : _NO; |
139 | 139 | $ret['online'] = (int)$this->getVar('dir_online') > 0 ? _YES : _NO; |
140 | 140 | $ret['filterrelease'] = (int)$this->getVar('dir_filterrelease') > 0 ? _YES : _NO; |
141 | - $ret['datecreated'] = \formatTimestamp($this->getVar('dir_datecreated'), 's'); |
|
142 | - $ret['submitter'] = \XoopsUser::getUnameFromId($this->getVar('dir_submitter')); |
|
143 | - return $ret; |
|
144 | - } |
|
141 | + $ret['datecreated'] = \formatTimestamp($this->getVar('dir_datecreated'), 's'); |
|
142 | + $ret['submitter'] = \XoopsUser::getUnameFromId($this->getVar('dir_submitter')); |
|
143 | + return $ret; |
|
144 | + } |
|
145 | 145 | |
146 | - /** |
|
147 | - * Returns an array representation of the object |
|
148 | - * |
|
149 | - * @return array |
|
150 | - */ |
|
151 | - public function toArrayDirectories() |
|
152 | - { |
|
153 | - $ret = []; |
|
154 | - $vars = $this->getVars(); |
|
155 | - foreach (\array_keys($vars) as $var) { |
|
156 | - $ret[$var] = $this->getVar('"{$var}"'); |
|
157 | - } |
|
158 | - return $ret; |
|
159 | - } |
|
146 | + /** |
|
147 | + * Returns an array representation of the object |
|
148 | + * |
|
149 | + * @return array |
|
150 | + */ |
|
151 | + public function toArrayDirectories() |
|
152 | + { |
|
153 | + $ret = []; |
|
154 | + $vars = $this->getVars(); |
|
155 | + foreach (\array_keys($vars) as $var) { |
|
156 | + $ret[$var] = $this->getVar('"{$var}"'); |
|
157 | + } |
|
158 | + return $ret; |
|
159 | + } |
|
160 | 160 | } |
@@ -191,14 +191,14 @@ |
||
191 | 191 | $donationform = [ |
192 | 192 | 0 => '<form name="donation" id="donation" action="http://www.txmodxoops.org/modules/xdonations/" method="post" onsubmit="return xoopsFormValidate_donation();">', |
193 | 193 | 1 => '<table class="outer" cellspacing="1" width="100%"><tbody><tr><th colspan="2">' |
194 | - . _AM_WGGITHUB_ABOUT_MAKE_DONATION |
|
195 | - . '</th></tr><tr align="left" valign="top"><td class="head"><div class="xoops-form-element-caption-required"><span class="caption-text">' |
|
196 | - . _AM_WGGITHUB_DONATION_AMOUNT |
|
197 | - . '</span><span class="caption-marker">*</span></div></td><td class="even"><select size="1" name="item[A][amount]" id="item[A][amount]" title="Donation Amount"><option value="5">5.00 EUR</option><option value="10">10.00 EUR</option><option value="20">20.00 EUR</option><option value="40">40.00 EUR</option><option value="60">60.00 EUR</option><option value="80">80.00 EUR</option><option value="90">90.00 EUR</option><option value="100">100.00 EUR</option><option value="200">200.00 EUR</option></select></td></tr><tr align="left" valign="top"><td class="head"></td><td class="even"><input class="formButton" name="submit" id="submit" value="' |
|
198 | - . _SUBMIT |
|
199 | - . '" title="' |
|
200 | - . _SUBMIT |
|
201 | - . '" type="submit"></td></tr></tbody></table>', |
|
194 | + . _AM_WGGITHUB_ABOUT_MAKE_DONATION |
|
195 | + . '</th></tr><tr align="left" valign="top"><td class="head"><div class="xoops-form-element-caption-required"><span class="caption-text">' |
|
196 | + . _AM_WGGITHUB_DONATION_AMOUNT |
|
197 | + . '</span><span class="caption-marker">*</span></div></td><td class="even"><select size="1" name="item[A][amount]" id="item[A][amount]" title="Donation Amount"><option value="5">5.00 EUR</option><option value="10">10.00 EUR</option><option value="20">20.00 EUR</option><option value="40">40.00 EUR</option><option value="60">60.00 EUR</option><option value="80">80.00 EUR</option><option value="90">90.00 EUR</option><option value="100">100.00 EUR</option><option value="200">200.00 EUR</option></select></td></tr><tr align="left" valign="top"><td class="head"></td><td class="even"><input class="formButton" name="submit" id="submit" value="' |
|
198 | + . _SUBMIT |
|
199 | + . '" title="' |
|
200 | + . _SUBMIT |
|
201 | + . '" type="submit"></td></tr></tbody></table>', |
|
202 | 202 | 2 => '<input name="op" id="op" value="createinvoice" type="hidden"><input name="plugin" id="plugin" value="donations" type="hidden"><input name="donation" id="donation" value="1" type="hidden"><input name="drawfor" id="drawfor" value="Chronolabs Co-Operative" type="hidden"><input name="drawto" id="drawto" value="%s" type="hidden"><input name="drawto_email" id="drawto_email" value="%s" type="hidden"><input name="key" id="key" value="%s" type="hidden"><input name="currency" id="currency" value="EUR" type="hidden"><input name="weight_unit" id="weight_unit" value="kgs" type="hidden"><input name="item[A][cat]" id="item[A][cat]" value="XDN%s" type="hidden"><input name="item[A][name]" id="item[A][name]" value="Donation for %s" type="hidden"><input name="item[A][quantity]" id="item[A][quantity]" value="1" type="hidden"><input name="item[A][shipping]" id="item[A][shipping]" value="0" type="hidden"><input name="item[A][handling]" id="item[A][handling]" value="0" type="hidden"><input name="item[A][weight]" id="item[A][weight]" value="0" type="hidden"><input name="item[A][tax]" id="item[A][tax]" value="0" type="hidden"><input name="return" id="return" value="http://www.txmodxoops.org/modules/xdonations/success.php" type="hidden"><input name="cancel" id="cancel" value="http://www.txmodxoops.org/modules/xdonations/success.php" type="hidden"></form>', |
203 | 203 | 'D' => '', |
204 | 204 | 3 => '', |
@@ -56,11 +56,11 @@ discard block |
||
56 | 56 | { |
57 | 57 | if ($considerHtml) { |
58 | 58 | // if the plain text is shorter than the maximum length, return the whole text |
59 | - if (mb_strlen(\preg_replace('/<.*?' . '>/', '', $text)) <= $length) { |
|
59 | + if (mb_strlen(\preg_replace('/<.*?'.'>/', '', $text)) <= $length) { |
|
60 | 60 | return $text; |
61 | 61 | } |
62 | 62 | // splits all html-tags to scanable lines |
63 | - \preg_match_all('/(<.+?' . '>)?([^<>]*)/s', $text, $lines, PREG_SET_ORDER); |
|
63 | + \preg_match_all('/(<.+?'.'>)?([^<>]*)/s', $text, $lines, PREG_SET_ORDER); |
|
64 | 64 | $total_length = mb_strlen($ending); |
65 | 65 | $open_tags = []; |
66 | 66 | $truncate = ''; |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | unset($open_tags[$pos]); |
79 | 79 | } |
80 | 80 | // if tag is an opening tag |
81 | - } elseif (\preg_match('/^<\s*([^\s>!]+).*?' . '>$/s', $line_matchings[1], $tag_matchings)) { |
|
81 | + } elseif (\preg_match('/^<\s*([^\s>!]+).*?'.'>$/s', $line_matchings[1], $tag_matchings)) { |
|
82 | 82 | // add tag to the beginning of $open_tags list |
83 | 83 | \array_unshift($open_tags, \mb_strtolower($tag_matchings[1])); |
84 | 84 | } |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | if ($considerHtml) { |
139 | 139 | // close all unclosed html-tags |
140 | 140 | foreach ($open_tags as $tag) { |
141 | - $truncate .= '</' . $tag . '>'; |
|
141 | + $truncate .= '</'.$tag.'>'; |
|
142 | 142 | } |
143 | 143 | } |
144 | 144 | |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | //--></script> |
212 | 212 | <!-- End Form Validation JavaScript //-->', |
213 | 213 | ]; |
214 | - $paypalform = [ |
|
214 | + $paypalform = [ |
|
215 | 215 | 0 => '<form action="https://www.paypal.com/cgi-bin/webscr" method="post">', |
216 | 216 | 1 => '<input name="cmd" value="_s-xclick" type="hidden">', |
217 | 217 | 2 => '<input name="hosted_button_id" value="%s" type="hidden">', |
@@ -224,11 +224,11 @@ discard block |
||
224 | 224 | case 2: |
225 | 225 | $donationform[$key] = \sprintf( |
226 | 226 | $donationform[$key], |
227 | - $GLOBALS['xoopsConfig']['sitename'] . ' - ' . ('' != $GLOBALS['xoopsUser']->getVar('name') ? $GLOBALS['xoopsUser']->getVar('name') . ' [' . $GLOBALS['xoopsUser']->getVar('uname') . ']' : $GLOBALS['xoopsUser']->getVar('uname')), |
|
227 | + $GLOBALS['xoopsConfig']['sitename'].' - '.('' != $GLOBALS['xoopsUser']->getVar('name') ? $GLOBALS['xoopsUser']->getVar('name').' ['.$GLOBALS['xoopsUser']->getVar('uname').']' : $GLOBALS['xoopsUser']->getVar('uname')), |
|
228 | 228 | $GLOBALS['xoopsUser']->getVar('email'), |
229 | 229 | XOOPS_LICENSE_KEY, |
230 | 230 | \mb_strtoupper($GLOBALS['xoopsModule']->getVar('dirname')), |
231 | - \mb_strtoupper($GLOBALS['xoopsModule']->getVar('dirname')) . ' ' . $GLOBALS['xoopsModule']->getVar('name') |
|
231 | + \mb_strtoupper($GLOBALS['xoopsModule']->getVar('dirname')).' '.$GLOBALS['xoopsModule']->getVar('name') |
|
232 | 232 | ); |
233 | 233 | break; |
234 | 234 | } |
@@ -33,140 +33,140 @@ |
||
33 | 33 | */ |
34 | 34 | class Readmes extends \XoopsObject |
35 | 35 | { |
36 | - /** |
|
37 | - * Constructor |
|
38 | - * |
|
39 | - * @param null |
|
40 | - */ |
|
41 | - public function __construct() |
|
42 | - { |
|
43 | - $this->initVar('rm_id', XOBJ_DTYPE_INT); |
|
44 | - $this->initVar('rm_repoid', XOBJ_DTYPE_INT); |
|
45 | - $this->initVar('rm_name', XOBJ_DTYPE_TXTBOX); |
|
46 | - $this->initVar('rm_type', XOBJ_DTYPE_TXTBOX); |
|
47 | - $this->initVar('rm_content', XOBJ_DTYPE_TXTAREA); |
|
48 | - $this->initVar('rm_encoding', XOBJ_DTYPE_TXTBOX); |
|
49 | - $this->initVar('rm_downloadurl', XOBJ_DTYPE_TXTBOX); |
|
50 | - $this->initVar('rm_datecreated', XOBJ_DTYPE_INT); |
|
51 | - $this->initVar('rm_submitter', XOBJ_DTYPE_INT); |
|
52 | - } |
|
36 | + /** |
|
37 | + * Constructor |
|
38 | + * |
|
39 | + * @param null |
|
40 | + */ |
|
41 | + public function __construct() |
|
42 | + { |
|
43 | + $this->initVar('rm_id', XOBJ_DTYPE_INT); |
|
44 | + $this->initVar('rm_repoid', XOBJ_DTYPE_INT); |
|
45 | + $this->initVar('rm_name', XOBJ_DTYPE_TXTBOX); |
|
46 | + $this->initVar('rm_type', XOBJ_DTYPE_TXTBOX); |
|
47 | + $this->initVar('rm_content', XOBJ_DTYPE_TXTAREA); |
|
48 | + $this->initVar('rm_encoding', XOBJ_DTYPE_TXTBOX); |
|
49 | + $this->initVar('rm_downloadurl', XOBJ_DTYPE_TXTBOX); |
|
50 | + $this->initVar('rm_datecreated', XOBJ_DTYPE_INT); |
|
51 | + $this->initVar('rm_submitter', XOBJ_DTYPE_INT); |
|
52 | + } |
|
53 | 53 | |
54 | - /** |
|
55 | - * @static function &getInstance |
|
56 | - * |
|
57 | - * @param null |
|
58 | - */ |
|
59 | - public static function getInstance() |
|
60 | - { |
|
61 | - static $instance = false; |
|
62 | - if (!$instance) { |
|
63 | - $instance = new self(); |
|
64 | - } |
|
65 | - } |
|
54 | + /** |
|
55 | + * @static function &getInstance |
|
56 | + * |
|
57 | + * @param null |
|
58 | + */ |
|
59 | + public static function getInstance() |
|
60 | + { |
|
61 | + static $instance = false; |
|
62 | + if (!$instance) { |
|
63 | + $instance = new self(); |
|
64 | + } |
|
65 | + } |
|
66 | 66 | |
67 | - /** |
|
68 | - * The new inserted $Id |
|
69 | - * @return inserted id |
|
70 | - */ |
|
71 | - public function getNewInsertedIdReadmes() |
|
72 | - { |
|
73 | - $newInsertedId = $GLOBALS['xoopsDB']->getInsertId(); |
|
74 | - return $newInsertedId; |
|
75 | - } |
|
67 | + /** |
|
68 | + * The new inserted $Id |
|
69 | + * @return inserted id |
|
70 | + */ |
|
71 | + public function getNewInsertedIdReadmes() |
|
72 | + { |
|
73 | + $newInsertedId = $GLOBALS['xoopsDB']->getInsertId(); |
|
74 | + return $newInsertedId; |
|
75 | + } |
|
76 | 76 | |
77 | - /** |
|
78 | - * @public function getForm |
|
79 | - * @param bool $action |
|
80 | - * @return \XoopsThemeForm |
|
81 | - */ |
|
82 | - public function getFormReadmes($action = false) |
|
83 | - { |
|
84 | - $helper = \XoopsModules\Wggithub\Helper::getInstance(); |
|
85 | - if (!$action) { |
|
86 | - $action = $_SERVER['REQUEST_URI']; |
|
87 | - } |
|
88 | - $isAdmin = $GLOBALS['xoopsUser']->isAdmin($GLOBALS['xoopsModule']->mid()); |
|
89 | - // Title |
|
90 | - $title = $this->isNew() ? \sprintf(_AM_WGGITHUB_README_ADD) : \sprintf(_AM_WGGITHUB_README_EDIT); |
|
91 | - // Get Theme Form |
|
92 | - \xoops_load('XoopsFormLoader'); |
|
93 | - $form = new \XoopsThemeForm($title, 'form', $action, 'post', true); |
|
94 | - $form->setExtra('enctype="multipart/form-data"'); |
|
95 | - // Form Table repositories |
|
96 | - $repositoriesHandler = $helper->getHandler('Repositories'); |
|
97 | - $rmRepoidSelect = new \XoopsFormSelect(_AM_WGGITHUB_README_REPOID, 'rm_repoid', $this->getVar('rm_repoid')); |
|
98 | - $rmRepoidSelect->addOptionArray($repositoriesHandler->getList()); |
|
99 | - $form->addElement($rmRepoidSelect); |
|
100 | - // Form Text rmName |
|
101 | - $form->addElement(new \XoopsFormText(_AM_WGGITHUB_README_NAME, 'rm_name', 50, 255, $this->getVar('rm_name'))); |
|
102 | - // Form Text rmType |
|
77 | + /** |
|
78 | + * @public function getForm |
|
79 | + * @param bool $action |
|
80 | + * @return \XoopsThemeForm |
|
81 | + */ |
|
82 | + public function getFormReadmes($action = false) |
|
83 | + { |
|
84 | + $helper = \XoopsModules\Wggithub\Helper::getInstance(); |
|
85 | + if (!$action) { |
|
86 | + $action = $_SERVER['REQUEST_URI']; |
|
87 | + } |
|
88 | + $isAdmin = $GLOBALS['xoopsUser']->isAdmin($GLOBALS['xoopsModule']->mid()); |
|
89 | + // Title |
|
90 | + $title = $this->isNew() ? \sprintf(_AM_WGGITHUB_README_ADD) : \sprintf(_AM_WGGITHUB_README_EDIT); |
|
91 | + // Get Theme Form |
|
92 | + \xoops_load('XoopsFormLoader'); |
|
93 | + $form = new \XoopsThemeForm($title, 'form', $action, 'post', true); |
|
94 | + $form->setExtra('enctype="multipart/form-data"'); |
|
95 | + // Form Table repositories |
|
96 | + $repositoriesHandler = $helper->getHandler('Repositories'); |
|
97 | + $rmRepoidSelect = new \XoopsFormSelect(_AM_WGGITHUB_README_REPOID, 'rm_repoid', $this->getVar('rm_repoid')); |
|
98 | + $rmRepoidSelect->addOptionArray($repositoriesHandler->getList()); |
|
99 | + $form->addElement($rmRepoidSelect); |
|
100 | + // Form Text rmName |
|
101 | + $form->addElement(new \XoopsFormText(_AM_WGGITHUB_README_NAME, 'rm_name', 50, 255, $this->getVar('rm_name'))); |
|
102 | + // Form Text rmType |
|
103 | 103 | $form->addElement(new \XoopsFormText(_AM_WGGITHUB_README_TYPE, 'rm_type', 50, 255, $this->getVar('rm_type'))); |
104 | - // Form Editor TextArea rmContent |
|
105 | - $form->addElement(new \XoopsFormTextArea(_AM_WGGITHUB_README_CONTENT, 'rm_content', $this->getVar('rm_content', 'e'), 4, 47)); |
|
106 | - // Form Text rmEncoding |
|
107 | - $form->addElement(new \XoopsFormText(_AM_WGGITHUB_README_ENCODING, 'rm_encoding', 50, 255, $this->getVar('rm_encoding'))); |
|
108 | - // Form Text rmDownloadurl |
|
109 | - $form->addElement(new \XoopsFormText(_AM_WGGITHUB_README_DOWNLOADURL, 'rm_downloadurl', 50, 255, $this->getVar('rm_downloadurl'))); |
|
110 | - // Form Text Date Select rmDatecreated |
|
111 | - $rmDatecreated = $this->isNew() ?: $this->getVar('rm_datecreated'); |
|
112 | - $form->addElement(new \XoopsFormTextDateSelect(_AM_WGGITHUB_README_DATECREATED, 'rm_datecreated', '', $rmDatecreated)); |
|
113 | - // Form Select User rmSubmitter |
|
114 | - $form->addElement(new \XoopsFormSelectUser(_AM_WGGITHUB_README_SUBMITTER, 'rm_submitter', false, $this->getVar('rm_submitter'))); |
|
115 | - // To Save |
|
116 | - $form->addElement(new \XoopsFormHidden('op', 'save')); |
|
117 | - $form->addElement(new \XoopsFormButtonTray('', _SUBMIT, 'submit', '', false)); |
|
118 | - return $form; |
|
119 | - } |
|
104 | + // Form Editor TextArea rmContent |
|
105 | + $form->addElement(new \XoopsFormTextArea(_AM_WGGITHUB_README_CONTENT, 'rm_content', $this->getVar('rm_content', 'e'), 4, 47)); |
|
106 | + // Form Text rmEncoding |
|
107 | + $form->addElement(new \XoopsFormText(_AM_WGGITHUB_README_ENCODING, 'rm_encoding', 50, 255, $this->getVar('rm_encoding'))); |
|
108 | + // Form Text rmDownloadurl |
|
109 | + $form->addElement(new \XoopsFormText(_AM_WGGITHUB_README_DOWNLOADURL, 'rm_downloadurl', 50, 255, $this->getVar('rm_downloadurl'))); |
|
110 | + // Form Text Date Select rmDatecreated |
|
111 | + $rmDatecreated = $this->isNew() ?: $this->getVar('rm_datecreated'); |
|
112 | + $form->addElement(new \XoopsFormTextDateSelect(_AM_WGGITHUB_README_DATECREATED, 'rm_datecreated', '', $rmDatecreated)); |
|
113 | + // Form Select User rmSubmitter |
|
114 | + $form->addElement(new \XoopsFormSelectUser(_AM_WGGITHUB_README_SUBMITTER, 'rm_submitter', false, $this->getVar('rm_submitter'))); |
|
115 | + // To Save |
|
116 | + $form->addElement(new \XoopsFormHidden('op', 'save')); |
|
117 | + $form->addElement(new \XoopsFormButtonTray('', _SUBMIT, 'submit', '', false)); |
|
118 | + return $form; |
|
119 | + } |
|
120 | 120 | |
121 | - /** |
|
122 | - * Get Values |
|
123 | - * @param null $keys |
|
124 | - * @param null $format |
|
125 | - * @param null $maxDepth |
|
126 | - * @return array |
|
127 | - */ |
|
128 | - public function getValuesReadmes($keys = null, $format = null, $maxDepth = null) |
|
129 | - { |
|
130 | - $helper = \XoopsModules\Wggithub\Helper::getInstance(); |
|
131 | - $utility = new \XoopsModules\Wggithub\Utility(); |
|
132 | - $ret = $this->getValues($keys, $format, $maxDepth); |
|
133 | - $ret['id'] = $this->getVar('rm_id'); |
|
134 | - $repositoriesHandler = $helper->getHandler('Repositories'); |
|
135 | - $repositoriesObj = $repositoriesHandler->get($this->getVar('rm_repoid')); |
|
136 | - $ret['repoid'] = $repositoriesObj->getVar('repo_name'); |
|
121 | + /** |
|
122 | + * Get Values |
|
123 | + * @param null $keys |
|
124 | + * @param null $format |
|
125 | + * @param null $maxDepth |
|
126 | + * @return array |
|
127 | + */ |
|
128 | + public function getValuesReadmes($keys = null, $format = null, $maxDepth = null) |
|
129 | + { |
|
130 | + $helper = \XoopsModules\Wggithub\Helper::getInstance(); |
|
131 | + $utility = new \XoopsModules\Wggithub\Utility(); |
|
132 | + $ret = $this->getValues($keys, $format, $maxDepth); |
|
133 | + $ret['id'] = $this->getVar('rm_id'); |
|
134 | + $repositoriesHandler = $helper->getHandler('Repositories'); |
|
135 | + $repositoriesObj = $repositoriesHandler->get($this->getVar('rm_repoid')); |
|
136 | + $ret['repoid'] = $repositoriesObj->getVar('repo_name'); |
|
137 | 137 | $rmName = $this->getVar('rm_name'); |
138 | - $ret['name'] = $rmName; |
|
139 | - $ret['type'] = $this->getVar('rm_type'); |
|
140 | - $ret['content'] = $this->getVar('rm_content', 'e'); |
|
138 | + $ret['name'] = $rmName; |
|
139 | + $ret['type'] = $this->getVar('rm_type'); |
|
140 | + $ret['content'] = $this->getVar('rm_content', 'e'); |
|
141 | 141 | $contentDecoded = base64_decode($this->getVar('rm_content', 'n')); |
142 | - if ('.MD' == substr(strtoupper($rmName), -3)) { |
|
142 | + if ('.MD' == substr(strtoupper($rmName), -3)) { |
|
143 | 143 | $Parsedown = new MDParser\Parsedown(); |
144 | 144 | $contentClean = $Parsedown->text($contentDecoded); |
145 | 145 | } else { |
146 | 146 | $contentClean = $contentDecoded; |
147 | 147 | } |
148 | 148 | $ret['content_clean'] = $contentClean; |
149 | - $editorMaxchar = $helper->getConfig('editor_maxchar'); |
|
150 | - $ret['content_short'] = $utility::truncateHtml($ret['content'], $editorMaxchar); |
|
151 | - $ret['encoding'] = $this->getVar('rm_encoding'); |
|
152 | - $ret['downloadurl'] = $this->getVar('rm_downloadurl'); |
|
153 | - $ret['datecreated'] = \formatTimestamp($this->getVar('rm_datecreated'), 'm'); |
|
154 | - $ret['submitter'] = \XoopsUser::getUnameFromId($this->getVar('rm_submitter')); |
|
155 | - return $ret; |
|
156 | - } |
|
149 | + $editorMaxchar = $helper->getConfig('editor_maxchar'); |
|
150 | + $ret['content_short'] = $utility::truncateHtml($ret['content'], $editorMaxchar); |
|
151 | + $ret['encoding'] = $this->getVar('rm_encoding'); |
|
152 | + $ret['downloadurl'] = $this->getVar('rm_downloadurl'); |
|
153 | + $ret['datecreated'] = \formatTimestamp($this->getVar('rm_datecreated'), 'm'); |
|
154 | + $ret['submitter'] = \XoopsUser::getUnameFromId($this->getVar('rm_submitter')); |
|
155 | + return $ret; |
|
156 | + } |
|
157 | 157 | |
158 | - /** |
|
159 | - * Returns an array representation of the object |
|
160 | - * |
|
161 | - * @return array |
|
162 | - */ |
|
163 | - public function toArrayReadmes() |
|
164 | - { |
|
165 | - $ret = []; |
|
166 | - $vars = $this->getVars(); |
|
167 | - foreach (\array_keys($vars) as $var) { |
|
168 | - $ret[$var] = $this->getVar('"{$var}"'); |
|
169 | - } |
|
170 | - return $ret; |
|
171 | - } |
|
158 | + /** |
|
159 | + * Returns an array representation of the object |
|
160 | + * |
|
161 | + * @return array |
|
162 | + */ |
|
163 | + public function toArrayReadmes() |
|
164 | + { |
|
165 | + $ret = []; |
|
166 | + $vars = $this->getVars(); |
|
167 | + foreach (\array_keys($vars) as $var) { |
|
168 | + $ret[$var] = $this->getVar('"{$var}"'); |
|
169 | + } |
|
170 | + return $ret; |
|
171 | + } |
|
172 | 172 | } |
@@ -32,25 +32,25 @@ |
||
32 | 32 | */ |
33 | 33 | class Permissions extends \XoopsObject |
34 | 34 | { |
35 | - /** |
|
36 | - * Constructor |
|
37 | - * |
|
38 | - * @param null |
|
39 | - */ |
|
40 | - public function __construct() |
|
41 | - { |
|
42 | - } |
|
43 | - |
|
44 | - /** |
|
45 | - * @static function &getInstance |
|
46 | - * |
|
47 | - * @param null |
|
48 | - */ |
|
49 | - public static function getInstance() |
|
50 | - { |
|
51 | - static $instance = false; |
|
52 | - if (!$instance) { |
|
53 | - $instance = new self(); |
|
54 | - } |
|
55 | - } |
|
35 | + /** |
|
36 | + * Constructor |
|
37 | + * |
|
38 | + * @param null |
|
39 | + */ |
|
40 | + public function __construct() |
|
41 | + { |
|
42 | + } |
|
43 | + |
|
44 | + /** |
|
45 | + * @static function &getInstance |
|
46 | + * |
|
47 | + * @param null |
|
48 | + */ |
|
49 | + public static function getInstance() |
|
50 | + { |
|
51 | + static $instance = false; |
|
52 | + if (!$instance) { |
|
53 | + $instance = new self(); |
|
54 | + } |
|
55 | + } |
|
56 | 56 | } |
@@ -31,94 +31,94 @@ |
||
31 | 31 | */ |
32 | 32 | class DirectoriesHandler extends \XoopsPersistableObjectHandler |
33 | 33 | { |
34 | - /** |
|
35 | - * Constructor |
|
36 | - * |
|
37 | - * @param \XoopsDatabase $db |
|
38 | - */ |
|
39 | - public function __construct(\XoopsDatabase $db) |
|
40 | - { |
|
41 | - parent::__construct($db, 'wggithub_directories', Directories::class, 'dir_id', 'dir_name'); |
|
42 | - } |
|
34 | + /** |
|
35 | + * Constructor |
|
36 | + * |
|
37 | + * @param \XoopsDatabase $db |
|
38 | + */ |
|
39 | + public function __construct(\XoopsDatabase $db) |
|
40 | + { |
|
41 | + parent::__construct($db, 'wggithub_directories', Directories::class, 'dir_id', 'dir_name'); |
|
42 | + } |
|
43 | 43 | |
44 | - /** |
|
45 | - * @param bool $isNew |
|
46 | - * |
|
47 | - * @return object |
|
48 | - */ |
|
49 | - public function create($isNew = true) |
|
50 | - { |
|
51 | - return parent::create($isNew); |
|
52 | - } |
|
44 | + /** |
|
45 | + * @param bool $isNew |
|
46 | + * |
|
47 | + * @return object |
|
48 | + */ |
|
49 | + public function create($isNew = true) |
|
50 | + { |
|
51 | + return parent::create($isNew); |
|
52 | + } |
|
53 | 53 | |
54 | - /** |
|
55 | - * retrieve a field |
|
56 | - * |
|
57 | - * @param int $i field id |
|
58 | - * @param null fields |
|
59 | - * @return mixed reference to the {@link Get} object |
|
60 | - */ |
|
61 | - public function get($i = null, $fields = null) |
|
62 | - { |
|
63 | - return parent::get($i, $fields); |
|
64 | - } |
|
54 | + /** |
|
55 | + * retrieve a field |
|
56 | + * |
|
57 | + * @param int $i field id |
|
58 | + * @param null fields |
|
59 | + * @return mixed reference to the {@link Get} object |
|
60 | + */ |
|
61 | + public function get($i = null, $fields = null) |
|
62 | + { |
|
63 | + return parent::get($i, $fields); |
|
64 | + } |
|
65 | 65 | |
66 | - /** |
|
67 | - * get inserted id |
|
68 | - * |
|
69 | - * @param null |
|
70 | - * @return int reference to the {@link Get} object |
|
71 | - */ |
|
72 | - public function getInsertId() |
|
73 | - { |
|
74 | - return $this->db->getInsertId(); |
|
75 | - } |
|
66 | + /** |
|
67 | + * get inserted id |
|
68 | + * |
|
69 | + * @param null |
|
70 | + * @return int reference to the {@link Get} object |
|
71 | + */ |
|
72 | + public function getInsertId() |
|
73 | + { |
|
74 | + return $this->db->getInsertId(); |
|
75 | + } |
|
76 | 76 | |
77 | - /** |
|
78 | - * Get Count Directories in the database |
|
79 | - * @param int $start |
|
80 | - * @param int $limit |
|
81 | - * @param string $sort |
|
82 | - * @param string $order |
|
83 | - * @return int |
|
84 | - */ |
|
85 | - public function getCountDirectories($start = 0, $limit = 0, $sort = 'dir_id ASC, dir_name', $order = 'ASC') |
|
86 | - { |
|
87 | - $crCountDirectories = new \CriteriaCompo(); |
|
88 | - $crCountDirectories = $this->getDirectoriesCriteria($crCountDirectories, $start, $limit, $sort, $order); |
|
89 | - return $this->getCount($crCountDirectories); |
|
90 | - } |
|
77 | + /** |
|
78 | + * Get Count Directories in the database |
|
79 | + * @param int $start |
|
80 | + * @param int $limit |
|
81 | + * @param string $sort |
|
82 | + * @param string $order |
|
83 | + * @return int |
|
84 | + */ |
|
85 | + public function getCountDirectories($start = 0, $limit = 0, $sort = 'dir_id ASC, dir_name', $order = 'ASC') |
|
86 | + { |
|
87 | + $crCountDirectories = new \CriteriaCompo(); |
|
88 | + $crCountDirectories = $this->getDirectoriesCriteria($crCountDirectories, $start, $limit, $sort, $order); |
|
89 | + return $this->getCount($crCountDirectories); |
|
90 | + } |
|
91 | 91 | |
92 | - /** |
|
93 | - * Get All Directories in the database |
|
94 | - * @param int $start |
|
95 | - * @param int $limit |
|
96 | - * @param string $sort |
|
97 | - * @param string $order |
|
98 | - * @return array |
|
99 | - */ |
|
100 | - public function getAllDirectories($start = 0, $limit = 0, $sort = 'dir_id ASC, dir_name', $order = 'ASC') |
|
101 | - { |
|
102 | - $crAllDirectories = new \CriteriaCompo(); |
|
103 | - $crAllDirectories = $this->getDirectoriesCriteria($crAllDirectories, $start, $limit, $sort, $order); |
|
104 | - return $this->getAll($crAllDirectories); |
|
105 | - } |
|
92 | + /** |
|
93 | + * Get All Directories in the database |
|
94 | + * @param int $start |
|
95 | + * @param int $limit |
|
96 | + * @param string $sort |
|
97 | + * @param string $order |
|
98 | + * @return array |
|
99 | + */ |
|
100 | + public function getAllDirectories($start = 0, $limit = 0, $sort = 'dir_id ASC, dir_name', $order = 'ASC') |
|
101 | + { |
|
102 | + $crAllDirectories = new \CriteriaCompo(); |
|
103 | + $crAllDirectories = $this->getDirectoriesCriteria($crAllDirectories, $start, $limit, $sort, $order); |
|
104 | + return $this->getAll($crAllDirectories); |
|
105 | + } |
|
106 | 106 | |
107 | - /** |
|
108 | - * Get Criteria Directories |
|
109 | - * @param $crDirectories |
|
110 | - * @param int $start |
|
111 | - * @param int $limit |
|
112 | - * @param string $sort |
|
113 | - * @param string $order |
|
114 | - * @return int |
|
115 | - */ |
|
116 | - private function getDirectoriesCriteria($crDirectories, $start, $limit, $sort, $order) |
|
117 | - { |
|
118 | - $crDirectories->setStart($start); |
|
119 | - $crDirectories->setLimit($limit); |
|
120 | - $crDirectories->setSort($sort); |
|
121 | - $crDirectories->setOrder($order); |
|
122 | - return $crDirectories; |
|
123 | - } |
|
107 | + /** |
|
108 | + * Get Criteria Directories |
|
109 | + * @param $crDirectories |
|
110 | + * @param int $start |
|
111 | + * @param int $limit |
|
112 | + * @param string $sort |
|
113 | + * @param string $order |
|
114 | + * @return int |
|
115 | + */ |
|
116 | + private function getDirectoriesCriteria($crDirectories, $start, $limit, $sort, $order) |
|
117 | + { |
|
118 | + $crDirectories->setStart($start); |
|
119 | + $crDirectories->setLimit($limit); |
|
120 | + $crDirectories->setSort($sort); |
|
121 | + $crDirectories->setOrder($order); |
|
122 | + return $crDirectories; |
|
123 | + } |
|
124 | 124 | } |
@@ -20,12 +20,12 @@ discard block |
||
20 | 20 | * @author Goffy - XOOPS Development Team - Email:<[email protected]> - Website:<https://wedega.com> |
21 | 21 | */ |
22 | 22 | |
23 | -include dirname(__DIR__, 2) . '/mainfile.php'; |
|
24 | -include __DIR__ . '/include/common.php'; |
|
23 | +include dirname(__DIR__, 2).'/mainfile.php'; |
|
24 | +include __DIR__.'/include/common.php'; |
|
25 | 25 | $moduleDirName = \basename(__DIR__); |
26 | 26 | // Breadcrumbs |
27 | 27 | $xoBreadcrumbs = []; |
28 | -$xoBreadcrumbs[] = ['title' => _MA_WGGITHUB_TITLE, 'link' => WGGITHUB_URL . '/']; |
|
28 | +$xoBreadcrumbs[] = ['title' => _MA_WGGITHUB_TITLE, 'link' => WGGITHUB_URL.'/']; |
|
29 | 29 | // Get instance of module |
30 | 30 | $helper = \XoopsModules\Wggithub\Helper::getInstance(); |
31 | 31 | $settingsHandler = $helper->getHandler('Settings'); |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | // |
39 | 39 | $myts = MyTextSanitizer::getInstance(); |
40 | 40 | // Default Css Style |
41 | -$style = WGGITHUB_URL . '/assets/css/style.css'; |
|
41 | +$style = WGGITHUB_URL.'/assets/css/style.css'; |
|
42 | 42 | // Smarty Default |
43 | 43 | $sysPathIcon16 = $GLOBALS['xoopsModule']->getInfo('sysicons16'); |
44 | 44 | $sysPathIcon32 = $GLOBALS['xoopsModule']->getInfo('sysicons32'); |
@@ -33,61 +33,61 @@ discard block |
||
33 | 33 | */ |
34 | 34 | function b_wggithub_repositories_show($options) |
35 | 35 | { |
36 | - include_once XOOPS_ROOT_PATH . '/modules/wggithub/class/repositories.php'; |
|
37 | - $myts = MyTextSanitizer::getInstance(); |
|
38 | - $GLOBALS['xoopsTpl']->assign('wggithub_upload_url', WGGITHUB_UPLOAD_URL); |
|
39 | - $block = []; |
|
40 | - $typeBlock = $options[0]; |
|
41 | - $limit = $options[1]; |
|
42 | - $lenghtTitle = $options[2]; |
|
43 | - $helper = Helper::getInstance(); |
|
44 | - $repositoriesHandler = $helper->getHandler('Repositories'); |
|
45 | - $crRepositories = new \CriteriaCompo(); |
|
46 | - \array_shift($options); |
|
47 | - \array_shift($options); |
|
48 | - \array_shift($options); |
|
36 | + include_once XOOPS_ROOT_PATH . '/modules/wggithub/class/repositories.php'; |
|
37 | + $myts = MyTextSanitizer::getInstance(); |
|
38 | + $GLOBALS['xoopsTpl']->assign('wggithub_upload_url', WGGITHUB_UPLOAD_URL); |
|
39 | + $block = []; |
|
40 | + $typeBlock = $options[0]; |
|
41 | + $limit = $options[1]; |
|
42 | + $lenghtTitle = $options[2]; |
|
43 | + $helper = Helper::getInstance(); |
|
44 | + $repositoriesHandler = $helper->getHandler('Repositories'); |
|
45 | + $crRepositories = new \CriteriaCompo(); |
|
46 | + \array_shift($options); |
|
47 | + \array_shift($options); |
|
48 | + \array_shift($options); |
|
49 | 49 | |
50 | - switch ($typeBlock) { |
|
51 | - case 'last': |
|
52 | - default: |
|
53 | - // For the block: repositories last |
|
54 | - $crRepositories->setSort('repo_datecreated'); |
|
55 | - $crRepositories->setOrder('DESC'); |
|
56 | - break; |
|
57 | - case 'new': |
|
58 | - // For the block: repositories new |
|
59 | - $crRepositories->add(new \Criteria('repo_datecreated', \DateTime::createFromFormat(_SHORTDATESTRING), '>=')); |
|
60 | - $crRepositories->add(new \Criteria('repo_datecreated', \DateTime::createFromFormat(_SHORTDATESTRING) + 86400, '<=')); |
|
61 | - $crRepositories->setSort('repo_datecreated'); |
|
62 | - $crRepositories->setOrder('ASC'); |
|
63 | - break; |
|
64 | - case 'hits': |
|
65 | - // For the block: repositories hits |
|
66 | - $crRepositories->setSort('repo_hits'); |
|
67 | - $crRepositories->setOrder('DESC'); |
|
68 | - break; |
|
69 | - case 'top': |
|
70 | - // For the block: repositories top |
|
71 | - $crRepositories->setSort('repo_top'); |
|
72 | - $crRepositories->setOrder('ASC'); |
|
73 | - break; |
|
74 | - case 'random': |
|
75 | - // For the block: repositories random |
|
76 | - $crRepositories->setSort('RAND()'); |
|
77 | - break; |
|
78 | - } |
|
50 | + switch ($typeBlock) { |
|
51 | + case 'last': |
|
52 | + default: |
|
53 | + // For the block: repositories last |
|
54 | + $crRepositories->setSort('repo_datecreated'); |
|
55 | + $crRepositories->setOrder('DESC'); |
|
56 | + break; |
|
57 | + case 'new': |
|
58 | + // For the block: repositories new |
|
59 | + $crRepositories->add(new \Criteria('repo_datecreated', \DateTime::createFromFormat(_SHORTDATESTRING), '>=')); |
|
60 | + $crRepositories->add(new \Criteria('repo_datecreated', \DateTime::createFromFormat(_SHORTDATESTRING) + 86400, '<=')); |
|
61 | + $crRepositories->setSort('repo_datecreated'); |
|
62 | + $crRepositories->setOrder('ASC'); |
|
63 | + break; |
|
64 | + case 'hits': |
|
65 | + // For the block: repositories hits |
|
66 | + $crRepositories->setSort('repo_hits'); |
|
67 | + $crRepositories->setOrder('DESC'); |
|
68 | + break; |
|
69 | + case 'top': |
|
70 | + // For the block: repositories top |
|
71 | + $crRepositories->setSort('repo_top'); |
|
72 | + $crRepositories->setOrder('ASC'); |
|
73 | + break; |
|
74 | + case 'random': |
|
75 | + // For the block: repositories random |
|
76 | + $crRepositories->setSort('RAND()'); |
|
77 | + break; |
|
78 | + } |
|
79 | 79 | |
80 | - $crRepositories->setLimit($limit); |
|
81 | - $repositoriesAll = $repositoriesHandler->getAll($crRepositories); |
|
82 | - unset($crRepositories); |
|
83 | - if (\count($repositoriesAll) > 0) { |
|
84 | - foreach (\array_keys($repositoriesAll) as $i) { |
|
85 | - $block[$i]['name'] = $myts->htmlSpecialChars($repositoriesAll[$i]->getVar('repo_name')); |
|
86 | - $block[$i]['htmlurl'] = $myts->htmlSpecialChars($repositoriesAll[$i]->getVar('repo_htmlurl')); |
|
87 | - } |
|
88 | - } |
|
80 | + $crRepositories->setLimit($limit); |
|
81 | + $repositoriesAll = $repositoriesHandler->getAll($crRepositories); |
|
82 | + unset($crRepositories); |
|
83 | + if (\count($repositoriesAll) > 0) { |
|
84 | + foreach (\array_keys($repositoriesAll) as $i) { |
|
85 | + $block[$i]['name'] = $myts->htmlSpecialChars($repositoriesAll[$i]->getVar('repo_name')); |
|
86 | + $block[$i]['htmlurl'] = $myts->htmlSpecialChars($repositoriesAll[$i]->getVar('repo_htmlurl')); |
|
87 | + } |
|
88 | + } |
|
89 | 89 | |
90 | - return $block; |
|
90 | + return $block; |
|
91 | 91 | |
92 | 92 | } |
93 | 93 | |
@@ -98,32 +98,32 @@ discard block |
||
98 | 98 | */ |
99 | 99 | function b_wggithub_repositories_edit($options) |
100 | 100 | { |
101 | - include_once XOOPS_ROOT_PATH . '/modules/wggithub/class/repositories.php'; |
|
102 | - $helper = Helper::getInstance(); |
|
103 | - $repositoriesHandler = $helper->getHandler('Repositories'); |
|
104 | - $GLOBALS['xoopsTpl']->assign('wggithub_upload_url', WGGITHUB_UPLOAD_URL); |
|
105 | - $form = _MB_WGGITHUB_DISPLAY; |
|
106 | - $form .= "<input type='hidden' name='options[0]' value='".$options[0]."' />"; |
|
107 | - $form .= "<input type='text' name='options[1]' size='5' maxlength='255' value='" . $options[1] . "' /> <br>"; |
|
108 | - $form .= _MB_WGGITHUB_TITLE_LENGTH . " : <input type='text' name='options[2]' size='5' maxlength='255' value='" . $options[2] . "' /><br><br>"; |
|
109 | - \array_shift($options); |
|
110 | - \array_shift($options); |
|
111 | - \array_shift($options); |
|
101 | + include_once XOOPS_ROOT_PATH . '/modules/wggithub/class/repositories.php'; |
|
102 | + $helper = Helper::getInstance(); |
|
103 | + $repositoriesHandler = $helper->getHandler('Repositories'); |
|
104 | + $GLOBALS['xoopsTpl']->assign('wggithub_upload_url', WGGITHUB_UPLOAD_URL); |
|
105 | + $form = _MB_WGGITHUB_DISPLAY; |
|
106 | + $form .= "<input type='hidden' name='options[0]' value='".$options[0]."' />"; |
|
107 | + $form .= "<input type='text' name='options[1]' size='5' maxlength='255' value='" . $options[1] . "' /> <br>"; |
|
108 | + $form .= _MB_WGGITHUB_TITLE_LENGTH . " : <input type='text' name='options[2]' size='5' maxlength='255' value='" . $options[2] . "' /><br><br>"; |
|
109 | + \array_shift($options); |
|
110 | + \array_shift($options); |
|
111 | + \array_shift($options); |
|
112 | 112 | |
113 | - $crRepositories = new \CriteriaCompo(); |
|
114 | - $crRepositories->add(new \Criteria('repo_id', 0, '!=')); |
|
115 | - $crRepositories->setSort('repo_id'); |
|
116 | - $crRepositories->setOrder('ASC'); |
|
117 | - $repositoriesAll = $repositoriesHandler->getAll($crRepositories); |
|
118 | - unset($crRepositories); |
|
119 | - $form .= _MB_WGGITHUB_REPOSITORIES_TO_DISPLAY . "<br><select name='options[]' multiple='multiple' size='5'>"; |
|
120 | - $form .= "<option value='0' " . (\in_array(0, $options) == false ? '' : "selected='selected'") . '>' . _MB_WGGITHUB_ALL_REPOSITORIES . '</option>'; |
|
121 | - foreach (\array_keys($repositoriesAll) as $i) { |
|
122 | - $repo_id = $repositoriesAll[$i]->getVar('repo_id'); |
|
123 | - $form .= "<option value='" . $repo_id . "' " . (\in_array($repo_id, $options) == false ? '' : "selected='selected'") . '>' . $repositoriesAll[$i]->getVar('repo_name') . '</option>'; |
|
124 | - } |
|
125 | - $form .= '</select>'; |
|
113 | + $crRepositories = new \CriteriaCompo(); |
|
114 | + $crRepositories->add(new \Criteria('repo_id', 0, '!=')); |
|
115 | + $crRepositories->setSort('repo_id'); |
|
116 | + $crRepositories->setOrder('ASC'); |
|
117 | + $repositoriesAll = $repositoriesHandler->getAll($crRepositories); |
|
118 | + unset($crRepositories); |
|
119 | + $form .= _MB_WGGITHUB_REPOSITORIES_TO_DISPLAY . "<br><select name='options[]' multiple='multiple' size='5'>"; |
|
120 | + $form .= "<option value='0' " . (\in_array(0, $options) == false ? '' : "selected='selected'") . '>' . _MB_WGGITHUB_ALL_REPOSITORIES . '</option>'; |
|
121 | + foreach (\array_keys($repositoriesAll) as $i) { |
|
122 | + $repo_id = $repositoriesAll[$i]->getVar('repo_id'); |
|
123 | + $form .= "<option value='" . $repo_id . "' " . (\in_array($repo_id, $options) == false ? '' : "selected='selected'") . '>' . $repositoriesAll[$i]->getVar('repo_name') . '</option>'; |
|
124 | + } |
|
125 | + $form .= '</select>'; |
|
126 | 126 | |
127 | - return $form; |
|
127 | + return $form; |
|
128 | 128 | |
129 | 129 | } |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | use XoopsModules\Wggithub\Helper; |
25 | 25 | use XoopsModules\Wggithub\Constants; |
26 | 26 | |
27 | -include_once XOOPS_ROOT_PATH . '/modules/wggithub/include/common.php'; |
|
27 | +include_once XOOPS_ROOT_PATH.'/modules/wggithub/include/common.php'; |
|
28 | 28 | |
29 | 29 | /** |
30 | 30 | * Function show block |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | */ |
34 | 34 | function b_wggithub_repositories_show($options) |
35 | 35 | { |
36 | - include_once XOOPS_ROOT_PATH . '/modules/wggithub/class/repositories.php'; |
|
36 | + include_once XOOPS_ROOT_PATH.'/modules/wggithub/class/repositories.php'; |
|
37 | 37 | $myts = MyTextSanitizer::getInstance(); |
38 | 38 | $GLOBALS['xoopsTpl']->assign('wggithub_upload_url', WGGITHUB_UPLOAD_URL); |
39 | 39 | $block = []; |
@@ -98,14 +98,14 @@ discard block |
||
98 | 98 | */ |
99 | 99 | function b_wggithub_repositories_edit($options) |
100 | 100 | { |
101 | - include_once XOOPS_ROOT_PATH . '/modules/wggithub/class/repositories.php'; |
|
101 | + include_once XOOPS_ROOT_PATH.'/modules/wggithub/class/repositories.php'; |
|
102 | 102 | $helper = Helper::getInstance(); |
103 | 103 | $repositoriesHandler = $helper->getHandler('Repositories'); |
104 | 104 | $GLOBALS['xoopsTpl']->assign('wggithub_upload_url', WGGITHUB_UPLOAD_URL); |
105 | 105 | $form = _MB_WGGITHUB_DISPLAY; |
106 | 106 | $form .= "<input type='hidden' name='options[0]' value='".$options[0]."' />"; |
107 | - $form .= "<input type='text' name='options[1]' size='5' maxlength='255' value='" . $options[1] . "' /> <br>"; |
|
108 | - $form .= _MB_WGGITHUB_TITLE_LENGTH . " : <input type='text' name='options[2]' size='5' maxlength='255' value='" . $options[2] . "' /><br><br>"; |
|
107 | + $form .= "<input type='text' name='options[1]' size='5' maxlength='255' value='".$options[1]."' /> <br>"; |
|
108 | + $form .= _MB_WGGITHUB_TITLE_LENGTH." : <input type='text' name='options[2]' size='5' maxlength='255' value='".$options[2]."' /><br><br>"; |
|
109 | 109 | \array_shift($options); |
110 | 110 | \array_shift($options); |
111 | 111 | \array_shift($options); |
@@ -116,11 +116,11 @@ discard block |
||
116 | 116 | $crRepositories->setOrder('ASC'); |
117 | 117 | $repositoriesAll = $repositoriesHandler->getAll($crRepositories); |
118 | 118 | unset($crRepositories); |
119 | - $form .= _MB_WGGITHUB_REPOSITORIES_TO_DISPLAY . "<br><select name='options[]' multiple='multiple' size='5'>"; |
|
120 | - $form .= "<option value='0' " . (\in_array(0, $options) == false ? '' : "selected='selected'") . '>' . _MB_WGGITHUB_ALL_REPOSITORIES . '</option>'; |
|
119 | + $form .= _MB_WGGITHUB_REPOSITORIES_TO_DISPLAY."<br><select name='options[]' multiple='multiple' size='5'>"; |
|
120 | + $form .= "<option value='0' ".(\in_array(0, $options) == false ? '' : "selected='selected'").'>'._MB_WGGITHUB_ALL_REPOSITORIES.'</option>'; |
|
121 | 121 | foreach (\array_keys($repositoriesAll) as $i) { |
122 | 122 | $repo_id = $repositoriesAll[$i]->getVar('repo_id'); |
123 | - $form .= "<option value='" . $repo_id . "' " . (\in_array($repo_id, $options) == false ? '' : "selected='selected'") . '>' . $repositoriesAll[$i]->getVar('repo_name') . '</option>'; |
|
123 | + $form .= "<option value='".$repo_id."' ".(\in_array($repo_id, $options) == false ? '' : "selected='selected'").'>'.$repositoriesAll[$i]->getVar('repo_name').'</option>'; |
|
124 | 124 | } |
125 | 125 | $form .= '</select>'; |
126 | 126 |
@@ -5,18 +5,18 @@ |
||
5 | 5 | $pathIcon16 = \Xmf\Module\Admin::iconUrl('', 16); |
6 | 6 | $moduleDirName = \basename(\dirname(__DIR__)); |
7 | 7 | |
8 | - return (object)[ |
|
9 | - 'name' => \mb_strtoupper($moduleDirName) . ' IconConfigurator', |
|
8 | + return (object) [ |
|
9 | + 'name' => \mb_strtoupper($moduleDirName).' IconConfigurator', |
|
10 | 10 | 'icons' => [ |
11 | - 'edit' => "<img src='" . $pathIcon16 . "/edit.png' alt=" . _EDIT . "' align='middle'>", |
|
12 | - 'delete' => "<img src='" . $pathIcon16 . "/delete.png' alt='" . _DELETE . "' align='middle'>", |
|
13 | - 'clone' => "<img src='" . $pathIcon16 . "/editcopy.png' alt='" . _CLONE . "' align='middle'>", |
|
14 | - 'preview' => "<img src='" . $pathIcon16 . "/view.png' alt='" . _PREVIEW . "' align='middle'>", |
|
15 | - 'print' => "<img src='" . $pathIcon16 . "/printer.png' alt='" . _CLONE . "' align='middle'>", |
|
16 | - 'pdf' => "<img src='" . $pathIcon16 . "/pdf.png' alt='" . _CLONE . "' align='middle'>", |
|
17 | - 'add' => "<img src='" . $pathIcon16 . "/add.png' alt='" . _ADD . "' align='middle'>", |
|
18 | - '0' => "<img src='" . $pathIcon16 . "/0.png' alt='" . 0 . "' align='middle'>", |
|
19 | - '1' => "<img src='" . $pathIcon16 . "/1.png' alt='" . 1 . "' align='middle'>", |
|
11 | + 'edit' => "<img src='".$pathIcon16."/edit.png' alt="._EDIT."' align='middle'>", |
|
12 | + 'delete' => "<img src='".$pathIcon16."/delete.png' alt='"._DELETE."' align='middle'>", |
|
13 | + 'clone' => "<img src='".$pathIcon16."/editcopy.png' alt='"._CLONE."' align='middle'>", |
|
14 | + 'preview' => "<img src='".$pathIcon16."/view.png' alt='"._PREVIEW."' align='middle'>", |
|
15 | + 'print' => "<img src='".$pathIcon16."/printer.png' alt='"._CLONE."' align='middle'>", |
|
16 | + 'pdf' => "<img src='".$pathIcon16."/pdf.png' alt='"._CLONE."' align='middle'>", |
|
17 | + 'add' => "<img src='".$pathIcon16."/add.png' alt='"._ADD."' align='middle'>", |
|
18 | + '0' => "<img src='".$pathIcon16."/0.png' alt='".0."' align='middle'>", |
|
19 | + '1' => "<img src='".$pathIcon16."/1.png' alt='".1."' align='middle'>", |
|
20 | 20 | ], |
21 | 21 | ]; |
22 | 22 | } |
@@ -5,20 +5,20 @@ |
||
5 | 5 | $moduleDirName = \basename(\dirname(__DIR__)); |
6 | 6 | $moduleDirNameUpper = \mb_strtoupper($moduleDirName); |
7 | 7 | |
8 | - return (object)[ |
|
9 | - 'name' => \mb_strtoupper($moduleDirName) . ' PathConfigurator', |
|
8 | + return (object) [ |
|
9 | + 'name' => \mb_strtoupper($moduleDirName).' PathConfigurator', |
|
10 | 10 | 'paths' => [ |
11 | 11 | 'dirname' => $moduleDirName, |
12 | - 'admin' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/admin', |
|
13 | - 'modPath' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName, |
|
14 | - 'modUrl' => XOOPS_URL . '/modules/' . $moduleDirName, |
|
15 | - 'uploadPath' => XOOPS_UPLOAD_PATH . '/' . $moduleDirName, |
|
16 | - 'uploadUrl' => XOOPS_UPLOAD_URL . '/' . $moduleDirName, |
|
12 | + 'admin' => XOOPS_ROOT_PATH.'/modules/'.$moduleDirName.'/admin', |
|
13 | + 'modPath' => XOOPS_ROOT_PATH.'/modules/'.$moduleDirName, |
|
14 | + 'modUrl' => XOOPS_URL.'/modules/'.$moduleDirName, |
|
15 | + 'uploadPath' => XOOPS_UPLOAD_PATH.'/'.$moduleDirName, |
|
16 | + 'uploadUrl' => XOOPS_UPLOAD_URL.'/'.$moduleDirName, |
|
17 | 17 | ], |
18 | 18 | 'uploadFolders' => [ |
19 | - XOOPS_UPLOAD_PATH . '/' . $moduleDirName, |
|
20 | - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/category', |
|
21 | - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/screenshots', |
|
19 | + XOOPS_UPLOAD_PATH.'/'.$moduleDirName, |
|
20 | + XOOPS_UPLOAD_PATH.'/'.$moduleDirName.'/category', |
|
21 | + XOOPS_UPLOAD_PATH.'/'.$moduleDirName.'/screenshots', |
|
22 | 22 | //XOOPS_UPLOAD_PATH . '/flags' |
23 | 23 | ], |
24 | 24 | ]; |