示例#1
0
 public function deactivate()
 {
     $wpfc = new WpFastestCache();
     $path = ABSPATH;
     if ($wpfc->is_subdirectory_install()) {
         $path = $wpfc->getABSPATH();
     }
     if (is_file($path . ".htaccess") && is_writable($path . ".htaccess")) {
         $htaccess = file_get_contents($path . ".htaccess");
         $htaccess = preg_replace("/#\\s?BEGIN\\s?WpFastestCache.*?#\\s?END\\s?WpFastestCache/s", "", $htaccess);
         $htaccess = preg_replace("/#\\s?BEGIN\\s?GzipWpFastestCache.*?#\\s?END\\s?GzipWpFastestCache/s", "", $htaccess);
         $htaccess = preg_replace("/#\\s?BEGIN\\s?LBCWpFastestCache.*?#\\s?END\\s?LBCWpFastestCache/s", "", $htaccess);
         file_put_contents($path . ".htaccess", $htaccess);
     }
     wp_clear_scheduled_hook("wp_fastest_cache");
     wp_clear_scheduled_hook($wpfc->slug() . "_regular");
     delete_option("WpFastestCache");
     delete_option("WpFcDeleteCacheLogs");
     $wpfc->deleteCache();
 }