91 if(!isset(self::$iblockCache[$fields[
'IBLOCK_ID']]))
93 self::$iblockCache[$fields[
'IBLOCK_ID']] = array();
95 $dbRes = self::getList(array(
97 'IBLOCK_ID' => $fields[
'IBLOCK_ID']
99 'select' => array(
'SITEMAP_ID',
100 'SITE_ID' =>
'SITEMAP.SITE_ID',
'SITEMAP_SETTINGS' =>
'SITEMAP.SETTINGS',
101 'IBLOCK_CODE' =>
'IBLOCK.CODE',
'IBLOCK_XML_ID' =>
'IBLOCK.XML_ID',
102 'DETAIL_PAGE_URL' =>
'IBLOCK.DETAIL_PAGE_URL',
103 'SECTION_PAGE_URL' =>
'IBLOCK.SECTION_PAGE_URL',
107 while($res = $dbRes->fetch())
109 self::$iblockCache[$fields[
'IBLOCK_ID']][] = $res;
113 foreach(self::$iblockCache[$fields[
'IBLOCK_ID']] as $res)
115 $sitemapSettings = unserialize($res[
'SITEMAP_SETTINGS'], [
'allowed_classes' =>
false]);
119 if($itemType == self::TYPE_SECTION)
123 $sitemapSettings[
'IBLOCK_SECTION_SECTION'][$fields[
'IBLOCK_ID']],
124 $sitemapSettings[
'IBLOCK_SECTION'][$fields[
'IBLOCK_ID']]
129 if(is_array($fields[
'IBLOCK_SECTION']) && count($fields[
'IBLOCK_SECTION']) > 0)
131 foreach($fields[
'IBLOCK_SECTION'] as $sectionId)
135 $sitemapSettings[
'IBLOCK_SECTION_ELEMENT'][$fields[
'IBLOCK_ID']],
136 $sitemapSettings[
'IBLOCK_ELEMENT'][$fields[
'IBLOCK_ID']]
147 $add = $sitemapSettings[
'IBLOCK_ELEMENT'][$fields[
'IBLOCK_ID']] ==
'Y';
154 'IBLOCK_CODE' => $res[
'IBLOCK_CODE'],
155 'IBLOCK_XML_ID' => $res[
'IBLOCK_XML_ID'],
156 'DETAIL_PAGE_URL' => $res[
'DETAIL_PAGE_URL'],
157 'SECTION_PAGE_URL' => $res[
'SECTION_PAGE_URL'],
158 'SITE_ID' => $res[
'SITE_ID'],
159 'PROTOCOL' => $sitemapSettings[
'PROTO'] == 1 ?
'https' :
'http',
160 'DOMAIN' => $sitemapSettings[
'DOMAIN'],
161 'ROBOTS' => $sitemapSettings[
'ROBOTS'],
162 'SITEMAP_DIR' => $sitemapSettings[
'DIR'],
163 'SITEMAP_FILE' => $sitemapSettings[
'FILENAME_INDEX'],
164 'SITEMAP_FILE_IBLOCK' => $sitemapSettings[
'FILENAME_IBLOCK'],
181 public static function checkSection($sectionId, $sectionSettings, $defaultValue)
183 $value = $defaultValue;
185 if(is_array($sectionSettings) && count($sectionSettings) > 0)
187 while ($sectionId > 0)
189 if(isset($sectionSettings[$sectionId]))
191 $value = $sectionSettings[$sectionId];
195 $dbRes = \CIBlockSection::getList(array(), array(
'ID' => $sectionId),
false, array(
'ID',
'IBLOCK_SECTION_ID'));
196 $section = $dbRes->fetch();
198 $sectionId = $section[
"IBLOCK_SECTION_ID"];
202 return $value ===
'Y';