2026-10-05 GLOBAL

This commit is contained in:
Dekart Deploy Bot 2026-10-06 14:30:35 +00:00
parent e910bb61ef
commit d7b959147c
26 changed files with 302 additions and 65 deletions

View File

@ -0,0 +1,2 @@
/*! admin-branch-tabs.css (minified) */
.dekart-branch-tabs{display: flex;align-items: flex-start;gap: 20px;max-width: 1100px;margin-top: 4px;}.dekart-branch-tabs__nav{flex: 0 0 260px;position: sticky;top: 46px;background: rgba(255,255,255,0.06);border: 1px solid var(--cf-border,#c3c4c7);border-radius: 8px;padding: 8px;box-sizing: border-box;}.dekart-branch-tabs__nav ul{margin: 0;padding: 0;list-style: none;display: flex;flex-direction: column;gap: 2px;}.dekart-branch-tabs__nav button{display: block;width: 100%;text-align: left;padding: 9px 12px;font-size: 13px;line-height: 1.3;font-weight: 600;color: var(--cf-text-muted,#646970);background: transparent;border: 0;border-radius: 6px;cursor: pointer;transition: background 0.15s ease,color 0.15s ease;font-family: inherit;}.dekart-branch-tabs__nav button:hover{background: rgba(0,0,0,0.08);color: var(--cf-text,#1d2327);}body.branch-settings_page_branch-settings .dekart-branch-tabs__nav button:hover,body.toplevel_page_branch-settings .dekart-branch-tabs__nav button:hover{background: rgba(255,255,255,0.1);}.dekart-branch-tabs__nav button.is-active{background: var(--wp-admin-theme-color,#2271b1);color: #fff;box-shadow: 0 1px 3px rgba(0,0,0,0.25);}.dekart-branch-tabs__content{flex: 1 1 auto;min-width: 0;}.dekart-branch-tabs__content .branch-section{display: none;max-width: none;}.dekart-branch-tabs__content .branch-section.is-active{display: block;}.dekart-branch-tabs__content .branch-section h2{display: none;}.dekart-branch-tabs__content .branch-section:first-child .branch-section-body{display: grid;grid-template-columns: repeat(2,minmax(0,1fr));column-gap: 32px;align-items: start;}.dekart-branch-tabs__content .branch-section:first-child .branch-field:last-child{grid-column: 1 / -1;}@media (max-width: 782px){.dekart-branch-tabs{flex-direction: column;gap: 12px;}.dekart-branch-tabs__nav{flex: none;position: static;width: 100%;}.dekart-branch-tabs__nav ul{flex-direction: row;flex-wrap: wrap;}.dekart-branch-tabs__nav button{width: auto;white-space: nowrap;}.dekart-branch-tabs__content .branch-section:first-child .branch-section-body{grid-template-columns: 1fr;}}

View File

@ -0,0 +1,2 @@
/*! admin-teacher-tabs.css (minified) */
body.post-type-teacher .cf-container__tabs--tabbed-vertical .cf-container__tabs-list .cf-container__tabs-item--current{background: #fff;}body.post-type-teacher .cf-container__tabs--tabbed-vertical .cf-container__tabs-list .cf-container__tabs-item--current button{font-weight: 700;color: #1d2327;box-shadow: inset 3px 0 0 var(--wp-admin-theme-color,#2271b1);}body.post-type-teacher .cf-container__fields{padding: 16px 18px 20px;}body.post-type-teacher.dekart-cf-tabs-broken .postbox{outline: 2px dashed #d63638;outline-offset: -6px;}@media (max-width: 782px){body.post-type-teacher .cf-container--tabbed-vertical{flex-direction: column;}body.post-type-teacher .cf-container__tabs--tabbed-vertical{width: 100%;border-right: 0;border-bottom: 1px solid #e2e4e7;}}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,7 @@
/* critical-home.css — critical above-fold styles for front-page only */
:root{--main-color:#BF568E;--main-blue:#006DB7;--main-yellow:#FFD43E;--color-primary:#2563EB;--color-primary-dark:#1D4ED8;--color-primary-hover:#1E40AF;--color-secondary:#F59E0B;--color-bg-dark:#0F172A;--color-text:#0F172A;--color-text-muted:#475569;--color-text-light:#64748B;--color-rating:#F59E0B;--color-accent:#FFD43E;--color-focus-ring:rgba(37,99,235,.4);--font-display:"Plus Jakarta Sans","Inter","Oswald",sans-serif;--font-body:"Inter","Roboto",-apple-system,sans-serif;--text-body-sm:14px;--space-1:4px;--space-2:8px;--space-3:16px;--radius-sm:12px;--radius-md:20px;--radius-lg:24px;--radius-pill:100px;--radius-xl:24px;--shadow-sm:0 2px 12px rgba(15,23,42,.06);--shadow-md:0 8px 24px rgba(15,23,42,.1);--shadow-lg:0 16px 40px rgba(15,23,42,.12);--transition-fast:200ms ease-out;--transition-base:300ms ease-out;--focus-ring:0 0 0 4px var(--color-focus-ring);--z-index-header:200;--z-index-fixed:300;--z-index-modal:500;--accent-light:#F5F3FF;--accent-200:#DDD6FE;--accent-500:#8B5CF6;--accent-700:#5B21B6;--bg-soft:#F8FAFC;--text-tertiary:#94A3B8;--shadow-xl:0 20px 50px rgba(0,0,0,.15);--card-radius:20px;--card-shadow:0 2px 16px rgba(0,0,0,.06)}
html{overflow-x:hidden;height:auto}
body{overflow-x:hidden;color:#000;font-family:Roboto;background:#FFF;margin:0}
body{overflow-x:hidden;color:#000;font-family:Roboto,"Roboto fallback",sans-serif;background:#FFF;margin:0}
main{display:flex;flex-direction:column;gap:0}
.ds-container{max-width:1280px;margin:0 auto;padding-inline:16px}
@media(min-width:768px){.ds-container{padding-inline:24px}}

File diff suppressed because one or more lines are too long

View File

@ -118,3 +118,16 @@
src: url('../fonts/Roboto-900.woff2') format('woff2'),
url('../fonts/Roboto-900.ttf') format('truetype');
}
/* Метрик-совместимый fallback Roboto (снижает CLS при подмене шрифта) */
@font-face {
font-family: 'Roboto fallback';
font-style: normal;
font-weight: 400 700;
font-display: swap;
src: local('Arial');
size-adjust: 100.3%;
ascent-override: 92.77%;
descent-override: 24.41%;
line-gap-override: 0%;
}

View File

@ -0,0 +1,2 @@
/*! fonts.css (minified) */
@font-face{font-family: 'Oswald';font-style: normal;font-weight: 400;font-display: swap;src: url('../fonts/Oswald-400.woff2') format('woff2'),url('../fonts/Oswald-400.ttf') format('truetype');}@font-face{font-family: 'Oswald';font-style: normal;font-weight: 500;font-display: swap;src: url('../fonts/Oswald-500.woff2') format('woff2'),url('../fonts/Oswald-500.ttf') format('truetype');}@font-face{font-family: 'Oswald';font-style: normal;font-weight: 600;font-display: swap;src: url('../fonts/Oswald-600.woff2') format('woff2'),url('../fonts/Oswald-600.ttf') format('truetype');}@font-face{font-family: 'Oswald';font-style: normal;font-weight: 700;font-display: swap;src: url('../fonts/Oswald-700.woff2') format('woff2'),url('../fonts/Oswald-700.ttf') format('truetype');}@font-face{font-family: 'Plus Jakarta Sans';font-style: normal;font-weight: 500;font-display: swap;src: url('../fonts/PlusJakartaSans-500.woff2') format('woff2'),url('../fonts/PlusJakartaSans-500.ttf') format('truetype');}@font-face{font-family: 'Plus Jakarta Sans';font-style: normal;font-weight: 600;font-display: swap;src: url('../fonts/PlusJakartaSans-600.woff2') format('woff2'),url('../fonts/PlusJakartaSans-600.ttf') format('truetype');}@font-face{font-family: 'Plus Jakarta Sans';font-style: normal;font-weight: 700;font-display: swap;src: url('../fonts/PlusJakartaSans-700.woff2') format('woff2'),url('../fonts/PlusJakartaSans-700.ttf') format('truetype');}@font-face{font-family: 'Plus Jakarta Sans';font-style: normal;font-weight: 800;font-display: swap;src: url('../fonts/PlusJakartaSans-800.woff2') format('woff2'),url('../fonts/PlusJakartaSans-800.ttf') format('truetype');}@font-face{font-family: 'Roboto';font-style: normal;font-weight: 400;font-stretch: normal;font-display: swap;src: url('../fonts/Roboto-400.woff2') format('woff2'),url('../fonts/Roboto-400.ttf') format('truetype');}@font-face{font-family: 'Roboto';font-style: normal;font-weight: 500;font-stretch: normal;font-display: swap;src: url('../fonts/Roboto-500.woff2') format('woff2'),url('../fonts/Roboto-500.ttf') format('truetype');}@font-face{font-family: 'Roboto';font-style: normal;font-weight: 600;font-stretch: normal;font-display: swap;src: url('../fonts/Roboto-600.woff2') format('woff2'),url('../fonts/Roboto-600.ttf') format('truetype');}@font-face{font-family: 'Roboto';font-style: normal;font-weight: 700;font-stretch: normal;font-display: swap;src: url('../fonts/Roboto-700.woff2') format('woff2'),url('../fonts/Roboto-700.ttf') format('truetype');}@font-face{font-family: 'Roboto';font-style: normal;font-weight: 900;font-stretch: normal;font-display: swap;src: url('../fonts/Roboto-900.woff2') format('woff2'),url('../fonts/Roboto-900.ttf') format('truetype');}@font-face{font-family: 'Roboto fallback';font-style: normal;font-weight: 400 700;font-display: swap;src: local('Arial');size-adjust: 100.3%;ascent-override: 92.77%;descent-override: 24.41%;line-gap-override: 0%;}

File diff suppressed because one or more lines are too long

View File

@ -551,7 +551,7 @@ html {
body {
color: #000;
font-family: Roboto;
font-family: Roboto, 'Roboto fallback', sans-serif;
background: #FFF;
}
@ -4645,12 +4645,12 @@ footer a {
}
.footer-last-row a {
color: var(--main-blue);
color: #6FB6E8;
}
footer a:hover,
.footer_links .sub-menu a:hover {
color: var(--main-color);
color: #E9A0CE;
}
/* footer END */

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,2 @@
/*! reset.css (minified) */
*{padding: 0;margin: 0;border: 0;}*,*:before,*:after{-moz-box-sizing: border-box;-webkit-box-sizing: border-box;box-sizing: border-box;}:focus,:active{outline: none;}a:focus,a:active{outline: none;}nav,footer,header,aside{display: block;}html,body{height: 100%;width: 100%;font-size: 100%;font-size: 14px;-ms-text-size-adjust: 100%;-moz-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;overflow-x: hidden;}input::-ms-clear{display: none;}button{cursor: pointer;background: transparent;}button::-moz-focus-inner{padding: 0;border: 0;}a,a:visited{text-decoration: none;}a:hover{text-decoration: none;}ul li{list-style: none;}img{vertical-align: top;}p{margin: 0;padding: 0;}h1,h2,h3,h4,h5,h6{font-size: inherit;font-weight: 400;}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -204,16 +204,42 @@ document.querySelectorAll('.header-menu').forEach(item => {
progressBar.className = 'pksh-scroll-progress';
document.body.prepend(progressBar);
function updateProgress() {
var maxScroll = 0;
var ticking = false;
// геометрию читаем только вне обработчика scroll
function measure() {
maxScroll = document.documentElement.scrollHeight - document.documentElement.clientHeight;
}
function paint() {
ticking = false;
var scrollTop = window.pageYOffset || document.documentElement.scrollTop;
var docHeight = document.documentElement.scrollHeight - document.documentElement.clientHeight;
var progress = (scrollTop / docHeight) * 100;
var progress = maxScroll > 0 ? (scrollTop / maxScroll) * 100 : 0;
if (progress < 0) { progress = 0; }
if (progress > 100) { progress = 100; }
progressBar.style.width = progress + '%';
}
window.addEventListener('scroll', updateProgress, { passive: true });
window.addEventListener('resize', updateProgress, { passive: true });
updateProgress();
function onScroll() {
if (!ticking) {
ticking = true;
window.requestAnimationFrame(paint);
}
}
function onResize() {
window.requestAnimationFrame(function () { measure(); paint(); });
}
window.addEventListener('scroll', onScroll, { passive: true });
window.addEventListener('resize', onResize, { passive: true });
if ('ResizeObserver' in window) {
new ResizeObserver(measure).observe(document.documentElement);
}
measure();
paint();
})();
/* ── Desktop Sticky CTA — show after hero ── */

View File

@ -45,7 +45,7 @@ $exam_url = ( $exam_host && str_ends_with($exam_host, '.dekart.school') )
href="tel:<?php echo preg_replace('/[^0-9+]/', '', carbon_get_theme_option('site_phone')); ?>">
<img width="27" height="27"
src="<?php echo esc_url(get_template_directory_uri()); ?>/assets/images/icon-phone.svg"
alt="Телефон" loading="lazy" style="margin-left:-3px">
alt="" loading="lazy" style="margin-left:-3px">
<span><?php echo esc_html(carbon_get_theme_option('site_phone')); ?></span>
</a>
<div class="footer_mobile mobile">
@ -100,7 +100,7 @@ if (! empty($b24_raw)) {
<button class="btn-close-request-form" aria-label="Закрыть форму">
<img class="btn-close-request-form-img"
src="<?php echo esc_url(get_template_directory_uri()); ?>/assets/images/btn-close-modal.svg"
alt="Закрыть"
alt=""
loading="lazy">
</button>
<div class="form-wrapper__offer">

View File

@ -2974,12 +2974,8 @@ function enqueue_template_specific_styles()
// Front page
if (is_page_template('front-page.php') || is_front_page()) {
wp_enqueue_style(
'front-page-style',
get_template_directory_uri() . '/assets/css/front-page.css',
array(),
filemtime(get_template_directory() . '/assets/css/front-page.css')
);
$__fp_css = dekart_css_asset('front-page.css');
wp_enqueue_style('front-page-style', $__fp_css['url'], array(), $__fp_css['ver']);
wp_enqueue_script(
'front-page-script',
get_template_directory_uri() . '/assets/js/front-page.js',
@ -2998,12 +2994,8 @@ function enqueue_template_specific_styles()
// Страница начальной школы — hero в стиле главной + cta-секция
if (is_page_template('page-elementary-school.php')) {
wp_enqueue_style(
'front-page-style',
get_template_directory_uri() . '/assets/css/front-page.css',
array(),
filemtime(get_template_directory() . '/assets/css/front-page.css')
);
$__fp_css = dekart_css_asset('front-page.css');
wp_enqueue_style('front-page-style', $__fp_css['url'], array(), $__fp_css['ver']);
wp_enqueue_style(
'school-style',
get_template_directory_uri() . '/assets/css/school.css',
@ -3028,12 +3020,8 @@ function enqueue_template_specific_styles()
// Страница КЛАССА начальной школы — наследует стили школы + свои
if (is_page_template('page-class.php')) {
wp_enqueue_style(
'front-page-style',
get_template_directory_uri() . '/assets/css/front-page.css',
array(),
filemtime(get_template_directory() . '/assets/css/front-page.css')
);
$__fp_css = dekart_css_asset('front-page.css');
wp_enqueue_style('front-page-style', $__fp_css['url'], array(), $__fp_css['ver']);
wp_enqueue_style(
'school-style',
get_template_directory_uri() . '/assets/css/school.css',
@ -3101,13 +3089,7 @@ function dekart_ping_indexnow($post_id, $post)
/**
* CrUX — Chrome User Experience Report.
* Добавляет заголовок для мониторинга реальных пользовательских метрик.
*/
add_action('send_headers', function () {
if (! is_admin()) {
header('Link: <https://chromeuxreport.googleapis.com/>; rel=preconnect', false);
}
});
// Очистка метабоксов на странице Подготовка к школе — оставить только CF и Yoast
add_action('load-post.php', function () {
@ -3158,14 +3140,32 @@ function enqueue_block_library_global_styles(): void
if (! file_exists($file_path)) {
return;
}
wp_enqueue_style(
'block-library-global-styles',
get_template_directory_uri() . '/assets/css/block-library-global-styles.css',
array(),
filemtime($file_path)
);
$asset = dekart_css_asset('block-library-global-styles.css');
wp_enqueue_style('block-library-global-styles', $asset['url'], array(), $asset['ver']);
}
// Глобальные/некритичные стили — не блокируем рендер (preload + onload)
add_filter('style_loader_tag', static function ($tag, $handle) {
if (is_admin()) {
return $tag;
}
$defer = ( 'block-library-global-styles' === $handle );
// front-page.css не критичен на главной (критический CSS заинлайнен)
if ('front-page-style' === $handle && is_front_page()) {
$defer = true;
}
if (! $defer || false !== strpos($tag, "rel='preload'")) {
return $tag;
}
$preload = preg_replace(
"/rel=['\"]stylesheet['\"]/i",
"rel='preload' as='style' onload=\"this.onload=null;this.rel='stylesheet'\"",
$tag,
1
);
return $preload . '<noscript>' . $tag . '</noscript>';
}, 10, 2);
/**
* Helper: determine if current page needs Swiper slider assets.
*
@ -3529,7 +3529,7 @@ function dekart_security_headers(): void
header('X-Frame-Options: SAMEORIGIN');
header('Referrer-Policy: strict-origin-when-cross-origin');
// Content-Security-Policy — базовый, без блокировки легаси-скриптов
header("Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://cdn-ru.bitrix24.ru https://alee.bitrix24.ru https://api-maps.yandex.ru https://yastatic.net https://cdn.jsdelivr.net https://www.google.com https://www.gstatic.com https://www.googletagmanager.com https://mc.yandex.ru; style-src 'self' 'unsafe-inline' https://cdn.jsdelivr.net https://alee.bitrix24.ru; img-src 'self' data: https: blob:; font-src 'self' data:; frame-src 'self' https://cdn-ru.bitrix24.ru https://alee.bitrix24.ru https://www.google.com; connect-src 'self' https://api-maps.yandex.ru https://yastatic.net https://cdn-ru.bitrix24.ru https://alee.bitrix24.ru https://mc.yandex.ru wss://mc.yandex.ru; object-src 'none'; base-uri 'self'; form-action 'self' https://alee.bitrix24.ru;");
header("Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://cdn-ru.bitrix24.ru https://alee.bitrix24.ru https://api-maps.yandex.ru https://yastatic.net https://cdn.jsdelivr.net https://www.google.com https://www.gstatic.com https://www.googletagmanager.com https://mc.yandex.ru https://mc.yandex.com; style-src 'self' 'unsafe-inline' https://cdn.jsdelivr.net https://alee.bitrix24.ru; img-src 'self' data: https: blob:; font-src 'self' data:; frame-src 'self' https://cdn-ru.bitrix24.ru https://alee.bitrix24.ru https://www.google.com; connect-src 'self' https://api-maps.yandex.ru https://yastatic.net https://cdn-ru.bitrix24.ru https://alee.bitrix24.ru https://mc.yandex.ru wss://mc.yandex.ru https://mc.yandex.com wss://mc.yandex.com; object-src 'none'; base-uri 'self'; form-action 'self' https://alee.bitrix24.ru;");
}
}
@ -3737,6 +3737,19 @@ function dekart_counters_page()
<?php
}
// Отложенный (idle/взаимодействие) инжектор произвольных скриптов с сохранением порядка
function dekart_deferred_loader_script($blocks, int $timeout = 3000): string
{
$blocks = array_values(array_filter((array) $blocks, static function ($b) {
return '' !== trim((string) $b);
}));
if (! $blocks) {
return '';
}
$json = wp_json_encode($blocks, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
return '<script>(function(){var B=' . $json . ';var done=false;function inject(){if(done){return;}done=true;B.forEach(function(html){var t=document.createElement("template");t.innerHTML=html;Array.prototype.slice.call(t.content.childNodes).forEach(function(n){var node;if(n.nodeName==="SCRIPT"){node=document.createElement("script");for(var i=0;i<n.attributes.length;i++){node.setAttribute(n.attributes[i].name,n.attributes[i].value);}node.text=n.textContent||"";}else{node=n.cloneNode(true);}(document.head||document.documentElement).appendChild(node);});});}var ev=["scroll","click","keydown","mousemove","touchstart","pointerdown"];function go(){ev.forEach(function(e){window.removeEventListener(e,go);});inject();}ev.forEach(function(e){window.addEventListener(e,go,{passive:true,once:true});});if(window.requestIdleCallback){requestIdleCallback(inject,{timeout:' . (int) $timeout . '});}else{setTimeout(inject,' . (int) $timeout . ');}})();</script>';
}
add_action('wp_head', 'dekart_output_counters', 1);
function dekart_output_counters()
{
@ -3745,12 +3758,21 @@ function dekart_output_counters()
}
$yandex = stripslashes(get_option('dekart_counter_yandex', ''));
$gtmhead = stripslashes(get_option('dekart_counter_gtm_head', ''));
if ($yandex) {
echo "\n" . $yandex . "\n";
$blocks = array();
if (trim((string) $yandex)) {
$blocks[] = $yandex;
}
if ($gtmhead) {
echo "\n" . $gtmhead . "\n";
if (trim((string) $gtmhead)) {
$blocks[] = $gtmhead;
}
if (! $blocks) {
return;
}
// Ранние stub-ы: цели, вызванные до загрузки счётчиков, встают в очередь
echo '<script>window.dataLayer=window.dataLayer||[];window.gtag=window.gtag||function(){window.dataLayer.push(arguments);};window.ym=window.ym||function(){(window.ym.a=window.ym.a||[]).push(arguments);};window.ym.l=1*new Date();</script>' . "\n";
echo dekart_deferred_loader_script($blocks, 3000) . "\n";
}
add_action('wp_body_open', 'dekart_output_gtm_body', 1);
@ -3772,8 +3794,9 @@ function dekart_output_counters_footer()
return;
}
$footer = stripslashes(get_option('dekart_counter_footer', ''));
if ($footer) {
echo "\n" . $footer . "\n";
if (trim((string) $footer)) {
// Чат/CRM/пиксели — грузим лениво, не блокируя первый рендер
echo dekart_deferred_loader_script(array( $footer ), 3500) . "\n";
}
}
@ -4692,6 +4715,7 @@ require_once __DIR__ . '/inc/schema.php';
require_once __DIR__ . '/inc/webmaster-recrawl.php';
require_once __DIR__ . '/inc/js-snippet-comments.php';
require_once __DIR__ . '/inc/cli-city-normalizer.php';
require_once __DIR__ . '/inc/css-minify.php';
/**
* Фильтр: замена H1 для страницы "Подготовка к школе" (ID 2)

View File

@ -9,7 +9,6 @@
<link rel="preconnect" href="https://cdn-ru.bitrix24.ru">
<link rel="preconnect" href="https://alee.bitrix24.ru" crossorigin>
<link rel="preconnect" href="https://cdn.jsdelivr.net">
<link rel="dns-prefetch" href="//api-maps.yandex.ru">
<link rel="dns-prefetch" href="//mod.gudok.tel">
<?php
@ -62,11 +61,13 @@ if (is_front_page()) {
$critical_css = file_get_contents($critical_css_path);
echo '<style id="critical-front-css">' . $critical_css . '</style>' . "\n";
}
$main_css_url = get_template_directory_uri() . '/assets/css/main.css?ver=' . filemtime(get_template_directory() . '/assets/css/main.css');
$main_css = dekart_css_asset('main.css');
$main_css_url = $main_css['url'] . '?ver=' . $main_css['ver'];
?><link rel="preload" as="style" href="<?php echo esc_url($main_css_url); ?>" onload="this.onload=null;this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="<?php echo esc_url($main_css_url); ?>"></noscript>
<?php else : ?>
<link rel="stylesheet" href="<?php echo esc_url(get_template_directory_uri() . '/assets/css/main.css?ver=' . filemtime(get_template_directory() . '/assets/css/main.css')); ?>" media="all">
<?php else :
$main_css = dekart_css_asset('main.css'); ?>
<link rel="stylesheet" href="<?php echo esc_url($main_css['url'] . '?ver=' . $main_css['ver']); ?>" media="all">
<?php endif; ?>
<?php if (function_exists('needs_swiper') && needs_swiper()) : ?>
@ -78,6 +79,11 @@ if (is_front_page()) {
<link rel="preload" as="style" href="<?php echo esc_url(get_template_directory_uri() . '/assets/css/fonts.css?ver=' . filemtime(get_template_directory() . '/assets/css/fonts.css')); ?>" onload="this.onload=null;this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="<?php echo esc_url(get_template_directory_uri() . '/assets/css/fonts.css?ver=' . filemtime(get_template_directory() . '/assets/css/fonts.css')); ?>"></noscript>
<?php if (is_front_page()) : // предзагрузка начертаний hero — LCP/CLS ?>
<link rel="preload" as="font" type="font/woff2" crossorigin href="<?php echo esc_url(get_template_directory_uri() . '/assets/fonts/Roboto-400.woff2'); ?>">
<link rel="preload" as="font" type="font/woff2" crossorigin href="<?php echo esc_url(get_template_directory_uri() . '/assets/fonts/Roboto-600.woff2'); ?>">
<link rel="preload" as="font" type="font/woff2" crossorigin href="<?php echo esc_url(get_template_directory_uri() . '/assets/fonts/PlusJakartaSans-700.woff2'); ?>">
<?php endif; ?>
<?php
?>
@ -113,19 +119,19 @@ if (is_front_page()) {
aria-label="Написать в WhatsApp">
<img width="18" height="18"
src="<?php echo esc_url(get_template_directory_uri()); ?>/assets/images/icon-whatsapp-w.svg"
alt="WhatsApp" loading="lazy">
alt="" loading="lazy">
</a>
<a href="tel:<?php echo preg_replace('/[^0-9+]/', '', carbon_get_theme_option('site_phone')); ?>"
aria-label="Позвонить нам">
<img width="18" height="18"
src="<?php echo esc_url(get_template_directory_uri()); ?>/assets/images/phone-volume.svg"
alt="Телефон" loading="lazy">
alt="" loading="lazy">
</a>
<a href="<?php echo esc_url(carbon_get_theme_option('site_lk_url') ?: 'https://lk.dekart-school.ru/'); ?>" target="_blank" rel="noopener noreferrer"
aria-label="Личный кабинет">
<img width="18" height="18"
src="<?php echo esc_url(get_template_directory_uri()); ?>/assets/images/icon-user-w.svg"
alt="Личный кабинет" loading="lazy">
alt="" loading="lazy">
</a>
<button class="burger-btn"
aria-label="<?php esc_attr_e('Открыть меню', 'dekart'); ?>"
@ -139,7 +145,7 @@ if (is_front_page()) {
<div class="add-menu_item">
<img width="15" height="25"
src="<?php echo esc_url(get_template_directory_uri()); ?>/assets/images/icon-location.svg"
alt="Адрес" loading="lazy">
alt="" loading="lazy">
<span><?php echo esc_html(get_option('branch_address') ?: carbon_get_theme_option('site_address')); ?></span>
</div>
<a target="_blank" rel="noopener noreferrer"
@ -148,7 +154,7 @@ if (is_front_page()) {
aria-label="Написать в WhatsApp">
<img width="19" height="21"
src="<?php echo esc_url(get_template_directory_uri()); ?>/assets/images/icon-whatsap.svg"
alt="WhatsApp" loading="lazy">
alt="" loading="lazy">
</a>
<a class="add-menu_item header-tel"
href="tel:<?php echo preg_replace('/[^0-9+]/', '', carbon_get_theme_option('site_phone')); ?>">
@ -185,7 +191,7 @@ if (is_front_page()) {
<a class="inter-lk desktop" href="<?php echo esc_url(carbon_get_theme_option('site_lk_url') ?: 'https://lk.dekart-school.ru/'); ?>" target="_blank" rel="noopener noreferrer">
<img width="18" height="23"
src="<?php echo esc_url(get_template_directory_uri()); ?>/assets/images/icon-user.svg"
alt="Личный кабинет" loading="lazy">
alt="" loading="lazy">
<span><?php esc_html_e('Личный кабинет', 'dekart'); ?></span>
</a>
</div>

View File

@ -0,0 +1,119 @@
<?php
// Минификация CSS: строка-безопасный минификатор + WP-CLI генерация .min.css
if (! defined('ABSPATH')) {
exit;
}
/**
* Безопасная минификация CSS: убирает комментарии, схлопывает пробелы,
* срезает пробелы вокруг { } ; , — не трогая содержимое строк/url.
*/
function dekart_minify_css(string $css): string
{
// Комментарии, кроме баннеров /*! ... */
$css = preg_replace('#/\*(?!!)[\s\S]*?\*/#', '', $css);
$out = '';
$len = strlen($css);
$in_str = false;
$quote = '';
$ws = " \t\n\r\f";
$delims = '{};,';
for ($i = 0; $i < $len; $i++) {
$ch = $css[$i];
if ($in_str) {
$out .= $ch;
if ($ch === '\\' && $i + 1 < $len) {
$out .= $css[$i + 1];
$i++;
continue;
}
if ($ch === $quote) {
$in_str = false;
}
continue;
}
if ($ch === '"' || $ch === "'") {
$in_str = true;
$quote = $ch;
$out .= $ch;
continue;
}
if (strpos($ws, $ch) !== false) {
if ($out !== '' && substr($out, -1) !== ' ') {
$out .= ' ';
}
continue;
}
if (strpos($delims, $ch) !== false) {
if ($out !== '' && substr($out, -1) === ' ') {
$out = substr($out, 0, -1);
}
$out .= $ch;
while ($i + 1 < $len && strpos($ws, $css[$i + 1]) !== false) {
$i++;
}
continue;
}
$out .= $ch;
}
return trim($out);
}
/**
* URL и версия CSS-ассета: минифицированный файл, если он сгенерирован.
*
* @param string $rel Имя файла, напр. 'main.css' или 'page-camp.css'.
* @return array{url:string,ver:int|string}
*/
function dekart_css_asset(string $rel): array
{
$dir = get_template_directory() . '/assets/css/';
$uri = get_template_directory_uri() . '/assets/css/';
$min = preg_replace('/\.css$/', '.min.css', $rel);
if ($min !== $rel && file_exists($dir . $min)) {
return array( 'url' => $uri . $min, 'ver' => filemtime($dir . $min) );
}
return array( 'url' => $uri . $rel, 'ver' => filemtime($dir . $rel) );
}
if (defined('WP_CLI') && WP_CLI) {
/**
* Пересобирает .min.css для всех assets/css/*.css.
*
* ## EXAMPLES
* wp dekart minify-css
*
* @when after_wp_load
*/
WP_CLI::add_command('dekart minify-css', function () {
$dir = get_template_directory() . '/assets/css/';
$files = glob($dir . '*.css');
$count = 0;
foreach ($files as $file) {
$base = basename($file);
if (substr($base, -8) === '.min.css') {
continue;
}
$src = file_get_contents($file);
if ($src === false) {
continue;
}
$min = '/*! ' . $base . ' (minified) */' . "\n" . dekart_minify_css($src);
$target = $dir . preg_replace('/\.css$/', '.min.css', $base);
file_put_contents($target, $min);
$saved = strlen($src) - strlen($min);
WP_CLI::log(sprintf(' %s -> %s (-%d B)', $base, basename($target), max(0, $saved)));
$count++;
}
WP_CLI::success(sprintf('Минифицировано файлов: %d', $count));
});
}

View File

@ -1,11 +1,26 @@
<?php
$social_media = carbon_get_theme_option('social_media');
if (! is_array($social_media)) {
$social_media = array();
}
foreach ($social_media as $item) {
$icon = $item['social_media_img'];
if ($item['social_media_link'] != '') { ?>
<a class="social_item" href="<?php echo $item['social_media_link']; ?>" title="<?php echo $item['social_media_name']; ?>">
<img loading="lazy" width="32" height="32" src="<?php echo wp_get_attachment_url($icon); ?>" alt="">
$icon = $item['social_media_img'] ?? '';
$link = $item['social_media_link'] ?? '';
if ('' === trim((string) $link)) {
continue;
}
// Имя ссылки: из CF, иначе из домена
$name = trim((string) ($item['social_media_name'] ?? ''));
if ('' === $name) {
$name = (string) preg_replace('#^www\.#', '', (string) wp_parse_url($link, PHP_URL_HOST));
}
if ('' === $name) {
$name = 'Соцсеть';
}
?>
<a class="social_item" href="<?php echo esc_url($link); ?>" title="<?php echo esc_attr($name); ?>" aria-label="<?php echo esc_attr($name); ?>">
<img loading="lazy" width="32" height="32" src="<?php echo esc_url(wp_get_attachment_url($icon)); ?>" alt="">
</a>
<?php } ?>
<?php } ?>
<?php } ?>