diff --git a/language/en-GB/pkg_wtcontactwithfields.sys.ini b/language/en-GB/pkg_wtcontactwithfields.sys.ini index 2186d8b..b405f2a 100644 --- a/language/en-GB/pkg_wtcontactwithfields.sys.ini +++ b/language/en-GB/pkg_wtcontactwithfields.sys.ini @@ -4,6 +4,6 @@ PKG_WTCONTACTWITHFIELDS_AFTER_INSTALL = "Thank you for intalling extension" PKG_WTCONTACTWITHFIELDS_AFTER_DISCOVER_INSTALL = "Thank you for intalling extension" PKG_WTCONTACTWITHFIELDS_AFTER_UPDATE = "Thank you for updating extension" PKG_WTCONTACTWITHFIELDS_MAYBE_INTERESTING="

It may be interesting

" -PKG_WTCONTACTWITHFIELDS_WHATS_NEW="

v.1.0.0 What's new?

Joomla 5

First extension version.

" +PKG_WTCONTACTWITHFIELDS_WHATS_NEW="

v.1.0.1 What's new?

Bug fix

The plugin crashed with an error if the contact with the specified id did not exist or was removed from publication. Fixed it.

" PKG_WTCONTACTWITHFIELDS_AFTER_UNINSTALL="Very sorry..." PKG_WTCONTACTWITHFIELDS_JOOMLARU_TELEGRAM_CHAT="Telegram Joomla community" \ No newline at end of file diff --git a/language/ru-RU/pkg_wtcontactwithfields.sys.ini b/language/ru-RU/pkg_wtcontactwithfields.sys.ini index 3f56153..cf82f69 100644 --- a/language/ru-RU/pkg_wtcontactwithfields.sys.ini +++ b/language/ru-RU/pkg_wtcontactwithfields.sys.ini @@ -4,6 +4,6 @@ PKG_WTCONTACTWITHFIELDS_AFTER_INSTALL = "Спасибо за установку PKG_WTCONTACTWITHFIELDS_AFTER_DISCOVER_INSTALL = "Спасибо за установку расширения" PKG_WTCONTACTWITHFIELDS_AFTER_UPDATE = "Спасибо за обновление расширения" PKG_WTCONTACTWITHFIELDS_MAYBE_INTERESTING="

Может быть интересно

" -PKG_WTCONTACTWITHFIELDS_WHATS_NEW="

v.1.0.0 Что нового?

Joomla 5

Первая версия расширения.

" +PKG_WTCONTACTWITHFIELDS_WHATS_NEW="

v.1.0.1 Что нового?

Исправление ошибок

Плагин падал с ошибкой в случае если контакт с указанным id не существовал или был снят с публикации. Исправлено.

" PKG_WTCONTACTWITHFIELDS_AFTER_UNINSTALL="Очень жаль..." PKG_WTCONTACTWITHFIELDS_JOOMLARU_TELEGRAM_CHAT="Joomla сообщество в Телеграм" \ No newline at end of file diff --git a/pkg_script.php b/pkg_script.php index 1ff5dbf..72a71ba 100644 --- a/pkg_script.php +++ b/pkg_script.php @@ -1,9 +1,9 @@ isCompatible('5.0.0')) + if (!$version->isCompatible('5.0.0')) { - $this->app->enqueueMessage('😢 WT Contact everywhere with fields package doesn\'t support Joomla versions lower 5. Your Joomla version is '.$version->getShortVersion().'','error'); + $this->app->enqueueMessage('😢 WT Contact everywhere with fields package doesn\'t support Joomla versions lower 5. Your Joomla version is ' . $version->getShortVersion() . '', 'error'); + return false; } - + return true; } @@ -167,14 +168,14 @@ public function postflight(string $type, InstallerAdapter $adapter): bool } $element = strtoupper($adapter->getElement()); - $type = strtoupper($type); - $html = ' -
+ $type = strtoupper($type); + $html = ' +
-

'.$smile.' '.Text::_($element.'_AFTER_'.$type).'
'.Text::_($element).'

- '.Text::_($element.'_DESC'); +

' . $smile . ' ' . Text::_($element . '_AFTER_' . $type) . '
' . Text::_($element) . '

+ ' . Text::_($element . '_DESC'); - $html .= Text::_($element.'_WHATS_NEW'); + $html .= Text::_($element . '_WHATS_NEW'); $html .= '
@@ -185,7 +186,7 @@ public function postflight(string $type, InstallerAdapter $adapter): bool info@web-tolk.ru

' . Text::_($element . '_JOOMLARU_TELEGRAM_CHAT') . '

