/** * Flush all cache * * @param bool $flush_cf * @return void */ function flush_all($flush_cf = true) { _doing_it_wrong('flush_all', 'This function is deprecated. Use w3tc_flush_all() instead.', '0.9.3'); w3tc_flush_all(); }
/** * Generate the HTML code for the firewall clear cache panel. * * @param string $nonce Identifier of the HTTP request for CSRF protection * @return string The parsed-content of the firewall clear cache panel. */ function sucuriscan_firewall_clearcache($nonce) { $params = array(); if ($nonce) { // Flush the cache of the site(s) associated with the API key. if (SucuriScanRequest::post(':clear_cache') == 1) { $response = SucuriScanAPI::clearCloudproxyCache(); if ($response) { if (isset($response->messages[0])) { // Clear W3 Total Cache if it is installed. if (function_exists('w3tc_flush_all')) { w3tc_flush_all(); } SucuriScanInterface::info($response->messages[0]); } else { SucuriScanInterface::error('Could not clear the cache of your site, try later again.'); } } else { SucuriScanInterface::error('CloudProxy is not enabled on your site, or your API key is invalid.'); } } } return SucuriScanTemplate::getSection('firewall-clearcache', $params); }
/** * Process the requests sent by the form submissions originated in the monitoring * page, all forms must have a nonce field that will be checked against the one * generated in the template render function. * * @return void */ function sucuriscan_monitoring_form_submissions() { if (SucuriScanInterface::check_nonce()) { // Add and/or Update the Sucuri WAF API Key (do it before anything else). $option_name = ':cloudproxy_apikey'; $api_key = SucuriScanRequest::post($option_name); if ($api_key !== false) { if (SucuriScanAPI::is_valid_cloudproxy_key($api_key)) { SucuriScanOption::update_option($option_name, $api_key); SucuriScanOption::update_option(':revproxy', 'enabled'); SucuriScanInterface::info('CloudProxy API key saved successfully'); } elseif (empty($api_key)) { SucuriScanOption::delete_option($option_name); SucuriScanOption::update_option(':revproxy', 'disabled'); SucuriScanInterface::info('CloudProxy API key removed successfully'); } else { SucuriScanInterface::error('Invalid CloudProxy API key, check your settings and try again.'); } } // Flush the cache of the site(s) associated with the API key. if (SucuriScanRequest::post(':clear_cache', '1')) { $clear_cache_resp = SucuriScanAPI::clear_cloudproxy_cache(); if ($clear_cache_resp) { if (isset($clear_cache_resp->messages[0])) { // Clear W3 Total Cache if it is installed. if (function_exists('w3tc_flush_all')) { w3tc_flush_all(); } SucuriScanInterface::info($clear_cache_resp->messages[0]); } else { SucuriScanInterface::error('Could not clear the cache of your site, try later again.'); } } else { SucuriScanInterface::error('CloudProxy is not enabled on your site, or your API key is invalid.'); } } } }
function save($newsettings, $oldsettings) { $skin_field = isset($newsettings['skin']) ? $newsettings['skin'] : 'vanilla'; $customization = $skin_field; $all_customizations = cuttz_customization_aggregator(); if (is_array($all_customizations) && array_key_exists($skin_field, $all_customizations)) { // skin exists $current_customization = $all_customizations[$skin_field]; if (is_array($current_customization) && array_key_exists('functions', $current_customization)) { include_once $current_customization['functions']; } } else { $skin_field = 'vanilla'; if (is_array($all_customizations) && array_key_exists($skin_field, $all_customizations)) { //validate that vanilla exists $current_customization = $all_customizations['vanilla']; $newsettings['skin'] = 'vanilla'; //what if someone deletes vanilla? if (is_array($current_customization) && array_key_exists('functions', $current_customization)) { //if functions.php exists for vanilla, use it. include_once $current_customization['functions']; } } } if (isset($newsettings['new-skin']) && !empty($newsettings['new-skin'])) { $new_skin = cuttz_ws($newsettings['new-skin']); if (!empty($new_skin) && !file_exists(CUTTZ_USER_SKINS . '/' . $new_skin)) { cuttz_init_path(CUTTZ_USER_SKINS . '/' . $new_skin); $functions_out = CUTTZ_USER_SKINS . '/' . $new_skin . '/functions.php'; $msg = __("<?php\n/******** Place all your wp/php tweaks here ****************/\n/******** This is your skins functions.php file ******/\n", 'cuttz-framework'); $functions_out = file_put_contents($functions_out, $msg); $style_out = CUTTZ_USER_SKINS . '/' . $new_skin . '/style.scss'; $msg = __("/**************** Place all your css customizations in the style.scss file *****************/\n\n", 'cuttz-framework'); $style_out = file_put_contents($style_out, $msg); //if can't be created then somehow push/or handle error if (!$style_out || !$functions_out) { $newsettings['skin'] = $oldsettings['skin']; } else { $newsettings['skin'] = $new_skin; } } } $newgkey = empty($newsettings['gfonts-api-key']) ? 'false' : trim($newsettings['gfonts-api-key']); $oldgkey = empty($oldsettings['gfonts-api-key']) ? 'false' : trim($oldsettings['gfonts-api-key']); if ($newgkey != $oldgkey) { //just reset the cuttz_fonts_list transient so that it can be rebuilt if a new key has been set delete_transient('cuttz_fonts_list'); } if (function_exists('w3tc_flush_all')) { //check if W3Total cache is installed and active w3tc_flush_all(); //flush the entire cache since we've updated theme settings, widget output and more } return $newsettings; }