commit 83e6da4b797d666c4e81b8c8f41dae148522e240 Author: Andrei Date: Tue Jun 10 09:00:54 2025 +0300 Initial commit diff --git a/.customers.menu.php b/.customers.menu.php new file mode 100644 index 0000000..435b2f1 --- /dev/null +++ b/.customers.menu.php @@ -0,0 +1,74 @@ + \ No newline at end of file diff --git a/.docs.menu.php b/.docs.menu.php new file mode 100644 index 0000000..087e56e --- /dev/null +++ b/.docs.menu.php @@ -0,0 +1,32 @@ + \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f2dad09 --- /dev/null +++ b/.gitignore @@ -0,0 +1,113 @@ +# GP | SEO +!robots.txt +yandex_*.html +yandex_turbo.xml +turbo_yandex.xml +google*.html +sitemap*.xml + + + + +# GP | Bitrix +upload/ +urlrewrite.php +.htaccess +.htaccess.restore +.access.php +bitrix/* +bitrix/php_interface/dbconn.php +/bitrix/.settings.php +!bitriex/modules/main/include/prolog.php # вирус пишет сюда +!bitrix/license_key.php +!bitrix/urlrewrite.php +!bitrix/bitrix.php +!bitrix/templates/ +!bitrix/components/ +!bitrix/pagen.php +!bitrix/index.php +!bitrix/header.php +!bitrix/footer.php +!bitrix/php_interface/ +!bitrix/local/ +!bitrix/themes/ +!bitrix/php_interface/init.php +bitrix/templates/landing24/ +bitrix/templates/learning/ +bitrix/components/bitrix/ + + + + +# GP | Files ext +*.sql +*.sql.gz +*.tgz +*.tar.gz +*.tar.* +*.gz.* +*.tar +*.rar +*.zip +*.mp3 +*.mp4 +*.webm +*.mov +*.MOV +*.wav +*.flv +*.db +*.psd +*.pdf +*.doc +*.docx +*.txt +*.text +*.log +*.config +*.xml +*.tbk +*.csv +*.json +*.xls +*.xlsx + + + + +# GP | Dirs & files +bower_components/ +node_modules/ +nbproject/ +cache/ +.cache/ +phpMyAdmin-* +timthumb_cache/ +webstat/ +.idea/ +.csscomb.json +.htaccess +sitemap*.xml +sftp-config.json +robots.txt* +robots-*.txt +bower.json +.bowerrc +backup_rsync/ +.bash_history +.idea/ +.fleet/ +.DS_Store +.config/ +.bash* +.vim* +test/ +test*.php +gp-test*/ +gp-test*.php +_* +.*_lock + + +# Node-js скрипт для индексации 100 url в сутки +.google-indexing/ diff --git a/.interesting.menu.php b/.interesting.menu.php new file mode 100644 index 0000000..ecf9446 --- /dev/null +++ b/.interesting.menu.php @@ -0,0 +1,18 @@ + \ No newline at end of file diff --git a/.section.php b/.section.php new file mode 100644 index 0000000..f394b4c --- /dev/null +++ b/.section.php @@ -0,0 +1,7 @@ + 'Мы предлагаем широкий ассортимент качественной одежды по адекватным ценам.', + 'keywords' => 'женская одежда, мужская одежда, спортивная одежда, тапочки', + 'robots' => 'index, follow', +]; diff --git a/.services.menu.php b/.services.menu.php new file mode 100644 index 0000000..b8ae48e --- /dev/null +++ b/.services.menu.php @@ -0,0 +1,74 @@ + \ No newline at end of file diff --git a/.top.menu.php b/.top.menu.php new file mode 100644 index 0000000..c4303a4 --- /dev/null +++ b/.top.menu.php @@ -0,0 +1,74 @@ + \ No newline at end of file diff --git a/.useful.menu.php b/.useful.menu.php new file mode 100644 index 0000000..4a45ffb --- /dev/null +++ b/.useful.menu.php @@ -0,0 +1,74 @@ + \ No newline at end of file diff --git a/404.php b/404.php new file mode 100644 index 0000000..03e46e8 --- /dev/null +++ b/404.php @@ -0,0 +1,77 @@ +SetTitle("Страница не найдена");?> + +
+
+
Неправильно набран адрес,
или такой страницы на сайте больше не существует.
+
Вернитесь на главную или воспользуйтесь картой сайта.
+
+
+
+
Карта сайта:
+
+
+ +
+
Каталог
+ IncludeComponent( + "bitrix:catalog.section.list", + "tree", + array( + "COMPONENT_TEMPLATE" => "tree", + "IBLOCK_TYPE" => "catalog", + "IBLOCK_ID" => "2", + "SECTION_ID" => $_REQUEST["SECTION_ID"], + "SECTION_CODE" => "", + "COUNT_ELEMENTS" => "Y", + "TOP_DEPTH" => "2", + "SECTION_FIELDS" => array( + 0 => "", + 1 => "", + ), + "SECTION_USER_FIELDS" => array( + 0 => "", + 1 => "", + ), + "SECTION_URL" => "", + "CACHE_TYPE" => "A", + "CACHE_TIME" => "36000000", + "CACHE_GROUPS" => "Y", + "ADD_SECTIONS_CHAIN" => "Y" + ), + false + ); + ?> +
+ +
+
О магазине
+ IncludeComponent( + "bitrix:main.map", + ".default", + array( + "CACHE_TYPE" => "A", + "CACHE_TIME" => "36000000", + "SET_TITLE" => "N", + "LEVEL" => "3", + "COL_NUM" => "2", + "SHOW_DESCRIPTION" => "Y", + "COMPONENT_TEMPLATE" => ".default" + ), + false + );?> +
+ GetMessage("SM_NAME"), + "DESCRIPTION" => GetMessage("SM_DESCRIPTION"), + "ICON" => "/images/icon.png", + "PATH" => array( + "ID" => GetMessage("MAIN_GROUP_NAME_SOTBIT"), + "CHILD" => array( + "ID" => "sotbit.seo.meta", + "NAME" => GetMessage("MAIN_MENU_NAME_SOTBIT") + ) + ), +); +?> \ No newline at end of file diff --git a/bitrix/components/sotbit/seo.meta.bottom-menu/.parameters.php b/bitrix/components/sotbit/seo.meta.bottom-menu/.parameters.php new file mode 100644 index 0000000..b9a1608 --- /dev/null +++ b/bitrix/components/sotbit/seo.meta.bottom-menu/.parameters.php @@ -0,0 +1,197 @@ + "asc", +), array( + "TYPE" => $arCurrentValues["IBLOCK_TYPE"], + "ACTIVE" => "Y", +)); +while ($arr = $rsIBlock->Fetch()) + $arIBlock[$arr["ID"]] = "[".$arr["ID"]."] ".$arr["NAME"]; + +$arPropList = []; +if(intval($arCurrentValues['IBLOCK_ID']) > 0) { + $rsProps = CIBlockProperty::GetList( + array(), + array( + 'IBLOCK_ID' => $arCurrentValues['IBLOCK_ID'] + ) + ); + + while ($arProp = $rsProps->Fetch()) { + $arPropList[$arProp['ID']] = '[' . $arProp['ID'] . '] ' . $arProp['NAME']; + } + + if(CModule::IncludeModule('catalog')) { + $offerBlock = CCatalog::GetList( + array(), + array( + 'IBLOCK_ID' => $arCurrentValues['IBLOCK_ID'] + ), + false, + false, + array('OFFERS_IBLOCK_ID') + )->fetch(); + + if($offerBlock) { + $rsSku = CIBlockProperty::GetList( + array(), + array( + 'IBLOCK_ID' => $offerBlock['OFFERS_IBLOCK_ID'] + ) + ); + + while ($prop = $rsSku->fetch()) { + $arPropList[$prop['ID']] = '[' . $prop['ID'] . '] ' . $prop['NAME']; + } + } + } +} + +// Brands params +$arIBlockTypeBrands = CIBlockParameters::GetIBlockTypes(); +$rsIBlock = CIBlock::GetList( + array( + "sort" => "asc", + ), + array( + "TYPE" => $arCurrentValues["BRAND_IBLOCK_TYPE"], + "ACTIVE" => "Y", + ) +); +while ($arr = $rsIBlock->Fetch()) { + $arIBlockBrands[$arr["ID"]] = "[" . $arr["ID"] . "] " . $arr["NAME"]; +} + +if(intval($arCurrentValues['BRAND_IBLOCK_ID']) > 0) { + $rsBrands = CIBlockProperty::GetList( + array(), + array( + 'IBLOCK_ID' => $arCurrentValues['BRAND_IBLOCK_ID'] + ) + ); + + while ($arBrand = $rsBrands->Fetch()) { + $arBrandsList[$arBrand['ID']] = $arBrand['NAME']; + } + + if(CModule::IncludeModule('catalog')) { + $offerBlock = CCatalog::GetList( + array(), + array( + 'IBLOCK_ID' => $arCurrentValues['BRAND_IBLOCK_ID'] + ), + false, + false, + array('OFFERS_IBLOCK_ID') + )->fetch(); + + if($offerBlock) { + $rsBrands = CIBlockProperty::GetList( + array(), + array( + 'IBLOCK_ID' => $offerBlock['OFFERS_IBLOCK_ID'] + ) + ); + + while ($arBrand = $rsBrands->Fetch()) { + $arBrandsList[$arBrand['ID']] = $arBrand['NAME']; + } + } + } +} + +$arComponentParameters = array( + "GROUPS" => array( + 'BRAND_PARAMETERS' => array( + 'NAME' => GetMessage('SM_BRAND_PARAMS_NAME'), + 'SORT' => 150 + ) + ), + "PARAMETERS" => array( + 'TAB_NAME' => array( + "PARENT" => "BASE", + "NAME" => GetMessage('SM_TAB_PROPERTY_NAME'), + "TYPE" => "STRING", + "DEFAULT" => GetMessage('SM_TAB_PROPERTY_NAME_DEFAULT'), + ), + "IBLOCK_TYPE" => array( + "PARENT" => "BASE", + "NAME" => GetMessage("SM_IBLOCK_TYPE"), + "TYPE" => "LIST", + "VALUES" => $arIBlockType, + "REFRESH" => "Y", + ), + "IBLOCK_ID" => array( + "PARENT" => "BASE", + "NAME" => GetMessage("SM_IBLOCK_IBLOCK"), + "TYPE" => "LIST", + "ADDITIONAL_VALUES" => "Y", + "VALUES" => $arIBlock, + "REFRESH" => "Y", + ), + "EXCLUDE_PROPERTY_LIST" => array( + "PARENT" => "BASE", + "NAME" => GetMessage("SM_EXCLUDE_PROPERTY_LIST"), + "TYPE" => "LIST", + "MULTIPLE" => "Y", + "SIZE" => 10, + "VALUES" => $arPropList, + ), + "SHOW_BRAND_TAB" => array( + "PARENT" => "BRAND_PARAMETERS", + "NAME" => GetMessage("SM_SHOW_BRAND_TAB"), + "TYPE" => "CHECKBOX", + "DEFAULT" => "N", + "REFRESH" => "Y", + ), + "CACHE_TIME" => array( + "DEFAULT" => 36000000, + ), + "CACHE_GROUPS" => array( + "PARENT" => "CACHE_SETTINGS", + "NAME" => GetMessage("SM_CACHE_GROUPS"), + "TYPE" => "CHECKBOX", + "DEFAULT" => "Y", + ), + ) +); + +if($arCurrentValues['SHOW_BRAND_TAB'] == 'Y') { + $arBrandProps = array( + 'BRAND_TAB_NAME' => array( + "PARENT" => "BRAND_PARAMETERS", + "NAME" => GetMessage('SM_BRAND_TAB_NAME'), + "TYPE" => "STRING", + "DEFAULT" => GetMessage('SM_BRAND_TAB_NAME_DEFAULT'), + ), + "BRAND_IBLOCK_TYPE" => array( + "PARENT" => "BRAND_PARAMETERS", + "NAME" => GetMessage("SM_IBLOCK_TYPE"), + "TYPE" => "LIST", + "VALUES" => $arIBlockTypeBrands, + "REFRESH" => "Y", + ), + "BRAND_IBLOCK_ID" => array( + "PARENT" => "BRAND_PARAMETERS", + "NAME" => GetMessage("SM_IBLOCK_IBLOCK"), + "TYPE" => "LIST", + "ADDITIONAL_VALUES" => "Y", + "VALUES" => $arIBlockBrands, + "REFRESH" => "Y", + ), + "BRANDS_LIST" => array( + "PARENT" => "BRAND_PARAMETERS", + "NAME" => GetMessage("SM_EXCLUDE_PROPERTY_LIST"), + "TYPE" => "LIST", + "VALUES" => $arBrandsList, + ), + ); + + $arComponentParameters['PARAMETERS'] = array_merge($arComponentParameters['PARAMETERS'], $arBrandProps); +} +?> \ No newline at end of file diff --git a/bitrix/components/sotbit/seo.meta.bottom-menu/component.php b/bitrix/components/sotbit/seo.meta.bottom-menu/component.php new file mode 100644 index 0000000..2f1d06b --- /dev/null +++ b/bitrix/components/sotbit/seo.meta.bottom-menu/component.php @@ -0,0 +1,228 @@ +getCurPage(); + +if($arParams['EXCLUDE_PROPERTY_LIST']) { + $arParams['EXCLUDE_PROPERTY_LIST'] = array_merge($arParams['EXCLUDE_PROPERTY_LIST'], + [$arParams['BRANDS_LIST']]); +} else { + $arParams['EXCLUDE_PROPERTY_LIST'] = []; +} + +$cacheTime = $arParams['CACHE_TIME']; +$cache_id = serialize(array($arParams, $currentPage, ($arParams['CACHE_GROUPS'] === 'N' ? false : $USER->GetGroups()))); +$cacheDir = '/sotbit.seometa.bottom-menu/'; +$cache = \Bitrix\Main\Application::getInstance()->getManagedCache(); +$arrProperties = array(); + +if($cache->read($cacheTime, $cache_id, $cacheDir)) +{ + $items = $cache->get($cache_id); +} +else +{ + if($arParams['KOMBOX_FILTER'] == 'Y' && CModule::IncludeModule('kombox.filter')) + { + $str = CKomboxFilter::GetCurPageParam(); + $str = explode("?", $str); + $str = $str[0]; + } + else + { + $str = $APPLICATION->GetCurPage(); + } + + $str = CSeoMeta::encodeRealUrl($str); + $metaData = SeometaUrlTable::getByRealUrl($str, SITE_ID); + + if (!$metaData) { + $requestGet = Context::getCurrent()->getRequest()->getQueryList()->toArray(); + $pageParams = array_keys($requestGet); + $str = $APPLICATION->GetCurPageParam( + '', + $pageParams + ); + $str = CSeoMeta::encodeRealUrl($str); + $metaData = SeometaUrlTable::getByRealUrl($str, SITE_ID); + } + + if(!$metaData) { + $metaData = SeometaUrlTable::getByNewUrl($str, SITE_ID); + } + + if($metaData['ID']) { + $arrProperties = ChpuTagsTable::getByChpuID($metaData['ID']); + + if($arrProperties['TAG_OVERRIDE_TYPE'] == 'Y') { + $arrIDs = array_diff($arrProperties['TAG_DATA'], $arParams['EXCLUDE_PROPERTY_LIST']); + + $conditionId = $metaData['CONDITION_ID']; + $sectionId = $metaData['section_id']; + + $smartFilter = new \Sotbit\Seometa\Filter\SmartFilter($conditionId); + $rule = new Sotbit\Seometa\Condition\Rule(); + $condition = $rule->parse($smartFilter->getCondition()); + + $generator = Sotbit\Seometa\Generator\GeneratorFactory::create($smartFilter->getCondition()->FILTER_TYPE); + + $catalogUrl = new Sotbit\Seometa\Url\CatalogUrl($smartFilter->getCondition()); +// $catalogUrl->cleanTemplate(true); + $catalogUrl->setSectionPlaceholdersIfNeed($sectionId); + + $propertySet = new Sotbit\Seometa\Property\PropertySet(); + $propertySetEntity = new Sotbit\Seometa\Property\PropertySetEntity($condition->getData()[0]->getData()[0]->getData()); + $propertySet->add($propertySetEntity); + + $catalogUrl->replaceFromSet($propertySet, $generator); + $catalogUrl->getMask(); + + foreach ($arrIDs as $key => $arrID) { + if($sotbitFilterResult['ITEMS'][$arrID]['VALUES']) { + foreach ($sotbitFilterResult['ITEMS'][$arrID]['VALUES'] as $value) { + if(!$link = SeometaUrlTable::getByRealUrl($value['section_filter_link'], SITE_ID)) { + $link = SeometaUrlTable::getByNewUrl($value['section_filter_link'], SITE_ID); + } + + if($link) { + $item['NAME'] = $value['VALUE']; + $item['URL'] = $link['REAL_URL']; + $items['BOTTOM_MENU_PROPERTIES']['SECTION'][$key]['LINKS'][] = $item; + } + } + + if($items['BOTTOM_MENU_PROPERTIES']['SECTION'][$key]['LINKS']) { + $items['BOTTOM_MENU_PROPERTIES']['SECTION'][$key]['NAME'] = $sotbitFilterResult['ITEMS'][$arrID]['NAME']; + } + } + } + } else if($arrProperties['TAG_OVERRIDE_TYPE'] == 'M' && $arrProperties['TAG_DATA']['SECTION']) { + $items['BOTTOM_MENU_PROPERTIES'] = $arrProperties['TAG_DATA']; + } + } + + if($arrProperties['TAG_OVERRIDE_TYPE'] != 'Y' && $arrProperties['TAG_OVERRIDE_TYPE'] != 'M') { + $arLinksInSection = SeometaUrlTable::getList([ + 'filter' => [ + 'ACTIVE' => 'Y', + 'section_id' => $sotbitFilterResult['SECTION_ID'] + ], + 'select' => [ + 'NEW_URL', + 'SITE_ID', + 'iblock_id', + 'PROPERTIES' + ] + ]); + + + $section = ''; + while ($linkSection = $arLinksInSection->fetch()) { + $siteID = unserialize($linkSection['SITE_ID']); + if ($siteID && in_array(SITE_ID, + $siteID)) { + $properties = unserialize($linkSection['PROPERTIES']); + + foreach ($properties as $key => $arrVal) { + foreach ($arrVal as $val) { + $arrChpuProps[$key][$val] = $linkSection['NEW_URL']; + } + } + } + } + + if ($arrChpuProps) { + foreach ($arrChpuProps as $propCODE => $prop) { + $iblockProperty = CIBlockProperty::GetList( + array(), + array( + 'IBLOCK_ID' => $arParams['IBLOCK_ID'], + 'CODE' => $propCODE + ) + )->fetch(); + + if (!$iblockProperty['ID'] && Loader::includeModule('catalog')) { + $skuIblockId = CCatalog::GetList( + array(), + array( + 'IBLOCK_ID' => $arParams['IBLOCK_ID'], + 'CODE' => $propCODE + ), + false, + false, + array('OFFERS_IBLOCK_ID') + )->fetch(); + + if ($skuIblockId) { + $iblockProperty = CIBlockProperty::GetList( + array(), + array( + 'IBLOCK_ID' => $skuIblockId['OFFERS_IBLOCK_ID'], + 'CODE' => $propCODE + ) + )->fetch(); + } + } + + if ( + $iblockProperty['ID'] && + $sotbitFilterResult['ITEMS'][$iblockProperty['ID']] && + !in_array($iblockProperty['ID'], + $arParams['EXCLUDE_PROPERTY_LIST']) + ) { + foreach ($prop as $propKey => $pr) { + foreach ($sotbitFilterResult['ITEMS'][$iblockProperty['ID']]['VALUES'] as $VALUE) { + if ($VALUE['UPPER'] == mb_strtoupper($propKey)) { + $link['NAME'] = $propKey; + $link['URL'] = $pr; + + $items['BOTTOM_MENU_PROPERTIES']['SECTION'][$propCODE]['LINKS'][] = $link; + } + } + } + + if (count($items['BOTTOM_MENU_PROPERTIES']['SECTION'][$propCODE]['LINKS']) > 0) { + $items['BOTTOM_MENU_PROPERTIES']['SECTION'][$propCODE]['NAME'] = $sotbitFilterResult['ITEMS'][$iblockProperty['ID']]['NAME']; + } + } + } + } + } + + if($arParams['BRANDS_LIST'] && $sotbitFilterResult['ITEMS'][$arParams['BRANDS_LIST']]) { + $items['BRANDS_LIST'] = []; + foreach ($sotbitFilterResult['ITEMS'][$arParams['BRANDS_LIST']]['VALUES'] as $brandListItem) { + if($brandListItem['section_filter_link']) { + $brandItem['NAME'] = $brandListItem['VALUE']; + $brandItem['URL'] = $brandListItem['section_filter_link']; + $items['BRANDS_LIST'][] = $brandItem; + } + } + } + + $cache->set($cache_id, $items); +} + +$arResult = $items; + +$this->IncludeComponentTemplate(); +?> \ No newline at end of file diff --git a/bitrix/components/sotbit/seo.meta.bottom-menu/lang/ru/.description.php b/bitrix/components/sotbit/seo.meta.bottom-menu/lang/ru/.description.php new file mode 100644 index 0000000..a805070 --- /dev/null +++ b/bitrix/components/sotbit/seo.meta.bottom-menu/lang/ru/.description.php @@ -0,0 +1,6 @@ + \ No newline at end of file diff --git a/bitrix/components/sotbit/seo.meta.bottom-menu/lang/ru/.parameters.php b/bitrix/components/sotbit/seo.meta.bottom-menu/lang/ru/.parameters.php new file mode 100644 index 0000000..9561901 --- /dev/null +++ b/bitrix/components/sotbit/seo.meta.bottom-menu/lang/ru/.parameters.php @@ -0,0 +1,27 @@ + \ No newline at end of file diff --git a/bitrix/components/sotbit/seo.meta.bottom-menu/templates/.default/script.js b/bitrix/components/sotbit/seo.meta.bottom-menu/templates/.default/script.js new file mode 100644 index 0000000..712a179 --- /dev/null +++ b/bitrix/components/sotbit/seo.meta.bottom-menu/templates/.default/script.js @@ -0,0 +1,25 @@ +window.addEventListener('DOMContentLoaded', () => { + const tabButtons = document.querySelectorAll('.seometa-menu__button'); + const contentAreas = document.querySelectorAll('.seometa-menu__content'); + + for (let i = 0; i < tabButtons.length; i++) { + tabButtons[i].addEventListener('click', () => { + + tabButtons.forEach( + button => { + button.classList.remove('seometa-menu__button_active'); + } + ); + + tabButtons[i].classList.add('seometa-menu__button_active'); + + contentAreas.forEach( + area => { + area.style.display = 'none'; + } + ); + + contentAreas[i].style.display = 'flex'; + }) + } +}); diff --git a/bitrix/components/sotbit/seo.meta.bottom-menu/templates/.default/style.css b/bitrix/components/sotbit/seo.meta.bottom-menu/templates/.default/style.css new file mode 100644 index 0000000..9828c5f --- /dev/null +++ b/bitrix/components/sotbit/seo.meta.bottom-menu/templates/.default/style.css @@ -0,0 +1,39 @@ +.seometa-menu__buttons-wrapper { + display: -webkit-box; + display: -moz-box; + display: -ms-flexbox; + display: flex; + -ms-flex-wrap: wrap; + flex-wrap: wrap; + margin: 0 -5px 10px; } + +.seometa-menu__button { + font-weight: bold; + margin: 0 5px; + cursor: pointer; + -webkit-transition: all 0.2s ease; + transition: all 0.2s ease; } +.seometa-menu__button:hover { + color: var(--main-color); } +.seometa-menu__button_active { + color: var(--main-color); } + +.seometa-menu__content { + display: none; + padding: 10px; + flex-wrap: wrap; + border: 1px solid #ededed; } + +.seometa-menu__section { + display: inline-block; + width: 25%; + min-width: 200px; + padding: 10px; } + +.seometa-menu__link { + display: block; + margin-left: 10px; } + +.seometa-menu__name { + display: block; + margin-bottom: 5px; } diff --git a/bitrix/components/sotbit/seo.meta.bottom-menu/templates/.default/style.min.css b/bitrix/components/sotbit/seo.meta.bottom-menu/templates/.default/style.min.css new file mode 100644 index 0000000..c731205 --- /dev/null +++ b/bitrix/components/sotbit/seo.meta.bottom-menu/templates/.default/style.min.css @@ -0,0 +1 @@ +.seometa-menu__buttons-wrapper{display:-webkit-box;display:-moz-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;margin:0 -5px 10px}.seometa-menu__button{font-weight:700;margin:0 5px;cursor:pointer;-webkit-transition:all .2s ease;transition:all .2s ease}.seometa-menu__button:hover,.seometa-menu__button_active{color:var(--main-color)}.seometa-menu__content{display:none;flex-wrap:wrap;padding:10px;border:1px solid #ededed}.seometa-menu__section{display:inline-block;width:25%;min-width:200px;padding:10px}.seometa-menu__link{display:block;margin-left:10px}.seometa-menu__name{display:block;margin-bottom:5px} \ No newline at end of file diff --git a/bitrix/components/sotbit/seo.meta.bottom-menu/templates/.default/style.scss b/bitrix/components/sotbit/seo.meta.bottom-menu/templates/.default/style.scss new file mode 100644 index 0000000..5542b55 --- /dev/null +++ b/bitrix/components/sotbit/seo.meta.bottom-menu/templates/.default/style.scss @@ -0,0 +1,44 @@ +.seometa-menu__buttons-wrapper { + display: flex; + flex-wrap: wrap; + margin: 0 -5px 10px; +} + +.seometa-menu__button { + font-weight: bold; + margin: 0 5px; + cursor: pointer; + transition: all 0.2s ease; + + &:hover { + color: var(--main-color); + } + + &_active { + color: var(--main-color); + } +} + +.seometa-menu__content { + display: none; + flex-wrap: wrap; + padding: 10px; + border: 1px solid #ededed; +} + +.seometa-menu__section { + display: inline-block; + width: 25%; + min-width: 200px; + padding: 10px; +} + +.seometa-menu__link { + display: block; + margin-left: 10px; +} + +.seometa-menu__name { + display: block; + margin-bottom: 5px; +} diff --git a/bitrix/components/sotbit/seo.meta.bottom-menu/templates/.default/template.php b/bitrix/components/sotbit/seo.meta.bottom-menu/templates/.default/template.php new file mode 100644 index 0000000..02950b9 --- /dev/null +++ b/bitrix/components/sotbit/seo.meta.bottom-menu/templates/.default/template.php @@ -0,0 +1,50 @@ +setFrameMode(true); + +if ( + (is_array($arResult['BOTTOM_MENU_PROPERTIES']) && count($arResult['BOTTOM_MENU_PROPERTIES']) > 0) || + ($arParams['SHOW_BRAND_TAB'] == 'Y' && is_array($arResult['BRANDS_LIST']) && count($arResult['BRANDS_LIST']) > 0) +) { ?> +
+
+ 0):?> +
+ + +
+ +
+ + 0) {?> +
+ +
+ + + + + + + + +
+ +
+ + + 0):?> +
+ > +
+ + + + + +
+
+ +
+ + diff --git a/bitrix/components/sotbit/seo.meta.custom.tags/.description.php b/bitrix/components/sotbit/seo.meta.custom.tags/.description.php new file mode 100644 index 0000000..989a214 --- /dev/null +++ b/bitrix/components/sotbit/seo.meta.custom.tags/.description.php @@ -0,0 +1,14 @@ + GetMessage("SM_NAME"), + "DESCRIPTION" => GetMessage("SM_DESCRIPTION"), + "ICON" => "/images/icon.png", + "PATH" => array( + "ID" => GetMessage("MAIN_GROUP_NAME_SOTBIT"), + "CHILD" => array( + "ID" => "sotbit.seo.meta", + "NAME" => GetMessage("MAIN_MENU_NAME_SOTBIT"), + ) + ), +); +?> \ No newline at end of file diff --git a/bitrix/components/sotbit/seo.meta.custom.tags/.parameters.php b/bitrix/components/sotbit/seo.meta.custom.tags/.parameters.php new file mode 100644 index 0000000..560fed5 --- /dev/null +++ b/bitrix/components/sotbit/seo.meta.custom.tags/.parameters.php @@ -0,0 +1,88 @@ + "asc", +), array( + "TYPE" => $arCurrentValues["IBLOCK_TYPE"], + "ACTIVE" => "Y", +)); +while ($arr = $rsIBlock->Fetch()) + $arIBlock[$arr["ID"]] = "[".$arr["ID"]."] ".$arr["NAME"]; + +$result =\Bitrix\Iblock\SectionTable::getList(array( + 'select' => array('ID','NAME'), + 'filter' => array('IBLOCK_ID' => $arCurrentValues['IBLOCK_ID']) +)); +while ($Section = $result->fetch()) +{ + $arSections[$Section["ID"]] = "[".$Section["ID"]."] ".$Section["NAME"]; +} + +$arComponentParameters = array( + "GROUPS" => array(), + "PARAMETERS" => array( + "IBLOCK_TYPE" => array( + "PARENT" => "BASE", + "NAME" => GetMessage("SM_IBLOCK_TYPE"), + "TYPE" => "LIST", + "VALUES" => $arIBlockType, + "REFRESH" => "Y", + ), + "IBLOCK_ID" => array( + "PARENT" => "BASE", + "NAME" => GetMessage("SM_IBLOCK_IBLOCK"), + "TYPE" => "LIST", + "ADDITIONAL_VALUES" => "Y", + "VALUES" => $arIBlock, + "REFRESH" => "Y", + ), + "SECTION_ID" => array( + "PARENT" => "BASE", + "NAME" => GetMessage("SM_SECTION_ID"), + "TYPE" => "LIST", + "ADDITIONAL_VALUES" => "Y", + "VALUES" => $arSections, + ), + "INCLUDE_SUBSECTIONS" => array( + "PARENT" => "BASE", + 'NAME' => GetMessage('SM_INCLUDE_SUBSECTIONS'), + "TYPE" => "LIST", + "VALUES" => array( + "Y" => GetMessage('SM_INCLUDE_SUBSECTIONS_ALL'), + "A" => GetMessage('SM_INCLUDE_SUBSECTIONS_ACTIVE'), + "N" => GetMessage('SM_INCLUDE_SUBSECTIONS_NO'), + ), + "DEFAULT" => "Y", + ), + 'SORT' => array( + "PARENT" => "BASE", + 'NAME' => GetMessage('SM_SORT'), + 'TYPE' => "LIST", + "VALUES" => array('NAME'=>GetMessage("SM_SORT_NAME"),'CONDITIONS'=>GetMessage("SM_SORT_CONDITION"),'RANDOM'=>GetMessage("SM_SORT_RANDOM")), + ), + 'SORT_ORDER' => array( + "PARENT" => "BASE", + 'NAME' => GetMessage('SM_SORT_ORDER'), + 'TYPE' => "LIST", + "VALUES" => array('asc'=>GetMessage("SM_SORT_ORDER_ASC"),'desc'=>GetMessage("SM_SORT_ORDER_DESC")), + ), + 'CNT_TAGS' => array( + "PARENT" => "BASE", + "NAME" => GetMessage("SM_CNT_TAGS"), + "TYPE" => "STRING", + "DEFAULT" => '', + ), + "CACHE_TIME" => array( + "DEFAULT" => 36000000, + ), + "CACHE_GROUPS" => array( + "PARENT" => "CACHE_SETTINGS", + "NAME" => GetMessage("SM_CACHE_GROUPS"), + "TYPE" => "CHECKBOX", + "DEFAULT" => "Y", + ), + ), +); +?> \ No newline at end of file diff --git a/bitrix/components/sotbit/seo.meta.custom.tags/component.php b/bitrix/components/sotbit/seo.meta.custom.tags/component.php new file mode 100644 index 0000000..0892c5e --- /dev/null +++ b/bitrix/components/sotbit/seo.meta.custom.tags/component.php @@ -0,0 +1,221 @@ +GetCurPage(false); +$cacheTime = $arParams['CACHE_TIME']; +$cache_id = md5(serialize(array($curPage, $arParams, $SeoMetaWorkingConditions, ($arParams['CACHE_GROUPS'] === 'N' ? false : $USER->GetGroups())))); +$cacheDir = '/sotbit.seometa.custom.tags/'; +$cache = \Bitrix\Main\Application::getInstance()->getManagedCache(); +$Tags = array(); + +if($cache->read($cacheTime, $cache_id, $cacheDir)) +{ + $Tags = $cache->get($cache_id); +} +else +{ + $strict_relinking = false; + $Conditions = array(); + $sections = Tags::findNeedSections($arParams['SECTION_ID'], $arParams['INCLUDE_SUBSECTIONS']); // list of all sections + $SectionConditions = ConditionTable::GetConditionsBySections($sections); // list of all + // conditions by sections + + // if condition is active + if($SeoMetaWorkingConditions) + { + foreach($SeoMetaWorkingConditions as $SeoMetaWorkingCondition) + { + $wasSections = false; + if($SectionConditions[$SeoMetaWorkingCondition]) // if among all conditions by sections there is one that is active + { + if($SectionConditions[$SeoMetaWorkingCondition]['STRICT_RELINKING'] == 'Y') + { + $strict_relinking = true; + } + + if(sizeof($SectionConditions[$SeoMetaWorkingCondition]['SECTIONS']) > 0) + { + $wasSections = true; + } + + //unset($SectionConditions[$SeoMetaWorkingCondition]['SECTIONS'][array_search($arParams['SECTION_ID'], $SectionConditions[$SeoMetaWorkingCondition]['SECTIONS'])]); + + if(sizeof($SectionConditions[$SeoMetaWorkingCondition]['SECTIONS']) == 0 && $wasSections) + { + unset($SectionConditions[$SeoMetaWorkingCondition]); + } + } + } + } + + $WorkingConditions = ConditionTable::GetConditionsFromWorkingConditions($SeoMetaWorkingConditions); // conditions selected in relinking + + if(is_array($SectionConditions) && is_array($WorkingConditions)) + { + if(!$strict_relinking) + { + $Conditions = $SectionConditions; + } + + // merge conditions selected in relinking with other + foreach($WorkingConditions as $key => $WorkingCondition) + { + $Conditions[$key] = $WorkingCondition; + } + } + elseif(is_array($SectionConditions)) + { + $Conditions = $SectionConditions; + } + elseif(is_array($WorkingConditions)) + { + $Conditions = $WorkingConditions; + } + + $TagsObject = new Tags(); + + $Tags = SeometaUrlTable::getAllByCondition($SeoMetaWorkingConditions); + + $morphyObject = SeoMetaMorphy::morphyLibInit(); + $arrIDTags = []; + foreach ($Tags as &$tag) { + if ($curPage == $tag['NEW_URL'] && SITE_ID == $tag['SITE_ID']) { + $res = ChpuLinksTable::getList([ + 'select' => array('*'), + 'filter' => array( + 'MAIN_CHPU_ID' => $tag['ID'] + ) + ]); + + while ($item = $res->fetch()) { + if (is_array($tmp = unserialize($item['SEOMETA_DATA_CHPU_LINK']))) { + $item = array_merge($item, $tmp); + if(!$Tags[$item['LINK_CHPU_ID']]) { + $arrIDTags[] = $item['LINK_CHPU_ID']; + } + $Tags[$item['LINK_CHPU_ID']]['SEOMETA_DATA_CHPU_LINK'] = $item; + } + } + break; + } + } + + if($arrIDTags) { + $arrExternalTags = SeometaUrlTable::getByArrId($arrIDTags); + + foreach ($arrExternalTags as $index => $arrExternalTag) { + $Tags[$index] = array_merge($arrExternalTag, $Tags[$index]); + } + } + + + foreach ($Tags as $key => &$item) { + if($item['SEOMETA_DATA_CHPU_LINK']['NAME_CHPU_LINK_REPLACE'] == 'Y') { + $item['TITLE'] = $item['SEOMETA_DATA_CHPU_LINK']['NAME_CHPU_LINK']; + } else { + $item['TITLE'] = $item['NAME']; + } + + if(!empty($item['SEOMETA_DATA_CHPU_LINK']['IMAGE'])) { + $item['IMAGE'] = $item['SEOMETA_DATA_CHPU_LINK']['IMAGE']; + } + + if(intval($item['IMAGE']) > 0) + { + $fileArray = CFile::GetFileArray($item['IMAGE']); + $item['IMAGE'] = array(); + $item['IMAGE']['SRC'] = $fileArray['SRC']; + $item['IMAGE']['DESCRIPTION'] = $fileArray['DESCRIPTION']; + } + + if(!$item['SEOMETA_DATA_CHPU_LINK'] && empty($item['IMAGE'])) { + unset($Tags[$key]); + continue; + } + + $item['PROPERTIES'] = unserialize($item['PROPERTIES']); + \CSeoMetaTagsProperty::$params = $item['PROPERTIES']; + $sku = new Section($item['section_id']); + $title = Engine::process($sku, SeoMetaMorphy::prepareForMorphy($item['TITLE'])); + if(!empty($title)) { + $title = SeoMetaMorphy::convertMorphy($title, $morphyObject); + $item['TITLE'] = $title; + } + + unset($item['SEOMETA_DATA_CHPU_LINK']); + $item['URL'] = $item['NEW_URL']; + if(!$item['URL']){ + unset($Tags[$key]); + } + } + + if($strict_relinking) + { + foreach ($Tags as $key => $tagsArray) { + if($tagsArray['URL'] == $curPage) { + unset($Tags[$key]); + break; + } + } + } + + $samePage = array_search($curPage, + array_combine(array_keys($Tags), array_column($Tags, 'URL'))); + if($samePage === false){ + $samePage = array_search($curPage, + array_combine(array_keys($Tags), array_column($Tags, 'REAL_URL'))); + } + + if ($samePage !== false) { + unset($Tags[$samePage]); + } + + $Tags = $TagsObject->SortTags($Tags, $arParams['SORT'], $arParams['SORT_ORDER']); + $Tags = $TagsObject->CutTags($Tags, $arParams['CNT_TAGS']); + + unset($Conditions); + if($Tags) { + $cache->set($cache_id ,$Tags); + } else { + $cache->clean($cache_id); + } +} + +if ($arParams['AJAX'] === 'Y') { + $arResult['ITEMS'] = array_map(function($arrVal) { + $arrVal['URL'] = $arrVal['URL'] . '?ajaxTag=1'; + return $arrVal; + }, $Tags); +} else { + $arResult['ITEMS'] = $Tags; +} + +unset($Tags); + +$this->IncludeComponentTemplate(); +?> \ No newline at end of file diff --git a/bitrix/components/sotbit/seo.meta.custom.tags/lang/ru/.description.php b/bitrix/components/sotbit/seo.meta.custom.tags/lang/ru/.description.php new file mode 100644 index 0000000..b8cdb65 --- /dev/null +++ b/bitrix/components/sotbit/seo.meta.custom.tags/lang/ru/.description.php @@ -0,0 +1,6 @@ + \ No newline at end of file diff --git a/bitrix/components/sotbit/seo.meta.custom.tags/lang/ru/.parameters.php b/bitrix/components/sotbit/seo.meta.custom.tags/lang/ru/.parameters.php new file mode 100644 index 0000000..63d8e00 --- /dev/null +++ b/bitrix/components/sotbit/seo.meta.custom.tags/lang/ru/.parameters.php @@ -0,0 +1,20 @@ + \ No newline at end of file diff --git a/bitrix/components/sotbit/seo.meta.custom.tags/templates/.default/lang/ru/template.php b/bitrix/components/sotbit/seo.meta.custom.tags/templates/.default/lang/ru/template.php new file mode 100644 index 0000000..8b52501 --- /dev/null +++ b/bitrix/components/sotbit/seo.meta.custom.tags/templates/.default/lang/ru/template.php @@ -0,0 +1,5 @@ + diff --git a/bitrix/components/sotbit/seo.meta.custom.tags/templates/.default/script.js b/bitrix/components/sotbit/seo.meta.custom.tags/templates/.default/script.js new file mode 100644 index 0000000..7c626f8 --- /dev/null +++ b/bitrix/components/sotbit/seo.meta.custom.tags/templates/.default/script.js @@ -0,0 +1,105 @@ +window.addEventListener("DOMContentLoaded", function () { + if (document.querySelector(".sotbit-seometa-tags__hide")) { + let hideTagsBtns = document.querySelector(".sotbit-seometa-tags__hide"); + + hideTagsBtns.addEventListener("click", function () { + replaceClass(); + }); + + hideSeoMetaTags(); + } +}); + +window.addEventListener("resize", function () { + if (document.querySelector(".sotbit-seometa-tags__hide")) { + collapseTags(); + hideSeoMetaTags(); + } +}); + +function hideSeoMetaTags() { + if (document.querySelector(".sotbit-seometa-tags-column")) { + let seoMetaBlock = document.querySelector(".sotbit-seometa-tags-column"), + hideTagsBtns = seoMetaBlock.querySelector(".sotbit-seometa-tags__hide"), + tagsSection = seoMetaBlock.querySelector(".tags_section"), + windowWidth = window.innerWidth || document.documentElement.clientWidth, + tagsWrapper = seoMetaBlock.querySelector(".tags_wrapper"); + + if (windowWidth > 480) { + if (tagsSection.clientHeight > 88) { + setSeometaClass("inline-block"); + tagsWrapper.style.height = "88px" + } else { + hideTagsBtns.style.display = "none"; + } + } else { + if (tagsSection.clientHeight > 176) { + setSeometaClass("flex"); + tagsWrapper.style.height = "176px" + } else { + hideTagsBtns.style.display = "none"; + } + } + } +} + +function setSeometaClass(buttonDislpay) { + let seoMetaBlock = document.querySelector(".sotbit-seometa-tags-column"), + hideTagsBtns = seoMetaBlock.querySelector(".sotbit-seometa-tags__hide"); + let seoMetaClass = seoMetaBlock.getAttribute("class"); + + seoMetaClass = seoMetaClass.replace(" closed", ""); + seoMetaClass = seoMetaClass.replace(" opened", ""); + seoMetaClass = seoMetaClass + " closed"; + + seoMetaBlock.setAttribute("class", seoMetaClass); + hideTagsBtns.style.display = buttonDislpay; +} + +function replaceClass() { + let seoMetaBlock = document.querySelector(".sotbit-seometa-tags-column"); + let seoMetaClass = seoMetaBlock.getAttribute("class"); + let tagsWrapper = seoMetaBlock.querySelector(".tags_wrapper"); + let tagsSection = seoMetaBlock.querySelector(".tags_section"), + windowWidth = window.innerWidth || document.documentElement.clientWidth; + + if (seoMetaClass.includes("closed")) { + seoMetaClass = seoMetaClass.replace("closed", "opened"); + + seoMetaBlock.setAttribute("class", seoMetaClass); + + tagsWrapper.style.height = tagsSection.clientHeight + "px"; + + } else if (seoMetaClass.includes("opened")) { + + seoMetaClass = seoMetaClass.replace("opened", "closed"); + + seoMetaBlock.setAttribute("class", seoMetaClass); + + if (windowWidth > 480) { + tagsWrapper.style.height = "88px"; + } else { + tagsWrapper.style.height = "176px"; + } + } +} + +function collapseTags() { + let seoMetaBlock = document.querySelector(".sotbit-seometa-tags-column"); + let seoMetaClass = seoMetaBlock.getAttribute("class"); + let tagsWrapper = seoMetaBlock.querySelector(".tags_wrapper"); + let windowWidth = window.innerWidth || document.documentElement.clientWidth; + + if (seoMetaClass.includes("opened")) { + + seoMetaClass = seoMetaClass.replace("opened", "closed"); + + seoMetaBlock.setAttribute("class", seoMetaClass); + + if (windowWidth > 480) { + tagsWrapper.style.height = "88px"; + } else { + tagsWrapper.style.height = "176px"; + } + } +} diff --git a/bitrix/components/sotbit/seo.meta.custom.tags/templates/.default/style.css b/bitrix/components/sotbit/seo.meta.custom.tags/templates/.default/style.css new file mode 100644 index 0000000..23450d1 --- /dev/null +++ b/bitrix/components/sotbit/seo.meta.custom.tags/templates/.default/style.css @@ -0,0 +1,121 @@ +.sotbit-seometa-tags-column { + display: -webkit-box; + display: -moz-box; + display: -ms-flexbox; + display: flex; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -moz-box-orient: vertical; + -moz-box-direction: normal; + -ms-flex-direction: column; + flex-direction: column; } +.sotbit-seometa-tags-column .sotbit-seometa-tags-column-container .sotbit-seometa-tags-column__title { + width: 100%; + font-weight: 600; + font-size: 13px; + line-height: 20px; + margin-bottom: 10px; } +.sotbit-seometa-tags-column .sotbit-seometa-tags-column-container .tags_wrapper { + display: -webkit-box; + display: -moz-box; + display: -ms-flexbox; + display: flex; + -ms-flex-wrap: wrap; + flex-wrap: wrap; + overflow: hidden; + -webkit-transition: height 0.4s ease; + transition: height 0.4s ease; + margin-bottom: 0; } +.sotbit-seometa-tags-column .sotbit-seometa-tags-column-container .tags_wrapper .tags_section { + display: -webkit-box; + display: -moz-box; + display: -ms-flexbox; + display: flex; + -ms-flex-wrap: wrap; + flex-wrap: wrap; + overflow: hidden; + -webkit-transition: height 0.4s ease; + transition: height 0.4s ease; + margin-bottom: 0; } +.sotbit-seometa-tags-column .sotbit-seometa-tags-column-container .tags_wrapper .sotbit-seometa-tags-column-wrapper { + max-width: 100%; + width: auto; } +.sotbit-seometa-tags-column .sotbit-seometa-tags-column-container .tags_wrapper .sotbit-seometa-tags-column-wrapper .sotbit-seometa-tag-column .sotbit-seometa-tag-link { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + display: block; + max-width: 100%; } +.sotbit-seometa-tags-column .sotbit-seometa-tags__hide { + display: -webkit-box; + display: -moz-box; + display: -ms-flexbox; + display: flex; } +.sotbit-seometa-tags-column .sotbit-seometa-tags__hide .seometa-tags__hide, .sotbit-seometa-tags-column .sotbit-seometa-tags__hide .seometa-tags__show { + border: 1px solid #ededed; + -webkit-transition: all 0.2s ease-in-out; + transition: all 0.2s ease-in-out; + display: none; + padding: 0 30px; + font-size: 0.9rem; + line-height: 32px; + color: #000; + -webkit-box-align: center; + -moz-box-align: center; + -ms-flex-align: center; + align-items: center; } +.sotbit-seometa-tags-column .sotbit-seometa-tags__hide .seometa-tags__hide:hover, .sotbit-seometa-tags-column .sotbit-seometa-tags__hide .seometa-tags__show:hover { + border: 1px solid #fb0040; + color: #fb0040; } +.sotbit-seometa-tags-column .sotbit-seometa-tags__hide .seometa-tags__hide:hover .angle-up, .sotbit-seometa-tags-column .sotbit-seometa-tags__hide .seometa-tags__show:hover .angle-up { + border-bottom: 1px solid #fb0040; + border-right: 1px solid #fb0040; } +.sotbit-seometa-tags-column .sotbit-seometa-tags__hide .seometa-tags__hide .angle-up, .sotbit-seometa-tags-column .sotbit-seometa-tags__hide .seometa-tags__show .angle-up { + font-weight: 400; + display: block; + content: ''; + width: 7px; + height: 7px; + top: 8px; + right: 1rem; + margin-top: 0; + border-bottom: 1px solid #000; + border-right: 1px solid #000; + -webkit-transform: rotate(45deg) translateX(-3px); + transform: rotate(45deg) translateX(-3px); + -webkit-transition: all .2s ease-in-out; + transition: all .2s ease-in-out; + padding: 0; + margin-left: 10px; } +.sotbit-seometa-tags-column.closed .tags_wrapper { + height: 88px; } +.sotbit-seometa-tags-column.closed .sotbit-seometa-tags__hide .seometa-tags__hide { + display: none; } +.sotbit-seometa-tags-column.closed .sotbit-seometa-tags__hide .seometa-tags__show { + display: -webkit-box; + display: -moz-box; + display: -ms-flexbox; + display: flex; } +.sotbit-seometa-tags-column.opened .sotbit-seometa-tags__hide .seometa-tags__hide { + display: -webkit-box; + display: -moz-box; + display: -ms-flexbox; + display: flex; } +.sotbit-seometa-tags-column.opened .sotbit-seometa-tags__hide .seometa-tags__hide .angle-up { + -webkit-transform: rotate(225deg) translateX(-3px); + transform: rotate(225deg) translateX(-3px); } +.sotbit-seometa-tags-column.opened .sotbit-seometa-tags__hide .seometa-tags__show { + display: none; } + +@media screen and (max-width: 480px) { + .sotbit-seometa-tags-column .sotbit-seometa-tags__hide .seometa-tags__hide, .sotbit-seometa-tags-column .sotbit-seometa-tags__hide .seometa-tags__show { + width: 100%; + -webkit-box-pack: center; + -moz-box-pack: center; + -ms-flex-pack: center; + justify-content: center; + border: none; } + .sotbit-seometa-tags-column .sotbit-seometa-tags__hide .seometa-tags__hide:hover, .sotbit-seometa-tags-column .sotbit-seometa-tags__hide .seometa-tags__show:hover { + border: none; } + .sotbit-seometa-tags-column.closed .tags_wrapper { + height: 176px; } } diff --git a/bitrix/components/sotbit/seo.meta.custom.tags/templates/.default/style.min.css b/bitrix/components/sotbit/seo.meta.custom.tags/templates/.default/style.min.css new file mode 100644 index 0000000..6a7a9ed --- /dev/null +++ b/bitrix/components/sotbit/seo.meta.custom.tags/templates/.default/style.min.css @@ -0,0 +1 @@ +.sotbit-seometa-tags-column{-webkit-box-orient:vertical;-webkit-box-direction:normal;-moz-box-orient:vertical;-moz-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.sotbit-seometa-tags-column .sotbit-seometa-tags-column-container .sotbit-seometa-tags-column__title{width:100%;font-weight:600;font-size:13px;line-height:20px;margin-bottom:10px}.sotbit-seometa-tags-column .sotbit-seometa-tags-column-container .tags_wrapper,.sotbit-seometa-tags-column .sotbit-seometa-tags-column-container .tags_wrapper .tags_section{display:-webkit-box;display:-moz-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;overflow:hidden;-webkit-transition:height .4s ease;transition:height .4s ease;margin-bottom:0}.sotbit-seometa-tags-column .sotbit-seometa-tags-column-container .tags_wrapper .sotbit-seometa-tags-column-wrapper{max-width:100%;width:auto}.sotbit-seometa-tags-column .sotbit-seometa-tags-column-container .tags_wrapper .sotbit-seometa-tags-column-wrapper .sotbit-seometa-tag-column .sotbit-seometa-tag-link{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:block;max-width:100%}.sotbit-seometa-tags-column,.sotbit-seometa-tags-column .sotbit-seometa-tags__hide{display:-webkit-box;display:-moz-box;display:-ms-flexbox;display:flex}.sotbit-seometa-tags-column .sotbit-seometa-tags__hide .seometa-tags__hide,.sotbit-seometa-tags-column .sotbit-seometa-tags__hide .seometa-tags__show{border:1px solid #ededed;-webkit-transition:all .2s ease-in-out;transition:all .2s ease-in-out;display:none;padding:0 30px;font-size:.9rem;line-height:32px;color:#000;-webkit-box-align:center;-moz-box-align:center;-ms-flex-align:center;align-items:center}.sotbit-seometa-tags-column .sotbit-seometa-tags__hide .seometa-tags__hide:hover,.sotbit-seometa-tags-column .sotbit-seometa-tags__hide .seometa-tags__show:hover{border:1px solid #fb0040;color:#fb0040}.sotbit-seometa-tags-column .sotbit-seometa-tags__hide .seometa-tags__hide:hover .angle-up,.sotbit-seometa-tags-column .sotbit-seometa-tags__hide .seometa-tags__show:hover .angle-up{border-bottom:1px solid #fb0040;border-right:1px solid #fb0040}.sotbit-seometa-tags-column .sotbit-seometa-tags__hide .seometa-tags__hide .angle-up,.sotbit-seometa-tags-column .sotbit-seometa-tags__hide .seometa-tags__show .angle-up{font-weight:400;display:block;content:'';width:7px;height:7px;top:8px;right:1rem;margin-top:0;border-bottom:1px solid #000;border-right:1px solid #000;-webkit-transform:rotate(45deg) translateX(-3px);transform:rotate(45deg) translateX(-3px);-webkit-transition:all .2s ease-in-out;transition:all .2s ease-in-out;padding:0;margin-left:10px}.sotbit-seometa-tags-column.closed .tags_wrapper{height:88px}.sotbit-seometa-tags-column.closed .sotbit-seometa-tags__hide .seometa-tags__hide{display:none}.sotbit-seometa-tags-column.closed .sotbit-seometa-tags__hide .seometa-tags__show,.sotbit-seometa-tags-column.opened .sotbit-seometa-tags__hide .seometa-tags__hide{display:-webkit-box;display:-moz-box;display:-ms-flexbox;display:flex}.sotbit-seometa-tags-column.opened .sotbit-seometa-tags__hide .seometa-tags__hide .angle-up{-webkit-transform:rotate(225deg) translateX(-3px);transform:rotate(225deg) translateX(-3px)}.sotbit-seometa-tags-column.opened .sotbit-seometa-tags__hide .seometa-tags__show{display:none}@media screen and (max-width:480px){.sotbit-seometa-tags-column .sotbit-seometa-tags__hide .seometa-tags__hide,.sotbit-seometa-tags-column .sotbit-seometa-tags__hide .seometa-tags__show{width:100%;-webkit-box-pack:center;-moz-box-pack:center;-ms-flex-pack:center;justify-content:center;border:0}.sotbit-seometa-tags-column .sotbit-seometa-tags__hide .seometa-tags__hide:hover,.sotbit-seometa-tags-column .sotbit-seometa-tags__hide .seometa-tags__show:hover{border:0}.sotbit-seometa-tags-column.closed .tags_wrapper{height:176px}} \ No newline at end of file diff --git a/bitrix/components/sotbit/seo.meta.custom.tags/templates/.default/style.scss b/bitrix/components/sotbit/seo.meta.custom.tags/templates/.default/style.scss new file mode 100644 index 0000000..9b3da9d --- /dev/null +++ b/bitrix/components/sotbit/seo.meta.custom.tags/templates/.default/style.scss @@ -0,0 +1,156 @@ +.sotbit-seometa-tags-column { + display: flex; + flex-direction: column; + + .sotbit-seometa-tags-column-container { + + .sotbit-seometa-tags-column__title { + width: 100%; + font-weight: 600; + font-size: 13px; + line-height: 20px; + margin-bottom: 10px; + } + + .tags_wrapper { + display: flex; + flex-wrap: wrap; + overflow: hidden; + transition: height 0.4s ease; + margin-bottom: 0; + + .tags_section { + display: flex; + flex-wrap: wrap; + overflow: hidden; + transition: height 0.4s ease; + margin-bottom: 0; + } + + .sotbit-seometa-tags-column-wrapper { + max-width: 100%; + width: auto; + + .sotbit-seometa-tag-column { + + .sotbit-seometa-tag-link { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + display: block; + max-width: 100%; + } + } + } + } + } + + .sotbit-seometa-tags__hide { + display: flex; + + .seometa-tags__hide, .seometa-tags__show { + border: 1px solid #ededed; + transition: all 0.2s ease-in-out; + display: none; + padding: 0 30px; + font-size: 0.9rem; + line-height: 32px; + color: #000; + align-items: center; + + &:hover { + border: 1px solid #fb0040; + color: #fb0040; + + .angle-up { + border-bottom: 1px solid #fb0040; + border-right: 1px solid #fb0040; + } + + } + + .angle-up { + font-weight: 400; + display: block; + content: ''; + width: 7px; + height: 7px; + top: 8px; + right: 1rem; + margin-top: 0; + border-bottom: 1px solid #000; + border-right: 1px solid #000; + transform: rotate(45deg) translateX(-3px); + transition: all .2s ease-in-out; + padding: 0; + margin-left: 10px; + } + } + + } + + &.closed { + + .tags_wrapper { + height: 88px; + } + + .sotbit-seometa-tags__hide { + + .seometa-tags__hide { + display: none; + } + + .seometa-tags__show { + display: flex; + } + } + } + + &.opened { + + + + + .sotbit-seometa-tags__hide { + + .seometa-tags__hide { + display: flex; + + .angle-up { + transform: rotate(225deg) translateX(-3px); + } + } + + .seometa-tags__show { + display: none; + } + } + } +} + +@media screen and (max-width: 480px) { + .sotbit-seometa-tags-column { + + .sotbit-seometa-tags__hide { + + .seometa-tags__hide, .seometa-tags__show { + width: 100%; + justify-content: center; + border: none; + + &:hover { + border: none; + } + } + } + + &.closed { + + .tags_wrapper { + height: 176px; + } + } + } + +} diff --git a/bitrix/components/sotbit/seo.meta.custom.tags/templates/.default/template.php b/bitrix/components/sotbit/seo.meta.custom.tags/templates/.default/template.php new file mode 100644 index 0000000..ec7032c --- /dev/null +++ b/bitrix/components/sotbit/seo.meta.custom.tags/templates/.default/template.php @@ -0,0 +1,36 @@ +setFrameMode(true); +if ($arResult['ITEMS']):?> +
+ +
+ + > +
+ <?= $item['IMAGE']['SRC'] ?>> +
+ +

+ +
+ +
+
+
+
+ +
+
+
+
+ +
+ +
+ diff --git a/bitrix/components/sotbit/seo.meta.element.tags/.description.php b/bitrix/components/sotbit/seo.meta.element.tags/.description.php new file mode 100644 index 0000000..ba58436 --- /dev/null +++ b/bitrix/components/sotbit/seo.meta.element.tags/.description.php @@ -0,0 +1,18 @@ + Loc::getMessage("SM_NAME"), + "DESCRIPTION" => Loc::getMessage("SM_DESCRIPTION"), + "ICON" => "/images/icon.png", + "PATH" => array( + "ID" => Loc::getMessage("MAIN_GROUP_NAME_SOTBIT"), + "CHILD" => array( + "ID" => "sotbit.seo.meta", + "NAME" => Loc::getMessage("MAIN_MENU_NAME_SOTBIT"), + ) + ), +); +?> \ No newline at end of file diff --git a/bitrix/components/sotbit/seo.meta.element.tags/.parameters.php b/bitrix/components/sotbit/seo.meta.element.tags/.parameters.php new file mode 100644 index 0000000..4119d6b --- /dev/null +++ b/bitrix/components/sotbit/seo.meta.element.tags/.parameters.php @@ -0,0 +1,122 @@ + "asc", + ], + [ + "TYPE" => $arCurrentValues["IBLOCK_TYPE"], + "ACTIVE" => "Y", + ] +); +while ($arr = $rsIBlock->Fetch()) + $arIBlock[$arr["ID"]] = "[" . $arr["ID"] . "] " . $arr["NAME"]; + +$result = \Bitrix\Iblock\SectionTable::getList( + [ + 'select' => ['ID', 'NAME'], + 'filter' => ['IBLOCK_ID' => $arCurrentValues['IBLOCK_ID']] + ] +); +while ($Section = $result->fetch()) { + $arSections[$Section["ID"]] = "[" . $Section["ID"] . "] " . $Section["NAME"]; +} + +$arComponentParameters = [ + "GROUPS" => [], + "PARAMETERS" => [ + "IBLOCK_TYPE" => [ + "PARENT" => "BASE", + "NAME" => Loc::getMessage("SM_IBLOCK_TYPE"), + "TYPE" => "LIST", + "VALUES" => $arIBlockType, + "REFRESH" => "Y", + ], + "IBLOCK_ID" => [ + "PARENT" => "BASE", + "NAME" => Loc::getMessage("SM_IBLOCK_IBLOCK"), + "TYPE" => "LIST", + "ADDITIONAL_VALUES" => "Y", + "VALUES" => $arIBlock, + "REFRESH" => "Y", + ], + "ELEMENT_ID" => [ + "PARENT" => "BASE", + "NAME" => Loc::getMessage("SM_ELEMENT_ID"), + "TYPE" => "LIST", + "ADDITIONAL_VALUES" => "Y", + "VALUES" => $elementId, + ], + "SECTION_ID" => [ + "PARENT" => "BASE", + "NAME" => Loc::getMessage("SM_SECTION_ID"), + "TYPE" => "LIST", + "ADDITIONAL_VALUES" => "Y", + "VALUES" => $arSections, + ], + "INCLUDE_SUBSECTIONS" => [ + "PARENT" => "BASE", + 'NAME' => Loc::getMessage('SM_INCLUDE_SUBSECTIONS'), + "TYPE" => "LIST", + "VALUES" => [ + "Y" => Loc::getMessage('SM_INCLUDE_SUBSECTIONS_ALL'), + "N" => Loc::getMessage('SM_INCLUDE_SUBSECTIONS_NO'), + ], + "DEFAULT" => "Y", + ], + 'SORT' => [ + "PARENT" => "BASE", + 'NAME' => Loc::getMessage('SM_SORT'), + 'TYPE' => "LIST", + "VALUES" => [ + 'NAME' => Loc::getMessage("SM_SORT_NAME"), + 'CONDITIONS' => Loc::getMessage("SM_SORT_CONDITION"), + 'URL_SORT' => Loc::getMessage("SM_SORT_URL_SORT"), + 'PRODUCT_COUNT' => Loc::getMessage('SM_SORT_PRODUCT_COUNT'), + 'RANDOM' => Loc::getMessage("SM_SORT_RANDOM") + ], + ], + 'SORT_ORDER' => [ + "PARENT" => "BASE", + 'NAME' => Loc::getMessage('SM_SORT_ORDER'), + 'TYPE' => "LIST", + "VALUES" => ['asc' => Loc::getMessage("SM_SORT_ORDER_ASC"), 'desc' => Loc::getMessage("SM_SORT_ORDER_DESC")], + ], + 'CNT_TAGS' => [ + "PARENT" => "BASE", + "NAME" => Loc::getMessage("SM_CNT_TAGS"), + "TYPE" => "STRING", + "DEFAULT" => '', + ], + "PRODUCT_COUNT" => [ + "PARENT" => "BASE", + "NAME" => Loc::getMessage("SM_PRODUCT_COUNT"), + "TYPE" => "CHECKBOX", + "DEFAULT" => "N", + ], + "GENERATING_TAGS" => [ + "PARENT" => "BASE", + "NAME" => Loc::getMessage("SM_GENERATING_TAGS"), + "TYPE" => "CHECKBOX", + "DEFAULT" => "N", + ], + "CACHE_TIME" => [ + "DEFAULT" => 36000000, + ], + "CACHE_GROUPS" => [ + "PARENT" => "CACHE_SETTINGS", + "NAME" => Loc::getMessage("SM_CACHE_GROUPS"), + "TYPE" => "CHECKBOX", + "DEFAULT" => "Y", + ], + ], +]; +?> \ No newline at end of file diff --git a/bitrix/components/sotbit/seo.meta.element.tags/component.php b/bitrix/components/sotbit/seo.meta.element.tags/component.php new file mode 100644 index 0000000..d7a654d --- /dev/null +++ b/bitrix/components/sotbit/seo.meta.element.tags/component.php @@ -0,0 +1,176 @@ +GetCurPage(false), + $arParams['CACHE_GROUPS'] === 'N' ? false : $USER->GetGroups() +]); +$cacheDir = '/' . $moduleId . '.element.tags/'; +$cache = Cache::createInstance(); +$Tags = []; + + +if ($cache->initCache($cacheTime, $cache_id, $cacheDir)) { + $Tags = $cache->getVars(); +} elseif ($cache->startDataCache()) { + $Conditions = []; + + $tagsCategory = \Sotbit\Seometa\Orm\CategoryTagsTable::getById(1)->fetch(); + + if (isset($arParams['SECTION_ID']) && $arParams['SECTION_ID'] !== 0) { + $elemSection = $arParams['SECTION_ID']; + } else { + $elemSection = array_column(\Bitrix\Iblock\SectionElementTable::query() + ->setFilter(["IBLOCK_ELEMENT_ID" => $arParams['ELEMENT_ID']]) + ->addSelect('IBLOCK_SECTION_ID', 'SECTION_ID') + ->fetchAll() ?: [], 'SECTION_ID'); + } + + $sections = Tags::findNeedSections($elemSection, $arParams['INCLUDE_SUBSECTIONS'], 1); // list of all sections + $SectionConditions = ConditionTable::GetConditionsBySections($sections); // list of all conditions by sections + + if (is_array($SectionConditions)) { + $Conditions = $SectionConditions; + } + + $TagsObject = new Tags(); + $currentUrl = $APPLICATION->GetCurPage(false); + + // + $sectionUrl = CIBlockSection::GetList( + [], + ['ID' => $arParams['SECTION_ID']], + false, + ['SECTION_PAGE_URL'] + )->GetNext()['SECTION_PAGE_URL']; + + if ($sectionUrl == $currentUrl) { + $Conditions = array_filter($Conditions, fn($item) => !($item['HIDE_IN_SECTION'] == 'Y' && in_array($arParams['SECTION_ID'], $item['SECTIONS']))); + } + // + if ($arParams['GENERATING_TAGS'] == 'Y') { + $Tags = $TagsObject->GenerateTags($Conditions, array_keys($Conditions), 0, 0, 1); + if (is_array($Tags)) { + foreach ($Tags as &$tag) { + $tag = \Sotbit\Seometa\Orm\CategoryTagsTable::fillCategoryTags($Conditions[$tag['CONDITION_ID']], $tag, $tagsCategory, 'TAGS_DETAIL'); + } + unset($tag); + } + } else { + $Tags = []; + $morphyObject = SeoMetaMorphy::morphyLibInit(); + foreach ($Conditions as $item) { + if ($item['ELEMENT_TAG']) { + $arrTags = SeometaUrlTable::getAllByCondition($item['ID']); + foreach ($arrTags as &$arrTag) { + \CSeoMetaTagsProperty::$params = unserialize($arrTag['PROPERTIES']); + $sku = new Section($arrTag['section_id']); + $title = Engine::process($sku, SeoMetaMorphy::prepareForMorphy($item['ELEMENT_TAG'])); + + if (!empty($title)) { + $arrTag['TITLE'] = SeoMetaMorphy::convertMorphy($title, $morphyObject);; + } + + if (empty($arrTag['TITLE'])) { + $arrTag['TITLE'] = $title; + } + + $arrTag['URL'] = $arrTag['ACTIVE'] == 'Y' ? $arrTag['NEW_URL'] : $arrTag['REAL_URL']; + $arrTag = \Sotbit\Seometa\Orm\CategoryTagsTable::fillCategoryTags($Conditions[$arrTag['CONDITION_ID']], $arrTag, $tagsCategory, 'TAGS_DETAIL'); + } + + if (is_array($arrTags)) { + $Tags = array_merge($Tags, $arrTags); + } + } + } + } + + if (empty($Tags)) { + $Tags = []; + $cache->endDataCache($Tags); + return $this->IncludeComponentTemplate(); + } + + if (!empty($Tags)) { + foreach ($Tags as $keyTag => $tag) { + if ($tag['SITE_ID'] !== SITE_ID) { + unset($Tags[$keyTag]); + } + } + $Tags = array_values($Tags); + } + + $currentUrl = CSeoMeta::encodeRealUrl($currentUrl); + + if ($arParams['GENERATING_TAGS'] == 'Y') { + $Tags = $TagsObject->ReplaceChpuUrls($Tags); + } + + $curPage = array_search( + $currentUrl, + array_combine(array_keys($Tags), array_column($Tags, 'URL')) + ); + if ($curPage === false) { + $curPage = array_search( + $currentUrl, + array_combine(array_keys($Tags), array_column($Tags, 'REAL_URL')) + ); + } + + if ($curPage !== false) { + unset($Tags[$curPage]); + } + + $Tags = $TagsObject->SortTags($Tags, $arParams['SORT'], $arParams['SORT_ORDER']); + if($componentTemplate !== 'tagscategory') { + $Tags = $TagsObject->CutTags($Tags, $arParams['CNT_TAGS']); + } else { + $arParams['CNT_TAGS'] = $arParams['CNT_TAGS'] ?: 10; + } + + unset($Conditions); + $cache->endDataCache($Tags); +} + +if ($arParams['AJAX'] === 'Y') { + $arResult['ITEMS'] = array_map(function ($arrVal) { + $arrVal['URL'] = $arrVal['URL'] . '?ajaxTag=1'; + return $arrVal; + }, $Tags); +} else { + $arResult['ITEMS'] = $Tags; +} + +unset($Tags); +$this->IncludeComponentTemplate(); +?> diff --git a/bitrix/components/sotbit/seo.meta.element.tags/lang/ru/.description.php b/bitrix/components/sotbit/seo.meta.element.tags/lang/ru/.description.php new file mode 100644 index 0000000..603fb46 --- /dev/null +++ b/bitrix/components/sotbit/seo.meta.element.tags/lang/ru/.description.php @@ -0,0 +1,6 @@ + \ No newline at end of file diff --git a/bitrix/components/sotbit/seo.meta.element.tags/lang/ru/.parameters.php b/bitrix/components/sotbit/seo.meta.element.tags/lang/ru/.parameters.php new file mode 100644 index 0000000..7dbacd9 --- /dev/null +++ b/bitrix/components/sotbit/seo.meta.element.tags/lang/ru/.parameters.php @@ -0,0 +1,24 @@ + \ No newline at end of file diff --git a/bitrix/components/sotbit/seo.meta.element.tags/templates/.default/template.php b/bitrix/components/sotbit/seo.meta.element.tags/templates/.default/template.php new file mode 100644 index 0000000..ade3fbb --- /dev/null +++ b/bitrix/components/sotbit/seo.meta.element.tags/templates/.default/template.php @@ -0,0 +1,19 @@ +setFrameMode(true); +if($arResult['ITEMS']) +{ + foreach($arResult['ITEMS'] as $Item) + { + if($Item['TITLE'] && $Item['URL']) { + $count = $arParams['PRODUCT_COUNT'] == 'Y' ? ' (' . $Item['PRODUCT_COUNT'] . ')' : ''; + ?> +
+
+ +
+
+ \ No newline at end of file diff --git a/bitrix/components/sotbit/seo.meta.element.tags/templates/tagscategory/.parameters.php b/bitrix/components/sotbit/seo.meta.element.tags/templates/tagscategory/.parameters.php new file mode 100644 index 0000000..0bf651f --- /dev/null +++ b/bitrix/components/sotbit/seo.meta.element.tags/templates/tagscategory/.parameters.php @@ -0,0 +1,13 @@ + array( + "PARENT" => "BASE", + 'NAME' => GetMessage('SM_SORT_ORDER'), + 'TYPE' => "LIST", + "VALUES" => array('asc' => GetMessage("SM_SORT_ORDER_ASC"), 'desc' => GetMessage("SM_SORT_ORDER_DESC")), + ), +); +?> \ No newline at end of file diff --git a/bitrix/components/sotbit/seo.meta.element.tags/templates/tagscategory/lang/ru/.parameters.php b/bitrix/components/sotbit/seo.meta.element.tags/templates/tagscategory/lang/ru/.parameters.php new file mode 100644 index 0000000..3be5308 --- /dev/null +++ b/bitrix/components/sotbit/seo.meta.element.tags/templates/tagscategory/lang/ru/.parameters.php @@ -0,0 +1,5 @@ + diff --git a/bitrix/components/sotbit/seo.meta.element.tags/templates/tagscategory/lang/ru/template.php b/bitrix/components/sotbit/seo.meta.element.tags/templates/tagscategory/lang/ru/template.php new file mode 100644 index 0000000..d5f39eb --- /dev/null +++ b/bitrix/components/sotbit/seo.meta.element.tags/templates/tagscategory/lang/ru/template.php @@ -0,0 +1,4 @@ + \ No newline at end of file diff --git a/bitrix/components/sotbit/seo.meta.element.tags/templates/tagscategory/result_modifier.php b/bitrix/components/sotbit/seo.meta.element.tags/templates/tagscategory/result_modifier.php new file mode 100644 index 0000000..09bd820 --- /dev/null +++ b/bitrix/components/sotbit/seo.meta.element.tags/templates/tagscategory/result_modifier.php @@ -0,0 +1,31 @@ + $item['TAGS_DETAIL_NAME'], + 'SORT' => $item['TAGS_DETAIL_SORT'], + 'ITEMS' => [$item], + ]; + } +} + +if($arParams['SORT_ORDER_TAGS']) { + $sort = $arParams['SORT_ORDER_TAGS']; +} + +if($sort === 'asc') { + uasort($arCategory, function ($a, $b) { + return $a['SORT'] <=> $b['SORT']; + }); +} else { + uasort($arCategory, function ($a, $b) { + return $b['SORT'] <=> $a['SORT']; + }); +} + +$arResult['CATEGORY_TAGS'] = $arCategory; \ No newline at end of file diff --git a/bitrix/components/sotbit/seo.meta.element.tags/templates/tagscategory/script.js b/bitrix/components/sotbit/seo.meta.element.tags/templates/tagscategory/script.js new file mode 100644 index 0000000..9d759cd --- /dev/null +++ b/bitrix/components/sotbit/seo.meta.element.tags/templates/tagscategory/script.js @@ -0,0 +1,43 @@ +;(function () { + CategoryTags = function (params) { + this.tagsWrapper = params.tagsWrapper; + this.showMoreButton = params.showMoreButton; + this.categoryTags = params.categoryTags; + this.hideTag = params.hideTag; + this.expanded = params.expanded; + this.init(); + }; + + CategoryTags.prototype.init = function () { + const tagsWrapper = document.getElementById(this.tagsWrapper); + const showMoreButton = document.getElementById(this.showMoreButton); + const hiddenTags = document.querySelectorAll(this.hideTag); + const categoryTags = document.querySelectorAll(this.categoryTags); + let startHeight = 0; + + if (tagsWrapper) { + tagsWrapper.style.height = startHeight = tagsWrapper.offsetHeight + 'px'; + } + + if(showMoreButton) { + showMoreButton.addEventListener('click', async () => { + tagsWrapper.classList.toggle(this.expanded); + if (tagsWrapper.classList.contains(this.expanded)) { + await hiddenTags.forEach(tag => tag.classList.remove('hide-tag')); + let height = 0; + await categoryTags.forEach((category) => { + height += category.offsetHeight; + }); + showMoreButton.textContent = BX.message('less_btn'); + tagsWrapper.style.height = height + 'px'; + } else { + showMoreButton.textContent = BX.message('more_btn'); + tagsWrapper.style.height = startHeight; + setTimeout(() => { + hiddenTags.forEach(tag => tag.classList.add('hide-tag')); + }, 100) + } + }); + } + }; +})(); \ No newline at end of file diff --git a/bitrix/components/sotbit/seo.meta.element.tags/templates/tagscategory/style.css b/bitrix/components/sotbit/seo.meta.element.tags/templates/tagscategory/style.css new file mode 100644 index 0000000..1bfd569 --- /dev/null +++ b/bitrix/components/sotbit/seo.meta.element.tags/templates/tagscategory/style.css @@ -0,0 +1,44 @@ +.sotbit-seometa-tags-common-wrapper { + padding: 24px; + background: #F8F9FA; + overflow: hidden; + position: relative; +} + +.sotbit-seometa-tags-wrapper { + transition: height 0.5s ease-in-out; + overflow: hidden; +} + +.sotbit-seometa-tags-wrapper.expanded { + transition: height 0.5s ease-in-out; +} + +.sotbit-seometa-tags-wrapper-category { + overflow: hidden; + display: flex; + width: 100%; + flex-wrap: wrap; +} + +.sotbit-seometa-tags-padding { + padding-right: 8px; + margin-bottom: 8px; +} + +.hide-tag { + display: none; +} + +.sotbit-seometa-tag-link { + text-decoration: underline; +} + +.sotbit-seometa-btn-more { + margin-top: 16px; + display: none; +} + +.sotbit-seometa-btn-more.show-btn { + display: block; +} \ No newline at end of file diff --git a/bitrix/components/sotbit/seo.meta.element.tags/templates/tagscategory/template.php b/bitrix/components/sotbit/seo.meta.element.tags/templates/tagscategory/template.php new file mode 100644 index 0000000..f0f2b87 --- /dev/null +++ b/bitrix/components/sotbit/seo.meta.element.tags/templates/tagscategory/template.php @@ -0,0 +1,52 @@ +setFrameMode(true); +if ($arResult['CATEGORY_TAGS']) { ?> +
+
+ +
+ : + +
+ + + +
+ +
+ +
+
+ +
+
+ + + diff --git a/bitrix/components/sotbit/seo.meta.tags/.description.php b/bitrix/components/sotbit/seo.meta.tags/.description.php new file mode 100644 index 0000000..989a214 --- /dev/null +++ b/bitrix/components/sotbit/seo.meta.tags/.description.php @@ -0,0 +1,14 @@ + GetMessage("SM_NAME"), + "DESCRIPTION" => GetMessage("SM_DESCRIPTION"), + "ICON" => "/images/icon.png", + "PATH" => array( + "ID" => GetMessage("MAIN_GROUP_NAME_SOTBIT"), + "CHILD" => array( + "ID" => "sotbit.seo.meta", + "NAME" => GetMessage("MAIN_MENU_NAME_SOTBIT"), + ) + ), +); +?> \ No newline at end of file diff --git a/bitrix/components/sotbit/seo.meta.tags/.parameters.php b/bitrix/components/sotbit/seo.meta.tags/.parameters.php new file mode 100644 index 0000000..5ce66f2 --- /dev/null +++ b/bitrix/components/sotbit/seo.meta.tags/.parameters.php @@ -0,0 +1,105 @@ + "asc", +), array( + "TYPE" => $arCurrentValues["IBLOCK_TYPE"], + "ACTIVE" => "Y", +)); +while ($arr = $rsIBlock->Fetch()) + $arIBlock[$arr["ID"]] = "[" . $arr["ID"] . "] " . $arr["NAME"]; + +$result = \Bitrix\Iblock\SectionTable::getList(array( + 'select' => array('ID', 'NAME'), + 'filter' => array('IBLOCK_ID' => $arCurrentValues['IBLOCK_ID']) +)); +while ($Section = $result->fetch()) { + $arSections[$Section["ID"]] = "[" . $Section["ID"] . "] " . $Section["NAME"]; +} + +$arComponentParameters = array( + "GROUPS" => array(), + "PARAMETERS" => array( + "IBLOCK_TYPE" => array( + "PARENT" => "BASE", + "NAME" => GetMessage("SM_IBLOCK_TYPE"), + "TYPE" => "LIST", + "VALUES" => $arIBlockType, + "REFRESH" => "Y", + ), + "IBLOCK_ID" => array( + "PARENT" => "BASE", + "NAME" => GetMessage("SM_IBLOCK_IBLOCK"), + "TYPE" => "LIST", + "ADDITIONAL_VALUES" => "Y", + "VALUES" => $arIBlock, + "REFRESH" => "Y", + ), + "SECTION_ID" => array( + "PARENT" => "BASE", + "NAME" => GetMessage("SM_SECTION_ID"), + "TYPE" => "LIST", + "ADDITIONAL_VALUES" => "Y", + "VALUES" => $arSections, + ), + "INCLUDE_SUBSECTIONS" => array( + "PARENT" => "BASE", + 'NAME' => GetMessage('SM_INCLUDE_SUBSECTIONS'), + "TYPE" => "LIST", + "VALUES" => array( + "Y" => GetMessage('SM_INCLUDE_SUBSECTIONS_ALL'), + "A" => GetMessage('SM_INCLUDE_SUBSECTIONS_ACTIVE'), + "N" => GetMessage('SM_INCLUDE_SUBSECTIONS_NO'), + ), + "DEFAULT" => "Y", + ), + 'SORT' => array( + "PARENT" => "BASE", + 'NAME' => GetMessage('SM_SORT'), + 'TYPE' => "LIST", + "VALUES" => array( + 'NAME' => GetMessage("SM_SORT_NAME"), + 'CONDITIONS' => GetMessage("SM_SORT_CONDITION"), + 'URL_SORT' => GetMessage("SM_SORT_URL_SORT"), + 'PRODUCT_COUNT' => GetMessage('SM_SORT_PRODUCT_COUNT'), + 'RANDOM' => GetMessage("SM_SORT_RANDOM") + ), + ), + 'SORT_ORDER' => array( + "PARENT" => "BASE", + 'NAME' => GetMessage('SM_SORT_ORDER'), + 'TYPE' => "LIST", + "VALUES" => array('asc' => GetMessage("SM_SORT_ORDER_ASC"), 'desc' => GetMessage("SM_SORT_ORDER_DESC")), + ), + 'CNT_TAGS' => array( + "PARENT" => "BASE", + "NAME" => GetMessage("SM_CNT_TAGS"), + "TYPE" => "STRING", + "DEFAULT" => '', + ), + "PRODUCT_COUNT" => array( + "PARENT" => "BASE", + "NAME" => GetMessage("SM_PRODUCT_COUNT"), + "TYPE" => "CHECKBOX", + "DEFAULT" => "N", + ), + "GENERATING_TAGS" => array( + "PARENT" => "BASE", + "NAME" => GetMessage("SM_GENERATING_TAGS"), + "TYPE" => "CHECKBOX", + "DEFAULT" => "N", + ), + "CACHE_TIME" => array( + "DEFAULT" => 36000000, + ), + "CACHE_GROUPS" => array( + "PARENT" => "CACHE_SETTINGS", + "NAME" => GetMessage("SM_CACHE_GROUPS"), + "TYPE" => "CHECKBOX", + "DEFAULT" => "Y", + ), + ), +); +?> \ No newline at end of file diff --git a/bitrix/components/sotbit/seo.meta.tags/component.php b/bitrix/components/sotbit/seo.meta.tags/component.php new file mode 100644 index 0000000..1205036 --- /dev/null +++ b/bitrix/components/sotbit/seo.meta.tags/component.php @@ -0,0 +1,261 @@ +GetCurPage(false), + $arParams['CACHE_GROUPS'] === 'N' ? false : $USER->GetGroups() +]); +$cacheDir = '/' . $moduleId . '.tags/'; +$cache = Cache::createInstance(); +$Tags = []; + +if ($cache->initCache($cacheTime, $cache_id, $cacheDir)) { + $Tags = $cache->getVars(); +} elseif ($cache->startDataCache()) { + $strict_relinking = false; + $Conditions = []; + $sections = Tags::findNeedSections($arParams['SECTION_ID'], $arParams['INCLUDE_SUBSECTIONS']); // list of all sections + $SectionConditions = ConditionTable::GetConditionsBySections($sections); // list of all conditions by sections + + $tagsCategory = \Sotbit\Seometa\Orm\CategoryTagsTable::getById(1)->fetch(); + + // if condition is active + if ($SeoMetaWorkingConditions && is_array($SeoMetaWorkingConditions)) { + foreach ($SeoMetaWorkingConditions as $SeoMetaWorkingCondition) { + $wasSections = false; + // if among all conditions by sections there is one that is active + if ($SectionConditions[$SeoMetaWorkingCondition]) { + if ($SectionConditions[$SeoMetaWorkingCondition]['STRICT_RELINKING'] == 'Y') { + $strict_relinking = true; + } + + if (!empty($SectionConditions[$SeoMetaWorkingCondition]['SECTIONS'])) { + $wasSections = true; + } else { + unset($SectionConditions[$SeoMetaWorkingCondition]); + } + } + } + } + + $WorkingConditions = ConditionTable::GetConditionsFromWorkingConditions($SeoMetaWorkingConditions); // conditions selected in relinking + if (is_array($SectionConditions) && is_array($WorkingConditions)) { + if (!$strict_relinking) { + $Conditions = $SectionConditions; + } + + // merge conditions selected in relinking with other + foreach ($WorkingConditions as $key => $WorkingCondition) { + $Conditions[$key] = $WorkingCondition; + } + } elseif (is_array($SectionConditions)) { + $Conditions = $SectionConditions; + } elseif ($WorkingConditions) { + $Conditions = $WorkingConditions; + } + + $TagsObject = new Tags(); + $currentUrl = $APPLICATION->GetCurPage(false); + + // + $sectionUrl = CIBlockSection::GetList( + [], + ['ID' => $arParams['SECTION_ID']], + false, + ['SECTION_PAGE_URL'] + )->GetNext()['SECTION_PAGE_URL']; + + if ($sectionUrl == $currentUrl) { + $Conditions = array_filter($Conditions, fn($item) => !($item['HIDE_IN_SECTION'] == 'Y' && in_array($arParams['SECTION_ID'], $item['SECTIONS']))); + } + + $filterResult = CSeoMeta::getFilterResult(); + + // + if ($arParams['GENERATING_TAGS'] == 'Y') { + $Tags = $TagsObject->GenerateTags($Conditions, array_keys($Conditions)); + if(is_array($Tags)) { + foreach ($Tags as &$tag) { + $tag = \Sotbit\Seometa\Orm\CategoryTagsTable::fillCategoryTags($Conditions[$tag['CONDITION_ID']], $tag, $tagsCategory); + } + unset($tag); + } + } else { + $Tags = []; + $morphyObject = SeoMetaMorphy::morphyLibInit(); + foreach ($Conditions as $item) { + if ($item['TAG']) { + $arrTags = SeometaUrlTable::getAllByCondition($item['ID']); + foreach ($arrTags as &$arrTag) { + $arrTag['PROPERTIES'] = unserialize($arrTag['PROPERTIES']); + \CSeoMetaTagsProperty::$params = $arrTag['PROPERTIES']; + $sku = new Section($arrTag['section_id']); + $title = Engine::process($sku, SeoMetaMorphy::prepareForMorphy($item['TAG'])); + + if (!empty($title)) { + $arrTag['TITLE'] = SeoMetaMorphy::convertMorphy($title, $morphyObject);; + } + + if (empty($arrTag['TITLE'])) { + $arrTag['TITLE'] = $title; + } + + $arrTag['URL'] = $arrTag['ACTIVE'] == 'Y' ? $arrTag['NEW_URL'] : $arrTag['REAL_URL']; + $arrTag = \Sotbit\Seometa\Orm\CategoryTagsTable::fillCategoryTags($Conditions[$arrTag['CONDITION_ID']], $arrTag, $tagsCategory); + } + + if (is_array($arrTags)) { + $Tags = array_merge($Tags, $arrTags); + } + } + } + } + + if (empty($Tags)) { + $Tags = []; + $cache->endDataCache($Tags); + return $this->IncludeComponentTemplate(); + } + + if ($strict_relinking) { + foreach ($Tags as $key => $tag) { + if ($tag['URL'] == $currentUrl) { + unset($Tags[$key]); + } + } + + $Tags = array_values($Tags); + } + + $likeFilter = \Bitrix\Main\Config\Option::get($moduleId, 'TAGS_FILTER', 'N', SITE_ID); + + $arFilterResult = []; + $arFilterRangeResult = []; + if ($likeFilter === 'Y') { + foreach ($filterResult['ITEMS'] as $itemKey => $item) { + foreach ($item['VALUES'] as $key => $value) { + if ($key === 'MAX' || $key === 'MIN') { + if ($item['CODE']) { + $arFilterRangeResult[$item['CODE']][$key] = $value['VALUE']; + } else { + $arFilterRangeResult[$itemKey][$key] = $value['VALUE']; + } + + } else { + $arFilterResult[$item['CODE']][] = $value['LIST_VALUE_NAME'] ?: ($value['LIST_VALUE'] ?: $value['VALUE']); + } + } + } + } + + if (!empty($Tags)) { + foreach ($Tags as $keyTag => $tag) { + if ($tag['SITE_ID'] !== SITE_ID) { + unset($Tags[$keyTag]); + } + + if ($likeFilter === 'Y' && ($arFilterResult || $arFilterRangeResult)) { + $unset = true; + foreach ($tag['PROPERTIES'] as $code => $prop) { + if ($arFilterRangeResult[$code]) { + foreach ($prop as $value) { + if ((float)$arFilterRangeResult[$code]['MIN'] <= (float)$value && (float)$arFilterRangeResult[$code]['MAX'] >= (float)$value) { + $unset = false; + break; + } + } + } + + if ($arFilterResult[$code]) { + $prop = htmlspecialcharsback($prop); + if (array_intersect($prop, $arFilterResult[$code])) { + $unset = false; + } + } + } + + if ($unset) { + unset($Tags[$keyTag]); + } + } + } + $Tags = array_values($Tags); + } + + $currentUrl = CSeoMeta::encodeRealUrl($currentUrl); + + if ($arParams['GENERATING_TAGS'] == 'Y') { + $Tags = $TagsObject->ReplaceChpuUrls($Tags); + } + + $curPage = array_search( + $currentUrl, + array_combine(array_keys($Tags), array_column($Tags, 'URL')) + ); + if ($curPage === false) { + $curPage = array_search( + $currentUrl, + array_combine(array_keys($Tags), array_column($Tags, 'REAL_URL')) + ); + } + + if ($curPage !== false) { + unset($Tags[$curPage]); + } + + $Tags = $TagsObject->SortTags($Tags, $arParams['SORT'], $arParams['SORT_ORDER']); + if($componentTemplate !== 'tagscategory') { + $Tags = $TagsObject->CutTags($Tags, $arParams['CNT_TAGS']); + } else { + $arParams['CNT_TAGS'] = $arParams['CNT_TAGS'] ?: 10; + } + + + unset($Conditions); + $cache->endDataCache($Tags); +} + +if ($arParams['AJAX'] === 'Y') { + $arResult['ITEMS'] = array_map(function ($arrVal) { + $arrVal['URL'] = $arrVal['URL'] . '?ajaxTag=1'; + return $arrVal; + }, $Tags); +} else { + $arResult['ITEMS'] = $Tags; +} + +unset($Tags); +$this->IncludeComponentTemplate(); +?> diff --git a/bitrix/components/sotbit/seo.meta.tags/lang/ru/.description.php b/bitrix/components/sotbit/seo.meta.tags/lang/ru/.description.php new file mode 100644 index 0000000..ec78c29 --- /dev/null +++ b/bitrix/components/sotbit/seo.meta.tags/lang/ru/.description.php @@ -0,0 +1,6 @@ + \ No newline at end of file diff --git a/bitrix/components/sotbit/seo.meta.tags/lang/ru/.parameters.php b/bitrix/components/sotbit/seo.meta.tags/lang/ru/.parameters.php new file mode 100644 index 0000000..a71721a --- /dev/null +++ b/bitrix/components/sotbit/seo.meta.tags/lang/ru/.parameters.php @@ -0,0 +1,24 @@ + \ No newline at end of file diff --git a/bitrix/components/sotbit/seo.meta.tags/templates/.default/template.php b/bitrix/components/sotbit/seo.meta.tags/templates/.default/template.php new file mode 100644 index 0000000..ade3fbb --- /dev/null +++ b/bitrix/components/sotbit/seo.meta.tags/templates/.default/template.php @@ -0,0 +1,19 @@ +setFrameMode(true); +if($arResult['ITEMS']) +{ + foreach($arResult['ITEMS'] as $Item) + { + if($Item['TITLE'] && $Item['URL']) { + $count = $arParams['PRODUCT_COUNT'] == 'Y' ? ' (' . $Item['PRODUCT_COUNT'] . ')' : ''; + ?> +
+
+ +
+
+ \ No newline at end of file diff --git a/bitrix/components/sotbit/seo.meta.tags/templates/tagscategory/.parameters.php b/bitrix/components/sotbit/seo.meta.tags/templates/tagscategory/.parameters.php new file mode 100644 index 0000000..0bf651f --- /dev/null +++ b/bitrix/components/sotbit/seo.meta.tags/templates/tagscategory/.parameters.php @@ -0,0 +1,13 @@ + array( + "PARENT" => "BASE", + 'NAME' => GetMessage('SM_SORT_ORDER'), + 'TYPE' => "LIST", + "VALUES" => array('asc' => GetMessage("SM_SORT_ORDER_ASC"), 'desc' => GetMessage("SM_SORT_ORDER_DESC")), + ), +); +?> \ No newline at end of file diff --git a/bitrix/components/sotbit/seo.meta.tags/templates/tagscategory/lang/ru/.parameters.php b/bitrix/components/sotbit/seo.meta.tags/templates/tagscategory/lang/ru/.parameters.php new file mode 100644 index 0000000..3be5308 --- /dev/null +++ b/bitrix/components/sotbit/seo.meta.tags/templates/tagscategory/lang/ru/.parameters.php @@ -0,0 +1,5 @@ + diff --git a/bitrix/components/sotbit/seo.meta.tags/templates/tagscategory/lang/ru/template.php b/bitrix/components/sotbit/seo.meta.tags/templates/tagscategory/lang/ru/template.php new file mode 100644 index 0000000..d5f39eb --- /dev/null +++ b/bitrix/components/sotbit/seo.meta.tags/templates/tagscategory/lang/ru/template.php @@ -0,0 +1,4 @@ + \ No newline at end of file diff --git a/bitrix/components/sotbit/seo.meta.tags/templates/tagscategory/result_modifier.php b/bitrix/components/sotbit/seo.meta.tags/templates/tagscategory/result_modifier.php new file mode 100644 index 0000000..91db25e --- /dev/null +++ b/bitrix/components/sotbit/seo.meta.tags/templates/tagscategory/result_modifier.php @@ -0,0 +1,31 @@ + $item['TAGS_SECTION_NAME'], + 'SORT' => $item['TAGS_SECTION_SORT'], + 'ITEMS' => [$item], + ]; + } +} + +if($arParams['SORT_ORDER_TAGS']) { + $sort = $arParams['SORT_ORDER_TAGS']; +} + +if($sort === 'asc') { + uasort($arCategory, function ($a, $b) { + return $a['SORT'] <=> $b['SORT']; + }); +} else { + uasort($arCategory, function ($a, $b) { + return $b['SORT'] <=> $a['SORT']; + }); +} + +$arResult['CATEGORY_TAGS'] = $arCategory; \ No newline at end of file diff --git a/bitrix/components/sotbit/seo.meta.tags/templates/tagscategory/script.js b/bitrix/components/sotbit/seo.meta.tags/templates/tagscategory/script.js new file mode 100644 index 0000000..9d759cd --- /dev/null +++ b/bitrix/components/sotbit/seo.meta.tags/templates/tagscategory/script.js @@ -0,0 +1,43 @@ +;(function () { + CategoryTags = function (params) { + this.tagsWrapper = params.tagsWrapper; + this.showMoreButton = params.showMoreButton; + this.categoryTags = params.categoryTags; + this.hideTag = params.hideTag; + this.expanded = params.expanded; + this.init(); + }; + + CategoryTags.prototype.init = function () { + const tagsWrapper = document.getElementById(this.tagsWrapper); + const showMoreButton = document.getElementById(this.showMoreButton); + const hiddenTags = document.querySelectorAll(this.hideTag); + const categoryTags = document.querySelectorAll(this.categoryTags); + let startHeight = 0; + + if (tagsWrapper) { + tagsWrapper.style.height = startHeight = tagsWrapper.offsetHeight + 'px'; + } + + if(showMoreButton) { + showMoreButton.addEventListener('click', async () => { + tagsWrapper.classList.toggle(this.expanded); + if (tagsWrapper.classList.contains(this.expanded)) { + await hiddenTags.forEach(tag => tag.classList.remove('hide-tag')); + let height = 0; + await categoryTags.forEach((category) => { + height += category.offsetHeight; + }); + showMoreButton.textContent = BX.message('less_btn'); + tagsWrapper.style.height = height + 'px'; + } else { + showMoreButton.textContent = BX.message('more_btn'); + tagsWrapper.style.height = startHeight; + setTimeout(() => { + hiddenTags.forEach(tag => tag.classList.add('hide-tag')); + }, 100) + } + }); + } + }; +})(); \ No newline at end of file diff --git a/bitrix/components/sotbit/seo.meta.tags/templates/tagscategory/style.css b/bitrix/components/sotbit/seo.meta.tags/templates/tagscategory/style.css new file mode 100644 index 0000000..1bfd569 --- /dev/null +++ b/bitrix/components/sotbit/seo.meta.tags/templates/tagscategory/style.css @@ -0,0 +1,44 @@ +.sotbit-seometa-tags-common-wrapper { + padding: 24px; + background: #F8F9FA; + overflow: hidden; + position: relative; +} + +.sotbit-seometa-tags-wrapper { + transition: height 0.5s ease-in-out; + overflow: hidden; +} + +.sotbit-seometa-tags-wrapper.expanded { + transition: height 0.5s ease-in-out; +} + +.sotbit-seometa-tags-wrapper-category { + overflow: hidden; + display: flex; + width: 100%; + flex-wrap: wrap; +} + +.sotbit-seometa-tags-padding { + padding-right: 8px; + margin-bottom: 8px; +} + +.hide-tag { + display: none; +} + +.sotbit-seometa-tag-link { + text-decoration: underline; +} + +.sotbit-seometa-btn-more { + margin-top: 16px; + display: none; +} + +.sotbit-seometa-btn-more.show-btn { + display: block; +} \ No newline at end of file diff --git a/bitrix/components/sotbit/seo.meta.tags/templates/tagscategory/template.php b/bitrix/components/sotbit/seo.meta.tags/templates/tagscategory/template.php new file mode 100644 index 0000000..f0f2b87 --- /dev/null +++ b/bitrix/components/sotbit/seo.meta.tags/templates/tagscategory/template.php @@ -0,0 +1,52 @@ +setFrameMode(true); +if ($arResult['CATEGORY_TAGS']) { ?> +
+
+ +
+ : + +
+ + + +
+ +
+ +
+
+ +
+
+ + + diff --git a/bitrix/components/sotbit/seo.meta/.description.php b/bitrix/components/sotbit/seo.meta/.description.php new file mode 100644 index 0000000..989a214 --- /dev/null +++ b/bitrix/components/sotbit/seo.meta/.description.php @@ -0,0 +1,14 @@ + GetMessage("SM_NAME"), + "DESCRIPTION" => GetMessage("SM_DESCRIPTION"), + "ICON" => "/images/icon.png", + "PATH" => array( + "ID" => GetMessage("MAIN_GROUP_NAME_SOTBIT"), + "CHILD" => array( + "ID" => "sotbit.seo.meta", + "NAME" => GetMessage("MAIN_MENU_NAME_SOTBIT"), + ) + ), +); +?> \ No newline at end of file diff --git a/bitrix/components/sotbit/seo.meta/.parameters.php b/bitrix/components/sotbit/seo.meta/.parameters.php new file mode 100644 index 0000000..787fc85 --- /dev/null +++ b/bitrix/components/sotbit/seo.meta/.parameters.php @@ -0,0 +1,44 @@ + "asc", + ), + array( + "TYPE" => $arCurrentValues["IBLOCK_TYPE"], + "ACTIVE" => "Y", + ) +); + +while ($arr = $rsIBlock->Fetch()) + $arIBlock[$arr["ID"]] = "[".$arr["ID"]."] ".$arr["NAME"]; + +$arComponentParameters = array( + "GROUPS" => array(), + "PARAMETERS" => array( + "FILTER_NAME" => array( + "PARENT" => "DATA_SOURCE", + "NAME" => GetMessage("SM_FILTER_NAME"), + "TYPE" => "STRING", + "DEFAULT" => '', + ), + "SECTION_ID" => array( + "PARENT" => "DATA_SOURCE", + "NAME" => GetMessage("SM_SECTION_ID"), + "TYPE" => "STRING", + "DEFAULT" => '={$_REQUEST["SECTION_ID"]}', + ), + "CACHE_TIME" => array( + "DEFAULT" => 36000000, + ), + "KOMBOX_FILTER" => array( + 'NAME' => GetMessage('USE_KOMBOX_FILTER'), + 'TYPE' => 'CHECKBOX', + 'DEFAULT' => 'N', + 'REFRESH' => 'Y', + ), + ), +); +?> \ No newline at end of file diff --git a/bitrix/components/sotbit/seo.meta/component.php b/bitrix/components/sotbit/seo.meta/component.php new file mode 100644 index 0000000..4793435 --- /dev/null +++ b/bitrix/components/sotbit/seo.meta/component.php @@ -0,0 +1,710 @@ +SetPageProperty("robots", 'noindex, nofollow'); +} + +$paginationText = ""; +if ($_REQUEST['PAGEN_1']) { + $pagOption = Option::get($moduleId, "PAGINATION_TEXT_" . SITE_ID); + if ($pagOption) { + $paginationText = " " . str_replace('%N%', $_REQUEST['PAGEN_1'], $pagOption); + } +} + +$str = $APPLICATION->GetCurPage(); +if ($arParams['KOMBOX_FILTER'] == 'Y' && CModule::IncludeModule('kombox.filter')) { + $str = CKomboxFilter::GetCurPageParam(); + $str = explode("?", $str); + $str = $str[0]; +} + +$str = CSeoMeta::encodeRealUrl($str); + +$metaData = SeometaUrlTable::getByRealUrl($str, SITE_ID); +if(empty($metaData)) { + $metaData = SeometaUrlTable::getByRealUrl(preg_replace('/index.php$/', '', $str), SITE_ID); +} + +if(empty($metaData)) { + $requestGet = Context::getCurrent()->getRequest()->getQueryList()->toArray(); + $pageParams = array_keys($requestGet); + $str = $APPLICATION->GetCurPageParam( + '', + $pageParams + ); + $str = CSeoMeta::encodeRealUrl($str); + $metaData = SeometaUrlTable::getByRealUrl($str, SITE_ID); +} + +if (!empty($metaData['NEW_URL'])) { + $APPLICATION->SetCurPage($metaData['NEW_URL']); +} + +CSeoMeta::SetFilterResult($sotbitFilterResult, $arParams['SECTION_ID']); //filter result for class +CSeoMeta::AddAdditionalFilterResults(${$arParams['FILTER_NAME']}, $arParams['KOMBOX_FILTER']); +CSeoMeta::FilterCheck(); + +if ($this->StartResultCache($arParams["CACHE_TIME"] ?: false, + $arParams["CACHE_GROUPS"] ? $USER->GetGroups() : false) +) { + $arResult = CSeoMeta::getRules($arParams); //list of conditions for current section + $this->endResultCache(); +} + +$sku = new Section($arParams['SECTION_ID']); +$morphyObject = SeoMetaMorphy::morphyLibInit(); +$curReq = Context::getCurrent()->getRequest(); +$protocol = $curReq->isHttps() ? 'https://' : 'http://'; +$port = $curReq->getServerPort() == '80' ? ':' . $curReq->getServerPort() : ''; +$classEmojiExist = class_exists('\Bitrix\Main\Text\Emoji'); + +if(empty($arResult) && !empty($metaData)){ + + $APPLICATION->SetPageProperty("robots", 'index, follow'); + + if ($metaData['SEOMETA_DATA']['ELEMENT_TITLE_REPLACE'] == 'Y') { + $result['TITLE'] = $metaData['SEOMETA_DATA']['ELEMENT_TITLE']; + } + + if (!empty($result['TITLE'])) { + if ($classEmojiExist) { + $result['TITLE'] = Emoji::decode($result['TITLE']); + } + + $sotbitSeoMetaTitle = Engine::process($sku, + SeoMetaMorphy::prepareForMorphy($result['TITLE'])); + $sotbitSeoMetaTitle = SeoMetaMorphy::convertMorphy($sotbitSeoMetaTitle, $morphyObject); + $sotbitSeoMetaTitle .= $paginationText ?: ''; + $APPLICATION->SetPageProperty("title", $sotbitSeoMetaTitle); + $issetCondition = true; + } + + if ($metaData['SEOMETA_DATA']['ELEMENT_KEYWORDS_REPLACE'] == 'Y') { + $result['KEYWORDS'] = $metaData['SEOMETA_DATA']['ELEMENT_KEYWORDS']; + } + + if (!empty($result['KEYWORDS'])) { + if ($classEmojiExist) { + $result['KEYWORDS'] = Emoji::decode($result['KEYWORDS']); + } + + $sotbitSeoMetaKeywords = Engine::process($sku, + SeoMetaMorphy::prepareForMorphy($result['KEYWORDS'])); + $sotbitSeoMetaKeywords = SeoMetaMorphy::convertMorphy($sotbitSeoMetaKeywords, $morphyObject); + $APPLICATION->SetPageProperty("keywords", $sotbitSeoMetaKeywords); + $issetCondition = true; + } + + if ($metaData['SEOMETA_DATA']['ELEMENT_DESCRIPTION_REPLACE'] == 'Y') { + $result['DESCRIPTION'] = $metaData['SEOMETA_DATA']['ELEMENT_DESCRIPTION']; + } + + if (!empty($result['DESCRIPTION'])) { + if ($classEmojiExist) { + $result['DESCRIPTION'] = Emoji::decode($result['DESCRIPTION']); + } + + $sotbitSeoMetaDescription = Engine::process($sku, + SeoMetaMorphy::prepareForMorphy($result['DESCRIPTION'])); + $sotbitSeoMetaDescription = SeoMetaMorphy::convertMorphy($sotbitSeoMetaDescription, $morphyObject); + $sotbitSeoMetaDescription .= $paginationText ?: ''; + $APPLICATION->SetPageProperty("description", $sotbitSeoMetaDescription); + $issetCondition = true; + } + + if ($metaData['SEOMETA_DATA']['ELEMENT_PAGE_TITLE_REPLACE'] == 'Y') { + $result['PAGE_TITLE'] = $metaData['SEOMETA_DATA']['ELEMENT_PAGE_TITLE']; + } + + if (!empty($result['PAGE_TITLE'])) { + if ($classEmojiExist) { + $result['PAGE_TITLE'] = Emoji::decode($result['PAGE_TITLE']); + } + + $sotbitSeoMetaH1 = Engine::process($sku, + SeoMetaMorphy::prepareForMorphy($result['PAGE_TITLE'])); + $arResult['ELEMENT_H1'] = $sotbitSeoMetaH1 .= $paginationText ?: ''; + $sotbitSeoMetaH1 = SeoMetaMorphy::convertMorphy($sotbitSeoMetaH1, $morphyObject); + $APPLICATION->SetTitle($sotbitSeoMetaH1); + $issetCondition = true; + } + + if ($metaData['SEOMETA_DATA']['ELEMENT_BREADCRUMB_TITLE_REPLACE'] == 'Y') { + $result['BREADCRUMB_TITLE'] = $metaData['SEOMETA_DATA']['ELEMENT_BREADCRUMB_TITLE']; + } + + if (!empty($result['BREADCRUMB_TITLE'])) { + if ($classEmojiExist) { + $result['BREADCRUMB_TITLE'] = Emoji::decode($result['BREADCRUMB_TITLE']); + } + + $url = $protocol . $curReq->getServer()->getServerName() . $port . $curReq->getRequestUri(); + $sotbitSeoMetaBreadcrumbLink = $url; + $sotbitSeoMetaBreadcrumbTitle = Engine::process($sku, + SeoMetaMorphy::prepareForMorphy($result['BREADCRUMB_TITLE'])); + $sotbitSeoMetaBreadcrumbTitle = SeoMetaMorphy::convertMorphy($sotbitSeoMetaBreadcrumbTitle, $morphyObject); + if (!empty($sotbitSeoMetaBreadcrumbLink)) { + $arResult['BREADCRUMB_TITLE'] = $sotbitSeoMetaBreadcrumbTitle; + $arResult['BREADCRUMB_LINK'] = $url; + } + $issetCondition = true; + } + + if ($metaData['SEOMETA_DATA']['ELEMENT_TOP_DESC_REPLACE'] == 'Y') { + $result['ELEMENT_TOP_DESC'] = $metaData['SEOMETA_DATA']['ELEMENT_TOP_DESC']; + } + + if (!empty($result['ELEMENT_TOP_DESC'])) { + if ($classEmojiExist) { + $result['ELEMENT_TOP_DESC'] = Emoji::decode($result['ELEMENT_TOP_DESC']); + } + + $sotbitSeoMetaTopDesc = Engine::process($sku, + SeoMetaMorphy::prepareForMorphy(html_entity_decode($result['ELEMENT_TOP_DESC']))); + $sotbitSeoMetaTopDesc = SeoMetaMorphy::convertMorphy($sotbitSeoMetaTopDesc, $morphyObject); + if (!empty($sotbitSeoMetaTopDesc)) { + if ($result['ELEMENT_TOP_DESC_TYPE'] == 'text') { + $sotbitSeoMetaTopDesc = htmlspecialchars($sotbitSeoMetaTopDesc); + } + $arResult['ELEMENT_TOP_DESC'] = $sotbitSeoMetaTopDesc; + } + $issetCondition = true; + } + + if ($metaData['SEOMETA_DATA']['ELEMENT_BOTTOM_DESC_REPLACE'] == 'Y') { + $result['ELEMENT_BOTTOM_DESC'] = $metaData['SEOMETA_DATA']['ELEMENT_BOTTOM_DESC']; + } + if (!empty($result['ELEMENT_BOTTOM_DESC'])) { + if ($classEmojiExist) { + $result['ELEMENT_BOTTOM_DESC'] = Emoji::decode($result['ELEMENT_BOTTOM_DESC']); + } + + $sotbitSeoMetaBottomDesc = Engine::process($sku, + SeoMetaMorphy::prepareForMorphy(html_entity_decode($result['ELEMENT_BOTTOM_DESC']))); + $sotbitSeoMetaBottomDesc = SeoMetaMorphy::convertMorphy($sotbitSeoMetaBottomDesc, $morphyObject); + if (!empty($sotbitSeoMetaBottomDesc)) { + if ($result['ELEMENT_BOTTOM_DESC_TYPE'] == 'text') { + $sotbitSeoMetaBottomDesc = htmlspecialchars($sotbitSeoMetaBottomDesc); + } + + $arResult['ELEMENT_BOTTOM_DESC'] = $sotbitSeoMetaBottomDesc; + } + $issetCondition = true; + } + + if ($metaData['SEOMETA_DATA']['ELEMENT_ADD_DESC_REPLACE'] == 'Y') { + $result['ELEMENT_ADD_DESC'] = $metaData['SEOMETA_DATA']['ELEMENT_ADD_DESC']; + } + if (!empty($result['ELEMENT_ADD_DESC'])) { + if ($classEmojiExist) { + $result['ELEMENT_ADD_DESC'] = Emoji::decode($result['ELEMENT_ADD_DESC']); + } + + $sotbitSeoMetaAddDesc = Engine::process($sku, + SeoMetaMorphy::prepareForMorphy(html_entity_decode($result['ELEMENT_ADD_DESC']))); + $sotbitSeoMetaAddDesc = SeoMetaMorphy::convertMorphy($sotbitSeoMetaAddDesc, $morphyObject); + if (!empty($sotbitSeoMetaAddDesc)) { + if ($result['ELEMENT_ADD_DESC_TYPE'] == 'text') { + $sotbitSeoMetaAddDesc = htmlspecialchars($sotbitSeoMetaAddDesc); + } + $arResult['ELEMENT_ADD_DESC'] = $sotbitSeoMetaAddDesc; + } + $issetCondition = true; + } + + if ($metaData['SEOMETA_DATA']['ELEMENT_FILE_REPLACE'] == 'Y') { + $result['ELEMENT_FILE'] = $metaData['SEOMETA_DATA']['ELEMENT_FILE']; + } + if (intval($result['ELEMENT_FILE']) > 0) { + $fileArray = CFile::GetFileArray($result['ELEMENT_FILE']); + $arResult['ELEMENT_FILE']['SRC'] = $fileArray['SRC']; + $arResult['ELEMENT_FILE']['DESCRIPTION'] = $fileArray['DESCRIPTION']; + $sotbitSeoMetaFile = '' . $arResult['ELEMENT_FILE']['DESCRIPTION'] . ''; + $issetCondition = true; + } +}else{ + $COND = []; + foreach ($arResult as $key => $condition) { + //get conditions and metatags + $COND[$key]['RULES'] = unserialize($condition['RULE']); + $COND[$key]['META'] = unserialize($condition['META']); + $COND[$key]['ID'] = $condition['ID']; + $COND[$key]['NO_INDEX'] = $condition['NO_INDEX']; + $COND[$key]['STRONG'] = $condition['STRONG']; + } + + $issetCondition = false; + $results = []; + foreach ($COND as $rule) //get metatags if condition true + { + if ($res = CSeoMeta::SetMetaCondition($rule, $arParams['SECTION_ID'], $condition['INFOBLOCK'])) { + $results[] = $res; + } + } + + $sectionParams = CIBlockSection::GetList( + [], + ['ID' => $arParams['SECTION_ID']], + false, + ['SECTION_PAGE_URL'] + )->GetNext(); + + if ($results && is_array($results)) { + foreach ($results as $result) //set metatags + { + //INDEX + if ($result['NO_INDEX'] == 'Y') { + $APPLICATION->SetPageProperty("robots", 'noindex, nofollow'); + } elseif ($result['NO_INDEX'] == 'N') { + $APPLICATION->SetPageProperty("robots", 'index, follow'); + } + + if ($metaData['SEOMETA_DATA']['ELEMENT_TITLE_REPLACE'] == 'Y') { + $result['TITLE'] = $metaData['SEOMETA_DATA']['ELEMENT_TITLE']; + } + + if (!empty($result['TITLE'])) { + if ($classEmojiExist) { + $result['TITLE'] = Emoji::decode($result['TITLE']); + } + + $sotbitSeoMetaTitle = Engine::process($sku, + SeoMetaMorphy::prepareForMorphy($result['TITLE'])); + $sotbitSeoMetaTitle = SeoMetaMorphy::convertMorphy($sotbitSeoMetaTitle, $morphyObject); + $sotbitSeoMetaTitle .= $paginationText ?: ''; + $APPLICATION->SetPageProperty("title", $sotbitSeoMetaTitle); + $issetCondition = true; + } + + if ($metaData['SEOMETA_DATA']['ELEMENT_KEYWORDS_REPLACE'] == 'Y') { + $result['KEYWORDS'] = $metaData['SEOMETA_DATA']['ELEMENT_KEYWORDS']; + } + + if (!empty($result['KEYWORDS'])) { + if ($classEmojiExist) { + $result['KEYWORDS'] = Emoji::decode($result['KEYWORDS']); + } + + $sotbitSeoMetaKeywords = Engine::process($sku, + SeoMetaMorphy::prepareForMorphy($result['KEYWORDS'])); + $sotbitSeoMetaKeywords = html_entity_decode(SeoMetaMorphy::convertMorphy($sotbitSeoMetaKeywords, $morphyObject)); + $APPLICATION->SetPageProperty("keywords", $sotbitSeoMetaKeywords); + $issetCondition = true; + } + + if ($metaData['SEOMETA_DATA']['ELEMENT_DESCRIPTION_REPLACE'] == 'Y') { + $result['DESCRIPTION'] = $metaData['SEOMETA_DATA']['ELEMENT_DESCRIPTION']; + } + + if (!empty($result['DESCRIPTION'])) { + if ($classEmojiExist) { + $result['DESCRIPTION'] = Emoji::decode($result['DESCRIPTION']); + } + + $sotbitSeoMetaDescription = Engine::process($sku, + SeoMetaMorphy::prepareForMorphy(html_entity_decode($result['DESCRIPTION']))); + $sotbitSeoMetaDescription = html_entity_decode(SeoMetaMorphy::convertMorphy($sotbitSeoMetaDescription, $morphyObject)); + $sotbitSeoMetaDescription .= $paginationText ?: ''; + $APPLICATION->SetPageProperty("description", $sotbitSeoMetaDescription); + $issetCondition = true; + } + + if ($metaData['SEOMETA_DATA']['ELEMENT_PAGE_TITLE_REPLACE'] == 'Y') { + $result['PAGE_TITLE'] = $metaData['SEOMETA_DATA']['ELEMENT_PAGE_TITLE']; + } + + if (!empty($result['PAGE_TITLE'])) { + if ($classEmojiExist) { + $result['PAGE_TITLE'] = Emoji::decode($result['PAGE_TITLE']); + } + + $sotbitSeoMetaH1 = Engine::process($sku, + SeoMetaMorphy::prepareForMorphy($result['PAGE_TITLE'])); + $arResult['ELEMENT_H1'] = $sotbitSeoMetaH1 .= $paginationText ?: ''; + $sotbitSeoMetaH1 = SeoMetaMorphy::convertMorphy($sotbitSeoMetaH1, $morphyObject); + $APPLICATION->SetTitle($sotbitSeoMetaH1); + $issetCondition = true; + } + + if ($metaData['SEOMETA_DATA']['ELEMENT_BREADCRUMB_TITLE_REPLACE'] == 'Y') { + $result['BREADCRUMB_TITLE'] = $metaData['SEOMETA_DATA']['ELEMENT_BREADCRUMB_TITLE']; + } + + if (!empty($result['BREADCRUMB_TITLE'])) { + if ($classEmojiExist) { + $result['BREADCRUMB_TITLE'] = Emoji::decode($result['BREADCRUMB_TITLE']); + } + + $url = $protocol . $curReq->getServer()->getServerName() . $port . $curReq->getRequestUri(); + $sotbitSeoMetaBreadcrumbLink = $url; + $sotbitSeoMetaBreadcrumbTitle = Engine::process($sku, + SeoMetaMorphy::prepareForMorphy($result['BREADCRUMB_TITLE'])); + $sotbitSeoMetaBreadcrumbTitle = SeoMetaMorphy::convertMorphy($sotbitSeoMetaBreadcrumbTitle, $morphyObject); + if (!empty($sotbitSeoMetaBreadcrumbLink)) { + $arResult['BREADCRUMB_TITLE'] = $sotbitSeoMetaBreadcrumbTitle; + $arResult['BREADCRUMB_LINK'] = $url; + } + $issetCondition = true; + } + + if ($metaData['SEOMETA_DATA']['ELEMENT_TOP_DESC_REPLACE'] == 'Y') { + $result['ELEMENT_TOP_DESC'] = $metaData['SEOMETA_DATA']['ELEMENT_TOP_DESC']; + } + + if (!empty($result['ELEMENT_TOP_DESC'])) { + if ($classEmojiExist) { + $result['ELEMENT_TOP_DESC'] = Emoji::decode($result['ELEMENT_TOP_DESC']); + } + + $sotbitSeoMetaTopDesc = Engine::process($sku, + SeoMetaMorphy::prepareForMorphy(html_entity_decode($result['ELEMENT_TOP_DESC']))); + $sotbitSeoMetaTopDesc = SeoMetaMorphy::convertMorphy($sotbitSeoMetaTopDesc, $morphyObject); + if (!empty($sotbitSeoMetaTopDesc)) { + if ($result['ELEMENT_TOP_DESC_TYPE'] == 'text') { + $sotbitSeoMetaTopDesc = htmlspecialchars($sotbitSeoMetaTopDesc); + } + $arResult['ELEMENT_TOP_DESC'] = $sotbitSeoMetaTopDesc; + } + $issetCondition = true; + } + + if ($metaData['SEOMETA_DATA']['ELEMENT_BOTTOM_DESC_REPLACE'] == 'Y') { + $result['ELEMENT_BOTTOM_DESC'] = $metaData['SEOMETA_DATA']['ELEMENT_BOTTOM_DESC']; + } + if (!empty($result['ELEMENT_BOTTOM_DESC'])) { + if ($classEmojiExist) { + $result['ELEMENT_BOTTOM_DESC'] = Emoji::decode($result['ELEMENT_BOTTOM_DESC']); + } + + $sotbitSeoMetaBottomDesc = Engine::process($sku, + SeoMetaMorphy::prepareForMorphy(html_entity_decode($result['ELEMENT_BOTTOM_DESC']))); + $sotbitSeoMetaBottomDesc = SeoMetaMorphy::convertMorphy($sotbitSeoMetaBottomDesc, $morphyObject); + if (!empty($sotbitSeoMetaBottomDesc)) { + if ($result['ELEMENT_BOTTOM_DESC_TYPE'] == 'text') { + $sotbitSeoMetaBottomDesc = htmlspecialchars($sotbitSeoMetaBottomDesc); + } + + $arResult['ELEMENT_BOTTOM_DESC'] = $sotbitSeoMetaBottomDesc; + } + $issetCondition = true; + } + + if ($metaData['SEOMETA_DATA']['ELEMENT_ADD_DESC_REPLACE'] == 'Y') { + $result['ELEMENT_ADD_DESC'] = $metaData['SEOMETA_DATA']['ELEMENT_ADD_DESC']; + } + if (!empty($result['ELEMENT_ADD_DESC'])) { + if ($classEmojiExist) { + $result['ELEMENT_ADD_DESC'] = Emoji::decode($result['ELEMENT_ADD_DESC']); + } + + $sotbitSeoMetaAddDesc = Engine::process($sku, + SeoMetaMorphy::prepareForMorphy(html_entity_decode($result['ELEMENT_ADD_DESC']))); + $sotbitSeoMetaAddDesc = SeoMetaMorphy::convertMorphy($sotbitSeoMetaAddDesc, $morphyObject); + if (!empty($sotbitSeoMetaAddDesc)) { + if ($result['ELEMENT_ADD_DESC_TYPE'] == 'text') { + $sotbitSeoMetaAddDesc = htmlspecialchars($sotbitSeoMetaAddDesc); + } + $arResult['ELEMENT_ADD_DESC'] = $sotbitSeoMetaAddDesc; + } + $issetCondition = true; + } + + if ($metaData['SEOMETA_DATA']['ELEMENT_FILE_REPLACE'] == 'Y') { + $result['ELEMENT_FILE'] = $metaData['SEOMETA_DATA']['ELEMENT_FILE']; + } + if (intval($result['ELEMENT_FILE']) > 0) { + $fileArray = CFile::GetFileArray($result['ELEMENT_FILE']); + $arResult['ELEMENT_FILE']['SRC'] = $fileArray['SRC']; + $arResult['ELEMENT_FILE']['DESCRIPTION'] = $fileArray['DESCRIPTION']; + $sotbitSeoMetaFile = '' . $arResult['ELEMENT_FILE']['DESCRIPTION'] . ''; + $issetCondition = true; + } + + //CANONICAL + + if ($arParams['KOMBOX_FILTER'] == 'Y' && CModule::IncludeModule('kombox.filter')) { + $str = CKomboxFilter::GetCurPageParam(); + $str = explode("?", $str); + $CurPage_temp = SeometaUrlTable::getByRealUrl($str[0], SITE_ID); + if (!empty($CurPage_temp['NEW_URL'])) { + $CurPage = $CurPage_temp['NEW_URL']; + } else { + $CurPage = $str[0]; + } + } else { + $CurPage = $APPLICATION->GetCurPage(false); + } + + if ($issetCondition && Option::get($moduleId, "USE_CANONICAL_" . SITE_ID, "Y") != "N") { + if ($metaData['NEW_URL'] || $metaData['REAL_URL']) { + $APPLICATION->SetPageProperty("canonical", + $protocol . $curReq->getServer()->getServerName() + . $metaData['NEW_URL'] ?: $metaData['REAL_URL']); + } elseif ($curReq->getServer()->get('REDIRECT_URL') || $curReq->getRequestUri()) { + $APPLICATION->SetPageProperty("canonical", + $protocol . $curReq->getServer()->getServerName() + . $curReq->getServer()->get('REDIRECT_URL') ?: $curReq->getRequestUri()); + } else { + $APPLICATION->SetPageProperty("canonical", $protocol . $curReq->getServer()->getServerName() . $CurPage); + } + } + + //OpenGraph and TwitterCard + $metaDataOgTw = new OGraphTWCard(); + $arOGParams = OpengraphTable::getByConditionID($result['ID']); + if(is_array($arOGParams) && $arOGParams['OG_FIELD_ACTIVE'] == 'Y') { + unset($arOGParams['OG_FIELD_ACTIVE']); + unset($arOGParams['ID']); + unset($arOGParams['CONDITION_ID']); + if ($metaData['NEW_URL'] || $metaData['REAL_URL']) { + $arOGParams['OG_FIELD_URL'] = $protocol . $curReq->getServer()->getServerName() . $metaData['NEW_URL'] ?: $metaData['REAL_URL']; + } else { + $arOGParams['OG_FIELD_URL'] = $metaDataOgTw->getHttpSchema() . '://' . $curReq->getServer()->getServerName() . $CurPage; + } + foreach ($arOGParams as $name => $value) { + if($name == 'OG_FIELD_TITLE' || $name == 'OG_FIELD_DESCRIPTION') { + $afterProcess = Engine::process($sku, + SeoMetaMorphy::prepareForMorphy($value)); + $afterProcess = SeoMetaMorphy::convertMorphy($afterProcess, + $morphyObject); + + if($afterProcess) { + $value = $afterProcess; + } + } + + $metaDataOgTw->setData($name, + $value); + } + } + + $arTWParams = TwitterCardTable::getByConditionID($result['ID']); + if(is_array($arTWParams) && $arTWParams['TW_FIELD_ACTIVE'] == 'Y') { + unset($arTWParams['TW_FIELD_ACTIVE']); + unset($arTWParams['ID']); + unset($arTWParams['CONDITION_ID']); + unset($arTWParams['TW_FIELD_IMAGE_descr']); + foreach ($arTWParams as $name => $value) { + if($name == 'TW_FIELD_TITLE' || $name == 'TW_FIELD_DESCRIPTION') { + $afterProcess = Engine::process($sku, + SeoMetaMorphy::prepareForMorphy($value)); + $afterProcess = SeoMetaMorphy::convertMorphy($afterProcess, + $morphyObject); + + if($afterProcess) { + $value = $afterProcess; + } + } + + $metaDataOgTw->setData($name, $value); + } + } + + //tags + if ($issetCondition && $result['ID'] > 0) { + $SeoMetaWorkingConditions[] = $result['ID']; + } + } + } else { + $notConfiguredSeoData = SeometaNotConfiguredPagesTable::getBySiteID(SITE_ID); + if($notConfiguredSeoData['ACTIVE'] == 'Y' && CSeoMeta::isFilterChecked()) { + $mode = $_REQUEST['PAGEN_1'] ? $notConfiguredSeoData['BEHAVIOR_PAGINATION_PAGES'] : $notConfiguredSeoData['BEHAVIOR_FILTERED_PAGES']; + if ($mode == 'no_index') { + $APPLICATION->SetPageProperty("robots", 'noindex, nofollow'); + } elseif ($mode == 'canonical') { + if (Option::get($moduleId, "NO_INDEX_" . SITE_ID, "N") === 'Y') { + $APPLICATION->SetPageProperty("robots", 'noindex, nofollow'); + } else { + $APPLICATION->SetPageProperty("robots", 'index, follow'); + } + } + + if ($notConfiguredSeoData['META_ELEMENT_TITLE']) { + if ($classEmojiExist) { + $notConfiguredSeoData['META_ELEMENT_TITLE'] = Emoji::decode($notConfiguredSeoData['META_ELEMENT_TITLE']); + } + + $sotbitSeoMetaTitle = Engine::process($sku, + SeoMetaMorphy::prepareForMorphy($notConfiguredSeoData['META_ELEMENT_TITLE'])); + $sotbitSeoMetaTitle = SeoMetaMorphy::convertMorphy($sotbitSeoMetaTitle, $morphyObject); + $sotbitSeoMetaTitle .= $paginationText ?: ''; + $sotbitSeoMetaTitle = \CSeoMeta::UserFields($sotbitSeoMetaTitle, $arParams['SECTION_ID'], $condition['INFOBLOCK']); + $APPLICATION->SetPageProperty("title", $sotbitSeoMetaTitle); + } + + if ($notConfiguredSeoData['META_ELEMENT_KEYWORDS']) { + if ($classEmojiExist) { + $notConfiguredSeoData['META_ELEMENT_KEYWORDS'] = Emoji::decode($notConfiguredSeoData['META_ELEMENT_KEYWORDS']); + } + + $sotbitSeoMetaKeywords = Engine::process($sku, + SeoMetaMorphy::prepareForMorphy($notConfiguredSeoData['META_ELEMENT_KEYWORDS'])); + $sotbitSeoMetaKeywords = SeoMetaMorphy::convertMorphy($sotbitSeoMetaKeywords, $morphyObject); + $sotbitSeoMetaKeywords = \CSeoMeta::UserFields($sotbitSeoMetaKeywords, $arParams['SECTION_ID'], $condition['INFOBLOCK']); + $APPLICATION->SetPageProperty("keywords", $sotbitSeoMetaKeywords); + } + + if ($notConfiguredSeoData['META_ELEMENT_DESCRIPTION']) { + if ($classEmojiExist) { + $notConfiguredSeoData['META_ELEMENT_DESCRIPTION'] = Emoji::decode($notConfiguredSeoData['META_ELEMENT_DESCRIPTION']); + } + + $sotbitSeoMetaDescription = Engine::process($sku, + SeoMetaMorphy::prepareForMorphy($notConfiguredSeoData['META_ELEMENT_DESCRIPTION'])); + $sotbitSeoMetaDescription = SeoMetaMorphy::convertMorphy($sotbitSeoMetaDescription, $morphyObject); + $sotbitSeoMetaDescription .= $paginationText ?: ''; + $sotbitSeoMetaDescription = \CSeoMeta::UserFields($sotbitSeoMetaDescription, $arParams['SECTION_ID'], $condition['INFOBLOCK']); + $APPLICATION->SetPageProperty("description", $sotbitSeoMetaDescription); + } + + if ($notConfiguredSeoData['META_ELEMENT_PAGE_TITLE']) { + if ($classEmojiExist) { + $notConfiguredSeoData['META_ELEMENT_PAGE_TITLE'] = Emoji::decode($notConfiguredSeoData['META_ELEMENT_PAGE_TITLE']); + } + + $sotbitSeoMetaH1 = Engine::process($sku, + SeoMetaMorphy::prepareForMorphy($notConfiguredSeoData['META_ELEMENT_PAGE_TITLE'])); + + if ($sotbitSeoMetaH1) { + $sotbitSeoMetaH1 .= $paginationText ?: ''; + $sotbitSeoMetaH1 = SeoMetaMorphy::convertMorphy($sotbitSeoMetaH1, $morphyObject); + $sotbitSeoMetaH1 = \CSeoMeta::UserFields($sotbitSeoMetaH1, $arParams['SECTION_ID'], $condition['INFOBLOCK']); + $arResult['ELEMENT_H1'] = $sotbitSeoMetaH1; + $APPLICATION->SetTitle($sotbitSeoMetaH1); + } + } + + if ($notConfiguredSeoData['META_ELEMENT_BREADCRUMB_TITLE']) { + if ($classEmojiExist) { + $notConfiguredSeoData['META_ELEMENT_BREADCRUMB_TITLE'] = Emoji::decode($notConfiguredSeoData['META_ELEMENT_BREADCRUMB_TITLE']); + } + + $url = $protocol . $curReq->getServer()->getServerName() . $port . $curReq->getRequestUri(); + $sotbitSeoMetaBreadcrumbLink = $url; + $sotbitSeoMetaBreadcrumbTitle = Engine::process($sku, + SeoMetaMorphy::prepareForMorphy($notConfiguredSeoData['META_ELEMENT_BREADCRUMB_TITLE'])); + $sotbitSeoMetaBreadcrumbTitle = SeoMetaMorphy::convertMorphy($sotbitSeoMetaBreadcrumbTitle, $morphyObject); + $sotbitSeoMetaBreadcrumbTitle = \CSeoMeta::UserFields($sotbitSeoMetaBreadcrumbTitle, $arParams['SECTION_ID'], $condition['INFOBLOCK']); + if (isset($sotbitSeoMetaBreadcrumbLink) && !empty($sotbitSeoMetaBreadcrumbLink)) { + $arResult['BREADCRUMB_TITLE'] = $sotbitSeoMetaBreadcrumbTitle; + $arResult['BREADCRUMB_LINK'] = $url; + } + } + + if ($notConfiguredSeoData['META_ELEMENT_TOP_DESC']) { + if ($classEmojiExist) { + $notConfiguredSeoData['META_ELEMENT_TOP_DESC'] = Emoji::decode($notConfiguredSeoData['META_ELEMENT_TOP_DESC']); + } + + $sotbitSeoMetaTopDesc = Engine::process($sku, + SeoMetaMorphy::prepareForMorphy(html_entity_decode($notConfiguredSeoData['META_ELEMENT_TOP_DESC']))); + $sotbitSeoMetaTopDesc = SeoMetaMorphy::convertMorphy($sotbitSeoMetaTopDesc, $morphyObject); + $sotbitSeoMetaTopDesc = \CSeoMeta::UserFields($sotbitSeoMetaTopDesc, $arParams['SECTION_ID'], $condition['INFOBLOCK']); + $arResult['ELEMENT_TOP_DESC'] = $sotbitSeoMetaTopDesc ?: ''; + } + + if ($notConfiguredSeoData['META_ELEMENT_BOTTOM_DESC']) { + if ($classEmojiExist) { + $notConfiguredSeoData['META_ELEMENT_BOTTOM_DESC'] = Emoji::decode($notConfiguredSeoData['META_ELEMENT_BOTTOM_DESC']); + } + + $sotbitSeoMetaBottomDesc = Engine::process($sku, + SeoMetaMorphy::prepareForMorphy(html_entity_decode($notConfiguredSeoData['META_ELEMENT_BOTTOM_DESC']))); + $sotbitSeoMetaBottomDesc = SeoMetaMorphy::convertMorphy($sotbitSeoMetaBottomDesc, $morphyObject); + $sotbitSeoMetaBottomDesc = \CSeoMeta::UserFields($sotbitSeoMetaBottomDesc, $arParams['SECTION_ID'], $condition['INFOBLOCK']); + $arResult['ELEMENT_BOTTOM_DESC'] = $sotbitSeoMetaBottomDesc ?: ''; + } + + if ($notConfiguredSeoData['META_ELEMENT_ADD_DESC']) { + if ($classEmojiExist) { + $notConfiguredSeoData['META_ELEMENT_ADD_DESC'] = Emoji::decode($notConfiguredSeoData['META_ELEMENT_ADD_DESC']); + } + + $sotbitSeoMetaAddDesc = Engine::process($sku, + SeoMetaMorphy::prepareForMorphy(html_entity_decode($notConfiguredSeoData['META_ELEMENT_ADD_DESC']))); + $sotbitSeoMetaAddDesc = SeoMetaMorphy::convertMorphy($sotbitSeoMetaAddDesc, $morphyObject); + $sotbitSeoMetaAddDesc = \CSeoMeta::UserFields($sotbitSeoMetaAddDesc, $arParams['SECTION_ID'], $condition['INFOBLOCK']); + $arResult['ELEMENT_ADD_DESC'] = $sotbitSeoMetaAddDesc ?: ''; + } + + //CANONICAL + if ($mode == 'canonical') { + $CurPage = $APPLICATION->GetCurPage(false); + if ($arParams['KOMBOX_FILTER'] == 'Y' && CModule::IncludeModule('kombox.filter')) { + $str = CKomboxFilter::GetCurPageParam(); + $str = explode("?", $str); + $CurPage_temp = SeometaUrlTable::getByRealUrl($str[0], SITE_ID); + $CurPage = $str[0]; + if (!empty($CurPage_temp['NEW_URL'])) { + $CurPage = $CurPage_temp['NEW_URL']; + } + } + + if ($sectionParams['SECTION_PAGE_URL']) { + $APPLICATION->SetPageProperty("canonical", + $protocol . $curReq->getServer()->getServerName() . $sectionParams['SECTION_PAGE_URL']); + } + } + } + } +} + +$SeoMetaWorkingConditions = array_unique($SeoMetaWorkingConditions); + +if(Option::get("sotbit.seometa",'INC_STATISTIC','N',SITE_ID) == 'Y') { + $arParams['KOMBOX_FILTER'] = $arParams['KOMBOX_FILTER'] ?: 'N'; + Asset::getInstance()->addJs("/bitrix/components/sotbit/seo.meta/js/stat.js"); + + $prop['ITEMS'] = $sotbitFilterResult['ITEMS'] ?: []; + + echo ''; +} + +$this->IncludeComponentTemplate(); +?> \ No newline at end of file diff --git a/bitrix/components/sotbit/seo.meta/images/icon.png b/bitrix/components/sotbit/seo.meta/images/icon.png new file mode 100644 index 0000000..40ba4f1 Binary files /dev/null and b/bitrix/components/sotbit/seo.meta/images/icon.png differ diff --git a/bitrix/components/sotbit/seo.meta/js/stat.js b/bitrix/components/sotbit/seo.meta/js/stat.js new file mode 100644 index 0000000..12c8d15 --- /dev/null +++ b/bitrix/components/sotbit/seo.meta/js/stat.js @@ -0,0 +1,43 @@ +function Stat(arFilter, section, komboxFilter, siteID, siteCharSet, sotbitFilter) +{ + if(komboxFilter !== 'Y'){ + komboxFilter = 'N'; + } + + let title = document.querySelector('title').innerText; + let keywords = document.querySelector('meta[name=keywords]').content; + let description = document.querySelector('meta[name=description]').content; + + // regex for search emoji + if(siteCharSet.toLowerCase() !== "utf-8"){ + let regexp = /[\u{1f300}-\u{1f5ff}\u{1f900}-\u{1f9ff}\u{1f600}-\u{1f64f}\u{1f680}-\u{1f6ff}\u{2600}-\u{26ff}\u{2700}-\u{27bf}\u{1f1e6}-\u{1f1ff}\u{1f191}-\u{1f251}\u{1f004}\u{1f0cf}\u{1f170}-\u{1f171}\u{1f17e}-\u{1f17f}\u{1f18e}\u{3030}\u{2b50}\u{2b55}\u{2934}-\u{2935}\u{2b05}-\u{2b07}\u{2b1b}-\u{2b1c}\u{3297}\u{3299}\u{303d}\u{00a9}\u{00ae}\u{2122}\u{23f3}\u{24c2}\u{23e9}-\u{23ef}\u{25b6}\u{23f8}-\u{23fa}]/ug; + title = title.replace(regexp, function (title){ + return "%26#"+title.codePointAt(0)+";"; // get emoji html code + }); + keywords = keywords.replace(regexp, function (keywords){ + return "%26#"+keywords.codePointAt(0)+";"; + }); + description = description.replace(regexp, function (description){ + return "%26#"+description.codePointAt(0)+";"; + }); + } + + let metaInfo = { + title: title, + keywords: keywords, + description: description, + index: document.querySelector('meta[name=robots]') ? document.querySelector('meta[name=robots]').content : 'index, follow', + section: section, + komboxFilter: komboxFilter, + } + + const test = BX.ajax.runAction('sotbit:seometa.statistics.fillStat', { + data: { + to: window.location.href, + siteID: siteID, + metaInfo: JSON.stringify(metaInfo), + arFilter: JSON.stringify(arFilter), + sotbitFilter: JSON.stringify(sotbitFilter), + } + }).then(response => {}, error => {console.error(error);}); +} \ No newline at end of file diff --git a/bitrix/components/sotbit/seo.meta/lang/ru/.description.php b/bitrix/components/sotbit/seo.meta/lang/ru/.description.php new file mode 100644 index 0000000..f203d7a --- /dev/null +++ b/bitrix/components/sotbit/seo.meta/lang/ru/.description.php @@ -0,0 +1,6 @@ + \ No newline at end of file diff --git a/bitrix/components/sotbit/seo.meta/lang/ru/.parameters.php b/bitrix/components/sotbit/seo.meta/lang/ru/.parameters.php new file mode 100644 index 0000000..9c6c4fb --- /dev/null +++ b/bitrix/components/sotbit/seo.meta/lang/ru/.parameters.php @@ -0,0 +1,7 @@ + \ No newline at end of file diff --git a/bitrix/components/sotbit/seo.meta/templates/.default/template.php b/bitrix/components/sotbit/seo.meta/templates/.default/template.php new file mode 100644 index 0000000..84b3ec6 --- /dev/null +++ b/bitrix/components/sotbit/seo.meta/templates/.default/template.php @@ -0,0 +1,35 @@ +setFrameMode(true); + +if(isset($arResult['ELEMENT_H1']) && !empty($arResult['ELEMENT_H1'])) +{ + $this->SetViewTarget("sotbit_seometa_h1"); + echo $arResult['ELEMENT_H1']; + $this->EndViewTarget(); +} +if(isset($arResult['ELEMENT_TOP_DESC']) && !empty($arResult['ELEMENT_TOP_DESC'])) +{ + $this->SetViewTarget("sotbit_seometa_top_desc"); + echo $arResult['ELEMENT_TOP_DESC']; + $this->EndViewTarget(); +} +if(isset($arResult['ELEMENT_BOTTOM_DESC']) && !empty($arResult['ELEMENT_BOTTOM_DESC'])) +{ + $this->SetViewTarget("sotbit_seometa_bottom_desc"); + echo $arResult['ELEMENT_BOTTOM_DESC']; + $this->EndViewTarget(); +} +if(isset($arResult['ELEMENT_ADD_DESC']) && !empty($arResult['ELEMENT_ADD_DESC'])) +{ + $this->SetViewTarget("sotbit_seometa_add_desc"); + echo $arResult['ELEMENT_ADD_DESC']; + $this->EndViewTarget(); +} +if(isset($arResult['ELEMENT_FILE']) && !empty($arResult['ELEMENT_FILE'])) +{ + $this->SetViewTarget("sotbit_seometa_file"); + echo '' . $arResult['ELEMENT_FILE']['DESCRIPTION'] . ''; + $this->EndViewTarget(); +} +?> \ No newline at end of file diff --git a/bitrix/footer.php b/bitrix/footer.php new file mode 100644 index 0000000..de87666 --- /dev/null +++ b/bitrix/footer.php @@ -0,0 +1,6 @@ + \ No newline at end of file diff --git a/bitrix/header.php b/bitrix/header.php new file mode 100644 index 0000000..2d33883 --- /dev/null +++ b/bitrix/header.php @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/bitrix/index.php b/bitrix/index.php new file mode 100644 index 0000000..3ead9ff --- /dev/null +++ b/bitrix/index.php @@ -0,0 +1,3 @@ + + + diff --git a/bitrix/license_key.php b/bitrix/license_key.php new file mode 100644 index 0000000..2612008 --- /dev/null +++ b/bitrix/license_key.php @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/bitrix/php_interface/after_connect_d7.php b/bitrix/php_interface/after_connect_d7.php new file mode 100644 index 0000000..f347b46 --- /dev/null +++ b/bitrix/php_interface/after_connect_d7.php @@ -0,0 +1,3 @@ +queryExecute("SET NAMES 'utf8'"); +$this->queryExecute('SET collation_connection = "utf8_unicode_ci"'); diff --git a/bitrix/php_interface/include/catalog_export/cron_frame.php b/bitrix/php_interface/include/catalog_export/cron_frame.php new file mode 100644 index 0000000..0292c16 --- /dev/null +++ b/bitrix/php_interface/include/catalog_export/cron_frame.php @@ -0,0 +1,101 @@ +#!#PHP_PATH# -q + $DB->GetNowFunction() + ) +); \ No newline at end of file diff --git a/bitrix/php_interface/include/catalog_export/csv_new_run.php b/bitrix/php_interface/include/catalog_export/csv_new_run.php new file mode 100644 index 0000000..824cf5a --- /dev/null +++ b/bitrix/php_interface/include/catalog_export/csv_new_run.php @@ -0,0 +1,4 @@ +Export CSV (new) +require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/catalog/load/csv_new_run.php"); +?> \ No newline at end of file diff --git a/bitrix/php_interface/include/catalog_export/csv_new_setup.php b/bitrix/php_interface/include/catalog_export/csv_new_setup.php new file mode 100644 index 0000000..20ae821 --- /dev/null +++ b/bitrix/php_interface/include/catalog_export/csv_new_setup.php @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/bitrix/php_interface/include/catalog_export/csv_run.php b/bitrix/php_interface/include/catalog_export/csv_run.php new file mode 100644 index 0000000..13f86d1 --- /dev/null +++ b/bitrix/php_interface/include/catalog_export/csv_run.php @@ -0,0 +1,4 @@ +Export CSV +require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/catalog/load/csv_run.php"); +?> \ No newline at end of file diff --git a/bitrix/php_interface/include/catalog_export/csv_setup.php b/bitrix/php_interface/include/catalog_export/csv_setup.php new file mode 100644 index 0000000..386daf2 --- /dev/null +++ b/bitrix/php_interface/include/catalog_export/csv_setup.php @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/bitrix/php_interface/include/catalog_export/froogle_run.php b/bitrix/php_interface/include/catalog_export/froogle_run.php new file mode 100644 index 0000000..0684995 --- /dev/null +++ b/bitrix/php_interface/include/catalog_export/froogle_run.php @@ -0,0 +1,4 @@ +Froogle +require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/catalog/load/froogle_run.php"); +?> \ No newline at end of file diff --git a/bitrix/php_interface/include/catalog_export/froogle_setup.php b/bitrix/php_interface/include/catalog_export/froogle_setup.php new file mode 100644 index 0000000..6592cb7 --- /dev/null +++ b/bitrix/php_interface/include/catalog_export/froogle_setup.php @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/bitrix/php_interface/include/catalog_export/froogle_util.php b/bitrix/php_interface/include/catalog_export/froogle_util.php new file mode 100644 index 0000000..5bfadef --- /dev/null +++ b/bitrix/php_interface/include/catalog_export/froogle_util.php @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/bitrix/php_interface/include/catalog_export/yandex_detail.php b/bitrix/php_interface/include/catalog_export/yandex_detail.php new file mode 100644 index 0000000..10fbb0f --- /dev/null +++ b/bitrix/php_interface/include/catalog_export/yandex_detail.php @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/bitrix/php_interface/include/catalog_export/yandex_run.php b/bitrix/php_interface/include/catalog_export/yandex_run.php new file mode 100644 index 0000000..d3431d5 --- /dev/null +++ b/bitrix/php_interface/include/catalog_export/yandex_run.php @@ -0,0 +1,4 @@ +Yandex +require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/catalog/load/yandex_run.php"); +?> \ No newline at end of file diff --git a/bitrix/php_interface/include/catalog_export/yandex_setup.php b/bitrix/php_interface/include/catalog_export/yandex_setup.php new file mode 100644 index 0000000..bc9a3ff --- /dev/null +++ b/bitrix/php_interface/include/catalog_export/yandex_setup.php @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/bitrix/php_interface/include/catalog_export/yandex_simple_run.php b/bitrix/php_interface/include/catalog_export/yandex_simple_run.php new file mode 100644 index 0000000..0730d6b --- /dev/null +++ b/bitrix/php_interface/include/catalog_export/yandex_simple_run.php @@ -0,0 +1,4 @@ +Yandex - simple +require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/catalog/load/yandex_simple_run.php"); +?> \ No newline at end of file diff --git a/bitrix/php_interface/include/catalog_export/yandex_simple_setup.php b/bitrix/php_interface/include/catalog_export/yandex_simple_setup.php new file mode 100644 index 0000000..d2e35af --- /dev/null +++ b/bitrix/php_interface/include/catalog_export/yandex_simple_setup.php @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/bitrix/php_interface/include/catalog_export/yandex_util.php b/bitrix/php_interface/include/catalog_export/yandex_util.php new file mode 100644 index 0000000..c50eb9f --- /dev/null +++ b/bitrix/php_interface/include/catalog_export/yandex_util.php @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/bitrix/php_interface/include/catalog_import/commerceml_g_run.php b/bitrix/php_interface/include/catalog_import/commerceml_g_run.php new file mode 100644 index 0000000..92f10e9 --- /dev/null +++ b/bitrix/php_interface/include/catalog_import/commerceml_g_run.php @@ -0,0 +1,4 @@ +CommerceML MySql Fast - BETA VERS +require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/catalog/load_import/commerceml_g_run.php"); +?> \ No newline at end of file diff --git a/bitrix/php_interface/include/catalog_import/commerceml_g_setup.php b/bitrix/php_interface/include/catalog_import/commerceml_g_setup.php new file mode 100644 index 0000000..5834e42 --- /dev/null +++ b/bitrix/php_interface/include/catalog_import/commerceml_g_setup.php @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/bitrix/php_interface/include/catalog_import/commerceml_run.php b/bitrix/php_interface/include/catalog_import/commerceml_run.php new file mode 100644 index 0000000..2278a68 --- /dev/null +++ b/bitrix/php_interface/include/catalog_import/commerceml_run.php @@ -0,0 +1,4 @@ +CommerceML +require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/catalog/load_import/commerceml_run.php"); +?> \ No newline at end of file diff --git a/bitrix/php_interface/include/catalog_import/commerceml_setup.php b/bitrix/php_interface/include/catalog_import/commerceml_setup.php new file mode 100644 index 0000000..994e0e7 --- /dev/null +++ b/bitrix/php_interface/include/catalog_import/commerceml_setup.php @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/bitrix/php_interface/include/catalog_import/cron_frame.php b/bitrix/php_interface/include/catalog_import/cron_frame.php new file mode 100644 index 0000000..39cd5a3 --- /dev/null +++ b/bitrix/php_interface/include/catalog_import/cron_frame.php @@ -0,0 +1,104 @@ +#!#PHP_PATH# -q + $DB->GetNowFunction() + ) +); \ No newline at end of file diff --git a/bitrix/php_interface/include/catalog_import/csv_new_run.php b/bitrix/php_interface/include/catalog_import/csv_new_run.php new file mode 100644 index 0000000..0dc6a40 --- /dev/null +++ b/bitrix/php_interface/include/catalog_import/csv_new_run.php @@ -0,0 +1,4 @@ +Import CSV (new) +require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/catalog/load_import/csv_new_run.php"); +?> \ No newline at end of file diff --git a/bitrix/php_interface/include/catalog_import/csv_new_setup.php b/bitrix/php_interface/include/catalog_import/csv_new_setup.php new file mode 100644 index 0000000..c50bbee --- /dev/null +++ b/bitrix/php_interface/include/catalog_import/csv_new_setup.php @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/bitrix/php_interface/init.php b/bitrix/php_interface/init.php new file mode 100644 index 0000000..abbd4fd --- /dev/null +++ b/bitrix/php_interface/init.php @@ -0,0 +1,43 @@ +" . print_r($data, true) . ""; +} + +function getAverageRating($reviews): float +{ + $totalRating = 0; + $count = 0; + + if (!$reviews) return 0; + + foreach ($reviews as $review) { + if (!empty($review['SUB_VALUES']['REV_RATING']['VALUE'])) { + $rating = (float)$review['SUB_VALUES']['REV_RATING']['VALUE']; + $totalRating += $rating; + $count++; + } + } + + return $count > 0 ? round($totalRating / $count, 1) : 0; +} + +function getReviewWordForm($reviews): string { + + if (!$reviews) return 'отзыв'; + + $count = count($reviews); + + $mod10 = $count % 10; + $mod100 = $count % 100; + + if ($mod10 == 1 && $mod100 != 11) { + return 'отзыв'; + } elseif (in_array($mod10, [2, 3, 4]) && !in_array($mod100, [12, 13, 14])) { + return 'отзыва'; + } else { + return 'отзывов'; + } +} \ No newline at end of file diff --git a/bitrix/php_interface/subscribe/templates/store_news_s1/description.php b/bitrix/php_interface/subscribe/templates/store_news_s1/description.php new file mode 100644 index 0000000..cb47993 --- /dev/null +++ b/bitrix/php_interface/subscribe/templates/store_news_s1/description.php @@ -0,0 +1,9 @@ +GetMessage("news_template_name"), + "DESCRIPTION"=>GetMessage("news_template_desc") + ); +?> \ No newline at end of file diff --git a/bitrix/php_interface/subscribe/templates/store_news_s1/lang/en/description.php b/bitrix/php_interface/subscribe/templates/store_news_s1/lang/en/description.php new file mode 100644 index 0000000..cdc3b1f --- /dev/null +++ b/bitrix/php_interface/subscribe/templates/store_news_s1/lang/en/description.php @@ -0,0 +1,4 @@ + \ No newline at end of file diff --git a/bitrix/php_interface/subscribe/templates/store_news_s1/lang/ru/description.php b/bitrix/php_interface/subscribe/templates/store_news_s1/lang/ru/description.php new file mode 100644 index 0000000..ad70373 --- /dev/null +++ b/bitrix/php_interface/subscribe/templates/store_news_s1/lang/ru/description.php @@ -0,0 +1,4 @@ + \ No newline at end of file diff --git a/bitrix/php_interface/subscribe/templates/store_news_s1/template.php b/bitrix/php_interface/subscribe/templates/store_news_s1/template.php new file mode 100644 index 0000000..79a3dcb --- /dev/null +++ b/bitrix/php_interface/subscribe/templates/store_news_s1/template.php @@ -0,0 +1,41 @@ + + + +

