Skip to content

Commit

Permalink
Updated ValetPress.php plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
sdenike committed Sep 21, 2018
1 parent 86b9b7e commit a72732e
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions plugins/valetpress/valetpress.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<?php
require_once( ABSPATH . "wp-includes/pluggable.php" );

/*include 'sdenike.php';
/*
Plugin Name: Extra functions
Plugin Name: ValetPress functions
Plugin URI: https://systmweb.com
Description: Specific functions to help the site perform better.
Version: 2.0
Description: Specific functions used by ValetPress, do NOT use this in production.
Version: 1.0
Author: sdenike
AuthorURI: https://systmweb.com
*/

function sdenike_header_function() {
function vp_header_function() {
echo '<meta http-equiv="x-dns-prefetch-control" content="on"/>
<link rel="dns-prefetch" href="//www.google-analytics.com"/>
<link rel="dns-prefetch" href="//fonts.googleapis.com"/>
Expand All @@ -23,10 +23,10 @@ function sdenike_header_function() {
';
}

add_action('wp_head','sdenike_header_function');
add_action('wp_head','vp_header_function');

//* Enable GZIP compression function
function wp_http_compression() {
function vp_http_compression() {
// Dont use on Admin HTML editor
if (stripos($uri, '/js/tinymce') !== false)
return false;
Expand All @@ -39,30 +39,30 @@ function wp_http_compression() {
if (extension_loaded('zlib'))
if(!ob_start("ob_gzhandler")) ob_start();
}
add_action('init', 'wp_http_compression');
add_action('init', 'vp_http_compression');

//* Remove JS/CSS versions
function remove_cssjs_ver( $src ) {
function vp_remove_cssjs_ver( $src ) {
if( strpos( $src, '?ver=' ) )
$src = remove_query_arg( 'ver', $src );
return $src;
}
add_filter( 'style_loader_src', 'remove_cssjs_ver', 1000 );
add_filter( 'script_loader_src', 'remove_cssjs_ver', 1000 );
add_filter( 'style_loader_src', 'vp_remove_cssjs_ver', 1000 );
add_filter( 'script_loader_src', 'vp_remove_cssjs_ver', 1000 );

//* Remove WP Version from header and feed
function sdenike_remove_version() {
function vp_remove_version() {
return '';
}
add_filter('the_generator', 'sdenike_remove_version');
add_filter('the_generator', 'vp_remove_version');

//* Reduce image resolution
add_filter('jpeg_quality', function($arg){return 80;});

// Sharpen resized jpeg images
// http://wpsnipp.com/index.php/functions-php/sharpen-resized-wordpress-uploaded-images-jpg/#

function wps_sharpen_resized_file( $resized_file ) {
function vp_sharpen_resized_file( $resized_file ) {
$image = wp_load_image( $resized_file );
if ( !is_resource( $image ) )
return new WP_Error( 'error_loading_image', $image, $file );
Expand All @@ -89,7 +89,7 @@ function wps_sharpen_resized_file( $resized_file ) {
}
return $resized_file;
}
add_filter('image_make_intermediate_size', 'wps_sharpen_resized_file',900);
add_filter('image_make_intermediate_size', 'vp_sharpen_resized_file',900);

/**
* Plugin Name: PJ Transient Cleaner
Expand Down Expand Up @@ -154,12 +154,12 @@ public static function cleaner() {
Pj_Transient_Cleaner::load();

// Add Livereload.js to header function
function livereload_add() {
function vp_livereload_add() {
?>
<script src="<?php echo get_site_url();?>:35729/livereload.js?snipver=2" type="text/javascript" defer=""></script>
<?php
}
add_action('wp_head', 'livereload_add');
add_action('wp_head', 'vp_livereload_add');

// Auto login function
function vp_auto_login() {
Expand Down

0 comments on commit a72732e

Please # to comment.