From 542f848e41eef7bd288b10aa9a4d9e4d0c8de6d7 Mon Sep 17 00:00:00 2001 From: darkfriend Date: Sun, 22 Jan 2023 16:36:31 +0300 Subject: [PATCH] added support php8.0 --- .github/FUNDING.yml | 7 + .../admin/dev2fun_settings.php | 16 +-- .../classes/general/OpenGraph.php | 8 +- utf8/dev2fun.opengraph/include.php | 21 ++- .../admin/dev2fun_opengraph_manager.php | 5 +- utf8/dev2fun.opengraph/install/index.php | 130 ++++++++++-------- utf8/dev2fun.opengraph/install/version.php | 4 +- .../lang/ru/admin/dev2fun_settings.php | 4 +- .../lang/ru/lib/views/admin_additional.php | 2 +- utf8/dev2fun.opengraph/lib/views/admin.php | 52 +++---- .../lib/views/admin_additional.php | 30 ++-- utf8/dev2fun.opengraph/migrations/1.4.2.php | 24 ++++ .../admin/dev2fun_settings.php | 16 +-- .../classes/general/OpenGraph.php | 8 +- win1251/dev2fun.opengraph/include.php | 21 ++- .../admin/dev2fun_opengraph_manager.php | 5 +- win1251/dev2fun.opengraph/install/index.php | 130 ++++++++++-------- win1251/dev2fun.opengraph/install/version.php | 4 +- .../lang/ru/admin/dev2fun_settings.php | 4 +- .../lang/ru/lib/views/admin_additional.php | 2 +- win1251/dev2fun.opengraph/lib/views/admin.php | 52 +++---- .../lib/views/admin_additional.php | 30 ++-- .../dev2fun.opengraph/migrations/1.4.2.php | 24 ++++ 23 files changed, 341 insertions(+), 258 deletions(-) create mode 100644 .github/FUNDING.yml create mode 100644 utf8/dev2fun.opengraph/migrations/1.4.2.php create mode 100644 win1251/dev2fun.opengraph/migrations/1.4.2.php diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..9c6fa71 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,7 @@ +# These are supported funding model platforms + +# github: [darkfriend] +custom: [ + 'https://www.tinkoff.ru/cf/36wVfnMf7mo', + 'https://paypal.me/darkfriend' +] diff --git a/utf8/dev2fun.opengraph/admin/dev2fun_settings.php b/utf8/dev2fun.opengraph/admin/dev2fun_settings.php index ceee75d..9b11ea9 100644 --- a/utf8/dev2fun.opengraph/admin/dev2fun_settings.php +++ b/utf8/dev2fun.opengraph/admin/dev2fun_settings.php @@ -1,8 +1,8 @@ - * @copyright (c) 2019-2022, darkfriend - * @version 1.4.1 + * @copyright (c) 2019-2023, darkfriend + * @version 1.4.2 * @global CUser $USER * @global CMain $APPLICATION */ @@ -178,7 +178,7 @@ 'HEIGHT' => '', ]; } else { - $arSettingResize = unserialize($arSettingResize); + $arSettingResize = unserialize($arSettingResize, ["allowed_classes" => false]); } if (!isset($arSettingResize['TYPE'])) { $arSettingResize['TYPE'] = BX_RESIZE_IMAGE_PROPORTIONAL; @@ -194,7 +194,7 @@ if (!$arSortable) { $arSortable = array_keys($arSortableDefault); } else { - $arSortable = unserialize($arSortable); + $arSortable = unserialize($arSortable, ["allowed_classes" => false]); } require($_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/include/prolog_admin_after.php"); @@ -223,11 +223,11 @@ -
- Begin(); $tabControl->BeginNextTab(); @@ -582,9 +582,9 @@
    - +
  • - +
