/
private.php
60 lines (46 loc) · 1.5 KB
/
private.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
/**
* @version $Id$
* Kunena Component
* @package Kunena
*
* @Copyright (C) 2008 - 2011 Kunena Team. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
* @link http://www.kunena.org
*
**/
//
// Dont allow direct linking
defined( '_JEXEC' ) or die('');
kimport('integration.integration');
abstract class KunenaPrivate
{
public $priority = 0;
protected static $instance = false;
abstract public function __construct();
static public function getInstance($integration = null) {
if (self::$instance === false) {
$config = KunenaFactory::getConfig ();
if (! $integration)
$integration = $config->integration_private;
self::$instance = KunenaIntegration::initialize ( 'private', $integration );
}
return self::$instance;
}
protected function getOnClick($userid) {}
abstract protected function getURL($userid);
public function showIcon($userid)
{
$my = JFactory::getUser();
// Don't send messages from/to anonymous and to yourself
if ($my->id == 0 || $userid == 0 || $userid == $my->id) return '';
$url = $this->getURL($userid);
$onclick = $this->getOnClick($userid);
// No PMS enabled or PM not allowed
if (empty($url)) return '';
// We should offer the user a PM link
return '<a href="' . $url . '"' .$onclick. ' title="'.JText::_('COM_KUNENA_VIEW_PMS').'"><span class="kicon-profile kicon-profile-pm" alt="' .JText::_('COM_KUNENA_VIEW_PMS'). '"></span></a>';
}
public function getInboxLink() {}
public function getUnreadCount() {}
}