1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
fontfix.php
См. документацию.
1<?php
2
3namespace Bitrix\Landing\Update\Assets;
4
5use Bitrix\Landing\Internals\HookDataTable;
6use Bitrix\Main\Update\Stepper;
7
8final class FontFix extends Stepper
9{
10 protected const FONT_PARAMS = ':wght@300;400;500;600;700;900';
11 protected const PART_FONT_PATH = 'css2';
12 protected const STEP_PORTION = 10;
13 protected const CONTINUE_EXECUTING = true;
14 protected const STOP_EXECUTING = false;
15
21 public function execute(array &$result): bool
22 {
23 $res = HookDataTable::getList(
24 [
25 'select' => [
26 'ID', 'VALUE'
27 ],
28 'filter' => [
29 'HOOK' => 'FONTS',
30 ],
31 ]
32 );
33 if (!$result['count'])
34 {
35 $result['count'] = count($res);
36 }
37 if (!$result['steps'])
38 {
39 $result['steps'] = 0;
40 }
41
42 if (!$result['checkedRows'])
43 {
44 $result['checkedRows'] = 0;
45 }
46
47 $countFixedRows = 0;
48 $countRows = 0;
49 while ($row = $res->fetch())
50 {
51 $result["steps"] = $result["steps"]++;
52 if ($countRows > $result['checkedRows'])
53 {
54 $result['checkedRows']++;
55 preg_match_all(
56 '#(<noscript>.*?<style.*?data-id="([^"]+)"[^>]*>[^<]+</style>)#is',
57 $row['VALUE'],
59 );
60 $matchesNew = preg_replace(
61 '/(href="[^"]*)(css)([?]family=)([\w+]+)[^"]*(")/i',
62 '${1}'.self::PART_FONT_PATH.'$3$4'.self::FONT_PARAMS.'$5',
63 $matches[1]
64 );
65 if ($matches[1] !== $matchesNew)
66 {
67 $countFixedRows++;
68 $value = str_replace($matches[1], $matchesNew, $row['VALUE']);
69 HookDataTable::update(
70 $row['ID'],
71 ['VALUE' => $value]
72 );
73 if ($countFixedRows === self::STEP_PORTION)
74 {
75 $result['checkedRows'] = $countRows;
76 return self::CONTINUE_EXECUTING;
77 }
78 }
79 }
80 $countRows++;
81 }
82
83 return self::STOP_EXECUTING;
84 }
85}
const CONTINUE_EXECUTING
Определения fontfix.php:13
execute(array &$result)
Определения fontfix.php:21
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$res
Определения filter_act.php:7
$result
Определения get_property_values.php:14
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
Определения waybill.php:936
$matches
Определения index.php:22