|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace XoopsModules\Xooghost\Plugin; |
|
4
|
|
|
|
|
5
|
|
|
/** |
|
6
|
|
|
* Xooghost 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 Xooghost |
|
18
|
|
|
* @since 2.6.0 |
|
19
|
|
|
* @author Laurent JEN (Aka DuGris) |
|
20
|
|
|
*/ |
|
21
|
|
|
class SystemPlugin extends \Xoops\Module\Plugin\PluginAbstract implements \SystemPluginInterface |
|
22
|
|
|
{ |
|
23
|
|
|
/** |
|
24
|
|
|
* @param int $uid |
|
25
|
|
|
* |
|
26
|
|
|
* @return mixed |
|
27
|
|
|
*/ |
|
28
|
|
|
public function userPosts($uid) |
|
29
|
|
|
{ |
|
30
|
|
|
$helper = \XoopsModules\Xooghost\Helper::getInstance(); |
|
31
|
|
|
$pageHandler = $helper->getHandler('Page'); |
|
32
|
|
|
|
|
33
|
|
|
$criteria = new \CriteriaCompo(); |
|
34
|
|
|
$criteria->add(new \Criteria('xooghost_online', 1)); |
|
35
|
|
|
$criteria->add(new \Criteria('xooghost_published', time(), '<=')); |
|
36
|
|
|
$criteria->add(new \Criteria('xooghost_uid', $uid)); |
|
37
|
|
|
|
|
38
|
|
|
return $pageHandler->getCount($criteria); |
|
|
|
|
|
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* @return bool |
|
43
|
|
|
*/ |
|
44
|
|
|
public function waiting() |
|
45
|
|
|
{ |
|
46
|
|
|
$helper = \XoopsModules\Xooghost\Helper::getInstance(); |
|
47
|
|
|
$pageHandler = $helper->getHandler('Page'); |
|
48
|
|
|
$criteria = new \CriteriaCompo(new \Criteria('xooghost_online', 0)); |
|
49
|
|
|
if ($count = $pageHandler->getCount($criteria)) { |
|
50
|
|
|
$ret['count'] = $count; |
|
|
|
|
|
|
51
|
|
|
$ret['name'] = \Xoops::getInstance()->getHandlerModule()->getByDirname('xooghost')->getVar('name'); |
|
52
|
|
|
$ret['link'] = \Xoops::getInstance()->url('modules/xooghost/admin/pages.php?online=0'); |
|
53
|
|
|
|
|
54
|
|
|
return $ret; |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
return false; |
|
|
|
|
|
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
/** |
|
61
|
|
|
* @param int $limit |
|
62
|
|
|
* |
|
63
|
|
|
* @return array |
|
64
|
|
|
*/ |
|
65
|
|
|
public function backend($limit = 10) |
|
66
|
|
|
{ |
|
67
|
|
|
$xoops = \Xoops::getInstance(); |
|
68
|
|
|
$helper = \XoopsModules\Xooghost\Helper::getInstance(); |
|
69
|
|
|
$pageHandler = $helper->getHandler('Page'); |
|
70
|
|
|
|
|
71
|
|
|
$ret = []; |
|
72
|
|
|
$messages = $pageHandler->getPublished('published', 'desc', 0, $limit); |
|
|
|
|
|
|
73
|
|
|
foreach ($messages as $k => $message) { |
|
74
|
|
|
$ret[$k]['title'] = $message['xooghost_title']; |
|
75
|
|
|
$ret[$k]['link'] = $xoops->url('modules/xooghost/' . $message['xooghost_url']); |
|
76
|
|
|
$ret[$k]['content'] = $message['xooghost_content']; |
|
77
|
|
|
$ret[$k]['date'] = $message['xooghost_time']; |
|
78
|
|
|
} |
|
79
|
|
|
|
|
80
|
|
|
return $ret; |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
|
|
/** |
|
84
|
|
|
* @return array |
|
85
|
|
|
*/ |
|
86
|
|
|
public function userMenus() |
|
87
|
|
|
{ |
|
88
|
|
|
return []; |
|
89
|
|
|
} |
|
90
|
|
|
} |
|
91
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.