@@ -78,7 +78,7 @@ |
||
78 | 78 | ($this->onProgress)(); |
79 | 79 | |
80 | 80 | $chunk = $this->doRead(); |
81 | - $chunk->onResolve(function ($e, $data) { |
|
81 | + $chunk->onResolve(function($e, $data) { |
|
82 | 82 | if (null !== $data) { |
83 | 83 | $this->uploaded = \strlen($data); |
84 | 84 | } else { |
@@ -39,7 +39,7 @@ |
||
39 | 39 | |
40 | 40 | private $defaultOptions = self::OPTIONS_DEFAULTS + [ |
41 | 41 | 'auth_ntlm' => null, // array|string - an array containing the username as first value, and optionally the |
42 | - // password as the second one; or string like username:password - enabling NTLM auth |
|
42 | + // password as the second one; or string like username:password - enabling NTLM auth |
|
43 | 43 | 'extra' => [ |
44 | 44 | 'curl' => [], // A list of extra curl options indexed by their corresponding CURLOPT_* |
45 | 45 | ], |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | 'auth_ntlm' => null, // array|string - an array containing the username as first value, and optionally the |
42 | 42 | // password as the second one; or string like username:password - enabling NTLM auth |
43 | 43 | 'extra' => [ |
44 | - 'curl' => [], // A list of extra curl options indexed by their corresponding CURLOPT_* |
|
44 | + 'curl' => [], // A list of extra curl options indexed by their corresponding CURLOPT_* |
|
45 | 45 | ], |
46 | 46 | ]; |
47 | 47 | |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | return; |
98 | 98 | } |
99 | 99 | |
100 | - curl_multi_setopt($this->multi->handle, \CURLMOPT_PUSHFUNCTION, function ($parent, $pushed, array $requestHeaders) use ($maxPendingPushes) { |
|
100 | + curl_multi_setopt($this->multi->handle, \CURLMOPT_PUSHFUNCTION, function($parent, $pushed, array $requestHeaders) use ($maxPendingPushes) { |
|
101 | 101 | return $this->handlePush($parent, $pushed, $requestHeaders, $maxPendingPushes); |
102 | 102 | }); |
103 | 103 | } |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | } else { |
244 | 244 | $eof = false; |
245 | 245 | $buffer = ''; |
246 | - $curlopts[\CURLOPT_READFUNCTION] = static function ($ch, $fd, $length) use ($body, &$buffer, &$eof) { |
|
246 | + $curlopts[\CURLOPT_READFUNCTION] = static function($ch, $fd, $length) use ($body, &$buffer, &$eof) { |
|
247 | 247 | return self::readRequestBody($length, $body, $buffer, $eof); |
248 | 248 | }; |
249 | 249 | } |
@@ -473,18 +473,18 @@ discard block |
||
473 | 473 | $redirectHeaders = []; |
474 | 474 | if (0 < $options['max_redirects']) { |
475 | 475 | $redirectHeaders['host'] = $host; |
476 | - $redirectHeaders['with_auth'] = $redirectHeaders['no_auth'] = \array_filter($options['headers'], static function ($h) { |
|
476 | + $redirectHeaders['with_auth'] = $redirectHeaders['no_auth'] = \array_filter($options['headers'], static function($h) { |
|
477 | 477 | return 0 !== stripos($h, 'Host:'); |
478 | 478 | }); |
479 | 479 | |
480 | 480 | if (isset($options['normalized_headers']['authorization'][0]) || isset($options['normalized_headers']['cookie'][0])) { |
481 | - $redirectHeaders['no_auth'] = \array_filter($options['headers'], static function ($h) { |
|
481 | + $redirectHeaders['no_auth'] = \array_filter($options['headers'], static function($h) { |
|
482 | 482 | return 0 !== stripos($h, 'Authorization:') && 0 !== stripos($h, 'Cookie:'); |
483 | 483 | }); |
484 | 484 | } |
485 | 485 | } |
486 | 486 | |
487 | - return static function ($ch, string $location) use ($redirectHeaders) { |
|
487 | + return static function($ch, string $location) use ($redirectHeaders) { |
|
488 | 488 | try { |
489 | 489 | $location = self::parseUrl($location); |
490 | 490 | } catch (InvalidArgumentException $e) { |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | |
505 | 505 | private function findConstantName($opt): ?string |
506 | 506 | { |
507 | - $constants = \array_filter(get_defined_constants(), static function ($v, $k) use ($opt) { |
|
507 | + $constants = \array_filter(get_defined_constants(), static function($v, $k) use ($opt) { |
|
508 | 508 | return $v === $opt && 'C' === $k[0] && (0 === \strpos($k, 'CURLOPT_') || 0 === \strpos($k, 'CURLINFO_')); |
509 | 509 | }, \ARRAY_FILTER_USE_BOTH); |
510 | 510 |
@@ -136,7 +136,7 @@ |
||
136 | 136 | return new ResponseStream(MockResponse::stream($mockResponses, $timeout)); |
137 | 137 | } |
138 | 138 | |
139 | - return new ResponseStream((function () use ($mockResponses, $clientResponses, $timeout) { |
|
139 | + return new ResponseStream((function() use ($mockResponses, $clientResponses, $timeout) { |
|
140 | 140 | yield from MockResponse::stream($mockResponses, $timeout); |
141 | 141 | yield $this->client->stream($clientResponses, $timeout); |
142 | 142 | })()); |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | $buffer = $options['buffer'] ?? true; |
47 | 47 | |
48 | 48 | if ($buffer instanceof \Closure) { |
49 | - $options['buffer'] = static function (array $headers) use ($buffer) { |
|
49 | + $options['buffer'] = static function(array $headers) use ($buffer) { |
|
50 | 50 | if (!\is_bool($buffer = $buffer($headers))) { |
51 | 51 | if (!\is_array($bufferInfo = @stream_get_meta_data($buffer))) { |
52 | 52 | throw new \LogicException(\sprintf('The closure passed as option "buffer" must return bool or stream resource, got "%s".', get_debug_type($buffer))); |
@@ -287,8 +287,8 @@ discard block |
||
287 | 287 | return $body; |
288 | 288 | } |
289 | 289 | |
290 | - $generatorToCallable = static function (\Generator $body): \Closure { |
|
291 | - return static function () use ($body) { |
|
290 | + $generatorToCallable = static function(\Generator $body): \Closure { |
|
291 | + return static function() use ($body) { |
|
292 | 292 | while ($body->valid()) { |
293 | 293 | $chunk = $body->current(); |
294 | 294 | $body->next(); |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | } |
308 | 308 | |
309 | 309 | if ($body instanceof \Traversable) { |
310 | - return $generatorToCallable((static function ($body) { yield from $body; })($body)); |
|
310 | + return $generatorToCallable((static function($body) { yield from $body; })($body)); |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | if ($body instanceof \Closure) { |
@@ -477,11 +477,11 @@ discard block |
||
477 | 477 | |
478 | 478 | if (false !== \strpos($parts[$part], '%')) { |
479 | 479 | // https://tools.ietf.org/html/rfc3986#section-2.3 |
480 | - $parts[$part] = preg_replace_callback('/%(?:2[DE]|3[0-9]|[46][1-9A-F]|5F|[57][0-9A]|7E)++/i', function ($m) { return rawurldecode($m[0]); }, $parts[$part]); |
|
480 | + $parts[$part] = preg_replace_callback('/%(?:2[DE]|3[0-9]|[46][1-9A-F]|5F|[57][0-9A]|7E)++/i', function($m) { return rawurldecode($m[0]); }, $parts[$part]); |
|
481 | 481 | } |
482 | 482 | |
483 | 483 | // https://tools.ietf.org/html/rfc3986#section-3.3 |
484 | - $parts[$part] = preg_replace_callback("#[^-A-Za-z0-9._~!$&/'()*+,;=:@%]++#", function ($m) { return rawurlencode($m[0]); }, $parts[$part]); |
|
484 | + $parts[$part] = preg_replace_callback("#[^-A-Za-z0-9._~!$&/'()*+,;=:@%]++#", function($m) { return rawurlencode($m[0]); }, $parts[$part]); |
|
485 | 485 | } |
486 | 486 | |
487 | 487 | return [ |
@@ -56,7 +56,7 @@ |
||
56 | 56 | $content = ''; |
57 | 57 | $firstChunk = null; |
58 | 58 | |
59 | - return new AsyncResponse($this->client, $method, $url, $options, function (ChunkInterface $chunk, AsyncContext $context) use ($method, $url, $options, &$retryCount, &$content, &$firstChunk) { |
|
59 | + return new AsyncResponse($this->client, $method, $url, $options, function(ChunkInterface $chunk, AsyncContext $context) use ($method, $url, $options, &$retryCount, &$content, &$firstChunk) { |
|
60 | 60 | $exception = null; |
61 | 61 | try { |
62 | 62 | if ($chunk->isTimeout() || null !== $chunk->getInformationalStatus()) { |
@@ -47,38 +47,38 @@ |
||
47 | 47 | $GLOBALS['xoopsTpl']->assign('showItem', $dirId > 0); |
48 | 48 | |
49 | 49 | switch ($op) { |
50 | - case 'show': |
|
51 | - case 'list': |
|
52 | - default: |
|
53 | - $crDirectories = new \CriteriaCompo(); |
|
54 | - if ($dirId > 0) { |
|
55 | - $crDirectories->add(new \Criteria('dir_id', $dirId)); |
|
56 | - } |
|
57 | - $directoriesCount = $directoriesHandler->getCount($crDirectories); |
|
58 | - $GLOBALS['xoopsTpl']->assign('directoriesCount', $directoriesCount); |
|
59 | - $crDirectories->setStart($start); |
|
60 | - $crDirectories->setLimit($limit); |
|
61 | - $directoriesAll = $directoriesHandler->getAll($crDirectories); |
|
62 | - if ($directoriesCount > 0) { |
|
63 | - $directories = []; |
|
64 | - // Get All Directories |
|
65 | - foreach (\array_keys($directoriesAll) as $i) { |
|
66 | - $directories[$i] = $directoriesAll[$i]->getValuesDirectories(); |
|
67 | - $keywords[$i] = $directoriesAll[$i]->getVar('dir_name'); |
|
68 | - } |
|
69 | - $GLOBALS['xoopsTpl']->assign('directories', $directories); |
|
70 | - unset($directories); |
|
71 | - // Display Navigation |
|
72 | - if ($directoriesCount > $limit) { |
|
73 | - include_once \XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
74 | - $pagenav = new \XoopsPageNav($directoriesCount, $limit, $start, 'start', 'op=list&limit=' . $limit); |
|
75 | - $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); |
|
76 | - } |
|
77 | - $GLOBALS['xoopsTpl']->assign('type', $helper->getConfig('table_type')); |
|
78 | - $GLOBALS['xoopsTpl']->assign('divideby', $helper->getConfig('divideby')); |
|
79 | - $GLOBALS['xoopsTpl']->assign('numb_col', $helper->getConfig('numb_col')); |
|
80 | - } |
|
81 | - break; |
|
50 | + case 'show': |
|
51 | + case 'list': |
|
52 | + default: |
|
53 | + $crDirectories = new \CriteriaCompo(); |
|
54 | + if ($dirId > 0) { |
|
55 | + $crDirectories->add(new \Criteria('dir_id', $dirId)); |
|
56 | + } |
|
57 | + $directoriesCount = $directoriesHandler->getCount($crDirectories); |
|
58 | + $GLOBALS['xoopsTpl']->assign('directoriesCount', $directoriesCount); |
|
59 | + $crDirectories->setStart($start); |
|
60 | + $crDirectories->setLimit($limit); |
|
61 | + $directoriesAll = $directoriesHandler->getAll($crDirectories); |
|
62 | + if ($directoriesCount > 0) { |
|
63 | + $directories = []; |
|
64 | + // Get All Directories |
|
65 | + foreach (\array_keys($directoriesAll) as $i) { |
|
66 | + $directories[$i] = $directoriesAll[$i]->getValuesDirectories(); |
|
67 | + $keywords[$i] = $directoriesAll[$i]->getVar('dir_name'); |
|
68 | + } |
|
69 | + $GLOBALS['xoopsTpl']->assign('directories', $directories); |
|
70 | + unset($directories); |
|
71 | + // Display Navigation |
|
72 | + if ($directoriesCount > $limit) { |
|
73 | + include_once \XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
74 | + $pagenav = new \XoopsPageNav($directoriesCount, $limit, $start, 'start', 'op=list&limit=' . $limit); |
|
75 | + $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); |
|
76 | + } |
|
77 | + $GLOBALS['xoopsTpl']->assign('type', $helper->getConfig('table_type')); |
|
78 | + $GLOBALS['xoopsTpl']->assign('divideby', $helper->getConfig('divideby')); |
|
79 | + $GLOBALS['xoopsTpl']->assign('numb_col', $helper->getConfig('numb_col')); |
|
80 | + } |
|
81 | + break; |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | // Breadcrumbs |
@@ -25,9 +25,9 @@ discard block |
||
25 | 25 | use XoopsModules\Wggithub\Constants; |
26 | 26 | use XoopsModules\Wggithub\Common; |
27 | 27 | |
28 | -require __DIR__ . '/header.php'; |
|
28 | +require __DIR__.'/header.php'; |
|
29 | 29 | $GLOBALS['xoopsOption']['template_main'] = 'wggithub_directories.tpl'; |
30 | -include_once \XOOPS_ROOT_PATH . '/header.php'; |
|
30 | +include_once \XOOPS_ROOT_PATH.'/header.php'; |
|
31 | 31 | |
32 | 32 | $op = Request::getCmd('op', 'list'); |
33 | 33 | $start = Request::getInt('start', 0); |
@@ -70,8 +70,8 @@ discard block |
||
70 | 70 | unset($directories); |
71 | 71 | // Display Navigation |
72 | 72 | if ($directoriesCount > $limit) { |
73 | - include_once \XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
74 | - $pagenav = new \XoopsPageNav($directoriesCount, $limit, $start, 'start', 'op=list&limit=' . $limit); |
|
73 | + include_once \XOOPS_ROOT_PATH.'/class/pagenav.php'; |
|
74 | + $pagenav = new \XoopsPageNav($directoriesCount, $limit, $start, 'start', 'op=list&limit='.$limit); |
|
75 | 75 | $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); |
76 | 76 | } |
77 | 77 | $GLOBALS['xoopsTpl']->assign('type', $helper->getConfig('table_type')); |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | $xoBreadcrumbs[] = ['title' => \_MA_WGGITHUB_DIRECTORIES]; |
86 | 86 | |
87 | 87 | // Keywords |
88 | -wggithubMetaKeywords($helper->getConfig('keywords') . ', ' . \implode(',', $keywords)); |
|
88 | +wggithubMetaKeywords($helper->getConfig('keywords').', '.\implode(',', $keywords)); |
|
89 | 89 | unset($keywords); |
90 | 90 | |
91 | 91 | // Description |
@@ -93,4 +93,4 @@ discard block |
||
93 | 93 | $GLOBALS['xoopsTpl']->assign('xoops_mpageurl', WGGITHUB_URL.'/directories.php'); |
94 | 94 | $GLOBALS['xoopsTpl']->assign('wggithub_upload_url', WGGITHUB_UPLOAD_URL); |
95 | 95 | |
96 | -require __DIR__ . '/footer.php'; |
|
96 | +require __DIR__.'/footer.php'; |
@@ -20,7 +20,7 @@ |
||
20 | 20 | * @author Goffy - XOOPS Development Team - Email:<[email protected]> - Website:<https://wedega.com> |
21 | 21 | */ |
22 | 22 | if (\count($xoBreadcrumbs) > 1) { |
23 | - $GLOBALS['xoopsTpl']->assign('xoBreadcrumbs', $xoBreadcrumbs); |
|
23 | + $GLOBALS['xoopsTpl']->assign('xoBreadcrumbs', $xoBreadcrumbs); |
|
24 | 24 | } |
25 | 25 | $GLOBALS['xoopsTpl']->assign('adv', $helper->getConfig('advertise')); |
26 | 26 | // |
@@ -30,4 +30,4 @@ |
||
30 | 30 | $GLOBALS['xoopsTpl']->assign('admin', WGGITHUB_ADMIN); |
31 | 31 | $GLOBALS['xoopsTpl']->assign('copyright', $copyright); |
32 | 32 | // |
33 | -include_once \XOOPS_ROOT_PATH . '/footer.php'; |
|
33 | +include_once \XOOPS_ROOT_PATH.'/footer.php'; |
@@ -47,38 +47,38 @@ |
||
47 | 47 | $GLOBALS['xoopsTpl']->assign('showItem', $repoId > 0); |
48 | 48 | |
49 | 49 | switch ($op) { |
50 | - case 'show': |
|
51 | - case 'list': |
|
52 | - default: |
|
53 | - $crRepositories = new \CriteriaCompo(); |
|
54 | - if ($repoId > 0) { |
|
55 | - $crRepositories->add(new \Criteria('repo_id', $repoId)); |
|
56 | - } |
|
57 | - $repositoriesCount = $repositoriesHandler->getCount($crRepositories); |
|
58 | - $GLOBALS['xoopsTpl']->assign('repositoriesCount', $repositoriesCount); |
|
59 | - $crRepositories->setStart($start); |
|
60 | - $crRepositories->setLimit($limit); |
|
61 | - $repositoriesAll = $repositoriesHandler->getAll($crRepositories); |
|
62 | - if ($repositoriesCount > 0) { |
|
63 | - $repositories = []; |
|
64 | - // Get All Repositories |
|
65 | - foreach (\array_keys($repositoriesAll) as $i) { |
|
66 | - $repositories[$i] = $repositoriesAll[$i]->getValuesRepositories(); |
|
67 | - $keywords[$i] = $repositoriesAll[$i]->getVar('repo_name'); |
|
68 | - } |
|
69 | - $GLOBALS['xoopsTpl']->assign('repositories', $repositories); |
|
70 | - unset($repositories); |
|
71 | - // Display Navigation |
|
72 | - if ($repositoriesCount > $limit) { |
|
73 | - include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
74 | - $pagenav = new \XoopsPageNav($repositoriesCount, $limit, $start, 'start', 'op=list&limit=' . $limit); |
|
75 | - $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); |
|
76 | - } |
|
77 | - $GLOBALS['xoopsTpl']->assign('type', $helper->getConfig('table_type')); |
|
78 | - $GLOBALS['xoopsTpl']->assign('divideby', $helper->getConfig('divideby')); |
|
79 | - $GLOBALS['xoopsTpl']->assign('numb_col', $helper->getConfig('numb_col')); |
|
80 | - } |
|
81 | - break; |
|
50 | + case 'show': |
|
51 | + case 'list': |
|
52 | + default: |
|
53 | + $crRepositories = new \CriteriaCompo(); |
|
54 | + if ($repoId > 0) { |
|
55 | + $crRepositories->add(new \Criteria('repo_id', $repoId)); |
|
56 | + } |
|
57 | + $repositoriesCount = $repositoriesHandler->getCount($crRepositories); |
|
58 | + $GLOBALS['xoopsTpl']->assign('repositoriesCount', $repositoriesCount); |
|
59 | + $crRepositories->setStart($start); |
|
60 | + $crRepositories->setLimit($limit); |
|
61 | + $repositoriesAll = $repositoriesHandler->getAll($crRepositories); |
|
62 | + if ($repositoriesCount > 0) { |
|
63 | + $repositories = []; |
|
64 | + // Get All Repositories |
|
65 | + foreach (\array_keys($repositoriesAll) as $i) { |
|
66 | + $repositories[$i] = $repositoriesAll[$i]->getValuesRepositories(); |
|
67 | + $keywords[$i] = $repositoriesAll[$i]->getVar('repo_name'); |
|
68 | + } |
|
69 | + $GLOBALS['xoopsTpl']->assign('repositories', $repositories); |
|
70 | + unset($repositories); |
|
71 | + // Display Navigation |
|
72 | + if ($repositoriesCount > $limit) { |
|
73 | + include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
74 | + $pagenav = new \XoopsPageNav($repositoriesCount, $limit, $start, 'start', 'op=list&limit=' . $limit); |
|
75 | + $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); |
|
76 | + } |
|
77 | + $GLOBALS['xoopsTpl']->assign('type', $helper->getConfig('table_type')); |
|
78 | + $GLOBALS['xoopsTpl']->assign('divideby', $helper->getConfig('divideby')); |
|
79 | + $GLOBALS['xoopsTpl']->assign('numb_col', $helper->getConfig('numb_col')); |
|
80 | + } |
|
81 | + break; |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | // Breadcrumbs |
@@ -25,9 +25,9 @@ discard block |
||
25 | 25 | use XoopsModules\Wggithub\Constants; |
26 | 26 | use XoopsModules\Wggithub\Common; |
27 | 27 | |
28 | -require __DIR__ . '/header.php'; |
|
28 | +require __DIR__.'/header.php'; |
|
29 | 29 | $GLOBALS['xoopsOption']['template_main'] = 'wggithub_repositories.tpl'; |
30 | -include_once XOOPS_ROOT_PATH . '/header.php'; |
|
30 | +include_once XOOPS_ROOT_PATH.'/header.php'; |
|
31 | 31 | |
32 | 32 | $op = Request::getCmd('op', 'list'); |
33 | 33 | $start = Request::getInt('start', 0); |
@@ -70,8 +70,8 @@ discard block |
||
70 | 70 | unset($repositories); |
71 | 71 | // Display Navigation |
72 | 72 | if ($repositoriesCount > $limit) { |
73 | - include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
74 | - $pagenav = new \XoopsPageNav($repositoriesCount, $limit, $start, 'start', 'op=list&limit=' . $limit); |
|
73 | + include_once XOOPS_ROOT_PATH.'/class/pagenav.php'; |
|
74 | + $pagenav = new \XoopsPageNav($repositoriesCount, $limit, $start, 'start', 'op=list&limit='.$limit); |
|
75 | 75 | $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); |
76 | 76 | } |
77 | 77 | $GLOBALS['xoopsTpl']->assign('type', $helper->getConfig('table_type')); |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | $xoBreadcrumbs[] = ['title' => _MA_WGGITHUB_REPOSITORIES]; |
86 | 86 | |
87 | 87 | // Keywords |
88 | -wggithubMetaKeywords($helper->getConfig('keywords') . ', ' . \implode(',', $keywords)); |
|
88 | +wggithubMetaKeywords($helper->getConfig('keywords').', '.\implode(',', $keywords)); |
|
89 | 89 | unset($keywords); |
90 | 90 | |
91 | 91 | // Description |
@@ -93,4 +93,4 @@ discard block |
||
93 | 93 | $GLOBALS['xoopsTpl']->assign('xoops_mpageurl', WGGITHUB_URL.'/repositories.php'); |
94 | 94 | $GLOBALS['xoopsTpl']->assign('wggithub_upload_url', WGGITHUB_UPLOAD_URL); |
95 | 95 | |
96 | -require __DIR__ . '/footer.php'; |
|
96 | +require __DIR__.'/footer.php'; |
@@ -32,119 +32,119 @@ |
||
32 | 32 | */ |
33 | 33 | class Settings extends \XoopsObject |
34 | 34 | { |
35 | - /** |
|
36 | - * Constructor |
|
37 | - * |
|
38 | - * @param null |
|
39 | - */ |
|
40 | - public function __construct() |
|
41 | - { |
|
42 | - $this->initVar('set_id', XOBJ_DTYPE_INT); |
|
43 | - $this->initVar('set_username', XOBJ_DTYPE_TXTBOX); |
|
44 | - $this->initVar('set_token', XOBJ_DTYPE_TXTBOX); |
|
45 | - $this->initVar('set_options', XOBJ_DTYPE_TXTAREA); |
|
46 | - $this->initVar('set_primary', XOBJ_DTYPE_INT); |
|
47 | - $this->initVar('set_date', XOBJ_DTYPE_INT); |
|
48 | - $this->initVar('set_submitter', XOBJ_DTYPE_INT); |
|
49 | - } |
|
35 | + /** |
|
36 | + * Constructor |
|
37 | + * |
|
38 | + * @param null |
|
39 | + */ |
|
40 | + public function __construct() |
|
41 | + { |
|
42 | + $this->initVar('set_id', XOBJ_DTYPE_INT); |
|
43 | + $this->initVar('set_username', XOBJ_DTYPE_TXTBOX); |
|
44 | + $this->initVar('set_token', XOBJ_DTYPE_TXTBOX); |
|
45 | + $this->initVar('set_options', XOBJ_DTYPE_TXTAREA); |
|
46 | + $this->initVar('set_primary', XOBJ_DTYPE_INT); |
|
47 | + $this->initVar('set_date', XOBJ_DTYPE_INT); |
|
48 | + $this->initVar('set_submitter', XOBJ_DTYPE_INT); |
|
49 | + } |
|
50 | 50 | |
51 | - /** |
|
52 | - * @static function &getInstance |
|
53 | - * |
|
54 | - * @param null |
|
55 | - */ |
|
56 | - public static function getInstance() |
|
57 | - { |
|
58 | - static $instance = false; |
|
59 | - if (!$instance) { |
|
60 | - $instance = new self(); |
|
61 | - } |
|
62 | - } |
|
51 | + /** |
|
52 | + * @static function &getInstance |
|
53 | + * |
|
54 | + * @param null |
|
55 | + */ |
|
56 | + public static function getInstance() |
|
57 | + { |
|
58 | + static $instance = false; |
|
59 | + if (!$instance) { |
|
60 | + $instance = new self(); |
|
61 | + } |
|
62 | + } |
|
63 | 63 | |
64 | - /** |
|
65 | - * The new inserted $Id |
|
66 | - * @return inserted id |
|
67 | - */ |
|
68 | - public function getNewInsertedIdSettings() |
|
69 | - { |
|
70 | - $newInsertedId = $GLOBALS['xoopsDB']->getInsertId(); |
|
71 | - return $newInsertedId; |
|
72 | - } |
|
64 | + /** |
|
65 | + * The new inserted $Id |
|
66 | + * @return inserted id |
|
67 | + */ |
|
68 | + public function getNewInsertedIdSettings() |
|
69 | + { |
|
70 | + $newInsertedId = $GLOBALS['xoopsDB']->getInsertId(); |
|
71 | + return $newInsertedId; |
|
72 | + } |
|
73 | 73 | |
74 | - /** |
|
75 | - * @public function getForm |
|
76 | - * @param bool $action |
|
77 | - * @return \XoopsThemeForm |
|
78 | - */ |
|
79 | - public function getFormSettings($action = false) |
|
80 | - { |
|
81 | - $helper = \XoopsModules\Wggithub\Helper::getInstance(); |
|
82 | - if (!$action) { |
|
83 | - $action = $_SERVER['REQUEST_URI']; |
|
84 | - } |
|
85 | - $isAdmin = $GLOBALS['xoopsUser']->isAdmin($GLOBALS['xoopsModule']->mid()); |
|
86 | - // Title |
|
87 | - $title = $this->isNew() ? \sprintf(_AM_WGGITHUB_SETTING_ADD) : \sprintf(_AM_WGGITHUB_SETTING_EDIT); |
|
88 | - // Get Theme Form |
|
89 | - \xoops_load('XoopsFormLoader'); |
|
90 | - $form = new \XoopsThemeForm($title, 'form', $action, 'post', true); |
|
91 | - $form->setExtra('enctype="multipart/form-data"'); |
|
92 | - // Form Text setUsername |
|
93 | - $form->addElement(new \XoopsFormText(_AM_WGGITHUB_SETTING_USERNAME, 'set_username', 50, 255, $this->getVar('set_username')), true); |
|
94 | - // Form Text setToken |
|
95 | - $form->addElement(new \XoopsFormText(_AM_WGGITHUB_SETTING_TOKEN, 'set_token', 50, 255, $this->getVar('set_token')), true); |
|
96 | - // Form Editor TextArea setOptions |
|
97 | - $form->addElement(new \XoopsFormTextArea(_AM_WGGITHUB_SETTING_OPTIONS, 'set_options', $this->getVar('set_options', 'e'), 4, 47)); |
|
98 | - // Form Radio Yes/No setPrimary |
|
99 | - $setPrimary = $this->isNew() ?: $this->getVar('set_primary'); |
|
100 | - $form->addElement(new \XoopsFormRadioYN(_AM_WGGITHUB_SETTING_PRIMARY, 'set_primary', $setPrimary)); |
|
101 | - // Form Text Date Select setDate |
|
102 | - $setDate = $this->isNew() ?: $this->getVar('set_date'); |
|
103 | - $form->addElement(new \XoopsFormTextDateSelect(_AM_WGGITHUB_SETTING_DATE, 'set_date', '', $setDate)); |
|
104 | - // Form Select User setSubmitter |
|
105 | - $form->addElement(new \XoopsFormSelectUser(_AM_WGGITHUB_SETTING_SUBMITTER, 'set_submitter', false, $this->getVar('set_submitter'))); |
|
106 | - // To Save |
|
107 | - $form->addElement(new \XoopsFormHidden('op', 'save')); |
|
108 | - $form->addElement(new \XoopsFormButtonTray('', _SUBMIT, 'submit', '', false)); |
|
109 | - return $form; |
|
110 | - } |
|
74 | + /** |
|
75 | + * @public function getForm |
|
76 | + * @param bool $action |
|
77 | + * @return \XoopsThemeForm |
|
78 | + */ |
|
79 | + public function getFormSettings($action = false) |
|
80 | + { |
|
81 | + $helper = \XoopsModules\Wggithub\Helper::getInstance(); |
|
82 | + if (!$action) { |
|
83 | + $action = $_SERVER['REQUEST_URI']; |
|
84 | + } |
|
85 | + $isAdmin = $GLOBALS['xoopsUser']->isAdmin($GLOBALS['xoopsModule']->mid()); |
|
86 | + // Title |
|
87 | + $title = $this->isNew() ? \sprintf(_AM_WGGITHUB_SETTING_ADD) : \sprintf(_AM_WGGITHUB_SETTING_EDIT); |
|
88 | + // Get Theme Form |
|
89 | + \xoops_load('XoopsFormLoader'); |
|
90 | + $form = new \XoopsThemeForm($title, 'form', $action, 'post', true); |
|
91 | + $form->setExtra('enctype="multipart/form-data"'); |
|
92 | + // Form Text setUsername |
|
93 | + $form->addElement(new \XoopsFormText(_AM_WGGITHUB_SETTING_USERNAME, 'set_username', 50, 255, $this->getVar('set_username')), true); |
|
94 | + // Form Text setToken |
|
95 | + $form->addElement(new \XoopsFormText(_AM_WGGITHUB_SETTING_TOKEN, 'set_token', 50, 255, $this->getVar('set_token')), true); |
|
96 | + // Form Editor TextArea setOptions |
|
97 | + $form->addElement(new \XoopsFormTextArea(_AM_WGGITHUB_SETTING_OPTIONS, 'set_options', $this->getVar('set_options', 'e'), 4, 47)); |
|
98 | + // Form Radio Yes/No setPrimary |
|
99 | + $setPrimary = $this->isNew() ?: $this->getVar('set_primary'); |
|
100 | + $form->addElement(new \XoopsFormRadioYN(_AM_WGGITHUB_SETTING_PRIMARY, 'set_primary', $setPrimary)); |
|
101 | + // Form Text Date Select setDate |
|
102 | + $setDate = $this->isNew() ?: $this->getVar('set_date'); |
|
103 | + $form->addElement(new \XoopsFormTextDateSelect(_AM_WGGITHUB_SETTING_DATE, 'set_date', '', $setDate)); |
|
104 | + // Form Select User setSubmitter |
|
105 | + $form->addElement(new \XoopsFormSelectUser(_AM_WGGITHUB_SETTING_SUBMITTER, 'set_submitter', false, $this->getVar('set_submitter'))); |
|
106 | + // To Save |
|
107 | + $form->addElement(new \XoopsFormHidden('op', 'save')); |
|
108 | + $form->addElement(new \XoopsFormButtonTray('', _SUBMIT, 'submit', '', false)); |
|
109 | + return $form; |
|
110 | + } |
|
111 | 111 | |
112 | - /** |
|
113 | - * Get Values |
|
114 | - * @param null $keys |
|
115 | - * @param null $format |
|
116 | - * @param null $maxDepth |
|
117 | - * @return array |
|
118 | - */ |
|
119 | - public function getValuesSettings($keys = null, $format = null, $maxDepth = null) |
|
120 | - { |
|
121 | - $helper = \XoopsModules\Wggithub\Helper::getInstance(); |
|
122 | - $utility = new \XoopsModules\Wggithub\Utility(); |
|
123 | - $ret = $this->getValues($keys, $format, $maxDepth); |
|
124 | - $ret['id'] = $this->getVar('set_id'); |
|
125 | - $ret['username'] = $this->getVar('set_username'); |
|
126 | - $ret['token'] = $this->getVar('set_token'); |
|
127 | - $ret['options'] = \strip_tags($this->getVar('set_options', 'e')); |
|
128 | - $editorMaxchar = $helper->getConfig('editor_maxchar'); |
|
129 | - $ret['options_short'] = $utility::truncateHtml($ret['options'], $editorMaxchar); |
|
130 | - $ret['primary'] = (int)$this->getVar('set_primary') > 0 ? _YES : _NO; |
|
131 | - $ret['date'] = \formatTimestamp($this->getVar('set_date'), 's'); |
|
132 | - $ret['submitter'] = \XoopsUser::getUnameFromId($this->getVar('set_submitter')); |
|
133 | - return $ret; |
|
134 | - } |
|
112 | + /** |
|
113 | + * Get Values |
|
114 | + * @param null $keys |
|
115 | + * @param null $format |
|
116 | + * @param null $maxDepth |
|
117 | + * @return array |
|
118 | + */ |
|
119 | + public function getValuesSettings($keys = null, $format = null, $maxDepth = null) |
|
120 | + { |
|
121 | + $helper = \XoopsModules\Wggithub\Helper::getInstance(); |
|
122 | + $utility = new \XoopsModules\Wggithub\Utility(); |
|
123 | + $ret = $this->getValues($keys, $format, $maxDepth); |
|
124 | + $ret['id'] = $this->getVar('set_id'); |
|
125 | + $ret['username'] = $this->getVar('set_username'); |
|
126 | + $ret['token'] = $this->getVar('set_token'); |
|
127 | + $ret['options'] = \strip_tags($this->getVar('set_options', 'e')); |
|
128 | + $editorMaxchar = $helper->getConfig('editor_maxchar'); |
|
129 | + $ret['options_short'] = $utility::truncateHtml($ret['options'], $editorMaxchar); |
|
130 | + $ret['primary'] = (int)$this->getVar('set_primary') > 0 ? _YES : _NO; |
|
131 | + $ret['date'] = \formatTimestamp($this->getVar('set_date'), 's'); |
|
132 | + $ret['submitter'] = \XoopsUser::getUnameFromId($this->getVar('set_submitter')); |
|
133 | + return $ret; |
|
134 | + } |
|
135 | 135 | |
136 | - /** |
|
137 | - * Returns an array representation of the object |
|
138 | - * |
|
139 | - * @return array |
|
140 | - */ |
|
141 | - public function toArraySettings() |
|
142 | - { |
|
143 | - $ret = []; |
|
144 | - $vars = $this->getVars(); |
|
145 | - foreach (\array_keys($vars) as $var) { |
|
146 | - $ret[$var] = $this->getVar('"{$var}"'); |
|
147 | - } |
|
148 | - return $ret; |
|
149 | - } |
|
136 | + /** |
|
137 | + * Returns an array representation of the object |
|
138 | + * |
|
139 | + * @return array |
|
140 | + */ |
|
141 | + public function toArraySettings() |
|
142 | + { |
|
143 | + $ret = []; |
|
144 | + $vars = $this->getVars(); |
|
145 | + foreach (\array_keys($vars) as $var) { |
|
146 | + $ret[$var] = $this->getVar('"{$var}"'); |
|
147 | + } |
|
148 | + return $ret; |
|
149 | + } |
|
150 | 150 | } |
@@ -127,7 +127,7 @@ |
||
127 | 127 | $ret['options'] = \strip_tags($this->getVar('set_options', 'e')); |
128 | 128 | $editorMaxchar = $helper->getConfig('editor_maxchar'); |
129 | 129 | $ret['options_short'] = $utility::truncateHtml($ret['options'], $editorMaxchar); |
130 | - $ret['primary'] = (int)$this->getVar('set_primary') > 0 ? _YES : _NO; |
|
130 | + $ret['primary'] = (int) $this->getVar('set_primary') > 0 ? _YES : _NO; |
|
131 | 131 | $ret['date'] = \formatTimestamp($this->getVar('set_date'), 's'); |
132 | 132 | $ret['submitter'] = \XoopsUser::getUnameFromId($this->getVar('set_submitter')); |
133 | 133 | return $ret; |