Commit a51c8820 authored by Jordan Michaels's avatar Jordan Michaels

2020040101

parent 3aa1bbdf
......@@ -2,6 +2,9 @@
Versions are recorded in YYYYMMDDnn format. Please include latest versions at the top.
## 2020040101
* [FIX] Improved environmental testing and initial defaults
## 2020032401
* [UPGRADE] Added proper images for Vivio Swift Icons and Header images
* [FIX] A few minor layout issues have been corrected
......
......@@ -309,18 +309,24 @@ class Vivio_Swift_Dashboard_Menu extends Vivio_Swift_Admin_Messages
</h3>
<div class="inside">
<strong><?php _e('VERSION', 'vivio-swift');?>
<strong><?php _e('Version', 'vivio-swift');?>
: </strong><code><?php echo VIVIO_SWIFT_VERSION;?></code><br/>
<strong><?php _e('URL', 'vivio-swift');?>
: </strong><code><?php echo VIVIO_SWIFT_URL; ?></code><br/>
<strong><?php _e('PATH', 'vivio-swift');?>
: </strong><code><?php echo VIVIO_SWIFT_PATH; ?></code><br/>
<strong><?php _e('CACHE URL', 'vivio-swift');?>
<strong><?php _e('Cache URL', 'vivio-swift');?>
: </strong><code><?php echo VIVIO_SWIFT_CACHE_URL; ?></code><br/>
<strong><?php _e('CACHE PATH', 'vivio-swift');?>
<strong><?php _e('Cache Path', 'vivio-swift');?>
: </strong><code><?php echo VIVIO_SWIFT_CACHE_PATH; ?></code><br/>
<strong><?php _e('BOT NAME', 'vivio-swift');?>
<strong><?php _e('Cache Path Writable', 'vivio-swift');?>
: </strong><code><?php echo (is_writable(VIVIO_SWIFT_CACHE_PATH)) ? "Writable</code>" : "Not Writable</code> "."<font color='red'>WARNING</font>" ?><br/>
<strong><?php _e('Cache Bot Name', 'vivio-swift');?>
: </strong><code><?php echo VIVIO_SWIFT_CACHE_BOT_NAME; ?></code><br/>
<strong><?php _e('Debug File Path', 'vivio-swift');?>
: </strong><code><?php echo VIVIO_SWIFT_PATH."logs/".VIVIO_SWIFT_LOG_FILE; ?></code><br/>
<strong><?php _e('Debug File Writable', 'vivio-swift');?>
: </strong><code><?php echo (is_writable(VIVIO_SWIFT_PATH."logs/".VIVIO_SWIFT_LOG_FILE)) ? "Writable</code>" : "Not Writable</code> "."<font color='red'>WARNING</font>" ?><br/>
</div>
</div>
......@@ -369,8 +375,6 @@ class Vivio_Swift_Dashboard_Menu extends Vivio_Swift_Admin_Messages
echo $cookieDomain['host']; ?></code><br/>
<strong>CURL <?php _e('Library Present', 'vivio-swift');?>
: </strong><code><?php echo (function_exists('curl_init')) ? "Yes" : "No"; ?></code><br/>
<strong><?php _e('Debug File Write Permissions', 'vivio-swift');?>
: </strong><code><?php echo (is_writable(VIVIO_SWIFT_PATH."/logs/".VIVIO_SWIFT_LOG_FILE)) ? "Writable</code>" : "Not Writable</code> "."<font color='red'>WARNING</font>" ?><br/>
</div>
</div>
......
......@@ -2,8 +2,25 @@
class Vivio_Swift_Config_Settings
{
function __construct(){
// environment vars
var $has_apache;
var $has_modrewrite;
var $has_modheader;
// functional vars
var $can_cache;
var $can_header;
function __construct()
{
// perform environment tests to determine ability
$this->has_apache = boolval($vivio_swift_global->util_apache->apache_version());
$this->has_modrewrite = boolval($vivio_swift_global->util_apache->test_mod_rewrite());
$this->has_modheader = boolval($vivio_swift_global->util_apache->test_mod_headers());
// combine tests to determine functionality
$this->can_cache = (($this->has_apache && $this->has_modrewrite)?true:false);
$this->can_header = ($this->has_modheader?true:false);
}
static function add_value_configs()
......@@ -20,11 +37,11 @@ class Vivio_Swift_Config_Settings
// Query Strings
$vivio_swift_global->configs->add_value('vivio_swift_remove_query_strings','1');//Checkbox
// On-Access Cahce
$vivio_swift_global->configs->add_value('vivio_swift_cache_enabled','1');//Checkbox
// On-Access Cache
$vivio_swift_global->configs->add_value('vivio_swift_cache_enabled',$this->can_cache?'1':'');//Checkbox
// Preload Cache
$vivio_swift_global->configs->add_value('vivio_swift_preload_cache_enabled','1');//Checkbox
$vivio_swift_global->configs->add_value('vivio_swift_preload_cache_enabled',$this->can_cache?'1':'');//Checkbox
$vivio_swift_global->configs->add_value('vivio_swift_preload_cache_expire_hours','1');
$vivio_swift_global->configs->add_value('vivio_swift_preload_last_run_date','');
......@@ -49,7 +66,6 @@ class Vivio_Swift_Config_Settings
$vivio_swift_global->configs->add_value('vivio_swift_cache_control_headers_enable','0');//Checkbox
$vivio_swift_global->configs->add_value('vivio_swift_cache_control_headers_values',Vivio_Swift_Config_Settings::default_cache_control_groups());
// Compression options
$vivio_swift_global->configs->add_value('vivio_swift_compress_minify_css','');//Checkbox
$vivio_swift_global->configs->add_value('vivio_swift_compress_minify_js','');//Checkbox
......@@ -73,25 +89,25 @@ class Vivio_Swift_Config_Settings
$vivio_swift_global->configs->reset_config();
//Debug
// Debug
$vivio_swift_global->configs->set_value('vivio_swift_enable_debug','');//Checkbox
$vivio_swift_global->configs->set_value('vivio_swift_debug_level','3');//0-5 3=warn
//Cache Response HTML comment
// Cache Response HTML comment
$vivio_swift_global->configs->set_value('vivio_swift_enable_cache_comment','');//Checkbox
//Query Strings
// Query Strings
$vivio_swift_global->configs->set_value('vivio_swift_remove_query_strings','1');//Checkbox
//On-Access Cache
$vivio_swift_global->configs->set_value('vivio_swift_cache_enabled','1');//Checkbox
// On-Access Cache
$vivio_swift_global->configs->set_value('vivio_swift_cache_enabled',$this->can_cache?'1':'');//Checkbox
//Preload Cache
$vivio_swift_global->configs->set_value('vivio_swift_preload_cache_enabled','1');//Checkbox
// Preload Cache
$vivio_swift_global->configs->set_value('vivio_swift_preload_cache_enabled',$this->can_cache?'1':'');//Checkbox
$vivio_swift_global->configs->set_value('vivio_swift_preload_cache_expire_hours','1');
$vivio_swift_global->configs->set_value('vivio_swift_preload_last_run_date','');
//htaccess rules
// htaccess rules
$vivio_swift_global->configs->set_value('vivio_swift_cache_custom_rules_at_top','');//Checkbox
$vivio_swift_global->configs->set_value('vivio_swift_cache_exclude_posts','1');//Checkbox
$vivio_swift_global->configs->set_value('vivio_swift_cache_exclude_query_strings','1');//Checkbox
......@@ -125,7 +141,7 @@ class Vivio_Swift_Config_Settings
$vivio_swift_global->configs->set_value('vivio_swift_refresh_on_category_change','1');//Checkbox
$vivio_swift_global->configs->set_value('vivio_swift_refresh_on_tag_change','1');//Checkbox
//Done. Save it.
// Done. Save it.
$vivio_swift_global->configs->save_config();
}
......
......@@ -16,19 +16,21 @@ class Vivio_Swift_Utility_Apache {
return in_array($module, apache_get_modules());
}
function test_required_modules()
{
$has_mod_rewrite = $this->test_mod_rewrite();
$has_mod_headers = $this->test_mod_headers();
}
function test_mod_rewrite()
{
if($this->apache_version()){
return $this->apache_module_exists('mod_rewrite');
}else{
return false;
};
}
function test_mod_headers()
{
if($this->apache_version()){
return $this->apache_module_exists('mod_headers');
}else{
return false;
};
}
}
\ No newline at end of file
......@@ -4,7 +4,6 @@ class Vivio_Swift_Utility_File
{
function __construct(){
}
static function write_content_to_file($file_path, $contents)
......@@ -36,6 +35,9 @@ class Vivio_Swift_Utility_File
return true;
}
/*
* custom file backup method for htaccess to vivio swift backup dir
*/
static function backup_and_rename_htaccess($src_file_path, $suffix = 'backup')
{
global $vivio_swift_global;
......@@ -44,7 +46,7 @@ class Vivio_Swift_Utility_File
$vivio_swift_backup_dir = VIVIO_SWIFT_BACKUPS_PATH;
if (!$vivio_swift_global->util_file->create_dir($vivio_swift_backup_dir))
{
$vivio_swift_global->debug_logger->log_debug("backup_and_rename_htaccess - Creation of backup directory failed!",4);
$vivio_swift_global->debug_logger->log_debug("Vivio_Swift_Utility_File::backup_and_rename_htaccess() - Creation of backup directory failed!", 4);
return false;
}
......@@ -53,6 +55,7 @@ class Vivio_Swift_Utility_File
$backup_file_path = $vivio_swift_backup_dir . '/' . $backup_file_name;
if (!copy($src_file_path, $backup_file_path)) {
$vivio_swift_global->debug_logger->log_debug("Vivio_Swift_Utility_File::backup_and_rename_htaccess() - Failed to backup ".$src_file_path." to ".$backup_file_path, 4);
// Failed to make a backup copy
return false;
}
......@@ -109,7 +112,8 @@ class Vivio_Swift_Utility_File
}
/*
* Checks if a write operation is possible for the file in question
* Checks if a write operation is possible for a currently non-existing file
* use is_writable() for files or directories that already exist.
*/
static function is_file_writable($filepath)
{
......
......@@ -4,38 +4,38 @@ class Vivio_Swift_Utility_Htaccess
{
//The following variables hold the markers for each of features added to the .htacces file
//This enables us to locate blocks of code when a feature needs to be removed.
public static $vivio_swift_excludes_marker_start = '# BEGIN Excludes';
public static $vivio_swift_excludes_marker_end = '# END Excludes';
private static $vivio_swift_excludes_marker_start = '# BEGIN Excludes';
private static $vivio_swift_excludes_marker_end = '# END Excludes';
public static $vivio_swift_basics_marker_start = '# BEGIN Basics';
public static $vivio_swift_basics_marker_end = '# END Basics';
private static $vivio_swift_basics_marker_start = '# BEGIN Basics';
private static $vivio_swift_basics_marker_end = '# END Basics';
public static $vivio_swift_excludes_posts_start = '# BEGIN Exclude POST Requests';
public static $vivio_swift_excludes_posts_end = '# END Exclude POST Requests';
private static $vivio_swift_excludes_posts_start = '# BEGIN Exclude POST Requests';
private static $vivio_swift_excludes_posts_end = '# END Exclude POST Requests';
public static $vivio_swift_exclude_query_strings_start = '# BEGIN Exclude Query Strings';
public static $vivio_swift_exclude_query_strings_end = '# END Exclude Query Strings';
private static $vivio_swift_exclude_query_strings_start = '# BEGIN Exclude Query Strings';
private static $vivio_swift_exclude_query_strings_end = '# END Exclude Query Strings';
public static $vivio_swift_exclude_cookie_contains_start = '# BEGIN Exclude Cookie Contains';
public static $vivio_swift_exclude_cookie_contains_end = '# END Exclude Cookie Contains';
private static $vivio_swift_exclude_cookie_contains_start = '# BEGIN Exclude Cookie Contains';
private static $vivio_swift_exclude_cookie_contains_end = '# END Exclude Cookie Contains';
public static $vivio_swift_exclude_user_agent_start = '# BEGIN Exclude User Agents';
public static $vivio_swift_exclude_user_agent_end = '# END Exclude User Agents';
private static $vivio_swift_exclude_user_agent_start = '# BEGIN Exclude User Agents';
private static $vivio_swift_exclude_user_agent_end = '# END Exclude User Agents';
public static $vivio_swift_exclude_path_is_start = '# BEGIN Exclude Path is';
public static $vivio_swift_exclude_path_is_end = '# END Exclude Path is';
private static $vivio_swift_exclude_path_is_start = '# BEGIN Exclude Path is';
private static $vivio_swift_exclude_path_is_end = '# END Exclude Path is';
public static $vivio_swift_exclude_path_ends_with_start = '# BEGIN Exclude Path ends with';
public static $vivio_swift_exclude_path_ends_with_end = '# END Exclude Path ends with';
private static $vivio_swift_exclude_path_ends_with_start = '# BEGIN Exclude Path ends with';
private static $vivio_swift_exclude_path_ends_with_end = '# END Exclude Path ends with';
public static $vivio_swift_exclude_path_contains_start = '# BEGIN Exclude Path contains';
public static $vivio_swift_exclude_path_contains_end = '# END Exclude Path contains';
private static $vivio_swift_exclude_path_contains_start = '# BEGIN Exclude Path contains';
private static $vivio_swift_exclude_path_contains_end = '# END Exclude Path contains';
public static $vivio_swift_custom_rules_start = '# BEGIN Custom Rules';
public static $vivio_swift_custom_rules_end = '# END Custom Rules';
private static $vivio_swift_custom_rules_start = '# BEGIN Custom Rules';
private static $vivio_swift_custom_rules_end = '# END Custom Rules';
public static $vivio_swift_cachecontrol_marker_start = '# BEGIN Cache-Control';
public static $vivio_swift_cachecontrol_marker_end = '# END Cache-Control';
private static $vivio_swift_cachecontrol_marker_start = '# BEGIN Cache-Control';
private static $vivio_swift_cachecontrol_marker_end = '# END Cache-Control';
function __construct()
{
......@@ -391,10 +391,6 @@ class Vivio_Swift_Utility_Htaccess
$rules .= Vivio_Swift_Utility_Htaccess::$vivio_swift_exclude_cookie_contains_start . PHP_EOL; //Add feature marker start
foreach ($arr_cookie_values as $i => $value) {
$rules .= 'RewriteCond %{HTTP:Cookie} !^.*('.$value.').*$' . PHP_EOL;
// don't use cache on certain types of WP users
//$rules .= 'RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$' . PHP_EOL;
// don't use cache on an active woocommerce session
// $rules .= 'RewriteCond %{HTTP:Cookie} !wp_woocommerce_session' . PHP_EOL;
}
$rules .= Vivio_Swift_Utility_Htaccess::$vivio_swift_exclude_cookie_contains_end . PHP_EOL; //Add feature marker end
}
......
......@@ -3,7 +3,7 @@ Contributors: viviotech
Tags: cache, faster, performance, optimize, accelerate
Donate link: https://code.viviotech.net/wp/vivio-swift/
Requires at least: 4.0
Tested up to: 5.3
Tested up to: 5.4
Stable tag: trunk
Requires PHP: 5.6
License: GPL3 or later
......
......@@ -3,7 +3,7 @@
Plugin Name: Vivio Swift
Plugin URI: https://code.viviotech.net/wp/vivio-swift
Description: Make your WordPress sites fly with simple yet powerful acceleration tools like caching, compression, and simplification.
Version: 2020032501
Version: 2020040101
Author: Vivio Technologies
Author URI: https://viviotech.net
License: GPL3
......@@ -12,7 +12,7 @@ Domain Path: /languages
Copyright (C)2018-2020 Vivio Technologies
Additional Contributers and Copyrights:
Additional Contributers, Copyrights, & Inspiration:
Tips and Tricks HQ, wpsolutions, Peter Petreski, Ruhul Amin, mbrsolution, chesio
*/
......@@ -25,7 +25,7 @@ if (!class_exists('Vivio_Swift')){
class Vivio_Swift{
var $version = '2020032501';
var $version = '2020040101';
var $plugin_url;
var $plugin_path;
var $configs;
......@@ -127,7 +127,7 @@ if (!class_exists('Vivio_Swift')){
{
// set debugging
$debug_config = $this->configs->get_value('vivio_swift_enable_debug');
$debug_enabled = empty($debug_config) ? false : true;
$debug_enabled = empty($debug_config)?false:true;
$debug_level = $this->configs->get_value('vivio_swift_debug_level');
// init objects
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment