Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/landing/lib/update/block/ |
Upload File : |
<?php namespace Bitrix\Landing\Update\Block; use Bitrix\Landing\Internals\BlockTable; class FontWeight { // todo: check this! protected const FONT_BOLD_MATCHER = '/font-weight-bold/i'; /** * @var integer */ protected $blockId; /** * @var string */ protected $content; public function __construct($blockId, $content) { $this->blockId = $blockId; $this->content = $content; } public function update(): void { // todo: what about partners? !!!!!!!!!!!!! $this->changeWeightClass(); $this->save(); } protected function save(): void { BlockTable::update( $this->blockId, [ 'CONTENT' => $this->content ] ); } protected function changeWeightClass() { $this->content = preg_replace(self::FONT_BOLD_MATCHER, 'g-font-weight-700', $this->content); } public static function updateLanding(int $lid): void { $res = BlockTable::getList( [ 'select' => [ 'ID', 'CONTENT' ], 'filter' => [ 'LID' => $lid, ], ] ); while ($row = $res->fetch()) { $block = new self($row['ID'], $row['CONTENT']); $block->update(); } } }