$settings['new_primary_colour_ccs'] = '#777777'; // test color
foreach($appPats as $path){
$styleSettings = [
'primary_colour' => [
'reg' => "\bprimaryColour:\s?['\"][a-z0-9 ,._+;()'@!?&#:\/-]+['\"]",
'string' => "primaryColour: \"".$settings['new_primary_colour_ccs']."\"",
'value' => $settings['new_primary_colour_ccs']
]
];
foreach ($styleSettings as $style) {
$content = file_get_contents($path);
$result = preg_replace($style['reg'], $style['string'], $content);
file_put_contents($path, $result);
var_dump($result);
}
}
My css text looks like this:
(n["createcCommentVNode"])("",!0)],64)})),256))])):Object
(n["createCommentVNode"])("", !0)])]), Object(n["createELementVNode"])("div"
,me,[Object(n["createELementVNode"])("div",be,[X.config.EntryFormWithoutTime
?(Object(n["openBlock"])(),Object(n["createBlock"])(te,{key:0,onUpdated:e
.onUpdated,"is-new":"",modelValue:R.newEntry,"onUpdate:modelValue":t[0]||
(t[0]=function(e){return R.newEntry=e})},null,8,["onUpdated","modelValue"]
)):(Object(n["openBlock"])(),Object(n["createBlock"])(xe,{key:1,onUpdated:e
.onUpdated,"is-new":"",modelValue:R.newEntry,"onUpdate:modelValue":t[1]||
(t[1]=function(e){return R.newEntry=e})},null,8,["onUpdated","modelValue"]
))])])],64)}a("498a"),a("acl1f"),a("5319"),a("a434");var ge={client:"Rail
Partners",showWelcomeMessage:!1,logo:"https: //1wee.webx.host/images
/RP_Logo_Black.svg",LogoWidth:124,LogoMargin:"10px 0 10px 0"
,navBackgroundColour:"rgb(36, 142, 120)",navShowWave:!1,colourScheme:"blue"
,bodyBackgroundImage:!1,bgColour:"#FFFFFF",primaryColour:"#AD9DF4",url
:"https://1wee.webx.host",enableAcademy:!0,enableScheduler:!0
,homepageDispLayVehicLeChart:!1,calendarDispLayNameOn1ly:!0
,caLendarMonthyDefaultSort:"name",EntryFormWithoutTime:!0
,caLendarAnnualLeaveCatId:25,calendarRemainingTimeLeftShownInHours:!0
,notificationEmailId:26,userProfile:{profileImgId:3,width:400,height:400
,quality:100}},fe=a("a18a"),ke=a.n(fe),ve={class:"uk-text-center uk-width
-large uk-align-center"},ye=Object(n["createELementVNode"])("img",{class:"uk
I need to change my css style using preg_replace
preg_replaceas first parameter, is not. (If you are really stumbling around blind without proper PHP error reporting enabled, so that PHP did not tell you what is wrong, then please go and enable that first of all now.)