'; echo "

AIO Cache: Support Us

\n"; echo "

THANK YOU for installing AIO Cache!

\n"; echo "

Donors of USD $10 or more will receive a thank you letter and the PRO VERSION of this plugin.

To see what you get with PRO VERSION, go to the \"AIO Cache\" menu, then to \"PRO VERSION\".


\"\"
\n"; echo "



Please post the following information to the Wordpress.org AIO Cache Support Forum:


  >  Please report issues with other scripts as well as bugs.

  >  Please report compatibility with alternative web servers such as IIS, Nginx, and others.

  >  Please request new features for upcoming releases.

  >  Instead of rating this plugin badly, please give us some insight as to how we can make this plugin suit your performance needs in a better way.

\n"; echo "\n"; } function aio_cache_main_settings() { global $wp_cache_config_file, $valid_nonce; $valid_nonce = wp_verify_nonce($_REQUEST['_wpnonce'], 'wp-cache'); echo '
'; echo "

AIO Cache: Main Settings

\n"; echo '

To donate, click here.

'; if(isset($_REQUEST['wp_restore_config']) && $valid_nonce) { unlink($wp_cache_config_file); echo 'Configuration file changed, some values might be wrong. Load the page again from the "Options" menu to reset them.'; } echo '
'; if ( !wp_cache_check_link() || !wp_cache_verify_config_file() || !wp_cache_verify_cache_dir() ) { echo "
Cannot continue... fix previous problems and retry.
"; echo "
\n"; return; } if (!wp_cache_check_global_config()) { echo "\n"; return; } if ( $valid_nonce ) { if(isset($_REQUEST['wp_enable'])) { wp_cache_enable(); } elseif (isset($_REQUEST['wp_disable'])) { wp_cache_disable(); } } echo '
'; if (wp_cache_is_enabled()) { echo ''; echo '

Current Status:   Enabled

'; } else { echo ''; echo '

Current Status:   Disabled