- '.Text::_($element."_MAYBE_INTERESTING").' + ' . Text::_($element . "_MAYBE_INTERESTING") . '
'; diff --git a/pkg_wtcontactwithfields.xml b/pkg_wtcontactwithfields.xml index f79ef43..90d2dba 100644 --- a/pkg_wtcontactwithfields.xml +++ b/pkg_wtcontactwithfields.xml @@ -2,9 +2,9 @@ PKG_WTCONTACTWITHFIELDS Sergey Tolkachyov - 12/02/2024 + April 2024 wtcontactwithfields - 1.0.0 + 1.0.1 https://web-tolk.ru/ Sergey Tolkachyov https://web-tolk.ru/ diff --git a/plg_content_wtcontactwithfields/services/provider.php b/plg_content_wtcontactwithfields/services/provider.php index ebf314a..afed5c6 100644 --- a/plg_content_wtcontactwithfields/services/provider.php +++ b/plg_content_wtcontactwithfields/services/provider.php @@ -1,7 +1,7 @@ 'plg_content_wtcontactwithfields.php'], Log::ALL, ['plg_content_wtcontactwithfields']); + } + + /** * Returns an array of events this subscriber will listen to. * @@ -89,7 +95,7 @@ public function onContentPrepare(ContentPrepareEvent $event): void return; } - //Проверка есть ли строка замены в контенте + // Проверка есть ли строка замены в контенте if (strpos($article->text, 'wt_contact_wf') === false) { return; @@ -120,7 +126,10 @@ public function onContentPrepare(ContentPrepareEvent $event): void $contact = $this->getContactInfo((int) $short_code_params["contact_id"]); - $html = $this->renderContact($contact, $tmpl); + if (!empty($contact)) + { + $html = $this->renderContact($contact, $tmpl); + } $article->text = str_replace($short_codes[0][$i], $html, $article->text); if(property_exists($article,'introtext') && !empty($article->introtext)) @@ -138,6 +147,7 @@ public function onContentPrepare(ContentPrepareEvent $event): void return; } $i++; + $html = ''; } } @@ -303,8 +313,14 @@ private function getContactInfo(int $contact_id): mixed ->getMVCFactory() ->createModel('Contact', 'Site', ['ignore_request' => false]); - return $model->getItem((int) $contact_id); + try + { + return $model->getItem($contact_id); + } catch (\Exception $e) { + Log::add('WT Contact anywhere with fields: '.($e->getMessage()).'. Contact id '.$contact_id,Log::ERROR); + return null; + } } /** diff --git a/plg_content_wtcontactwithfields/src/Fields/PlugininfoField.php b/plg_content_wtcontactwithfields/src/Fields/PlugininfoField.php index 8b5e7c7..68dc953 100644 --- a/plg_content_wtcontactwithfields/src/Fields/PlugininfoField.php +++ b/plg_content_wtcontactwithfields/src/Fields/PlugininfoField.php @@ -1,7 +1,7 @@ PLG_WTCONTACTWITHFIELDS Sergey Tolkachyov - 07/02/2024 + April 2024 Copyright (C) 2019-2023. All rights reserved. GNU/GPL 3.0 info@web-tolk.ru https://web-tolk.ru - 1.0.0 + 1.0.1 PLG_WTCONTACTWITHFIELDS_DESC Joomla\Plugin\Content\Wtcontactwithfields diff --git a/plg_editors-xtd_wtcontactwithfieldsbutton/media/js/wtcontactwithfieldsbutton.js b/plg_editors-xtd_wtcontactwithfieldsbutton/media/js/wtcontactwithfieldsbutton.js index 413b9da..4b41dc7 100644 --- a/plg_editors-xtd_wtcontactwithfieldsbutton/media/js/wtcontactwithfieldsbutton.js +++ b/plg_editors-xtd_wtcontactwithfieldsbutton/media/js/wtcontactwithfieldsbutton.js @@ -3,7 +3,7 @@ * @copyright Copyright (C) 2024 Sergey Tolkachyov. All rights reserved. * @author Sergey Tolkachyov - https://web-tolk.ru * @link https://web-tolk.ru - * @version 1.0.0 + * @version 1.0.1 * @license GNU General Public License version 3 or later */ (() => { diff --git a/plg_editors-xtd_wtcontactwithfieldsbutton/services/provider.php b/plg_editors-xtd_wtcontactwithfieldsbutton/services/provider.php index e0bfd0c..611313b 100644 --- a/plg_editors-xtd_wtcontactwithfieldsbutton/services/provider.php +++ b/plg_editors-xtd_wtcontactwithfieldsbutton/services/provider.php @@ -1,7 +1,7 @@ Editors-xtd - WT Contact anywhere with fields Sergey Tolkachyov - 08/02/2024 + April 2024 Copyright (C) Sergey Tolkachyov. All rights reserved. GNU General Public License version 3 info@web-tolk.ru https://web-tolk.ru - 1.0.0 + 1.0.1 PLG_WTCONTACTWITHFIELDSBUTTON_DESC Joomla\Plugin\EditorsXtd\Wtcontactwithfieldsbutton