Skip to content
This repository has been archived by the owner on Apr 24, 2023. It is now read-only.

Commit

Permalink
v1.0.15
Browse files Browse the repository at this point in the history
  • Loading branch information
AlekVolsk authored Dec 13, 2022
1 parent d01b16b commit 8a3f55e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# CFI

![Version](https://img.shields.io/badge/VERSION-1.0.14-0366d6.svg?style=for-the-badge)
![Version](https://img.shields.io/badge/VERSION-1.0.15-0366d6.svg?style=for-the-badge)
![Joomla!](https://img.shields.io/badge/Joomla!-3.7+-1A3867.svg?style=for-the-badge)
![Php](https://img.shields.io/badge/php-5.6+-8892BF.svg?style=for-the-badge)

Expand Down
2 changes: 1 addition & 1 deletion README.ru.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# CFI

![Version](https://img.shields.io/badge/VERSION-1.0.14-0366d6.svg?style=for-the-badge)
![Version](https://img.shields.io/badge/VERSION-1.0.15-0366d6.svg?style=for-the-badge)
![Joomla!](https://img.shields.io/badge/Joomla!-3.7+-1A3867.svg?style=for-the-badge)
![Php](https://img.shields.io/badge/php-5.6+-8892BF.svg?style=for-the-badge)

Expand Down
20 changes: 14 additions & 6 deletions cfi.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,29 @@ class PlgSystemCfi extends CMSPlugin
private $file = null;
private $cp;
private $fieldPlugins;
private $isAdmin;

protected $autoloadLanguage = true;

public function __construct(&$subject, $config)
{
parent::__construct($subject, $config);

if (Version::MAJOR_VERSION > 3) {
$this->isAdmin = Factory::$application->getName() === 'administrator';
} else {
$this->isAdmin = Factory::getApplication()->isClient('administrator');
}

$this->initConstruct();
}

private function initConstruct($ajax = false)
{
if (!$this->isAdmin) {
return;
}

if (Version::MAJOR_VERSION > 3) {
$this->app = Factory::getContainer()->get(Joomla\CMS\Application\AdministratorApplication::class);
$this->appConfig = $this->app->getConfig();
Expand All @@ -70,10 +82,6 @@ private function initConstruct($ajax = false)
$this->db = Factory::getDbo();
}

if (!$this->app->isClient('administrator')) {
return;
}

$this->doc = Factory::getDocument();

if ($ajax) {
Expand Down Expand Up @@ -117,7 +125,7 @@ private function initConstruct($ajax = false)

public function onBeforeRender()
{
if (!$this->app->isClient('administrator') || $this->doc->getType() != 'html') {
if (!$this->isAdmin || $this->doc->getType() != 'html') {
return;
}

Expand All @@ -138,7 +146,7 @@ public function onBeforeRender()

public function onAfterRender()
{
if (!$this->app->isClient('administrator') || $this->doc->getType() != 'html') {
if (!$this->isAdmin || $this->doc->getType() != 'html') {
return;
}

Expand Down
4 changes: 2 additions & 2 deletions cfi.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<extension version="3.7" type="plugin" group="system" method="upgrade">
<name>PLG_CFI</name>
<version>1.0.14</version>
<creationDate>Oktober 2022</creationDate>
<version>1.0.15</version>
<creationDate>December 2022</creationDate>
<author>Aleksey A. Morozov</author>
<authorEmail>[email protected]</authorEmail>
<authorUrl>https://alekvolsk.pw</authorUrl>
Expand Down

0 comments on commit 8a3f55e

Please sign in to comment.