'; } wp_nonce_field('wp-cache'); echo "
\n"; wp_cache_edit_max_time(); echo ''; wp_cache_files(); wp_cache_restore(); /*function add_my_google_analytics() { ?>\n"; } function aio_cache_other_settings() { global $wp_cache_config_file, $valid_nonce; $valid_nonce = wp_verify_nonce($_REQUEST['_wpnonce'], 'wp-cache'); echo '
'; echo "

AIO Cache: Other Settings

\n"; echo '

To donate, click here.

'; echo '
'; wp_cache_edit_rejected(); echo "
\n"; wp_cache_edit_accepted(); echo '
'; wp_cache_edit_rejected_ua(); echo "
\n"; } function aio_cache_go_pro() { echo '
'; echo "

AIO Cache: *Pro Version*

\n"; echo "

Donors of USD $10 or more will receive a thank you letter and the PRO version of this plugin.

To see what you get with PRO, go to the \"AIO Cache\" menu, then to \"PRO Features\".



Pro Version Features

  > Donation Link Removal.

  > Up to 3x Speed Increase

  > More Stability and Compatibility

  > Speed-Related SEO Optimization.

  > Static JavaScript and CSS Resources.

  > Better HTML, CSS, and JS Optimization.

  > More Administration Options and Better Admin Panel Design.


ONLY FOR DONORS OF $10 USD or more.


\"\"

*Still in development. You will receive yours BEFORE Friday, March 8, 2013.



\n"; echo "
\n"; } function wp_cache_restore() { echo '
'; echo ''; echo '

Configuration messed up?

'; wp_nonce_field('wp-cache'); echo "\n"; echo '
'; } function wp_cache_edit_max_time () { global $cache_max_time, $wp_cache_config_file, $valid_nonce; if(isset($_REQUEST['wp_max_time']) && $valid_nonce) { $max_time = (int)$_REQUEST['wp_max_time']; if ($max_time > 0) { $cache_max_time = $max_time; wp_cache_replace_line('^ *\$cache_max_time', "\$cache_max_time = $cache_max_time;", $wp_cache_config_file); } } echo '
'; echo "

Expiration Time:


Seconds
"; wp_nonce_field('wp-cache'); echo "
\n"; } function wp_cache_sanitize_value($text, & $array) { $text = wp_specialchars(strip_tags($text)); $array = preg_split("/[\s,]+/", chop($text)); $text = var_export($array, true); $text = preg_replace('/[\s]+/', ' ', $text); return $text; } function wp_cache_edit_rejected_ua() { global $cache_rejected_user_agent, $wp_cache_config_file, $valid_nonce; if (!function_exists('apache_request_headers')) return; if(isset($_REQUEST['wp_rejected_user_agent']) && $valid_nonce) { $text = wp_cache_sanitize_value($_REQUEST['wp_rejected_user_agent'], $cache_rejected_user_agent); wp_cache_replace_line('^ *\$cache_rejected_user_agent', "\$cache_rejected_user_agent = $text;", $wp_cache_config_file); } echo 'Rejected UA Strings'; echo "

Strings in the HTTP 'User Agent' header that prevent AIO Cache from caching bot, spiders, and crawlers' requests. Note that cached files are still sent to these request if they already exists.

\n"; echo '
'; echo ' '; echo '
'; wp_nonce_field('wp-cache'); echo '
'; echo "
\n"; } function wp_cache_edit_rejected() { global $cache_acceptable_files, $cache_rejected_uri, $wp_cache_config_file, $valid_nonce; if(isset($_REQUEST['wp_rejected_uri']) && $valid_nonce) { $text = wp_cache_sanitize_value($_REQUEST['wp_rejected_uri'], $cache_rejected_uri); wp_cache_replace_line('^ *\$cache_rejected_uri', "\$cache_rejected_uri = $text;", $wp_cache_config_file); } echo 'Rejected URIs'; echo "

Add here strings (not a filename) that forces a page not to be cached. For example, if your URLs include year and you dont want to cache last year posts, it's enough to specify the year, i.e. '/2004/'. AIO Cache will search if that string is part of the URI and if so, it will no cache that page.

\n"; echo '
'; echo ' '; echo '
'; wp_nonce_field('wp-cache'); echo "
\n"; } function wp_cache_edit_accepted() { global $cache_acceptable_files, $cache_rejected_uri, $wp_cache_config_file, $valid_nonce; if(isset($_REQUEST['wp_accepted_files']) && $valid_nonce) { $text = wp_cache_sanitize_value($_REQUEST['wp_accepted_files'], $cache_acceptable_files); wp_cache_replace_line('^ *\$cache_acceptable_files', "\$cache_acceptable_files = $text;", $wp_cache_config_file); } echo 'Accepted Files'; echo "

Add here those filenames that can be cached, even if they match one of the rejected substring specified above.

\n"; echo '
'; echo ' '; echo '
'; wp_nonce_field('wp-cache'); echo "
\n"; } function wp_cache_enable() { global $wp_cache_config_file, $cache_enabled; if(get_settings('gzipcompression')) { echo "Error: GZIP compression is enabled, disable it if you want to enable AIO Cache.

"; return false; } if( wp_cache_replace_line('^ *\$cache_enabled', '$cache_enabled = true;', $wp_cache_config_file) ) { $cache_enabled = true; } } function wp_cache_disable() { global $wp_cache_config_file, $cache_enabled; if (wp_cache_replace_line('^ *\$cache_enabled', '$cache_enabled = false;', $wp_cache_config_file)) { $cache_enabled = false; } } function wp_cache_is_enabled() { global $wp_cache_config_file; if(get_settings('gzipcompression')) { echo "Warning: GZIP compression is enabled in Wordpress, wp-cache will be bypassed until you disable gzip compression.
"; return false; } $lines = file($wp_cache_config_file); foreach($lines as $line) { if (preg_match('/^ *\$cache_enabled *= *true *;/', $line)) return true; } return false; } function wp_cache_replace_line($old, $new, $my_file) { if (!is_writable($my_file)) { echo "Error: file $my_file is not writeable.
\n"; return false; } $found = false; $lines = file($my_file); foreach($lines as $line) { if ( preg_match("/$old/", $line)) { $found = true; break; } } if ($found) { $fd = fopen($my_file, 'w'); foreach($lines as $line) { if ( !preg_match("/$old/", $line)) fputs($fd, $line); else { fputs($fd, "$new //Added by AIO Cache\n"); } } fclose($fd); return true; } $fd = fopen($my_file, 'w'); $done = false; foreach($lines as $line) { if ( $done || !preg_match('/^define|\$|\?>/', $line)) fputs($fd, $line); else { fputs($fd, "$new //Added by AIO Cache\n"); fputs($fd, $line); $done = true; } } fclose($fd); return true; /* copy($my_file, $my_file . "-prev"); rename($my_file . '-new', $my_file); */ } function wp_cache_verify_cache_dir() { global $cache_path; $dir = dirname($cache_path); if ( !file_exists($cache_path) ) { if ( !is_writable( $dir ) || !($dir = mkdir( $cache_path, 0777) ) ) { echo "Error: Your cache directory ($cache_path) did not exist and couldn't be created by the web server.
Check $dir permissions."; return false; } } if ( !is_writable($cache_path)) { echo "Error: Your cache directory ($cache_path) or $dir need to be writable for this plugin to work.
Double-check it."; return false; } if ( '/' != substr($cache_path, -1)) { $cache_path .= '/'; } return true; } function wp_cache_verify_config_file() { global $wp_cache_config_file, $wp_cache_config_file_sample; $new = false; $dir = dirname($wp_cache_config_file); if ( !is_writable($dir)) { echo "Error: wp-content directory ($dir) is not writable by the Web server.
Check its permissions."; return false; } if ( !file_exists($wp_cache_config_file) ) { if ( !file_exists($wp_cache_config_file_sample) ) { echo "Error: Sample AIO Cache config file ($wp_cache_config_file_sample) does not exist.
Verify you installation."; return false; } copy($wp_cache_config_file_sample, $wp_cache_config_file); $new = true; } if ( !is_writable($wp_cache_config_file)) { echo "Error: Your AIO Cache config file ($wp_cache_config_file) is not writable by the Web server.
Check its permissions."; return false; } require($wp_cache_config_file); return true; } function wp_cache_check_link() { global $wp_cache_link, $wp_cache_file; if ( basename(@readlink($wp_cache_link)) != basename($wp_cache_file)) { @unlink($wp_cache_link); if (!@symlink ($wp_cache_file, $wp_cache_link)) { echo "advanced-cache.php link does not exist
"; echo "Create it by executing:
ln -s $wp_cache_file $wp_cache_link
in your server
"; return false; } } return true; } function wp_cache_check_global_config() { $global = ABSPATH . 'wp-config.php'; $lines = file($global); foreach($lines as $line) { if (preg_match('/^ *define *\( *\'WP_CACHE\' *, *true *\) *;/', $line)) { return true; } } $line = 'define(\'WP_CACHE\', true);'; if (!is_writable($global) || !wp_cache_replace_line('define *\( *\'WP_CACHE\'', $line, $global) ) { echo "Error: WP_CACHE is not enabled in your wp-config.php file and AIO Cache couldn't modify it.
"; echo "Edit $global and add the following line:
define('WP_CACHE', true);
Otherwise, AIO Cache will not be executed by Wordpress core.
"; return false; } return true; } function wp_cache_files() { global $cache_path, $file_prefix, $cache_max_time, $valid_nonce; if ( '/' != substr($cache_path, -1)) { $cache_path .= '/'; } if ( $valid_nonce ) { if(isset($_REQUEST['wp_delete_cache'])) { wp_cache_clean_cache($file_prefix); } if(isset($_REQUEST['wp_delete_cache_file'])) { wp_cache_clean_cache($_REQUEST['wp_delete_cache_file']); } if(isset($_REQUEST['wp_delete_expired'])) { wp_cache_clean_expired($file_prefix); } } if(isset($_REQUEST['wp_list_cache'])) { $list_files = true; $list_mess = "Update list"; } else $list_mess = "List files"; echo '
'; echo ''; echo '

Cache Contents

'; echo "\n"; $count = 0; $expired = 0; $now = time(); if ( ($handle = opendir( $cache_path )) ) { if ($list_files) echo ""; while ( false !== ($file = readdir($handle))) { if ( preg_match("/^$file_prefix.*\.meta/", $file) ) { $this_expired = false; $content_file = preg_replace("/meta$/", "html", $file); $mtime = filemtime($cache_path.$file); if ( ! ($fsize = @filesize($cache_path.$content_file)) ) continue; // .meta does not exists $fsize = intval($fsize/1024); $age = $now - $mtime; if ( $age > $cache_max_time) { $expired++; $this_expired = true; } $count++; if ($list_files) { $meta = new CacheMeta; $meta = unserialize(file_get_contents($cache_path . $file)); echo $flip ? '' : ''; $flip = !$flip; echo '"; if ($this_expired) echo ""; else echo ""; echo ""; echo '\n"; } } } closedir($handle); if ($list_files) echo "
'; echo $meta->uri . "$age secs$age secs$fsize KB
'; echo ''; echo ''; echo '
'; wp_nonce_field('wp-cache'); echo "
"; } echo "

