Ejemplo n.º 1
0
 public function deactivate()
 {
     if (is_file(ABSPATH . ".htaccess") && is_writable(ABSPATH . ".htaccess")) {
         $htaccess = file_get_contents(ABSPATH . ".htaccess");
         $htaccess = preg_replace("/#\\s?BEGIN\\s?WPCache.*?#\\s?END\\s?WPCache/s", "", $htaccess);
         $htaccess = preg_replace("/#\\s?BEGIN\\s?GzipWPCache.*?#\\s?END\\s?GzipWPCache/s", "", $htaccess);
         file_put_contents(ABSPATH . ".htaccess", $htaccess);
     }
     wp_clear_scheduled_hook("wp_cache");
     delete_option("WPCache");
     $wpcache = new WPCache();
     $wpcache->deleteCache();
 }
Ejemplo n.º 2
0
 * WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE 
 * PLUGIN "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, 
 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 
 * PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PLUGIN IS 
 * WITH YOU. SHOULD THE PLUGIN PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY 
 * SERVICING, REPAIR OR CORRECTION.
 * 
 */
// exit if accessed directly
if (!defined('ABSPATH')) {
    exit;
}
// enqueue css
function wpcache_wp_admin_style()
{
    wp_register_style('wpcache_wp_admin_css', plugins_url('css/style.css', __FILE__), false, '1.0.0');
    wp_enqueue_style('wpcache_wp_admin_css');
}
add_action('admin_enqueue_scripts', 'wpcache_wp_admin_style');
// Add required includes
require_once dirname(__FILE__) . "/inc/functions.php";
$wpcache = new WPCache();
if (is_admin()) {
    // Add options panel
    $wpcache->add_options_panel();
} else {
    // Start caching
    $wpcache->startCache();
}
// Runs on plugin deactivation
register_deactivation_hook(__FILE__, array('WPCache', 'deactivate'));