Новости магазина

+

IncludeComponent( + "bitrix:subscribe.news", + "", + Array( + "SITE_ID" => "s1", + "IBLOCK_TYPE" => "news", + "ID" => "", + "SORT_BY" => "ACTIVE_FROM", + "SORT_ORDER" => "DESC", + ), + null, + array( + "HIDE_ICONS" => "Y", + ) +);?>

+$SUBSCRIBE_TEMPLATE_RUBRIC["NAME"], + "BODY_TYPE"=>"html", + "CHARSET"=>"UTF-8", + "DIRECT_SEND"=>"Y", + "FROM_FIELD"=>$SUBSCRIBE_TEMPLATE_RUBRIC["FROM_FIELD"], + ); +else + return false; +?> \ No newline at end of file diff --git a/bitrix/templates/.default/ajax/ajax.css b/bitrix/templates/.default/ajax/ajax.css new file mode 100644 index 0000000..eff7a05 --- /dev/null +++ b/bitrix/templates/.default/ajax/ajax.css @@ -0,0 +1,3 @@ +iframe.waitwindowlocal {position:absolute; border:0px; z-index:9999;} +div.waitwindowlocal {position:absolute; width:25px; height: 25px; padding:0px; z-index:10000; background-color:#FCF7D1; border:1px solid #E1B52D; background-image:url(images/wait.gif); background-position:center center; background-repeat:no-repeat;} +div.waitwindowlocalshadow {position:absolute; z-index:9998; background-image:url(images/shadow.gif); border:1px solid #808080;} diff --git a/bitrix/templates/.default/ajax/ajax.min.css b/bitrix/templates/.default/ajax/ajax.min.css new file mode 100644 index 0000000..cade9b8 --- /dev/null +++ b/bitrix/templates/.default/ajax/ajax.min.css @@ -0,0 +1 @@ +iframe.waitwindowlocal{position:absolute;border:0;z-index:9999}div.waitwindowlocal{position:absolute;width:25px;height:25px;padding:0;z-index:10000;background-color:#fcf7d1;border:1px solid #e1b52d;background-image:url(images/wait.gif);background-position:center center;background-repeat:no-repeat}div.waitwindowlocalshadow{position:absolute;z-index:9998;background-image:url(images/shadow.gif);border:1px solid #808080} \ No newline at end of file diff --git a/bitrix/templates/.default/ajax/images/shadow.gif b/bitrix/templates/.default/ajax/images/shadow.gif new file mode 100644 index 0000000..850ed74 Binary files /dev/null and b/bitrix/templates/.default/ajax/images/shadow.gif differ diff --git a/bitrix/templates/.default/ajax/images/wait.gif b/bitrix/templates/.default/ajax/images/wait.gif new file mode 100644 index 0000000..00334a8 Binary files /dev/null and b/bitrix/templates/.default/ajax/images/wait.gif differ diff --git a/bitrix/templates/.default/components/bitrix/menu/horizontal_multilevel2/.description.php b/bitrix/templates/.default/components/bitrix/menu/horizontal_multilevel2/.description.php new file mode 100644 index 0000000..a43c5fe --- /dev/null +++ b/bitrix/templates/.default/components/bitrix/menu/horizontal_multilevel2/.description.php @@ -0,0 +1,8 @@ + GetMessage("MENU_HORIZONT_MULTI_NAME"), + "DESCRIPTION" => GetMessage("MENU_HORIZONT_MULTI_DESC"), +); +?> \ No newline at end of file diff --git a/bitrix/templates/.default/components/bitrix/menu/horizontal_multilevel2/images/arrow.gif b/bitrix/templates/.default/components/bitrix/menu/horizontal_multilevel2/images/arrow.gif new file mode 100644 index 0000000..9370948 Binary files /dev/null and b/bitrix/templates/.default/components/bitrix/menu/horizontal_multilevel2/images/arrow.gif differ diff --git a/bitrix/templates/.default/components/bitrix/menu/horizontal_multilevel2/images/header_menu_bg.gif b/bitrix/templates/.default/components/bitrix/menu/horizontal_multilevel2/images/header_menu_bg.gif new file mode 100644 index 0000000..501071b Binary files /dev/null and b/bitrix/templates/.default/components/bitrix/menu/horizontal_multilevel2/images/header_menu_bg.gif differ diff --git a/bitrix/templates/.default/components/bitrix/menu/horizontal_multilevel2/images/lock.gif b/bitrix/templates/.default/components/bitrix/menu/horizontal_multilevel2/images/lock.gif new file mode 100644 index 0000000..3837a21 Binary files /dev/null and b/bitrix/templates/.default/components/bitrix/menu/horizontal_multilevel2/images/lock.gif differ diff --git a/bitrix/templates/.default/components/bitrix/menu/horizontal_multilevel2/lang/de/.description.php b/bitrix/templates/.default/components/bitrix/menu/horizontal_multilevel2/lang/de/.description.php new file mode 100644 index 0000000..1b24122 --- /dev/null +++ b/bitrix/templates/.default/components/bitrix/menu/horizontal_multilevel2/lang/de/.description.php @@ -0,0 +1,4 @@ + \ No newline at end of file diff --git a/bitrix/templates/.default/components/bitrix/menu/horizontal_multilevel2/lang/en/.description.php b/bitrix/templates/.default/components/bitrix/menu/horizontal_multilevel2/lang/en/.description.php new file mode 100644 index 0000000..61d7f88 --- /dev/null +++ b/bitrix/templates/.default/components/bitrix/menu/horizontal_multilevel2/lang/en/.description.php @@ -0,0 +1,4 @@ + \ No newline at end of file diff --git a/bitrix/templates/.default/components/bitrix/menu/horizontal_multilevel2/lang/en/template.php b/bitrix/templates/.default/components/bitrix/menu/horizontal_multilevel2/lang/en/template.php new file mode 100644 index 0000000..0d7a6c6 --- /dev/null +++ b/bitrix/templates/.default/components/bitrix/menu/horizontal_multilevel2/lang/en/template.php @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/bitrix/templates/.default/components/bitrix/menu/horizontal_multilevel2/lang/ru/.description.php b/bitrix/templates/.default/components/bitrix/menu/horizontal_multilevel2/lang/ru/.description.php new file mode 100644 index 0000000..4cf2465 --- /dev/null +++ b/bitrix/templates/.default/components/bitrix/menu/horizontal_multilevel2/lang/ru/.description.php @@ -0,0 +1,4 @@ + \ No newline at end of file diff --git a/bitrix/templates/.default/components/bitrix/menu/horizontal_multilevel2/lang/ru/template.php b/bitrix/templates/.default/components/bitrix/menu/horizontal_multilevel2/lang/ru/template.php new file mode 100644 index 0000000..fc6d7cb --- /dev/null +++ b/bitrix/templates/.default/components/bitrix/menu/horizontal_multilevel2/lang/ru/template.php @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/bitrix/templates/.default/components/bitrix/menu/horizontal_multilevel2/script.js b/bitrix/templates/.default/components/bitrix/menu/horizontal_multilevel2/script.js new file mode 100644 index 0000000..bcef060 --- /dev/null +++ b/bitrix/templates/.default/components/bitrix/menu/horizontal_multilevel2/script.js @@ -0,0 +1,22 @@ +var jshover = function() +{ + var menuDiv = document.getElementById("horizontal-multilevel-menu") + if (!menuDiv) + return; + + var sfEls = menuDiv.getElementsByTagName("li"); + for (var i=0; i + + +