This is how I got it in the end:
$preloadsListJson = get_option(WPACU_PLUGIN_ID.'_global_data');
if ($preloadsListJson) {
$preloadsList = @json_decode($preloadsListJson, true);
// Issues with decoding the JSON file? Return an empty list
if (Misc::jsonLastError() !== JSON_ERROR_NONE) {
return;
}
$fromLocation = ($GLOBALS['wpacu_from_location_inc'] % 2) ? 'db' : 'disk';
// Are new positions set for styles and scripts?
if (isset($preloadsList['styles']['preloads']) && ! empty($preloadsList['styles']['preloads'])) {
foreach ($preloadsList['styles']['preloads'] as $key => $value) {
$handleDbStr = md5($key);
$transientName = 'wpacu_css_optimize_'.$handleDbStr;
$transientFile = @json_decode(
\WpAssetCleanUp\OptimiseAssets\OptimizeCommon::getTransient($transientName, $fromLocation),
true
);
}
}
if (isset($preloadsList['scripts']['preloads']) && ! empty($preloadsList['scripts']['preloads'])) {
foreach ($preloadsList['scripts']['preloads'] as $key => $value) {
$handleDbStr = md5($key);
$transientName = 'wpacu_js_optimize_'.$handleDbStr;
$transientFile = @json_decode(
\WpAssetCleanUp\OptimiseAssets\OptimizeCommon::getTransient($transientName, $fromLocation),
true
);
}
}
}
-
This reply was modified 3 years, 7 months ago by Mos Craciun.