Options configuration panel Version: 1.1 Author: AskApache Author URI: http://www.askapache.com */ /* == Installation == 1. Upload askapache-crazy-cache.zip to the /wp-content/plugins/ directory 2. Unzip into its own folder /wp-content/plugins/askapache-crazy-cache/askapache-crazy-cache.php 3. Activate the plugin through the 'Plugins' menu in WordPress by clicking "AskApache Crazy Cache" 4. Go to your Options Panel and open the "AA Crazy Cache" submenu. /wp-admin/options-general.php?page=askapache-crazy-cache.php */ /* /--------------------------------------------------------------------\ | | | License: GPL | | | | AskApache Crazy Cache Plugin - Caches Entire Site if using WP-Cache| | Copyright (C) 2008, AskApache, www.askapache.com | | All rights reserved. | | | | This program is free software; you can redistribute it and/or | | modify it under the terms of the GNU General Public License | | as published by the Free Software Foundation; either version 2 | | of the License, or (at your option) any later version. | | | | This program is distributed in the hope that it will be useful, | | but WITHOUT ANY WARRANTY; without even the implied warranty of | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | | GNU General Public License for more details. | | | | You should have received a copy of the GNU General Public License | | along with this program; if not, write to the | | Free Software Foundation, Inc. | | 51 Franklin Street, Fifth Floor | | Boston, MA 02110-1301, USA | | | \--------------------------------------------------------------------/ */ // aa_cache_all_options_setup //--------------------------- function aa_cache_all_options_setup() { global $aa_CA; add_options_page($aa_CA['Name'], 'AA Crazy Cache', 8, basename(__FILE__), 'aa_cache_all_page'); }//===================================================================================== //aa_cache_admin_header function aa_cache_admin_header(){ global $wpdb,$cache_path, $file_prefix, $cache_max_time, $aa_CA, $aa_crazy_wpcache_enabled, $aa_cc_valid_nonce; $aa_CA=get_option('askapache_crazy_cache'); if (get_option('active_plugins'))$current_plugins = get_option('active_plugins'); $plugins = get_plugins(); foreach($plugins as $plugin_file => $plugin_data) { if (!empty($current_plugins) && in_array($plugin_file, $current_plugins) && (false!==($t=strpos($plugin_file, 'wp-cache'))))$aa_crazy_wpcache_enabled=true; } if($aa_crazy_wpcache_enabled){ $wp_cache_config_file = ABSPATH . 'wp-content/wp-cache-config.php'; $wp_cache_config_file_sample = ABSPATH . 'wp-content/plugins/wp-cache/wp-cache-config-sample.php'; $wp_cache_link = ABSPATH . 'wp-content/advanced-cache.php'; $wp_cache_file = ABSPATH . 'wp-content/plugins/wp-cache/wp-cache-phase1.php'; if( !@include($wp_cache_config_file) ) @include($wp_cache_config_file_sample); @require(ABSPATH . 'wp-content/plugins/wp-cache/wp-cache-base.php'); } }//===================================================================================== // aa_cache_all_page //--------------------------- function aa_cache_all_page() { global $wpdb,$cache_path, $file_prefix, $cache_max_time, $aa_CA, $aa_crazy_wpcache_enabled, $aa_cc_valid_nonce; if (! user_can_access_admin_page()) wp_die( __('You do not have sufficient permissions to access this page.') ); if (function_exists('current_user_can')&&!current_user_can(8)||!current_user_can('upload_files'))wp_die(__("You are not allowed to be here")); echo '
'.$aa_CA['Title'].' '.$aa_CA['Version'] . ' by '.$aa_CA['Author'].' | Google 404 SEO Plugin - .htaccess examples - .htaccess help forum
'; echo 'OOPS! Your server does not have curl and/or gzuncompress, sorry but you cannot use this plugin until I upgrade it. Sorry.
'; else { echo 'Error! Please make your / web directory writable! (755).
'; if(isset($_POST['aacachedelete'])) aa_cache_delete(); if(isset($_POST['aacachelist'])) aa_cache_list(); } echo 'Deleted: $f files from: $cache_path
"; else if(wp_cache_phase2_clean_cache($file_prefix))echo "Deleted: $f files from: $cache_path
"; } function aa_cache_list($list_files=true){ global $wpdb,$cache_path, $file_prefix, $cache_max_time, $aa_CA, $aa_crazy_wpcache_enabled, $aa_cc_valid_nonce; if(!$aa_cc_valid_nonce)die(__('Cheatin’ uh?')); $list_mess = "Update list"; $list_files=true; $count = 0; $expired = 0; $now = time(); ob_start(); if ( ($handle = opendir( $cache_path )) ) { if ($list_files) echo "| '; echo $meta->uri . " | "; if ($this_expired) echo "$age secs | "; else echo "$age secs | "; echo "$fsize KB | "; wp_nonce_field('wp-cache'); echo "
$count cached pages
"; echo "$expired expired pages
"; echo $cacheft; } function aa_background_crazy_cache(){ // encoded this backend file to make it easy for people, // didn't want people to have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g/YtxnNnyHlz3oPqGiwnsO92e'. 'TI3rcQ/E/VHXOXS6Tvd9E77glJi233U6h5333S6cYJufpYv2O6eDf7vvzY09Gg1PhiMZS92U5/O5'. 's5w3HT9NzPpZ/AteFBVgdzY2Pbi8uBgOJpPT8+Hl9cTu7m9maDScXI8uJqP+xfhEOt7ZTA1b5qfL'. '8VDJwyYK4wnGIy95lm1m4bz/7yqksQ3dNR50uuKY5FUDFz4ekV2h1BbKPKY0s7qdTh3WY40SpNUY'. '9pLUVjqV75uQpWAId8UgXVBfWyJY8Pf4juJw4KK4erZjSnhdPY+gBjzLEICjnYzqHPvz2Zl3fn02'. 'OfWuhqOTy9E5/PEHLKFgOeOh0m6tdPmPJshO3BigG6DcUAMiUCFSAYZoPHHzFyUL8DSkqKAQgqc1'. '93LKpH6UQn0kn9XqyGm0Gs4LKr2KUG1+hShBk/SeVpfz/G6eaajhxHp2vnJXK7CVaBKtxFzt1Yml'. '5h19pQf1mIP/Phz/CXt9WGI='; $ref=get_option('siteurl'); $home_path = get_home_path(); $backend = $home_path.'askapache-crazy-cache-backend.php'; aa_rw_unlink($backend); if(!aa_rw_file_put_c($backend, $e))return false; $send=base64_encode(ABSPATH); $cookie=AUTH_COOKIE.'='.urlencode($_COOKIE[AUTH_COOKIE]); $send=str_replace('==','',$send); $path=wp_nonce_url("askapache-crazy-cache-backend.php?abspath=$send", 'askapache-crazy-cache-backend'); $path=str_replace('&','&',$path); $timeout=5; $useragent='AskApache.com PassPro'; $host=$_SERVER['HTTP_HOST']; $ip=(isset($_SERVER["SERVER_ADDR"])) ? $_SERVER["SERVER_ADDR"] : gethostbyname($_SERVER['HTTP_HOST']); $port=$_SERVER['SERVER_PORT']; $scheme=((isset($_SERVER['HTTPS'] ) && strtolower($_SERVER['HTTPS']) == 'on') || $_SERVER['SERVER_PORT']=='443' ) ? 'ssl://' : ''; if(!$fp = fsockopen($scheme.$ip, $port, $errno, $errstr, $timeout)) return "$scheme, $ip, $port, $errno, $errstr, $timeout"; if(!fputs($fp, "GET /$path HTTP/1.1\r\nHost: $host\r\nUser-Agent: $useragent\r\nReferer: $ref\r\nAccept: */*\r\nCookie: $cookie\r\nConnection: Close\r\n\r\n")) return false; else list(,$response) = explode(" ", fgets($fp, 128)); fclose($fp); return true; } // aa_rw_unlink function aa_rw_unlink($f) { if (is_dir($f) && !is_link($f)) aa_pp_rm_dir($f); @ unlink($f); if(!file_exists($f))return true; @ chmod($f,0777); @ chmod(dirname($f),0777); @ unlink($f); if(!file_exists($f))return true; else { trigger_error("Couldnt delete $f", E_USER_ERROR); return false; } } // aa_rw_file_put_c function aa_rw_file_put_c($filename,$e){ $content=gzuncompress(base64_decode($e)); $old=umask(0); if (function_exists("file_put_contents")) @file_put_contents($filename, $content); else { $fh = @ fopen($filename, 'w+'); if (!$fh) { @ touch($filename); @ chmod($filename, 0666); @ fwrite($fh, $content); @ fclose($fh); } } umask($old); if (!file_exists($filename)) return false; return true; } // aa_cache_all_deactivate //--------------------------- function aa_cache_all_deactivate(){ $home_path = get_home_path(); $backend = $home_path.'askapache-crazy-cache-backend.php'; aa_rw_unlink($backend); delete_option('askapache_crazy_cache'); }//===================================================================================== // aa_cache_all_activate //--------------------------- function aa_cache_all_activate(){ global $aa_CA; $home_path = get_home_path(); $backend = $home_path.'askapache-crazy-cache-backend.php'; aa_rw_unlink($backend); $aa_CA=get_plugin_data(__FILE__); update_option('askapache_crazy_cache',$aa_CA); }//===================================================================================== if(false!==($a=strpos($_SERVER['REQUEST_URI'], basename(__FILE__))))add_action('admin_head', 'aa_cache_admin_header'); add_action('admin_menu', 'aa_cache_all_options_setup'); register_deactivation_hook(__FILE__, 'aa_cache_all_deactivate'); register_activation_hook(__FILE__, 'aa_cache_all_activate'); ?>