-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathseccontent.php
92 lines (75 loc) · 2.14 KB
/
seccontent.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
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
<?php
/**
* @author Sociedad Española de Cardiología
* @copyright Copyright (C) 2018 Sociedad Española de Cardiología. All rights reserved.
* @url https://secardiologia.github.io
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// no direct access
defined('_JEXEC') or die('Restricted Access');
jimport('joomla.plugin.plugin');
class plgContentSeccontent extends JPlugin
{
var $position;
function plgContentSeccontent(&$subject, $config)
{
parent::__construct($subject, $config);
parent::__construct($subject, $config);
$this->plugin = JPluginHelper::getPlugin('content', 'seccontent');
$this->position = $this->params->get('position');
}
function onContentAfterDisplay($context, &$article, &$params, $page = 0)
{
$app = JFactory::getApplication();
if ($app->isAdmin())
{
return '';
}
if ($this->position == 2 && $context != 'com_content.category')
return $this->getSecContent($context, $article);
}
public function onContentAfterTitle($context, &$article, &$params, $page = 0){
$app = JFactory::getApplication();
if ($app->isAdmin())
{
return '';
}
if ($this->position == 3 && $context != 'com_content.category')
return $this->getSecContent($context, $article);
}
function onContentBeforeDisplay($context, &$article, &$params, $page=0)
{
$app = JFactory::getApplication();
if ($app->isAdmin())
{
return '';
}
if ($this->position == 1 && $context != 'com_content.category')
return $this->getSecContent($context, $article);
}
function getSecContent($context, &$article)
{
if (!isset($article->catid)) {
$article->catid = 0;
}
$categories = array();
$cats = $this->getParam('catids');
if (is_array($cats)) {
$categories = $cats;
} else {
$categories[] = $cats;
}
// Custom content
$custom_content = $this->getParam('custom');
if (in_array($article->catid, $categories)) {
$output = '';
$output .= '<div class="seccontent">';
$output .= $custom_content;
$output .= '</div>';
return $output;
}
}
function getParam($param) {
return $this->params->get($param);
}
}