function do_update_actions() { if (empty($_POST)) { return; } if (!empty($_POST['super_static_cache_mode'])) { $super_static_cache_mode = trim($_POST['super_static_cache_mode']); update_option('super_static_cache_mode', $super_static_cache_mode); $super_static_cache_excet_arr = $_POST['super_static_cache_excet']; $super_static_cache_excet = implode(',', $super_static_cache_excet_arr); update_option('super_static_cache_excet', $super_static_cache_excet); $super_static_cache_strict = $_POST['super_static_cache_strict'] == "true" ? true : false; update_option('super_static_cache_strict', $super_static_cache_strict); $super_static_cache_nocachesinglepage = $_POST['super_static_cache_nocachesinglepage']; $super_static_cache_nocachesinglepage = str_replace("\r\n", ",", $super_static_cache_nocachesinglepage); update_option('super_static_cache_nocachesinglepage', $super_static_cache_nocachesinglepage); } if (!empty($_POST['update_cache_action'])) { $update_cache_action_arr = $_POST['update_cache_action']; $update_cache_action = implode(',', $update_cache_action_arr); update_option('update_cache_action', $update_cache_action); } if (!empty($_POST['clearcache'])) { $del_type_arr = $_POST['clearcache']; if (in_array('home', $del_type_arr)) { clear_home_cache(); } if (in_array('single', $del_type_arr)) { clear_post_page_cache("post"); } if (in_array('page', $del_type_arr)) { clear_post_page_cache("page"); } if (in_array('category', $del_type_arr)) { clear_category_cache(); } if (in_array('tag', $del_type_arr)) { clear_tag_cache(); } if (in_array('all', $del_type_arr)) { global $wpssc; if ($wpssc->cachemod == "direct") { clear_home_cache(); clear_category_cache(); clear_tag_cache(); clear_post_page_cache("post"); clear_post_page_cache("page"); } else { if ($wpssc->cachemod == "phprewrite" || $wpssc->cachemod == "serverrewrite") { $wpssc->delete_cache($wpssc->siteurl . "/"); } } } } if (!empty($_POST['clearpostpagecache'])) { $ids = explode(",", trim($_POST['clearpostpagecache'])); foreach ($ids as $id) { clear_post_cache($id); } } }
function delete_post($file, $destination) { if (!login()) { return null; } $deleted_content = $file; // Get cache file $arr = explode('_', $file); $replaced = substr($arr[0], 0, strrpos($arr[0], '/')) . '/'; $str = explode('/', $replaced); $dt = str_replace($replaced, '', $arr[0]); clear_post_cache($dt, $arr[1], str_replace('.md', '', $arr[2]), $file, $str[count($str) - 3], $str[count($str) - 2]); if (!empty($deleted_content)) { unlink($deleted_content); rebuilt_cache('all'); if ($destination == 'post') { $redirect = site_url(); header("Location: {$redirect}"); } else { $redirect = site_url() . $destination; header("Location: {$redirect}"); } } }
function delete_post($file, $destination) { if (!login()) { return null; } $deleted_content = $file; // Get cache file $arr = explode('_', $file); $replaced = substr($arr[0], 0, strrpos($arr[0], '/')) . '/'; $dt = str_replace($replaced, '', $arr[0]); /* [nhr] 12/30/2015 * $str doesn't exist and category isn't listed in the $arr. * added empty string to prevent warnings */ clear_post_cache($dt, $arr[1], str_replace('.md', '', $arr[2]), $file, ""); if (!empty($deleted_content)) { unlink($deleted_content); rebuilt_cache('all'); if ($destination == 'post') { $redirect = site_url(); header("Location: {$redirect}"); } else { $redirect = site_url() . $destination; header("Location: {$redirect}"); } } }