Files
ukaiautomation/add_inline_css.php

49 lines
1.3 KiB
PHP
Raw Normal View History

2025-06-08 11:21:30 +01:00
<?php
// Add inline CSS fix for buttons
$articles_dir = '/var/www/html/blog/articles/';
$files = glob($articles_dir . '*.php');
$inline_css = '
<style>
.btn {
background: #179e83 !important;
color: white !important;
padding: 15px 30px !important;
border: none !important;
border-radius: 5px !important;
text-decoration: none !important;
display: inline-block !important;
font-family: Arial, sans-serif !important;
font-size: 16px !important;
font-weight: bold !important;
text-align: center !important;
cursor: pointer !important;
margin: 10px 0 !important;
min-width: 150px !important;
box-sizing: border-box !important;
}
.btn:hover {
background: #11725e !important;
color: white !important;
}
</style>';
foreach ($files as $file) {
$content = file_get_contents($file);
if ($content === false) {
continue;
}
// Add inline CSS right before </head>
if (strpos($content, '</head>') !== false && strpos($content, 'btn-fix-inline') === false) {
$content = str_replace('</head>', $inline_css . "\n<!-- btn-fix-inline -->\n</head>", $content);
file_put_contents($file, $content);
echo "Added inline CSS to: " . basename($file) . "\n";
}
}
echo "Inline CSS fix complete!\n";
?>