cpanel.php
4.12 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<?php
/**
* @copyright Copyright (c) 2009-2020 Ryan Demmer. All rights reserved
* @license GNU/GPL 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* JCE is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses
*/
defined('JPATH_PLATFORM') or die;
require_once JPATH_ADMINISTRATOR . '/components/com_jce/includes/constants.php';
class JceModelCpanel extends JModelLegacy
{
public function getIcons()
{
$user = JFactory::getUser();
$icons = array();
$views = array(
'config' => 'equalizer',
'profiles' => 'users',
'browser' => 'picture',
'mediabox' => 'pictures',
);
foreach ($views as $name => $icon) {
// if its mediabox, check the plugin is installed and enabled
if ($name === "mediabox" && !JPluginHelper::isEnabled('system', 'jcemediabox')) {
continue;
}
// check if its allowed...
if (!$user->authorise('jce.' . $name, 'com_jce')) {
continue;
}
$link = 'index.php?option=com_jce&view=' . $name;
$title = JText::_('WF_' . strtoupper($name));
if ($name === "browser") {
if (!JPluginHelper::isEnabled('quickicon', 'jce')) {
continue;
}
$title = JText::_('WF_' . strtoupper($name) . '_TITLE');
}
$icons[] = '<li class="quickicon mb-3"><a title="' . JText::_('WF_' . strtoupper($name) . '_DESC') . '" href="' . $link . '" class="btn btn-default" role="button"><div class="quickicon-icon d-flex align-items-end" role="presentation"><span class="fa fa-' . $icon . ' icon-' . $icon . '" aria-hidden="true" role="presentation"></span></div><div class="quickicon-text d-flex align-items-center"><span class="j-links-link">' . $title . '</span></div></a></li>';
}
return $icons;
}
public function getFeeds()
{
$app = JFactory::getApplication();
$params = JComponentHelper::getParams('com_jce');
$limit = $params->get('feed_limit', 2);
$feeds = array();
$options = array(
'rssUrl' => 'https://www.joomlacontenteditor.net/news?format=feed',
);
$xml = simplexml_load_file($options['rssUrl']);
if (empty($xml)) {
return $feeds;
}
jimport('joomla.filter.input');
$filter = JFilterInput::getInstance();
$count = count($xml->channel->item);
if ($count) {
$count = ($count > $limit) ? $limit : $count;
for ($i = 0; $i < $count; ++$i) {
$feed = new StdClass();
$item = $xml->channel->item[$i];
$link = (string) $item->link;
$feed->link = htmlspecialchars($filter->clean($link));
$title = (string) $item->title;
$feed->title = htmlspecialchars($filter->clean($title));
$description = (string) $item->description;
$feed->description = htmlspecialchars($filter->clean($description));
$feeds[] = $feed;
}
}
return $feeds;
}
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @since 1.6
*/
protected function populateState($ordering = null, $direction = null)
{
$licence = "";
$version = "";
if ($xml = simplexml_load_file(JPATH_ADMINISTRATOR . '/components/com_jce/jce.xml')) {
$licence = (string) $xml->license;
$version = (string) $xml->version;
if (WF_EDITOR_PRO) {
$version = '<span class="badge badge-info badge-primary">Pro</span> ' . $version;
}
}
$this->setState('version', $version);
$this->setState('licence', $licence);
}
}