Expired Pages: $expired

"; echo '
'; echo ''; echo ''; echo '
'; wp_nonce_field('wp-cache'); echo "
\n"; echo "

Cached Pages: $count

"; echo '
'; echo ''; echo '
'; wp_nonce_field('wp-cache'); echo "
\n"; echo '
'; } function wp_cache_clean_cache($file_prefix) { global $cache_path; // If init-2 was compiled, use its function to avoid race-conditions if(function_exists('wp_cache_phase2_clean_cache')) return wp_cache_phase2_clean_cache($file_prefix); $expr = "/^$file_prefix/"; if ( ($handle = opendir( $cache_path )) ) { while ( false !== ($file = readdir($handle))) { if ( preg_match($expr, $file) ) { unlink($cache_path . $file); } } closedir($handle); } } function wp_cache_clean_expired($file_prefix) { global $cache_path, $cache_max_time; // If init-2 was compiled, use its function to avoid race-conditions if(function_exists('wp_cache_phase2_clean_expired')) return wp_cache_phase2_clean_expired($file_prefix); $expr = "/^$file_prefix/"; $now = time(); if ( ($handle = opendir( $cache_path )) ) { while ( false !== ($file = readdir($handle))) { if ( preg_match($expr, $file) && (filemtime($cache_path . $file) + $cache_max_time) <= $now) { unlink($cache_path . $file); } } closedir($handle); } } //Start Lazy Load ----------------------------------------------------------------------------------------- if ( ! class_exists( 'LazyLoad_Images' ) ) : class LazyLoad_Images { const version = '0.5'; static function init() { if ( is_admin() ) return; add_action( 'wp_enqueue_scripts', array( __CLASS__, 'add_scripts' ) ); add_filter( 'the_content', array( __CLASS__, 'add_image_placeholders' ), 99 ); // Run this later, so other content filters have run, including image_add_wh on WP.com add_filter( 'post_thumbnail_html', array( __CLASS__, 'add_image_placeholders' ), 11 ); add_filter( 'get_avatar', array( __CLASS__, 'add_image_placeholders' ), 11 ); } static function add_scripts() { wp_enqueue_script( 'wpcom-lazy-load-images', self::get_url( 'js/lazy-load.js' ), array( 'jquery', 'jquery-sonar' ), self::version, true ); wp_enqueue_script( 'jquery-sonar', self::get_url( 'js/jquery.sonar.min.js' ), array( 'jquery' ), self::version, true ); } static function add_image_placeholders( $content ) { // Don't lazyload for feeds, previews, mobile if( is_feed() || is_preview() || ( function_exists( 'is_mobile' ) && is_mobile() ) ) return $content; // Don't lazy-load if the content has already been run through previously if ( false !== strpos( $content, 'data-lazy-src' ) ) return $content; // In case you want to change the placeholder image $placeholder_image = apply_filters( 'lazyload_images_placeholder_image', self::get_url( 'images/1x1.trans.gif' ) ); // This is a pretty simple regex, but it works $content = preg_replace( '#]+?)src=[\'"]?([^\'"\s>]+)[\'"]?([^>]*)>#', sprintf( '', $placeholder_image ), $content ); return $content; } static function get_url( $path = '' ) { return plugins_url( ltrim( $path, '/' ), __FILE__ ); } } function lazyload_images_add_placeholders( $content ) { return LazyLoad_Images::add_image_placeholders( $content ); } LazyLoad_Images::init(); endif; //End Lazy Load ----------------------------------------------------------------------------------------- //Start MiniPress ----------------------------------------------------------------------------------------- require_once( 'lib/class.jsmin.php' ); require_once( 'lib/class.compressor.php' ); require_once( 'lib/class.minipress.php' ); function minipress_init() { load_plugin_textdomain( 'minipress_translate', false, dirname( dirname( plugin_basename( __FILE__ ) ) ), '/lang/' ); } add_action( 'init', 'minipress_init' ); add_action( 'wp_enqueue_scripts', array( 'MiniPress', 'concat_scripts' ), '99' ); add_action( 'wp_enqueue_scripts', array( 'MiniPress', 'concat_styles' ), '99' ); //End MiniPress ----------------------------------------------------------------------------------------- ?>