- * @copyright (c) 2019-2022, darkfriend - * @version 1.4.1 + * @copyright (c) 2019-2023, darkfriend + * @version 1.4.2 */ namespace Dev2fun\Module; @@ -70,7 +70,7 @@ public static function IsAddTab() /** * @param \CAdminTabControl $form */ - public function AddAdminTab(&$form) + public static function AddAdminTab(&$form) { Loader::includeModule("dev2fun.opengraph"); if (!OpenGraph::$_init && self::IsAddTab()) { @@ -103,7 +103,7 @@ public function AddAdminTab(&$form) * Event Handler on save element * @param array &$arFields */ - public function saveElement(&$arFields) + public static function saveElement(&$arFields) { if (!empty($arFields["ID"])) { $obParser = new \CTextParser; diff --git a/utf8/dev2fun.opengraph/include.php b/utf8/dev2fun.opengraph/include.php index 940309d..6351d22 100644 --- a/utf8/dev2fun.opengraph/include.php +++ b/utf8/dev2fun.opengraph/include.php @@ -1,8 +1,8 @@ - * @copyright (c) 2019-2022, darkfriend - * @version 1.4.0 + * @copyright (c) 2019-2023, darkfriend + * @version 1.4.2 */ IncludeModuleLangFile(__FILE__); @@ -150,7 +150,7 @@ public static function getSettingFields($incDefault = true) if ($sFields) { $sFields = unserialize($sFields, ['allowed_classes' => false]); } else { - $sFields = array(); + $sFields = []; } if ($incDefault) { $sFields = array_merge(self::$arReqSettings, $sFields); @@ -205,7 +205,7 @@ public function getSettingsExcludePage() if ($pages) { $pages = unserialize($pages, ['allowed_classes' => false]); } else { - $pages = array(); + $pages = []; } return $pages; } @@ -236,7 +236,7 @@ public function getSettingsResize() if ($data) { $data = unserialize($data, ['allowed_classes' => false]); } else { - $data = array(); + $data = []; } return $data; } @@ -251,7 +251,7 @@ public function getSettingsSortable() if ($data) { $data = unserialize($data, ['allowed_classes' => false]); } else { - $data = array(); + $data = []; } return $data; } @@ -457,16 +457,15 @@ public function getUrl($path = '') public static function ShowThanksNotice() { \CAdminNotify::Add([ - // 'MESSAGE' => \Bitrix\Main\Localization\Loc::getMessage('D2F_OPENGRAPH_DONATE_MESSAGE',['#URL#'=>$APPLICATION->GetCurUri('tabControl_active_tab=donate')]), 'MESSAGE' => Loc::getMessage('D2F_OPENGRAPH_DONATE_MESSAGE', ['#URL#' => '/bitrix/admin/dev2fun_opengraph_manager.php?action=settings&tabControl_active_tab=donate']), 'TAG' => 'dev2fun_opengraph_update', 'MODULE_ID' => 'dev2fun.opengraph', ]); } - public function DoBuildGlobalMenu(&$aGlobalMenu, &$aModuleMenu) + public static function DoBuildGlobalMenu(&$aGlobalMenu, &$aModuleMenu) { - $aModuleMenu[] = array( + $aModuleMenu[] = [ "parent_menu" => "global_menu_settings", "icon" => "dev2fun_admin_icon", "page_icon" => "dev2fun_admin_icon", @@ -476,7 +475,7 @@ public function DoBuildGlobalMenu(&$aGlobalMenu, &$aModuleMenu) "url" => "/bitrix/admin/dev2fun_opengraph_manager.php?action=settings", "items_id" => "menu_dev2fun_opengraph", "section" => "dev2fun_opengraph", - "more_url" => array(), + "more_url" => [], // "items" => array( // array( // "text" => GetMessage("SUB_SETINGS_MENU_TEXT"), @@ -487,6 +486,6 @@ public function DoBuildGlobalMenu(&$aGlobalMenu, &$aModuleMenu) // "page_icon" => "default_page_icon", // ), // ) - ); + ]; } } \ No newline at end of file diff --git a/utf8/dev2fun.opengraph/install/admin/dev2fun_opengraph_manager.php b/utf8/dev2fun.opengraph/install/admin/dev2fun_opengraph_manager.php index 133242e..871b2dd 100644 --- a/utf8/dev2fun.opengraph/install/admin/dev2fun_opengraph_manager.php +++ b/utf8/dev2fun.opengraph/install/admin/dev2fun_opengraph_manager.php @@ -1,10 +1,9 @@ - \ No newline at end of file diff --git a/utf8/dev2fun.opengraph/install/index.php b/utf8/dev2fun.opengraph/install/index.php index 48fce8a..24625fd 100644 --- a/utf8/dev2fun.opengraph/install/index.php +++ b/utf8/dev2fun.opengraph/install/index.php @@ -2,8 +2,8 @@ /** * Install * @author dev2fun (darkfriend) - * @copyright (c) 2022, darkfriend - * @version 1.4.0 + * @copyright (c) 2019-2023, darkfriend + * @version 1.4.2 */ IncludeModuleLangFile(__FILE__); @@ -16,7 +16,9 @@ ] ); -if(class_exists("dev2fun_opengraph")) return; +if (class_exists("dev2fun_opengraph")) { + return; +} use Bitrix\Main\Localization\Loc, Dev2fun\OpenGraph\OpenGraphTable, @@ -31,11 +33,12 @@ class dev2fun_opengraph extends CModule var $MODULE_DESCRIPTION; var $MODULE_GROUP_RIGHTS = "Y"; - public function __construct(){ + public function __construct() + { $path = str_replace("\\", "/", __FILE__); $path = substr($path, 0, strlen($path) - strlen("/index.php")); - include($path."/version.php"); - if (is_array($arModuleVersion) && array_key_exists("VERSION", $arModuleVersion)){ + include($path . "/version.php"); + if (is_array($arModuleVersion) && array_key_exists("VERSION", $arModuleVersion)) { $this->MODULE_VERSION = $arModuleVersion["VERSION"]; $this->MODULE_VERSION_DATE = $arModuleVersion["VERSION_DATE"]; } else { @@ -48,9 +51,10 @@ public function __construct(){ $this->PARTNER_URI = "http://dev2fun.com/"; } - function DoInstall(){ + public function DoInstall() + { global $APPLICATION; - if(!check_bitrix_sessid()) { + if (!check_bitrix_sessid()) { return false; } try { @@ -58,7 +62,7 @@ function DoInstall(){ $this->installDB(); $this->registerEvents(); \Bitrix\Main\ModuleManager::registerModule($this->MODULE_ID); - $APPLICATION->IncludeAdminFile(GetMessage("D2F_OPENGRAPH_STEP1"), __DIR__."/step1.php"); + $APPLICATION->IncludeAdminFile(GetMessage("D2F_OPENGRAPH_STEP1"), __DIR__ . "/step1.php"); } catch (Exception $e) { $APPLICATION->ThrowException($e->getMessage()); return false; @@ -66,33 +70,35 @@ function DoInstall(){ return true; } - public function installDB() { + public function installDB() + { global $DB; - try{ - $tableExist = $DB->Query('SELECT * FROM '.OpenGraphTable::getTableName().' LIMIT 1',true); - if(!$tableExist) { + try { + $tableExist = $DB->Query('SELECT * FROM ' . OpenGraphTable::getTableName() . ' LIMIT 1', true); + if (!$tableExist) { OpenGraphTable::getEntity()->createDbTable(); $connection = \Bitrix\Main\Application::getInstance()->getConnection(); - $connection->createIndex(OpenGraphTable::getTableName(),'IDX_REFERENCE_ID','REFERENCE_ID'); - $connection->createIndex(OpenGraphTable::getTableName(),'IDX_META_KEY','META_KEY'); - $connection->createIndex(OpenGraphTable::getTableName(),'IDX_REFERENCE_TYPE','REFERENCE_TYPE'); + $connection->createIndex(OpenGraphTable::getTableName(), 'IDX_REFERENCE_ID', 'REFERENCE_ID'); + $connection->createIndex(OpenGraphTable::getTableName(), 'IDX_META_KEY', 'META_KEY'); + $connection->createIndex(OpenGraphTable::getTableName(), 'IDX_REFERENCE_TYPE', 'REFERENCE_TYPE'); } dev2funModuleOpenGraphClass::setFields(dev2funModuleOpenGraphClass::$arReqOG); - Option::set($this->MODULE_ID,'ADDTAB_ELEMENT','Y'); - Option::set($this->MODULE_ID,'ADDTAB_SECTION','Y'); - Option::set($this->MODULE_ID,'SHOW_IN_ELEMENTS','Y'); - Option::set($this->MODULE_ID,'SHOW_IN_SECTIONS','Y'); + Option::set($this->MODULE_ID, 'ADDTAB_ELEMENT', 'Y'); + Option::set($this->MODULE_ID, 'ADDTAB_SECTION', 'Y'); + Option::set($this->MODULE_ID, 'SHOW_IN_ELEMENTS', 'Y'); + Option::set($this->MODULE_ID, 'SHOW_IN_SECTIONS', 'Y'); } catch (\Bitrix\Main\DB\SqlQueryException $e) { throw new Exception($e->getMessage()); } return true; } - public function registerEvents() { + public function registerEvents() + { $eventManager = \Bitrix\Main\EventManager::getInstance(); $eventManager->registerEventHandler("main", "OnPageStart", $this->MODULE_ID, "Dev2fun\\Module\\OpenGraph", "SetEventHandler"); -// $eventManager->registerEventHandler("main", "OnEpilog", $this->MODULE_ID, "dev2funModuleOpenGraphClass", "AddOpenGraph"); + // $eventManager->registerEventHandler("main", "OnEpilog", $this->MODULE_ID, "dev2funModuleOpenGraphClass", "AddOpenGraph"); $eventManager->registerEventHandler("main", "OnBuildGlobalMenu", $this->MODULE_ID, "dev2funModuleOpenGraphClass", "DoBuildGlobalMenu"); $eventManager->registerEventHandler("main", "OnAdminTabControlBegin", $this->MODULE_ID, "Dev2fun\\Module\\OpenGraph", "AddAdminTab"); @@ -111,39 +117,41 @@ public function registerEvents() { return true; } - public function installFiles() { + public function installFiles() + { // copy admin files - if(!CopyDirFiles($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/".$this->MODULE_ID."/install/admin", $_SERVER["DOCUMENT_ROOT"]."/bitrix/admin", true, true)){ - throw new Exception(Loc::getMessage("ERRORS_CREATE_DIR", array('#DIR#'=>'bitrix/admin'))); + if (!CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/" . $this->MODULE_ID . "/install/admin", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/admin", true, true)) { + throw new Exception(Loc::getMessage("ERRORS_CREATE_DIR", ['#DIR#' => 'bitrix/admin'])); } // copy themes files - if(!CopyDirFiles($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/".$this->MODULE_ID."/install/themes", $_SERVER["DOCUMENT_ROOT"]."/bitrix/themes", true, true)){ - throw new Exception(Loc::getMessage("ERRORS_CREATE_DIR",array('#DIR#'=>'bitrix/themes'))); + if (!CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/" . $this->MODULE_ID . "/install/themes", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/themes", true, true)) { + throw new Exception(Loc::getMessage("ERRORS_CREATE_DIR", ['#DIR#' => 'bitrix/themes'])); } // copy js files - if(!CopyDirFiles($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/".$this->MODULE_ID."/install/js", $_SERVER["DOCUMENT_ROOT"]."/bitrix/js/".$this->MODULE_ID, true, true)){ - throw new Exception(Loc::getMessage("ERRORS_CREATE_DIR",array('#DIR#'=>'bitrix/js'))); + if (!CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/" . $this->MODULE_ID . "/install/js", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/js/" . $this->MODULE_ID, true, true)) { + throw new Exception(Loc::getMessage("ERRORS_CREATE_DIR", ['#DIR#' => 'bitrix/js'])); } - if(!CopyDirFiles($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/".$this->MODULE_ID."/install/css", $_SERVER["DOCUMENT_ROOT"]."/bitrix/css/".$this->MODULE_ID, true, true)){ - throw new Exception(Loc::getMessage("ERRORS_CREATE_DIR",array('#DIR#'=>__DIR__."/install/css"))); + if (!CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/" . $this->MODULE_ID . "/install/css", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/css/" . $this->MODULE_ID, true, true)) { + throw new Exception(Loc::getMessage("ERRORS_CREATE_DIR", ['#DIR#' => __DIR__ . "/install/css"])); return false; } return true; } - function DoUninstall(){ + public function DoUninstall() + { global $APPLICATION; - if(!check_bitrix_sessid()) return false; + if (!check_bitrix_sessid()) return false; try { $this->deleteFiles(); $this->unInstallDB(); $this->unRegisterEvents(); \Bitrix\Main\ModuleManager::unRegisterModule($this->MODULE_ID); - $APPLICATION->IncludeAdminFile(Loc::getMessage("D2F_OPENGRAPH_UNSTEP1"), __DIR__."/unstep1.php"); + $APPLICATION->IncludeAdminFile(Loc::getMessage("D2F_OPENGRAPH_UNSTEP1"), __DIR__ . "/unstep1.php"); } catch (Exception $e) { $APPLICATION->ThrowException($e->getMessage()); return false; @@ -151,49 +159,52 @@ function DoUninstall(){ return true; } - public function deleteFiles() { + public function deleteFiles() + { - if(file_exists($_SERVER['DOCUMENT_ROOT']."/bitrix/admin/dev2fun_opengraph_manager.php") && !DeleteDirFilesEx("/bitrix/admin/dev2fun_opengraph_manager.php")){ - throw new Exception(Loc::getMessage("ERRORS_DELETE_FILE",array('#FILE#'=>'bitrix/admin/dev2fun_opengraph_manager.php'))); + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/bitrix/admin/dev2fun_opengraph_manager.php") && !DeleteDirFilesEx("/bitrix/admin/dev2fun_opengraph_manager.php")) { + throw new Exception(Loc::getMessage("ERRORS_DELETE_FILE", ['#FILE#' => 'bitrix/admin/dev2fun_opengraph_manager.php'])); } - if(file_exists($_SERVER['DOCUMENT_ROOT'].'/bitrix/themes/.default/icons/'.$this->MODULE_ID) && !DeleteDirFilesEx( '/bitrix/themes/.default/icons/'.$this->MODULE_ID )){ - throw new Exception(Loc::getMessage("ERRORS_DELETE_FILE",array('#FILE#'=>'bitrix/themes/.default/icons/'.$this->MODULE_ID))); + if (file_exists($_SERVER['DOCUMENT_ROOT'] . '/bitrix/themes/.default/icons/' . $this->MODULE_ID) && !DeleteDirFilesEx('/bitrix/themes/.default/icons/' . $this->MODULE_ID)) { + throw new Exception(Loc::getMessage("ERRORS_DELETE_FILE", ['#FILE#' => 'bitrix/themes/.default/icons/' . $this->MODULE_ID])); } - if(file_exists($_SERVER['DOCUMENT_ROOT'].'/bitrix/themes/.default/'.$this->MODULE_ID.'.css') && !DeleteDirFilesEx( '/bitrix/themes/.default/'.$this->MODULE_ID.'.css' )){ - throw new Exception(Loc::getMessage("ERRORS_DELETE_FILE",array('#FILE#'=>'bitrix/themes/.default/'.$this->MODULE_ID.'.css'))); + if (file_exists($_SERVER['DOCUMENT_ROOT'] . '/bitrix/themes/.default/' . $this->MODULE_ID . '.css') && !DeleteDirFilesEx('/bitrix/themes/.default/' . $this->MODULE_ID . '.css')) { + throw new Exception(Loc::getMessage("ERRORS_DELETE_FILE", ['#FILE#' => 'bitrix/themes/.default/' . $this->MODULE_ID . '.css'])); } - if(file_exists($_SERVER['DOCUMENT_ROOT'].'/bitrix/js/'.$this->MODULE_ID) && !DeleteDirFilesEx( '/bitrix/js/'.$this->MODULE_ID )){ - throw new Exception(Loc::getMessage("ERRORS_DELETE_FILE",array('#FILE#'=>'bitrix/js/'.$this->MODULE_ID))); + if (file_exists($_SERVER['DOCUMENT_ROOT'] . '/bitrix/js/' . $this->MODULE_ID) && !DeleteDirFilesEx('/bitrix/js/' . $this->MODULE_ID)) { + throw new Exception(Loc::getMessage("ERRORS_DELETE_FILE", ['#FILE#' => 'bitrix/js/' . $this->MODULE_ID])); } - if(file_exists($_SERVER['DOCUMENT_ROOT'].'/bitrix/css/'.$this->MODULE_ID) && !DeleteDirFilesEx( '/bitrix/css/'.$this->MODULE_ID )){ - throw new Exception(Loc::getMessage("ERRORS_DELETE_FILE",array('#FILE#'=>'bitrix/css/'.$this->MODULE_ID))); + if (file_exists($_SERVER['DOCUMENT_ROOT'] . '/bitrix/css/' . $this->MODULE_ID) && !DeleteDirFilesEx('/bitrix/css/' . $this->MODULE_ID)) { + throw new Exception(Loc::getMessage("ERRORS_DELETE_FILE", ['#FILE#' => 'bitrix/css/' . $this->MODULE_ID])); } return true; } - public function unRegisterEvents() { + public function unRegisterEvents() + { $eventManager = \Bitrix\Main\EventManager::getInstance(); -// $eventManager->unRegisterEventHandler('main','OnEpilog',$this->MODULE_ID); - $eventManager->unRegisterEventHandler("main","OnPageStart", $this->MODULE_ID); - $eventManager->unRegisterEventHandler('main','OnBuildGlobalMenu',$this->MODULE_ID); - $eventManager->unRegisterEventHandler('main','OnAdminTabControlBegin',$this->MODULE_ID); + // $eventManager->unRegisterEventHandler('main','OnEpilog',$this->MODULE_ID); + $eventManager->unRegisterEventHandler("main", "OnPageStart", $this->MODULE_ID); + $eventManager->unRegisterEventHandler('main', 'OnBuildGlobalMenu', $this->MODULE_ID); + $eventManager->unRegisterEventHandler('main', 'OnAdminTabControlBegin', $this->MODULE_ID); - $eventManager->unRegisterEventHandler('iblock','OnAfterIBlockSectionUpdate',$this->MODULE_ID); - $eventManager->unRegisterEventHandler('iblock','OnAfterIBlockSectionAdd',$this->MODULE_ID); - $eventManager->unRegisterEventHandler('iblock','OnAfterIBlockElementDelete',$this->MODULE_ID); + $eventManager->unRegisterEventHandler('iblock', 'OnAfterIBlockSectionUpdate', $this->MODULE_ID); + $eventManager->unRegisterEventHandler('iblock', 'OnAfterIBlockSectionAdd', $this->MODULE_ID); + $eventManager->unRegisterEventHandler('iblock', 'OnAfterIBlockElementDelete', $this->MODULE_ID); - $eventManager->unRegisterEventHandler('iblock','OnAfterIBlockElementUpdate',$this->MODULE_ID); - $eventManager->unRegisterEventHandler('iblock','OnAfterIBlockElementAdd',$this->MODULE_ID); - $eventManager->unRegisterEventHandler('iblock','OnAfterIBlockSectionDelete',$this->MODULE_ID); + $eventManager->unRegisterEventHandler('iblock', 'OnAfterIBlockElementUpdate', $this->MODULE_ID); + $eventManager->unRegisterEventHandler('iblock', 'OnAfterIBlockElementAdd', $this->MODULE_ID); + $eventManager->unRegisterEventHandler('iblock', 'OnAfterIBlockSectionDelete', $this->MODULE_ID); return true; } - public function unInstallDB() { + public function unInstallDB() + { global $DB, $DBType; - $errors = $DB->RunSQLBatch(__DIR__."/db/uninstall.sql"); - if($errors !== false) { + $errors = $DB->RunSQLBatch(__DIR__ . "/db/uninstall.sql"); + if ($errors !== false) { throw new Exception(implode(PHP_EOL, $errors)); } $connection = \Bitrix\Main\Application::getInstance()->getConnection(); @@ -202,4 +213,3 @@ public function unInstallDB() { return true; } } -?> \ No newline at end of file diff --git a/utf8/dev2fun.opengraph/install/version.php b/utf8/dev2fun.opengraph/install/version.php index f8ef0b2..e2bfa41 100644 --- a/utf8/dev2fun.opengraph/install/version.php +++ b/utf8/dev2fun.opengraph/install/version.php @@ -1,5 +1,5 @@ "1.4.1", - "VERSION_DATE" => "2022-04-26 02:00:00", + "VERSION" => "1.4.2", + "VERSION_DATE" => "2023-01-22 17:00:00", ]; diff --git a/utf8/dev2fun.opengraph/lang/ru/admin/dev2fun_settings.php b/utf8/dev2fun.opengraph/lang/ru/admin/dev2fun_settings.php index 538e127..bce794c 100644 --- a/utf8/dev2fun.opengraph/lang/ru/admin/dev2fun_settings.php +++ b/utf8/dev2fun.opengraph/lang/ru/admin/dev2fun_settings.php @@ -1,7 +1,7 @@ - - * @version 1.3.7 + * @version 1.4.2 */ $MESS["SEC_MAIN_TAB"] = "Настройки OpenGraph"; $MESS["SEC_MAIN_TAB_TITLE"] = "Настройки OpenGraph"; diff --git a/utf8/dev2fun.opengraph/lang/ru/lib/views/admin_additional.php b/utf8/dev2fun.opengraph/lang/ru/lib/views/admin_additional.php index 5d5d059..ab25358 100644 --- a/utf8/dev2fun.opengraph/lang/ru/lib/views/admin_additional.php +++ b/utf8/dev2fun.opengraph/lang/ru/lib/views/admin_additional.php @@ -1,3 +1,3 @@ - - - + - + - - + + - + - - + + - + - - + +
og:og: - +
og:og: - "OG_IMAGE", "description" => true, "upload" => true, @@ -35,11 +37,13 @@ "fileDialog" => true, "cloud" => true, "delete" => true, - "maxCount" => 1 - ))->show($arOpenGraph[$arField] > 0 ? $arOpenGraph[$arField]: 0); + "maxCount" => 1, + ])->show($arOpenGraph[$arField] > 0 ? $arOpenGraph[$arField] : 0); } else { - echo CFileInput::Show("OG_IMAGE", ($arOpenGraph[$arField] > 0 && !$bCopy? $arOpenGraph[$arField] : 0), - array( + echo CFileInput::Show( + "OG_IMAGE", + ($arOpenGraph[$arField] > 0 && !$bCopy ? $arOpenGraph[$arField] : 0), + [ "IMAGE" => "Y", "PATH" => "Y", "FILE_SIZE" => "Y", @@ -49,28 +53,30 @@ // "W" => COption::GetOptionString("iblock", "detail_image_size"), // "H" => COption::GetOptionString("iblock", "detail_image_size"), // ), - ), array( + ], + [ 'upload' => true, 'medialib' => true, 'file_dialog' => true, 'cloud' => true, 'del' => true, 'description' => true, - ) + ] ); - }?> + } ?>
og:og: - +
diff --git a/utf8/dev2fun.opengraph/lib/views/admin_additional.php b/utf8/dev2fun.opengraph/lib/views/admin_additional.php index f2dbf9e..e2b470c 100644 --- a/utf8/dev2fun.opengraph/lib/views/admin_additional.php +++ b/utf8/dev2fun.opengraph/lib/views/admin_additional.php @@ -8,21 +8,21 @@ /** @var array $arOpenGraph */ ?> - - - - - - - - - + + + + + + + + +
- -
- -
+ +
+ +
diff --git a/utf8/dev2fun.opengraph/migrations/1.4.2.php b/utf8/dev2fun.opengraph/migrations/1.4.2.php new file mode 100644 index 0000000..c90a837 --- /dev/null +++ b/utf8/dev2fun.opengraph/migrations/1.4.2.php @@ -0,0 +1,24 @@ + + * Date: 22.01.2023 + * Time: 16:24 + */ + +/** @var CMain $APPLICATION */ +/** @var CUser $USER */ +/** @var CDatabase $DB */ +/** @var CUpdater $updater */ + +include($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php"); + +$moduleID = 'dev2fun.opengraph'; + +\Bitrix\Main\Loader::includeModule($moduleID); + +CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/{$moduleID}/install/admin", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/admin/", true, true); + +\dev2funModuleOpenGraphClass::ShowThanksNotice(); + +echo '1.4.2 - DONE'.PHP_EOL; \ No newline at end of file diff --git a/win1251/dev2fun.opengraph/admin/dev2fun_settings.php b/win1251/dev2fun.opengraph/admin/dev2fun_settings.php index ceee75d..9b11ea9 100644 --- a/win1251/dev2fun.opengraph/admin/dev2fun_settings.php +++ b/win1251/dev2fun.opengraph/admin/dev2fun_settings.php @@ -1,8 +1,8 @@ - * @copyright (c) 2019-2022, darkfriend - * @version 1.4.1 + * @copyright (c) 2019-2023, darkfriend + * @version 1.4.2 * @global CUser $USER * @global CMain $APPLICATION */ @@ -178,7 +178,7 @@ 'HEIGHT' => '', ]; } else { - $arSettingResize = unserialize($arSettingResize); + $arSettingResize = unserialize($arSettingResize, ["allowed_classes" => false]); } if (!isset($arSettingResize['TYPE'])) { $arSettingResize['TYPE'] = BX_RESIZE_IMAGE_PROPORTIONAL; @@ -194,7 +194,7 @@ if (!$arSortable) { $arSortable = array_keys($arSortableDefault); } else { - $arSortable = unserialize($arSortable); + $arSortable = unserialize($arSortable, ["allowed_classes" => false]); } require($_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/include/prolog_admin_after.php"); @@ -223,11 +223,11 @@ - - Begin(); $tabControl->BeginNextTab(); @@ -582,9 +582,9 @@
    - +
  • - +
- * @copyright (c) 2019-2022, darkfriend - * @version 1.4.1 + * @copyright (c) 2019-2023, darkfriend + * @version 1.4.2 */ namespace Dev2fun\Module; @@ -70,7 +70,7 @@ public static function IsAddTab() /** * @param \CAdminTabControl $form */ - public function AddAdminTab(&$form) + public static function AddAdminTab(&$form) { Loader::includeModule("dev2fun.opengraph"); if (!OpenGraph::$_init && self::IsAddTab()) { @@ -103,7 +103,7 @@ public function AddAdminTab(&$form) * Event Handler on save element * @param array &$arFields */ - public function saveElement(&$arFields) + public static function saveElement(&$arFields) { if (!empty($arFields["ID"])) { $obParser = new \CTextParser; diff --git a/win1251/dev2fun.opengraph/include.php b/win1251/dev2fun.opengraph/include.php index 940309d..6351d22 100644 --- a/win1251/dev2fun.opengraph/include.php +++ b/win1251/dev2fun.opengraph/include.php @@ -1,8 +1,8 @@ - * @copyright (c) 2019-2022, darkfriend - * @version 1.4.0 + * @copyright (c) 2019-2023, darkfriend + * @version 1.4.2 */ IncludeModuleLangFile(__FILE__); @@ -150,7 +150,7 @@ public static function getSettingFields($incDefault = true) if ($sFields) { $sFields = unserialize($sFields, ['allowed_classes' => false]); } else { - $sFields = array(); + $sFields = []; } if ($incDefault) { $sFields = array_merge(self::$arReqSettings, $sFields); @@ -205,7 +205,7 @@ public function getSettingsExcludePage() if ($pages) { $pages = unserialize($pages, ['allowed_classes' => false]); } else { - $pages = array(); + $pages = []; } return $pages; } @@ -236,7 +236,7 @@ public function getSettingsResize() if ($data) { $data = unserialize($data, ['allowed_classes' => false]); } else { - $data = array(); + $data = []; } return $data; } @@ -251,7 +251,7 @@ public function getSettingsSortable() if ($data) { $data = unserialize($data, ['allowed_classes' => false]); } else { - $data = array(); + $data = []; } return $data; } @@ -457,16 +457,15 @@ public function getUrl($path = '') public static function ShowThanksNotice() { \CAdminNotify::Add([ - // 'MESSAGE' => \Bitrix\Main\Localization\Loc::getMessage('D2F_OPENGRAPH_DONATE_MESSAGE',['#URL#'=>$APPLICATION->GetCurUri('tabControl_active_tab=donate')]), 'MESSAGE' => Loc::getMessage('D2F_OPENGRAPH_DONATE_MESSAGE', ['#URL#' => '/bitrix/admin/dev2fun_opengraph_manager.php?action=settings&tabControl_active_tab=donate']), 'TAG' => 'dev2fun_opengraph_update', 'MODULE_ID' => 'dev2fun.opengraph', ]); } - public function DoBuildGlobalMenu(&$aGlobalMenu, &$aModuleMenu) + public static function DoBuildGlobalMenu(&$aGlobalMenu, &$aModuleMenu) { - $aModuleMenu[] = array( + $aModuleMenu[] = [ "parent_menu" => "global_menu_settings", "icon" => "dev2fun_admin_icon", "page_icon" => "dev2fun_admin_icon", @@ -476,7 +475,7 @@ public function DoBuildGlobalMenu(&$aGlobalMenu, &$aModuleMenu) "url" => "/bitrix/admin/dev2fun_opengraph_manager.php?action=settings", "items_id" => "menu_dev2fun_opengraph", "section" => "dev2fun_opengraph", - "more_url" => array(), + "more_url" => [], // "items" => array( // array( // "text" => GetMessage("SUB_SETINGS_MENU_TEXT"), @@ -487,6 +486,6 @@ public function DoBuildGlobalMenu(&$aGlobalMenu, &$aModuleMenu) // "page_icon" => "default_page_icon", // ), // ) - ); + ]; } } \ No newline at end of file diff --git a/win1251/dev2fun.opengraph/install/admin/dev2fun_opengraph_manager.php b/win1251/dev2fun.opengraph/install/admin/dev2fun_opengraph_manager.php index 133242e..871b2dd 100644 --- a/win1251/dev2fun.opengraph/install/admin/dev2fun_opengraph_manager.php +++ b/win1251/dev2fun.opengraph/install/admin/dev2fun_opengraph_manager.php @@ -1,10 +1,9 @@ - \ No newline at end of file diff --git a/win1251/dev2fun.opengraph/install/index.php b/win1251/dev2fun.opengraph/install/index.php index 48fce8a..24625fd 100644 --- a/win1251/dev2fun.opengraph/install/index.php +++ b/win1251/dev2fun.opengraph/install/index.php @@ -2,8 +2,8 @@ /** * Install * @author dev2fun (darkfriend) - * @copyright (c) 2022, darkfriend - * @version 1.4.0 + * @copyright (c) 2019-2023, darkfriend + * @version 1.4.2 */ IncludeModuleLangFile(__FILE__); @@ -16,7 +16,9 @@ ] ); -if(class_exists("dev2fun_opengraph")) return; +if (class_exists("dev2fun_opengraph")) { + return; +} use Bitrix\Main\Localization\Loc, Dev2fun\OpenGraph\OpenGraphTable, @@ -31,11 +33,12 @@ class dev2fun_opengraph extends CModule var $MODULE_DESCRIPTION; var $MODULE_GROUP_RIGHTS = "Y"; - public function __construct(){ + public function __construct() + { $path = str_replace("\\", "/", __FILE__); $path = substr($path, 0, strlen($path) - strlen("/index.php")); - include($path."/version.php"); - if (is_array($arModuleVersion) && array_key_exists("VERSION", $arModuleVersion)){ + include($path . "/version.php"); + if (is_array($arModuleVersion) && array_key_exists("VERSION", $arModuleVersion)) { $this->MODULE_VERSION = $arModuleVersion["VERSION"]; $this->MODULE_VERSION_DATE = $arModuleVersion["VERSION_DATE"]; } else { @@ -48,9 +51,10 @@ public function __construct(){ $this->PARTNER_URI = "http://dev2fun.com/"; } - function DoInstall(){ + public function DoInstall() + { global $APPLICATION; - if(!check_bitrix_sessid()) { + if (!check_bitrix_sessid()) { return false; } try { @@ -58,7 +62,7 @@ function DoInstall(){ $this->installDB(); $this->registerEvents(); \Bitrix\Main\ModuleManager::registerModule($this->MODULE_ID); - $APPLICATION->IncludeAdminFile(GetMessage("D2F_OPENGRAPH_STEP1"), __DIR__."/step1.php"); + $APPLICATION->IncludeAdminFile(GetMessage("D2F_OPENGRAPH_STEP1"), __DIR__ . "/step1.php"); } catch (Exception $e) { $APPLICATION->ThrowException($e->getMessage()); return false; @@ -66,33 +70,35 @@ function DoInstall(){ return true; } - public function installDB() { + public function installDB() + { global $DB; - try{ - $tableExist = $DB->Query('SELECT * FROM '.OpenGraphTable::getTableName().' LIMIT 1',true); - if(!$tableExist) { + try { + $tableExist = $DB->Query('SELECT * FROM ' . OpenGraphTable::getTableName() . ' LIMIT 1', true); + if (!$tableExist) { OpenGraphTable::getEntity()->createDbTable(); $connection = \Bitrix\Main\Application::getInstance()->getConnection(); - $connection->createIndex(OpenGraphTable::getTableName(),'IDX_REFERENCE_ID','REFERENCE_ID'); - $connection->createIndex(OpenGraphTable::getTableName(),'IDX_META_KEY','META_KEY'); - $connection->createIndex(OpenGraphTable::getTableName(),'IDX_REFERENCE_TYPE','REFERENCE_TYPE'); + $connection->createIndex(OpenGraphTable::getTableName(), 'IDX_REFERENCE_ID', 'REFERENCE_ID'); + $connection->createIndex(OpenGraphTable::getTableName(), 'IDX_META_KEY', 'META_KEY'); + $connection->createIndex(OpenGraphTable::getTableName(), 'IDX_REFERENCE_TYPE', 'REFERENCE_TYPE'); } dev2funModuleOpenGraphClass::setFields(dev2funModuleOpenGraphClass::$arReqOG); - Option::set($this->MODULE_ID,'ADDTAB_ELEMENT','Y'); - Option::set($this->MODULE_ID,'ADDTAB_SECTION','Y'); - Option::set($this->MODULE_ID,'SHOW_IN_ELEMENTS','Y'); - Option::set($this->MODULE_ID,'SHOW_IN_SECTIONS','Y'); + Option::set($this->MODULE_ID, 'ADDTAB_ELEMENT', 'Y'); + Option::set($this->MODULE_ID, 'ADDTAB_SECTION', 'Y'); + Option::set($this->MODULE_ID, 'SHOW_IN_ELEMENTS', 'Y'); + Option::set($this->MODULE_ID, 'SHOW_IN_SECTIONS', 'Y'); } catch (\Bitrix\Main\DB\SqlQueryException $e) { throw new Exception($e->getMessage()); } return true; } - public function registerEvents() { + public function registerEvents() + { $eventManager = \Bitrix\Main\EventManager::getInstance(); $eventManager->registerEventHandler("main", "OnPageStart", $this->MODULE_ID, "Dev2fun\\Module\\OpenGraph", "SetEventHandler"); -// $eventManager->registerEventHandler("main", "OnEpilog", $this->MODULE_ID, "dev2funModuleOpenGraphClass", "AddOpenGraph"); + // $eventManager->registerEventHandler("main", "OnEpilog", $this->MODULE_ID, "dev2funModuleOpenGraphClass", "AddOpenGraph"); $eventManager->registerEventHandler("main", "OnBuildGlobalMenu", $this->MODULE_ID, "dev2funModuleOpenGraphClass", "DoBuildGlobalMenu"); $eventManager->registerEventHandler("main", "OnAdminTabControlBegin", $this->MODULE_ID, "Dev2fun\\Module\\OpenGraph", "AddAdminTab"); @@ -111,39 +117,41 @@ public function registerEvents() { return true; } - public function installFiles() { + public function installFiles() + { // copy admin files - if(!CopyDirFiles($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/".$this->MODULE_ID."/install/admin", $_SERVER["DOCUMENT_ROOT"]."/bitrix/admin", true, true)){ - throw new Exception(Loc::getMessage("ERRORS_CREATE_DIR", array('#DIR#'=>'bitrix/admin'))); + if (!CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/" . $this->MODULE_ID . "/install/admin", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/admin", true, true)) { + throw new Exception(Loc::getMessage("ERRORS_CREATE_DIR", ['#DIR#' => 'bitrix/admin'])); } // copy themes files - if(!CopyDirFiles($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/".$this->MODULE_ID."/install/themes", $_SERVER["DOCUMENT_ROOT"]."/bitrix/themes", true, true)){ - throw new Exception(Loc::getMessage("ERRORS_CREATE_DIR",array('#DIR#'=>'bitrix/themes'))); + if (!CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/" . $this->MODULE_ID . "/install/themes", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/themes", true, true)) { + throw new Exception(Loc::getMessage("ERRORS_CREATE_DIR", ['#DIR#' => 'bitrix/themes'])); } // copy js files - if(!CopyDirFiles($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/".$this->MODULE_ID."/install/js", $_SERVER["DOCUMENT_ROOT"]."/bitrix/js/".$this->MODULE_ID, true, true)){ - throw new Exception(Loc::getMessage("ERRORS_CREATE_DIR",array('#DIR#'=>'bitrix/js'))); + if (!CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/" . $this->MODULE_ID . "/install/js", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/js/" . $this->MODULE_ID, true, true)) { + throw new Exception(Loc::getMessage("ERRORS_CREATE_DIR", ['#DIR#' => 'bitrix/js'])); } - if(!CopyDirFiles($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/".$this->MODULE_ID."/install/css", $_SERVER["DOCUMENT_ROOT"]."/bitrix/css/".$this->MODULE_ID, true, true)){ - throw new Exception(Loc::getMessage("ERRORS_CREATE_DIR",array('#DIR#'=>__DIR__."/install/css"))); + if (!CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/" . $this->MODULE_ID . "/install/css", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/css/" . $this->MODULE_ID, true, true)) { + throw new Exception(Loc::getMessage("ERRORS_CREATE_DIR", ['#DIR#' => __DIR__ . "/install/css"])); return false; } return true; } - function DoUninstall(){ + public function DoUninstall() + { global $APPLICATION; - if(!check_bitrix_sessid()) return false; + if (!check_bitrix_sessid()) return false; try { $this->deleteFiles(); $this->unInstallDB(); $this->unRegisterEvents(); \Bitrix\Main\ModuleManager::unRegisterModule($this->MODULE_ID); - $APPLICATION->IncludeAdminFile(Loc::getMessage("D2F_OPENGRAPH_UNSTEP1"), __DIR__."/unstep1.php"); + $APPLICATION->IncludeAdminFile(Loc::getMessage("D2F_OPENGRAPH_UNSTEP1"), __DIR__ . "/unstep1.php"); } catch (Exception $e) { $APPLICATION->ThrowException($e->getMessage()); return false; @@ -151,49 +159,52 @@ function DoUninstall(){ return true; } - public function deleteFiles() { + public function deleteFiles() + { - if(file_exists($_SERVER['DOCUMENT_ROOT']."/bitrix/admin/dev2fun_opengraph_manager.php") && !DeleteDirFilesEx("/bitrix/admin/dev2fun_opengraph_manager.php")){ - throw new Exception(Loc::getMessage("ERRORS_DELETE_FILE",array('#FILE#'=>'bitrix/admin/dev2fun_opengraph_manager.php'))); + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/bitrix/admin/dev2fun_opengraph_manager.php") && !DeleteDirFilesEx("/bitrix/admin/dev2fun_opengraph_manager.php")) { + throw new Exception(Loc::getMessage("ERRORS_DELETE_FILE", ['#FILE#' => 'bitrix/admin/dev2fun_opengraph_manager.php'])); } - if(file_exists($_SERVER['DOCUMENT_ROOT'].'/bitrix/themes/.default/icons/'.$this->MODULE_ID) && !DeleteDirFilesEx( '/bitrix/themes/.default/icons/'.$this->MODULE_ID )){ - throw new Exception(Loc::getMessage("ERRORS_DELETE_FILE",array('#FILE#'=>'bitrix/themes/.default/icons/'.$this->MODULE_ID))); + if (file_exists($_SERVER['DOCUMENT_ROOT'] . '/bitrix/themes/.default/icons/' . $this->MODULE_ID) && !DeleteDirFilesEx('/bitrix/themes/.default/icons/' . $this->MODULE_ID)) { + throw new Exception(Loc::getMessage("ERRORS_DELETE_FILE", ['#FILE#' => 'bitrix/themes/.default/icons/' . $this->MODULE_ID])); } - if(file_exists($_SERVER['DOCUMENT_ROOT'].'/bitrix/themes/.default/'.$this->MODULE_ID.'.css') && !DeleteDirFilesEx( '/bitrix/themes/.default/'.$this->MODULE_ID.'.css' )){ - throw new Exception(Loc::getMessage("ERRORS_DELETE_FILE",array('#FILE#'=>'bitrix/themes/.default/'.$this->MODULE_ID.'.css'))); + if (file_exists($_SERVER['DOCUMENT_ROOT'] . '/bitrix/themes/.default/' . $this->MODULE_ID . '.css') && !DeleteDirFilesEx('/bitrix/themes/.default/' . $this->MODULE_ID . '.css')) { + throw new Exception(Loc::getMessage("ERRORS_DELETE_FILE", ['#FILE#' => 'bitrix/themes/.default/' . $this->MODULE_ID . '.css'])); } - if(file_exists($_SERVER['DOCUMENT_ROOT'].'/bitrix/js/'.$this->MODULE_ID) && !DeleteDirFilesEx( '/bitrix/js/'.$this->MODULE_ID )){ - throw new Exception(Loc::getMessage("ERRORS_DELETE_FILE",array('#FILE#'=>'bitrix/js/'.$this->MODULE_ID))); + if (file_exists($_SERVER['DOCUMENT_ROOT'] . '/bitrix/js/' . $this->MODULE_ID) && !DeleteDirFilesEx('/bitrix/js/' . $this->MODULE_ID)) { + throw new Exception(Loc::getMessage("ERRORS_DELETE_FILE", ['#FILE#' => 'bitrix/js/' . $this->MODULE_ID])); } - if(file_exists($_SERVER['DOCUMENT_ROOT'].'/bitrix/css/'.$this->MODULE_ID) && !DeleteDirFilesEx( '/bitrix/css/'.$this->MODULE_ID )){ - throw new Exception(Loc::getMessage("ERRORS_DELETE_FILE",array('#FILE#'=>'bitrix/css/'.$this->MODULE_ID))); + if (file_exists($_SERVER['DOCUMENT_ROOT'] . '/bitrix/css/' . $this->MODULE_ID) && !DeleteDirFilesEx('/bitrix/css/' . $this->MODULE_ID)) { + throw new Exception(Loc::getMessage("ERRORS_DELETE_FILE", ['#FILE#' => 'bitrix/css/' . $this->MODULE_ID])); } return true; } - public function unRegisterEvents() { + public function unRegisterEvents() + { $eventManager = \Bitrix\Main\EventManager::getInstance(); -// $eventManager->unRegisterEventHandler('main','OnEpilog',$this->MODULE_ID); - $eventManager->unRegisterEventHandler("main","OnPageStart", $this->MODULE_ID); - $eventManager->unRegisterEventHandler('main','OnBuildGlobalMenu',$this->MODULE_ID); - $eventManager->unRegisterEventHandler('main','OnAdminTabControlBegin',$this->MODULE_ID); + // $eventManager->unRegisterEventHandler('main','OnEpilog',$this->MODULE_ID); + $eventManager->unRegisterEventHandler("main", "OnPageStart", $this->MODULE_ID); + $eventManager->unRegisterEventHandler('main', 'OnBuildGlobalMenu', $this->MODULE_ID); + $eventManager->unRegisterEventHandler('main', 'OnAdminTabControlBegin', $this->MODULE_ID); - $eventManager->unRegisterEventHandler('iblock','OnAfterIBlockSectionUpdate',$this->MODULE_ID); - $eventManager->unRegisterEventHandler('iblock','OnAfterIBlockSectionAdd',$this->MODULE_ID); - $eventManager->unRegisterEventHandler('iblock','OnAfterIBlockElementDelete',$this->MODULE_ID); + $eventManager->unRegisterEventHandler('iblock', 'OnAfterIBlockSectionUpdate', $this->MODULE_ID); + $eventManager->unRegisterEventHandler('iblock', 'OnAfterIBlockSectionAdd', $this->MODULE_ID); + $eventManager->unRegisterEventHandler('iblock', 'OnAfterIBlockElementDelete', $this->MODULE_ID); - $eventManager->unRegisterEventHandler('iblock','OnAfterIBlockElementUpdate',$this->MODULE_ID); - $eventManager->unRegisterEventHandler('iblock','OnAfterIBlockElementAdd',$this->MODULE_ID); - $eventManager->unRegisterEventHandler('iblock','OnAfterIBlockSectionDelete',$this->MODULE_ID); + $eventManager->unRegisterEventHandler('iblock', 'OnAfterIBlockElementUpdate', $this->MODULE_ID); + $eventManager->unRegisterEventHandler('iblock', 'OnAfterIBlockElementAdd', $this->MODULE_ID); + $eventManager->unRegisterEventHandler('iblock', 'OnAfterIBlockSectionDelete', $this->MODULE_ID); return true; } - public function unInstallDB() { + public function unInstallDB() + { global $DB, $DBType; - $errors = $DB->RunSQLBatch(__DIR__."/db/uninstall.sql"); - if($errors !== false) { + $errors = $DB->RunSQLBatch(__DIR__ . "/db/uninstall.sql"); + if ($errors !== false) { throw new Exception(implode(PHP_EOL, $errors)); } $connection = \Bitrix\Main\Application::getInstance()->getConnection(); @@ -202,4 +213,3 @@ public function unInstallDB() { return true; } } -?> \ No newline at end of file diff --git a/win1251/dev2fun.opengraph/install/version.php b/win1251/dev2fun.opengraph/install/version.php index f8ef0b2..e2bfa41 100644 --- a/win1251/dev2fun.opengraph/install/version.php +++ b/win1251/dev2fun.opengraph/install/version.php @@ -1,5 +1,5 @@ "1.4.1", - "VERSION_DATE" => "2022-04-26 02:00:00", + "VERSION" => "1.4.2", + "VERSION_DATE" => "2023-01-22 17:00:00", ]; diff --git a/win1251/dev2fun.opengraph/lang/ru/admin/dev2fun_settings.php b/win1251/dev2fun.opengraph/lang/ru/admin/dev2fun_settings.php index 493211c..48c9b18 100644 --- a/win1251/dev2fun.opengraph/lang/ru/admin/dev2fun_settings.php +++ b/win1251/dev2fun.opengraph/lang/ru/admin/dev2fun_settings.php @@ -1,7 +1,7 @@ - - * @version 1.3.7 + * @version 1.4.2 */ $MESS["SEC_MAIN_TAB"] = " OpenGraph"; $MESS["SEC_MAIN_TAB_TITLE"] = " OpenGraph"; diff --git a/win1251/dev2fun.opengraph/lang/ru/lib/views/admin_additional.php b/win1251/dev2fun.opengraph/lang/ru/lib/views/admin_additional.php index 8f82628..8e84e73 100644 --- a/win1251/dev2fun.opengraph/lang/ru/lib/views/admin_additional.php +++ b/win1251/dev2fun.opengraph/lang/ru/lib/views/admin_additional.php @@ -1,3 +1,3 @@ - - - + - + - - + + - + - - + + - + - - + +
og:og: - +
og:og: - "OG_IMAGE", "description" => true, "upload" => true, @@ -35,11 +37,13 @@ "fileDialog" => true, "cloud" => true, "delete" => true, - "maxCount" => 1 - ))->show($arOpenGraph[$arField] > 0 ? $arOpenGraph[$arField]: 0); + "maxCount" => 1, + ])->show($arOpenGraph[$arField] > 0 ? $arOpenGraph[$arField] : 0); } else { - echo CFileInput::Show("OG_IMAGE", ($arOpenGraph[$arField] > 0 && !$bCopy? $arOpenGraph[$arField] : 0), - array( + echo CFileInput::Show( + "OG_IMAGE", + ($arOpenGraph[$arField] > 0 && !$bCopy ? $arOpenGraph[$arField] : 0), + [ "IMAGE" => "Y", "PATH" => "Y", "FILE_SIZE" => "Y", @@ -49,28 +53,30 @@ // "W" => COption::GetOptionString("iblock", "detail_image_size"), // "H" => COption::GetOptionString("iblock", "detail_image_size"), // ), - ), array( + ], + [ 'upload' => true, 'medialib' => true, 'file_dialog' => true, 'cloud' => true, 'del' => true, 'description' => true, - ) + ] ); - }?> + } ?>
og:og: - +
diff --git a/win1251/dev2fun.opengraph/lib/views/admin_additional.php b/win1251/dev2fun.opengraph/lib/views/admin_additional.php index f2dbf9e..e2b470c 100644 --- a/win1251/dev2fun.opengraph/lib/views/admin_additional.php +++ b/win1251/dev2fun.opengraph/lib/views/admin_additional.php @@ -8,21 +8,21 @@ /** @var array $arOpenGraph */ ?> - - - - - - - - - + + + + + + + + +
- -
- -
+ +
+ +
diff --git a/win1251/dev2fun.opengraph/migrations/1.4.2.php b/win1251/dev2fun.opengraph/migrations/1.4.2.php new file mode 100644 index 0000000..c90a837 --- /dev/null +++ b/win1251/dev2fun.opengraph/migrations/1.4.2.php @@ -0,0 +1,24 @@ + + * Date: 22.01.2023 + * Time: 16:24 + */ + +/** @var CMain $APPLICATION */ +/** @var CUser $USER */ +/** @var CDatabase $DB */ +/** @var CUpdater $updater */ + +include($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php"); + +$moduleID = 'dev2fun.opengraph'; + +\Bitrix\Main\Loader::includeModule($moduleID); + +CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/{$moduleID}/install/admin", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/admin/", true, true); + +\dev2funModuleOpenGraphClass::ShowThanksNotice(); + +echo '1.4.2 - DONE'.PHP_EOL; \ No newline at end of file