Skip to content

Commit f071c3b

Browse files
authored
Merge pull request #5 from AlekVolsk/master
обеспечение совместимости с J4
2 parents cb51bce + c964bdb commit f071c3b

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

jllike/jllike.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,13 @@ public function onAfterRender()
7676

7777
public function onContentPrepare($context, &$article, &$params, $page = 0)
7878
{
79-
if(JFactory::getApplication()->isAdmin())
79+
if(JFactory::getApplication()->isClient('administrator'))
8080
{
8181
return true;
8282
}
8383

84+
$input = JFactory::getApplication()->input;
85+
8486
$allowContext = array(
8587
'com_content.article',
8688
'easyblog.blog',
@@ -107,7 +109,7 @@ public function onContentPrepare($context, &$article, &$params, $page = 0)
107109
$autoAdd = $this->params->get('autoAdd',0);
108110
$sharePos = (int)$this->params->get('shares_position', 1);
109111
$enableOpenGraph = $this->params->get('enable_opengraph',1);
110-
$option = JRequest::getCmd('option');
112+
$option = $input->get('option');
111113
$helper = PlgJLLikeHelper::getInstance($this->params);
112114

113115
if (strpos($article->text, '{jllike}') === false && !$autoAdd)
@@ -120,7 +122,7 @@ public function onContentPrepare($context, &$article, &$params, $page = 0)
120122
$article->catid = '';
121123
}
122124

123-
$print = JRequest::getInt('print', 0);
125+
$print = (int) $input->get('print', 0);
124126

125127
$root = JURI::getInstance()->toString(array('host'));
126128
$url = $this->protokol . $this->params->get('pathbase', '') . str_replace('www.', '', $root);
@@ -170,7 +172,9 @@ public function onContentPrepare($context, &$article, &$params, $page = 0)
170172
}
171173

172174

173-
include_once JPATH_ROOT.'/components/com_content/helpers/route.php';
175+
if (version_compare(JVERSION, '3.12.0', '<')) {
176+
include_once JPATH_ROOT.'/components/com_content/helpers/route.php';
177+
}
174178
$link = $url . JRoute::_(ContentHelperRoute::getArticleRoute($article->slug, $article->catid));
175179

176180
$image = '';
@@ -207,7 +211,7 @@ public function onContentPrepare($context, &$article, &$params, $page = 0)
207211

208212
if ($context == 'com_content.article')
209213
{
210-
$view = JRequest::getCmd('view');
214+
$view = $input->get('view');
211215
if ($view == 'article')
212216
{
213217
if ($autoAdd == 1 || strpos($article->text, '{jllike}') == true)
@@ -266,7 +270,7 @@ public function onContentPrepare($context, &$article, &$params, $page = 0)
266270
if (($context == 'easyblog.blog') && ($this->params->get('easyblogshow', 0) == 1))
267271
{
268272
$allow_in_category = $this->params->get('allow_in_category', 0);
269-
$isCategory = (JRequest::getCmd('view', '') == 'entry') ? false : true;
273+
$isCategory = ($input->get('view', '') == 'entry') ? false : true;
270274

271275
if(!$allow_in_category && $isCategory)
272276
{
@@ -310,4 +314,4 @@ public function onContentPrepare($context, &$article, &$params, $page = 0)
310314
break;
311315
}
312316
}
313-
}
317+
}

jllikeads/jllikeads.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function ADSonContentAfterDisplay($content)
2424
$plugin = & JPluginHelper::getPlugin('content', 'jllike');
2525
$plgParams = new JRegistry;
2626
$plgParams->loadString($plugin->params);
27-
$view = JRequest::getCmd('view');
27+
$view = JFactory::getApplication()->input->get('view');
2828
$ADSShow = $plgParams->get('adscontent', 0);
2929

3030
if (!$ADSShow || $view != 'details')

jllikek2/jllike.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ private function enableShow()
8686
$layout = $input->getString('layout','');
8787
$task = $input->getString('task','');
8888

89-
if(!$app->isAdmin() && ($view == 'itemlist' || ($view == 'item' && ($layout == 'item' || !$layout))) && $task != 'edit' && $task != 'add')
89+
if(!$app->isClient('administrator') && ($view == 'itemlist' || ($view == 'item' && ($layout == 'item' || !$layout))) && $task != 'edit' && $task != 'add')
9090
{
9191
return true;
9292
}

0 commit comments

Comments
 (0)