900af8a7 by Jeff Balicki

cache

1 parent 8804f524
Showing 190 changed files with 322 additions and 1161 deletions
/* FVM 3 */
#fastvelocity-min{margin-top:10px}
#fastvelocity-min .clear{clear:both}
.fvm-settings label{font-size:15px;color:#222;padding-top:1px}
.fvm-settings span.note-info{font-size:15px;margin-left:8px;color:#666;font-style:italic}
.fvm-settings p.description{font-size:15px;color:#666;font-style:italic}
#tab-info h4{font-size:15px;margin-bottom:-10px}
.fvm-hide{max-height:1px;overflow:none;position:absolute;top:-9999px;left:-9999px;visibility:hidden}
.fvm-warning{font-weight:500;color:#A00}
h3.fvm-bold-green{font-weight:500;font-size:15px;color:#1196A3}
.fvm-bold-green{font-weight:500;color:#1196A3}
.fvm-label-special{line-height:38px}
.fvm-label-pad{line-height:21px}
.fvm-rowintro{padding-bottom:10px;font-size:15px}
table.fvm-settings td,table.fvm-settings td p,table.fvm-settings th{font-size:15px}
.fvm-wrapper{font-size:16px;padding:18px}
.fvm-wrapper h4{font-size:16px;margin:0;color:#1196A3}
.fvm-wrapper .accordion p,.fvm-wrapper .accordion code{font-size:16px;line-height:1.3}
.fvm-wrapper .accordion a, .fvm-wrapper .accordion a:hover { color: #0073aa; }
.fvm-code-full{width:100%;padding:8px;background:#F3F3F3;box-sizing:border-box;font-family:Consolas,Monaco,monospace;font-size:13px;line-height:1.5;margin-bottom:15px}
#status .fvm-cache-stats{margin:10px 0 0}
#status textarea.row-log{display:block;margin:0;padding:6px;border:none;background:#23282d;color:#ccc;height:300px;max-width:100%;overflow:auto;line-height:1.5;font-size:.8125rem;white-space:pre;font-family:monospace}
#status textarea.row-log::-webkit-scrollbar{width:8px;height:8px;background-color:#222}
#status textarea.row-log::-webkit-scrollbar-thumb{background-color:#000}
#status textarea.row-log::-webkit-scrollbar-track{background-color:#999}
/* jQuery UI */
.ui-helper-reset{margin:0;padding:0;border:0;outline:0;line-height:1.3;text-decoration:none;font-size:100%;list-style:none}
.ui-icon{display:inline-block;vertical-align:middle;margin-top:-.25em;position:relative;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat}
.ui-accordion .ui-accordion-header{display:block;cursor:pointer;position:relative;margin:2px 0 0;padding:.5em .5em .5em .7em;font-size:100%}
.ui-accordion .ui-accordion-content{padding:1em 2.2em;border-top:0;overflow:auto}
.ui-widget{font-size:1em}
.ui-widget-content{border:1px solid #ddd;background:#fff;color:#333}
.ui-widget-content a{color:#333}
.ui-state-default,.ui-widget-content .ui-state-default,.ui-widget-header .ui-state-default,.ui-button,html .ui-button.ui-state-disabled:hover,html .ui-button.ui-state-disabled:active{border:1px solid #c5c5c5;background:#f6f6f6;font-weight:400;color:#454545}
.ui-state-hover,.ui-widget-content .ui-state-hover,.ui-widget-header .ui-state-hover,.ui-state-focus,.ui-widget-content .ui-state-focus,.ui-widget-header .ui-state-focus,.ui-button:hover,.ui-button:focus{border:1px solid #ccc;background:#ededed;font-weight:400;color:#2b2b2b}
.ui-state-active,.ui-widget-content .ui-state-active,.ui-widget-header .ui-state-active,a.ui-button:active,.ui-button:active,.ui-button.ui-state-active:hover{border:1px solid #bbb;background:#0073aa;font-weight:400;color:#fff}
.ui-icon{width:16px;height:16px}
.ui-icon,.ui-widget-content .ui-icon{background-image:url(images/ui-icons_444444_256x240.png)}
.ui-state-hover .ui-icon,.ui-state-focus .ui-icon,.ui-button:hover .ui-icon,.ui-button:focus .ui-icon{background-image:url(images/ui-icons_555555_256x240.png)}
.ui-state-active .ui-icon,.ui-button:active .ui-icon{background-image:url(images/ui-icons_ffffff_256x240.png)}
.ui-icon-triangle-1-e{background-position:-32px -16px}
.ui-icon-triangle-1-s{background-position:-65px -16px}
.ui-corner-all,.ui-corner-top,.ui-corner-left,.ui-corner-tl{border-top-left-radius:3px}
.ui-corner-all,.ui-corner-top,.ui-corner-right,.ui-corner-tr{border-top-right-radius:3px}
.ui-corner-all,.ui-corner-bottom,.ui-corner-left,.ui-corner-bl{border-bottom-left-radius:3px}
.ui-corner-all,.ui-corner-bottom,.ui-corner-right,.ui-corner-br{border-bottom-right-radius:3px}
.ui-state-focus:focus{outline:none}
/* Mobile */
@media screen and (max-width:520px) {
.fvm-label-special { line-height: inherit; }
}
// get logs via ajax
function fvm_get_logs() {
// ajax request
jQuery( document ).ready(function() {
var data = { 'action': 'fvm_get_logs' };
jQuery.post(ajaxurl, data, function(resp) {
if(resp.success == 'OK') {
// logs
jQuery('.log-stats textarea').val(resp.log);
jQuery('.log-stats textarea').scrollTop(jQuery('.log-stats textarea')[0].scrollHeight);
} else {
// error log
console.error(resp.success);
}
});
});
}
jQuery( document ).ready(function() {
// help section
jQuery( ".accordion" ).accordion({ active: false, collapsible: true, heightStyle: "content" });
});
\ No newline at end of file
<?php
/*
Plugin Name: Fast Velocity Minify
Plugin URI: http://fastvelocity.com
Description: Improve your speed score on GTmetrix, Pingdom Tools and Google PageSpeed Insights by merging and minifying CSS and JavaScript files into groups, compressing HTML and other speed optimizations.
Author: Raul Peixoto
Author URI: http://fastvelocity.com
Text Domain: fast-velocity-minify
Version: 3.2.6
License: GPL2
------------------------------------------------------------------------
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
# Exit if accessed directly
if (!defined('ABSPATH')){ exit(); }
# Invalidate OPCache for current file on WP 5.5+
if(function_exists('wp_opcache_invalidate') && stripos(__FILE__, '/fvm.php') !== false) {
wp_opcache_invalidate(__FILE__, true);
}
# info, variables, paths
$fvm_var_file = __FILE__; # /home/path/plugins/pluginname/wpr.php
$fvm_var_basename = plugin_basename($fvm_var_file); # pluginname/wpr.php
$fvm_var_dir_path = plugin_dir_path($fvm_var_file); # /home/path/plugins/pluginname/
$fvm_var_url_path = plugins_url(dirname($fvm_var_basename)) . '/'; # https://example.com/wp-content/plugins/pluginname/
$fvm_var_plugin_version = get_file_data($fvm_var_file, array('Version' => 'Version'), false)['Version'];
$fvm_var_inc_dir = $fvm_var_dir_path . 'inc' . DIRECTORY_SEPARATOR; # /home/path/plugins/pluginname/inc/
$fvm_var_inc_lib = $fvm_var_dir_path . 'libs' . DIRECTORY_SEPARATOR; # /home/path/plugins/pluginname/libs/
# global functions for backend, frontend, ajax, etc
require_once($fvm_var_inc_dir . 'common.php');
require_once($fvm_var_inc_dir . 'updates.php');
# wp-cli support
if (defined('WP_CLI') && WP_CLI) {
require_once($fvm_var_inc_dir . 'wp-cli.php');
}
# get all options from database
$fvm_settings = fvm_get_settings();
# site url, domain name
$fvm_urls = array('wp_site_url'=>trailingslashit(site_url()), 'wp_domain'=>fvm_get_domain());
# only on backend
if(is_admin()) {
# admin functionality
require_once($fvm_var_inc_dir . 'admin.php');
require_once($fvm_var_inc_dir . 'serverinfo.php');
# both backend and frontend, as long as user can manage options
add_action('admin_bar_menu', 'fvm_admintoolbar', 100);
add_action('init', 'fvm_process_cache_purge_request');
# do admin stuff, as long as user can manage options
add_action('admin_init', 'fvm_save_settings');
add_action('admin_init', 'fvm_check_minimum_requirements');
add_action('admin_init', 'fvm_check_misconfiguration');
add_action('admin_init', 'fvm_update_changes');
add_action('admin_enqueue_scripts', 'fvm_add_admin_jscss');
add_action('admin_menu', 'fvm_add_admin_menu');
add_action('admin_notices', 'fvm_show_admin_notice_from_transient');
add_action('wp_ajax_fvm_get_logs', 'fvm_get_logs_callback');
# purge everything
add_action('switch_theme', 'fvm_purge_all');
add_action('customize_save', 'fvm_purge_all');
add_action('avada_clear_dynamic_css_cache', 'fvm_purge_all');
add_action('upgrader_process_complete', 'fvm_purge_all');
add_action('update_option_theme_mods_' . get_option('stylesheet'), 'fvm_purge_all');
}
# frontend only, any user permissions
if(!is_admin()) {
# frontend functionality
require_once($fvm_var_inc_dir . 'frontend.php');
# both back and front, as long as the option is enabled
add_action('init', 'fvm_disable_emojis');
add_action('wp_loaded', 'fvm_ajax_optimizer');
# both backend and frontend, as long as user can manage options
add_action('admin_bar_menu', 'fvm_admintoolbar', 100);
add_action('init', 'fvm_process_cache_purge_request');
# actions for frontend only
add_action('template_redirect', 'fvm_start_buffer', -PHP_INT_MAX);
}
<?php
# Exit if accessed directly
if (!defined('ABSPATH')){ exit(); }
# update routines for new fields and replacements
function fvm_update_changes() {
# current version
global $fvm_var_plugin_version;
# Version 3.0 routines start
# delete old FVM files
global $fvm_var_dir_path, $fvm_var_inc_lib, $fvm_var_inc_dir;
# prevent deleting if the paths are empty
# can happen when a user runs wp-cli on a child directory
if(isset($fvm_var_dir_path) && isset($fvm_var_inc_lib) && isset($fvm_var_inc_dir) && !empty($fvm_var_dir_path) && !empty($fvm_var_inc_lib) && !empty($fvm_var_inc_dir)) {
# must be inside a fast-velocity-minify directory
if (stripos($fvm_var_dir_path, 'fast-velocity-minify') !== false) {
# delete
if(file_exists($fvm_var_inc_dir.'functions-cache.php')) { @unlink($fvm_var_inc_dir.'functions-cache.php'); }
if(file_exists($fvm_var_inc_dir.'functions-cli.php')) { @unlink($fvm_var_inc_dir.'functions-cli.php'); }
if(file_exists($fvm_var_inc_dir.'functions-serverinfo.php')) { @unlink($fvm_var_inc_dir.'functions-serverinfo.php'); }
if(file_exists($fvm_var_inc_dir.'functions-upgrade.php')) { @unlink($fvm_var_inc_dir.'functions-upgrade.php'); }
if(file_exists($fvm_var_inc_dir.'functions.php')) { @unlink($fvm_var_inc_dir.'functions.php'); }
if(file_exists($fvm_var_dir_path.'fvm.css')) { @unlink($fvm_var_dir_path.'fvm.css'); }
if(file_exists($fvm_var_dir_path.'fvm.js')) { @unlink($fvm_var_dir_path.'fvm.js'); }
if(file_exists($fvm_var_inc_lib.'mrclay' . DIRECTORY_SEPARATOR . 'HTML.php')) {
@unlink($fvm_var_inc_lib.'mrclay' . DIRECTORY_SEPARATOR . 'HTML.php');
@unlink($fvm_var_inc_lib.'mrclay' . DIRECTORY_SEPARATOR . 'index.html');
@rmdir($fvm_var_inc_lib.'mrclay');
}
}
}
# Version 3.2 routines start
if (get_option("fastvelocity_plugin_version") !== false) {
if (version_compare($fvm_var_plugin_version, '3.2.0', '>=') && get_option("fastvelocity_min_ignore") !== false) {
# cleanup
delete_option('fastvelocity_min_change_cache_path');
delete_option('fastvelocity_min_change_cache_base_url');
delete_option('fastvelocity_min_fvm_cdn_url');
delete_option('fastvelocity_plugin_version');
delete_option('fvm-last-cache-update');
delete_option('fastvelocity_min_ignore');
delete_option('fastvelocity_min_blacklist');
delete_option('fastvelocity_min_ignorelist');
delete_option('fastvelocity_min_excludecsslist');
delete_option('fastvelocity_min_excludejslist');
delete_option('fastvelocity_min_enable_purgemenu');
delete_option('fastvelocity_min_default_protocol');
delete_option('fastvelocity_min_disable_js_merge');
delete_option('fastvelocity_min_disable_css_merge');
delete_option('fastvelocity_min_disable_js_minification');
delete_option('fastvelocity_min_disable_css_minification');
delete_option('fastvelocity_min_remove_print_mediatypes');
delete_option('fastvelocity_min_skip_html_minification');
delete_option('fastvelocity_min_strip_htmlcomments');
delete_option('fastvelocity_min_skip_cssorder');
delete_option('fastvelocity_min_skip_google_fonts');
delete_option('fastvelocity_min_skip_emoji_removal');
delete_option('fastvelocity_fvm_clean_header_one');
delete_option('fastvelocity_min_enable_defer_js');
delete_option('fastvelocity_min_exclude_defer_jquery');
delete_option('fastvelocity_min_force_inline_css');
delete_option('fastvelocity_min_force_inline_css_footer');
delete_option('fastvelocity_min_remove_googlefonts');
delete_option('fastvelocity_min_defer_for_pagespeed');
delete_option('fastvelocity_min_defer_for_pagespeed_optimize');
delete_option('fastvelocity_min_exclude_defer_login');
delete_option('fastvelocity_min_skip_defer_lists');
delete_option('fastvelocity_min_fvm_fix_editor');
delete_option('fastvelocity_min_loadcss');
delete_option('fastvelocity_min_fvm_removecss');
delete_option('fastvelocity_enabled_css_preload');
delete_option('fastvelocity_enabled_js_preload');
delete_option('fastvelocity_fontawesome_method');
delete_option('fastvelocity_gfonts_method');
}
}
# Version 3.2 routines end
}
<?php
# Exit if accessed directly
if (!defined('ABSPATH')){ exit(); }
###################################################
# extend wp-cli to purge cache, usage: wp fvm purge
###################################################
# only for wp-cli
if ( defined( 'WP_CLI' ) && WP_CLI ) {
class fastvelocity_WPCLI {
# purge files + cache
public function purge() {
WP_CLI::success( __( 'FVM and other caches were purged.', 'fast-velocity-minify' ) );
fvm_purge_static_files();
fvm_purge_others();
# purge everything
$cache = fvm_purge_static_files();
$others = fvm_purge_others();
# notices
WP_CLI::success( __( 'FVM: All Caches are now cleared.', 'fast-velocity-minify' ) .' ('.date("D, d M Y @ H:i:s e").')');
if(is_string($cache)) { WP_CLI::warning($cache); }
if(is_string($others)) { WP_CLI::success($others); }
}
# get cache size
public function stats() {
WP_CLI::error( __( 'This feature is currently under development.', 'fast-velocity-minify' ) );
}
}
# add commands
WP_CLI::add_command( 'fvm', 'fastvelocity_WPCLI' );
}
<?php
# server info
if( $active_tab == 'status' ) {
?>
<div class="fvm-wrapper">
<div id="status">
<div style="height: 40px;"></div>
<h2 class="title"><?php _e( 'Latest Logs', 'fast-velocity-minify' ); ?></h2>
<h3 class="fvm-bold-green"><?php _e( 'In this section, you can check the latest logs for CSS and JS files', 'fast-velocity-minify' ); ?></h3>
<div class="row-log log-stats wpraiser-textarea"><textarea rows="10" cols="50" class="large-text code row-log log-css" disabled></textarea></div>
<div style="height: 40px;"></div>
<h2 class="title"><?php _e( 'Server Info', 'fast-velocity-minify' ); ?></h2>
<h3 class="fvm-bold-green"><?php _e( 'In this section, you can check some server stats and information', 'fast-velocity-minify' ); ?></h3>
<textarea rows="10" cols="50" class="large-text code row-log" disabled><?php fvm_get_generalinfo(); ?></textarea>
<script>fvm_get_logs();</script>
</div>
</div>
<?php
}
\ No newline at end of file
<?php if( $active_tab == 'upgrade' ) { ?>
<div class="fvm-wrapper">
<h2 class="title">Upgrade Your Speed</h2>
<h3 class="fvm-bold-green">Would you like to improve your speed and google scores further?</h3>
</div>
<?php
}
<div class="wrap">
<h1>Fast Velocity Minify</h1>
<div style="height: 20px;"></div>
<?php
# get active tab, set default
$active_tab = isset($_GET['tab']) ? $_GET['tab'] : 'settings';
?>
<h2 class="nav-tab-wrapper wp-clearfix">
<a href="?page=fvm" class="nav-tab <?php echo $active_tab == 'settings' ? 'nav-tab-active' : ''; ?>"><?php _e( 'Settings', 'fast-velocity-minify' ); ?></a>
<a href="?page=fvm&tab=status" class="nav-tab <?php echo $active_tab == 'status' ? 'nav-tab-active' : ''; ?>"><?php _e( 'Status', 'fast-velocity-minify' ); ?></a>
<?php /*<a href="?page=fvm&tab=upgrade" class="nav-tab <?php echo $active_tab == 'upgrade' ? 'nav-tab-active' : ''; ?>"><?php _e( 'Upgrade', 'fast-velocity-minify' ); ?></a>*/ ?>
<a href="?page=fvm&tab=help" class="nav-tab <?php echo $active_tab == 'help' ? 'nav-tab-active' : ''; ?>"><?php _e( 'Help', 'fast-velocity-minify' ); ?></a>
</h2>
<div id="fvm">
<?php
# settings
include_once($fvm_var_dir_path . 'layout' . DIRECTORY_SEPARATOR . 'admin-layout-settings.php');
# include other tabs
include_once($fvm_var_dir_path . 'layout' . DIRECTORY_SEPARATOR . 'admin-layout-status.php');
#include_once($fvm_var_dir_path . 'layout' . DIRECTORY_SEPARATOR . 'admin-layout-upgrade.php');
include_once($fvm_var_dir_path . 'layout' . DIRECTORY_SEPARATOR . 'admin-layout-help.php');
?>
</div>
\ No newline at end of file
# replace
namespace MatthiasMullie > namespace FVM\MatthiasMullie
use MatthiasMullie > use FVM\MatthiasMullie
\ No newline at end of file
#!/usr/bin/env php
<?php
use MatthiasMullie\Minify;
// command line utility to minify CSS
if (file_exists(__DIR__ . '/../../../autoload.php')) {
// if composer install
require_once __DIR__ . '/../../../autoload.php';
} else {
require_once __DIR__ . '/../src/Minify.php';
require_once __DIR__ . '/../src/CSS.php';
require_once __DIR__ . '/../src/Exception.php';
}
error_reporting(E_ALL);
// check PHP setup for cli arguments
if (!isset($_SERVER['argv']) && !isset($argv)) {
fwrite(STDERR, 'Please enable the "register_argc_argv" directive in your php.ini' . PHP_EOL);
exit(1);
} elseif (!isset($argv)) {
$argv = $_SERVER['argv'];
}
// check if path to file given
if (!isset($argv[1])) {
fwrite(STDERR, 'Argument expected: path to file' . PHP_EOL);
exit(1);
}
// check if script run in cli environment
if ('cli' !== php_sapi_name()) {
fwrite(STDERR, $argv[1] . ' must be run in the command line' . PHP_EOL);
exit(1);
}
// check if source file exists
if (!file_exists($argv[1])) {
fwrite(STDERR, 'Source file "' . $argv[1] . '" not found' . PHP_EOL);
exit(1);
}
try {
$minifier = new Minify\CSS($argv[1]);
echo $minifier->minify();
} catch (Exception $e) {
fwrite(STDERR, $e->getMessage(), PHP_EOL);
exit(1);
}
#!/usr/bin/env php
<?php
use MatthiasMullie\Minify;
// command line utility to minify JS
if (file_exists(__DIR__ . '/../../../autoload.php')) {
// if composer install
require_once __DIR__ . '/../../../autoload.php';
} else {
require_once __DIR__ . '/../src/Minify.php';
require_once __DIR__ . '/../src/JS.php';
require_once __DIR__ . '/../src/Exception.php';
}
error_reporting(E_ALL);
// check PHP setup for cli arguments
if (!isset($_SERVER['argv']) && !isset($argv)) {
fwrite(STDERR, 'Please enable the "register_argc_argv" directive in your php.ini' . PHP_EOL);
exit(1);
} elseif (!isset($argv)) {
$argv = $_SERVER['argv'];
}
// check if path to file given
if (!isset($argv[1])) {
fwrite(STDERR, 'Argument expected: path to file' . PHP_EOL);
exit(1);
}
// check if script run in cli environment
if ('cli' !== php_sapi_name()) {
fwrite(STDERR, $argv[1] . ' must be run in the command line' . PHP_EOL);
exit(1);
}
// check if source file exists
if (!file_exists($argv[1])) {
fwrite(STDERR, 'Source file "' . $argv[1] . '" not found' . PHP_EOL);
exit(1);
}
try {
$minifier = new Minify\JS($argv[1]);
echo $minifier->minify();
} catch (Exception $e) {
fwrite(STDERR, $e->getMessage(), PHP_EOL);
exit(1);
}
in
public
extends
private
protected
implements
instanceof
\ No newline at end of file
do
in
let
new
var
case
else
enum
void
with
class
const
yield
delete
export
import
public
static
typeof
extends
package
private
function
protected
implements
instanceof
\ No newline at end of file
do
if
in
for
let
new
try
var
case
else
enum
eval
null
this
true
void
with
break
catch
class
const
false
super
throw
while
yield
delete
export
import
public
return
static
switch
typeof
default
extends
finally
package
private
continue
debugger
function
arguments
interface
protected
implements
instanceof
abstract
boolean
byte
char
double
final
float
goto
int
long
native
short
synchronized
throws
transient
volatile
\ No newline at end of file
+
-
*
/
%
=
+=
-=
*=
/=
%=
<<=
>>=
>>>=
&=
^=
|=
&
|
^
~
<<
>>
>>>
==
===
!=
!==
>
<
>=
<=
&&
||
!
.
[
]
?
:
,
;
(
)
{
}
\ No newline at end of file
+
-
*
/
%
=
+=
-=
*=
/=
%=
<<=
>>=
>>>=
&=
^=
|=
&
|
^
<<
>>
>>>
==
===
!=
!==
>
<
>=
<=
&&
||
.
[
]
?
:
,
;
(
)
}
\ No newline at end of file
+
-
*
/
%
=
+=
-=
*=
/=
%=
<<=
>>=
>>>=
&=
^=
|=
&
|
^
~
<<
>>
>>>
==
===
!=
!==
>
<
>=
<=
&&
||
!
.
[
?
:
,
;
(
{
<?php
/**
* Base Exception
*
* @deprecated Use Exceptions\BasicException instead
*
* @author Matthias Mullie <minify@mullie.eu>
*/
namespace FVM\MatthiasMullie\Minify;
/**
* Base Exception Class
* @deprecated Use Exceptions\BasicException instead
*
* @package Minify
* @author Matthias Mullie <minify@mullie.eu>
*/
abstract class Exception extends \Exception
{
}
<?php
/**
* Basic exception
*
* Please report bugs on https://github.com/matthiasmullie/minify/issues
*
* @author Matthias Mullie <minify@mullie.eu>
* @copyright Copyright (c) 2012, Matthias Mullie. All rights reserved
* @license MIT License
*/
namespace FVM\MatthiasMullie\Minify\Exceptions;
use FVM\MatthiasMullie\Minify\Exception;
/**
* Basic Exception Class
*
* @package Minify\Exception
* @author Matthias Mullie <minify@mullie.eu>
*/
abstract class BasicException extends Exception
{
}
<?php
/**
* File Import Exception
*
* Please report bugs on https://github.com/matthiasmullie/minify/issues
*
* @author Matthias Mullie <minify@mullie.eu>
* @copyright Copyright (c) 2012, Matthias Mullie. All rights reserved
* @license MIT License
*/
namespace FVM\MatthiasMullie\Minify\Exceptions;
/**
* File Import Exception Class
*
* @package Minify\Exception
* @author Matthias Mullie <minify@mullie.eu>
*/
class FileImportException extends BasicException
{
}
<?php
/**
* IO Exception
*
* Please report bugs on https://github.com/matthiasmullie/minify/issues
*
* @author Matthias Mullie <minify@mullie.eu>
* @copyright Copyright (c) 2012, Matthias Mullie. All rights reserved
* @license MIT License
*/
namespace FVM\MatthiasMullie\Minify\Exceptions;
/**
* IO Exception Class
*
* @package Minify\Exception
* @author Matthias Mullie <minify@mullie.eu>
*/
class IOException extends BasicException
{
}
<?php
namespace FVM\MatthiasMullie\PathConverter;
/**
* Convert paths relative from 1 file to another.
*
* E.g.
* ../../images/icon.jpg relative to /css/imports/icons.css
* becomes
* ../images/icon.jpg relative to /css/minified.css
*
* Please report bugs on https://github.com/matthiasmullie/path-converter/issues
*
* @author Matthias Mullie <pathconverter@mullie.eu>
* @copyright Copyright (c) 2015, Matthias Mullie. All rights reserved
* @license MIT License
*/
class Converter implements ConverterInterface
{
/**
* @var string
*/
protected $from;
/**
* @var string
*/
protected $to;
/**
* @param string $from The original base path (directory, not file!)
* @param string $to The new base path (directory, not file!)
* @param string $root Root directory (defaults to `getcwd`)
*/
public function __construct($from, $to, $root = '')
{
$shared = $this->shared($from, $to);
if ($shared === '') {
// when both paths have nothing in common, one of them is probably
// absolute while the other is relative
$root = $root ?: getcwd();
$from = strpos($from, $root) === 0 ? $from : preg_replace('/\/+/', '/', $root.'/'.$from);
$to = strpos($to, $root) === 0 ? $to : preg_replace('/\/+/', '/', $root.'/'.$to);
// or traveling the tree via `..`
// attempt to resolve path, or assume it's fine if it doesn't exist
$from = @realpath($from) ?: $from;
$to = @realpath($to) ?: $to;
}
$from = $this->dirname($from);
$to = $this->dirname($to);
$from = $this->normalize($from);
$to = $this->normalize($to);
$this->from = $from;
$this->to = $to;
}
/**
* Normalize path.
*
* @param string $path
*
* @return string
*/
protected function normalize($path)
{
// deal with different operating systems' directory structure
$path = rtrim(str_replace(DIRECTORY_SEPARATOR, '/', $path), '/');
/*
* Example:
* /home/forkcms/frontend/cache/compiled_templates/../../core/layout/css/../images/img.gif
* to
* /home/forkcms/frontend/core/layout/images/img.gif
*/
do {
$path = preg_replace('/[^\/]+(?<!\.\.)\/\.\.\//', '', $path, -1, $count);
} while ($count);
return $path;
}
/**
* Figure out the shared path of 2 locations.
*
* Example:
* /home/forkcms/frontend/core/layout/images/img.gif
* and
* /home/forkcms/frontend/cache/minified_css
* share
* /home/forkcms/frontend
*
* @param string $path1
* @param string $path2
*
* @return string
*/
protected function shared($path1, $path2)
{
// $path could theoretically be empty (e.g. no path is given), in which
// case it shouldn't expand to array(''), which would compare to one's
// root /
$path1 = $path1 ? explode('/', $path1) : array();
$path2 = $path2 ? explode('/', $path2) : array();
$shared = array();
// compare paths & strip identical ancestors
foreach ($path1 as $i => $chunk) {
if (isset($path2[$i]) && $path1[$i] == $path2[$i]) {
$shared[] = $chunk;
} else {
break;
}
}
return implode('/', $shared);
}
/**
* Convert paths relative from 1 file to another.
*
* E.g.
* ../images/img.gif relative to /home/forkcms/frontend/core/layout/css
* should become:
* ../../core/layout/images/img.gif relative to
* /home/forkcms/frontend/cache/minified_css
*
* @param string $path The relative path that needs to be converted
*
* @return string The new relative path
*/
public function convert($path)
{
// quit early if conversion makes no sense
if ($this->from === $this->to) {
return $path;
}
$path = $this->normalize($path);
// if we're not dealing with a relative path, just return absolute
if (strpos($path, '/') === 0) {
return $path;
}
// normalize paths
$path = $this->normalize($this->from.'/'.$path);
// strip shared ancestor paths
$shared = $this->shared($path, $this->to);
$path = mb_substr($path, mb_strlen($shared));
$to = mb_substr($this->to, mb_strlen($shared));
// add .. for every directory that needs to be traversed to new path
$to = str_repeat('../', count(array_filter(explode('/', $to))));
return $to.ltrim($path, '/');
}
/**
* Attempt to get the directory name from a path.
*
* @param string $path
*
* @return string
*/
protected function dirname($path)
{
if (@is_file($path)) {
return dirname($path);
}
if (@is_dir($path)) {
return rtrim($path, '/');
}
// no known file/dir, start making assumptions
// ends in / = dir
if (mb_substr($path, -1) === '/') {
return rtrim($path, '/');
}
// has a dot in the name, likely a file
if (preg_match('/.*\..*$/', basename($path)) !== 0) {
return dirname($path);
}
// you're on your own here!
return $path;
}
}
<?php
namespace FVM\MatthiasMullie\PathConverter;
/**
* Convert file paths.
*
* Please report bugs on https://github.com/matthiasmullie/path-converter/issues
*
* @author Matthias Mullie <pathconverter@mullie.eu>
* @copyright Copyright (c) 2015, Matthias Mullie. All rights reserved
* @license MIT License
*/
interface ConverterInterface
{
/**
* Convert file paths.
*
* @param string $path The path to be converted
*
* @return string The new path
*/
public function convert($path);
}
<?php
namespace FVM\MatthiasMullie\PathConverter;
/**
* Don't convert paths.
*
* Please report bugs on https://github.com/matthiasmullie/path-converter/issues
*
* @author Matthias Mullie <pathconverter@mullie.eu>
* @copyright Copyright (c) 2015, Matthias Mullie. All rights reserved
* @license MIT License
*/
class NoConverter implements ConverterInterface
{
/**
* {@inheritdoc}
*/
public function convert($path)
{
return $path;
}
}
<?php
/**
*
* Website: https://wpraiser.com/
* Author: Raul Peixoto (https://www.upwork.com/fl/raulpeixoto)
* Licensed under GPLv2 (or later)
* Version 1.0
*
* Usage: fvm_raisermin_js($js);
*
*/
# Exit if accessed directly
if (!defined('ABSPATH')){ exit(); }
# minify js, whitespace only
function fvm_raisermin_js($code){
# remove // comments
$code = preg_replace('/(^|\s)\/\/(.*)\n/m', '', $code);
$code = preg_replace('/(\{|\}|\[|\]|\(|\)|\;)\/\/(.*)\n/m', '$1', $code);
# remove /* ... */ comments
$code = preg_replace('/(^|\s)\/\*(.*)\*\//Us', '', $code);
$code = preg_replace('/(\;|\{)\/\*(.*)\*\//Us', '$1', $code);
# remove sourceMappingURL
$code = preg_replace('/(\/\/\s*[#]\s*sourceMappingURL\s*[=]\s*)([a-zA-Z0-9-_\.\/]+)(\.map)/ui', '', $code);
# uniform line endings, make them all line feed
$code = str_replace(array("\r\n", "\r"), "\n", $code);
# collapse all non-line feed whitespace into a single space
$code = preg_replace('/[^\S\n]+/', ' ', $code);
# strip leading & trailing whitespace
$code = str_replace(array(" \n", "\n "), "\n", $code);
# collapse consecutive line feeds into just 1
$code = preg_replace('/\n+/', "\n", $code);
# process horizontal space
$code = preg_replace('/([\[\]\(\)\{\}\;\<\>])(\h+)([\[\]\(\)\{\}\;\<\>])/ui', '$1 $3', $code);
$code = preg_replace('/([\)])(\h?)(\.)/ui', '$1$3', $code);
$code = preg_replace('/([\)\?])(\h?)(\.)/ui', '$1$3', $code);
$code = preg_replace('/(\,)(\h+)/ui', '$1 ', $code);
$code = preg_replace('/(\h+)(\,)/ui', ' $2', $code);
$code = preg_replace('/([if])(\h+)(\()/ui', '$1$3', $code);
# trim whitespace on beginning/end
return trim($code);
}
# remove UTF8 BOM
function fvm_min_remove_utf8_bom($text) {
$bom = pack('H*','EFBBBF');
while (preg_match("/^$bom/", $text)) {
$text = preg_replace("/^$bom/ui", '', $text);
}
return $text;
}
# minify html, don't touch certain tags
function fvm_raisermin_html($html) {
# clone
$content = $html;
# get all scripts
$skp = array();
preg_match_all('/(\<script(.*?)\<(\s*)\/script(\s*)\>|\<noscript(.*?)\<(\s*)\/noscript(\s*)\>|\<code(.*?)\<(\s*)\/code(\s*)\>|\<pre(.*?)\<(\s*)\/pre(\s*)\>)/uis', $html, $skp);
# replace all skippable patterns with comment
if(is_array($skp) && isset($skp[0]) && count($skp[0]) > 0) {
foreach ($skp[0] as $k=>$v) {
$content = str_replace($v, '<!-- SKIP '.$k.' -->', $content);
}
}
# remove line breaks, and colapse two or more white spaces into one
$content = preg_replace('/\s+/u', " ", $content);
# add linebreaks after html and head tags, for readability
$content = str_replace('<head>', PHP_EOL . '<head>' . PHP_EOL, $content);
$content = str_replace('</head>', PHP_EOL . '</head>' . PHP_EOL, $content);
$content = str_replace('<html', PHP_EOL . '<html', $content);
$content = str_replace('</html>', PHP_EOL . '</html>', $content);
# final readability adjustments
$content = str_replace('<meta ', PHP_EOL . '<meta ', $content);
$content = str_replace('<link ', PHP_EOL . '<link ', $content);
$content = str_replace('<style', PHP_EOL . '<style', $content);
$content = str_replace('<noscript', PHP_EOL . '<noscript>', $content);
# replace markers for scripts last
if(is_array($skp) && isset($skp[0]) && count($skp[0]) > 0) {
foreach ($skp[0] as $k=>$v) {
$content = str_replace('<!-- SKIP '.$k.' -->', PHP_EOL . $v . PHP_EOL, $content);
}
}
# no empty lines
$lines = explode(PHP_EOL, $content);
foreach($lines as $k=>$ln) { $ln = ltrim($ln); if(empty($ln)) { unset($lines[$k]); } else { $lines[$k] = $ln; } }
$content = implode(PHP_EOL, $lines);
# save as html, if not empty
if(!empty($content)) {
$html = $content;
}
# return
return $html;
}
@font-face {
font-family: "Flaticon";
src: url("fonts/statics/flaticon.eot");
src: url("fonts/statics/flaticon.eot#iefix") format("embedded-opentype"),
url("fonts/statics/flaticon.woff") format("woff"),
url("fonts/statics/flaticon.ttf") format("truetype"),
url("fonts/statics/flaticon.svg") format("svg");
font-weight: normal !important;
font-style: normal !important;
}
[class^="flaticon-"]:before, [class*=" flaticon-"]:before,
[class^="flaticon-"]:after, [class*=" flaticon-"]:after {
font-family: Flaticon;
font-size: 40px !important;
font-style: normal !important;
color: #ff8900 !important;
}.flaticon-css4:before {
content: "\e000";
}
.flaticon-desktop1:before {
content: "\e001";
}
.flaticon-js:before {
content: "\e002";
}
.flaticon-smart:before {
content: "\e003";
}
@font-face {
font-family: "Flaticon";
src: url("fonts/db/flaticon.eot");
src: url("fonts/db/Flaticon.eot?#iefix") format("embedded-opentype"),
url("fonts/db/Flaticon.woff") format("woff"),
url("fonts/db/Flaticon.ttf") format("truetype"),
url("fonts/db/Flaticon.svg#Flaticon") format("svg");
font-weight: normal;
font-style: normal;
}
@media screen and (-webkit-min-device-pixel-ratio:0) {
@font-face {
font-family: "Flaticon";
src: url("fonts/db/Flaticon.svg#Flaticon") format("svg");
}
}
[class^="flaticon-"]:before, [class*=" flaticon-"]:before,
[class^="flaticon-"]:after, [class*=" flaticon-"]:after {
font-family: Flaticon;
line-height: 44px !important;
font-style: normal !important;
}
.flaticon-check:before { content: "\f100"; color:#5cab40 !important; font-size: 25px !important;}
.flaticon-counterclockwise:before { content: "\f101"; font-weight: bold; font-size: 35px !important;}
.flaticon-draft:before { content: "\f102"; font-size: 35px !important;}
.flaticon-file:before { content: "\f103"; font-weight: bold; font-size: 35px !important;}
.flaticon-interface:before { content: "\f104"; font-weight: bold; font-size: 35px !important;}
.flaticon-pingback:before { content: "\f105"; font-weight: bold; font-size: 35px !important;}
.flaticon-recycling:before { content: "\f106"; font-weight: bold; font-size: 35px !important;}
.flaticon-start-settings:before { content: "\f107"; color:#3498db !important; font-size: 30px !important;}
.flaticon-technology:before { content: "\f108"; font-weight: bold; font-size: 35px !important;}
\ No newline at end of file
Silence is golden.
\ No newline at end of file
#revert-loader-toolbar{
display: none;
background: rgba(255, 255, 255, .7) url('data:image/gif;base64,R0lGODlhSwBLANUAAP////7+/v39/fz8/Pr6+vn5+ff39/b29vX19fT09PPz8/Ly8vHx8fDw8O/v7+7u7u3t7ezs7Ovr6+rq6unp6ejo6Ofn5+bm5uTk5OPj4+Li4uDg4N3d3dra2tjY2NfX19TU1NHR0c/Pz87Ozs3NzcfHx8XFxcTExMHBwbu7u7q6urW1tbS0tLGxsa+vr6ioqKenp6Kiop6enp2dnZycnJSUlJOTk4qKioCAgHd3d21tbWNjYwAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQFCgAAACwAAAAAQwBLAAAG/0CAcEgsGo/FAogVo8VYoAJySq1aj50mbcuNda7g8LXELZdL4rRaCDK7t6C13KrQvssxxXx/JN/daHyCQi9/bi+Dg4ZviVQFCpADSBaLbhZICB6aEnIUICOgoBx6SZVmUkUeNjusrDkq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vnAkI1kR4TKHMhgD2mfSHDODKgQDeZZzXrB7HfETAGSxnDh1DqEWeiZv20hw2bdy8RYFgrq3bt8codAAx4sOGBnC7XAgxoq/fESDA5m2y4a/hvmwHEz7MWIHiJQoYMwbxuAgHyYwTVwaAmTGHzQAidzZMebPo0X9Bn0Y9IgToAqz9dgDtMPaICbQt2C5AG8AH1mU3H+DbmWhvAAd+SzZ+XMgEun85OG6+pICC65uDAAAh+QQJCgAAACwAAAAASwBLAAAG/0CAcEgsGo9FhOqm2+luKgRySq1ar8JTc8ft6k7YsHgMgHXPZxh5zSam0HBuqk0XS7bxs05S71dfeXEvfoRHOYFwOYWLQ4hxjGEKF5NTHo5wHpBVIC80np4pF0YHl2gHmkgRLp+snihGeJc6qEcRMa24r0QypVwytEaruLgjRJa9mcBDI8PNCkQ1pTXKRJ3NuCBEBziOOKfUAArXwytFB9F5Nd/gFuO4MUce6F01yeBC7e6tUwce/uv38OljNSggmYGf5hgckwIhjQ4Lx+TTVzCiGBQDLVgkg3EcxI1kRtzC9QICyDYgVnRygWLDyZcwY9IBKHNMBhAjcobY8KzmFc4IIXIKFerSJ5UNQ5Pm/GAUCQSlUDk0NRIUqtIGU4dMsAr1Y9YOXKFmFRIWas+pZZWebZo26VqjYNvmHAtgq1yvWaumxUr3aVqpdIUgDcs08BCgVosaJoIBp06ei/lFnky5shgDDiRcoBAhgWUAFCaJnlRhweQDo1NPcrC4gOrXrAOHfq26AF3UtFU/oPsg92u6s32Ptp1VeO2xFYwPHxtBuWi6CZxvDiz9bVNJxvkYdiC8wmTutLVPLtB7NAXPnwEUWJ++vfv38OPLn78xCAA7') no-repeat center;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 9998;
}
#wp-admin-bar-wpfc-toolbar-parent, #wp-admin-bar-wpfc-toolbar-parent-delete-cache, #wp-admin-bar-wpfc-toolbar-parent-delete-cache-and-minified{
cursor: pointer;
}
@supports not (-ms-high-contrast: none) {
#wp-admin-bar-wpfc-toolbar-parent > .ab-empty-item::before{
content: url("../images/icon.svg");
}
}
#wp-admin-bar-wpfc-toolbar-parent .ab-empty-item:hover{
background-color: #FFA100;
}
\ No newline at end of file
Silence is golden.
\ No newline at end of file
<?php
class WpFastestCacheAdminToolbar{
private $is_multi = false;
public function __construct($is_multi){
$this->is_multi = $is_multi;
}
public function add(){
if(is_admin()){
add_action('wp_before_admin_bar_render', array($this, "wpfc_tweaked_toolbar_on_admin_panel"));
add_action('admin_enqueue_scripts', array($this, 'load_toolbar_js'));
add_action('admin_enqueue_scripts', array($this, 'load_toolbar_css'));
}else{
if(is_admin_bar_showing()){
add_action('wp_before_admin_bar_render', array($this, "wpfc_tweaked_toolbar_on_frontpage"));
add_action('wp_enqueue_scripts', array($this, 'load_toolbar_js'));
add_action('wp_enqueue_scripts', array($this, 'load_toolbar_css'));
add_action('wp_footer', array($this, 'print_my_inline_script'));
}
}
}
public function load_toolbar_js(){
wp_enqueue_script("wpfc-toolbar", plugins_url("wp-fastest-cache/js/toolbar.js"), array('jquery'), time(), true);
}
public function load_toolbar_css(){
wp_enqueue_style("wp-fastest-cache-toolbar", plugins_url("wp-fastest-cache/css/toolbar.css"), array(), time(), "all");
}
public function print_my_inline_script() {
?>
<script type="text/javascript">
var wpfc_ajaxurl = "<?php echo admin_url( 'admin-ajax.php' ); ?>";
var wpfc_nonce = "<?php echo wp_create_nonce("wpfc"); ?>";
</script>
<?php
}
public function wpfc_tweaked_toolbar_on_frontpage() {
global $wp_admin_bar;
$wp_admin_bar->add_node(array(
'id' => 'wpfc-toolbar-parent',
'title' => 'Clear Cache'
));
$wp_admin_bar->add_menu( array(
'id' => 'wpfc-toolbar-parent-clear-cache-of-this-page',
'title' => 'Clear Cache of This Page',
'parent'=> 'wpfc-toolbar-parent',
'meta' => array("class" => "wpfc-toolbar-child")
));
$wp_admin_bar->add_menu( array(
'id' => 'wpfc-toolbar-parent-delete-cache',
'title' => 'Delete Cache',
'parent'=> 'wpfc-toolbar-parent',
'meta' => array("class" => "wpfc-toolbar-child")
));
$wp_admin_bar->add_menu( array(
'id' => 'wpfc-toolbar-parent-delete-cache-and-minified',
'title' => 'Delete Cache and Minified CSS/JS',
'parent'=> 'wpfc-toolbar-parent',
'meta' => array("class" => "wpfc-toolbar-child")
));
if($this->is_multi){
$wp_admin_bar->add_menu( array(
'id' => 'wpfc-toolbar-parent-clear-cache-of-allsites',
'title' => __("Clear Cache of All Sites", "wp-fastest-cache"),
'parent'=> 'wpfc-toolbar-parent',
'meta' => array("class" => "wpfc-toolbar-child")
));
}
}
public function wpfc_tweaked_toolbar_on_admin_panel() {
global $wp_admin_bar;
$wp_admin_bar->add_node(array(
'id' => 'wpfc-toolbar-parent',
'title' => __("Delete Cache", "wp-fastest-cache"),
));
$wp_admin_bar->add_menu( array(
'id' => 'wpfc-toolbar-parent-delete-cache',
'title' => __("Clear All Cache", "wp-fastest-cache"),
'parent'=> 'wpfc-toolbar-parent',
'meta' => array("class" => "wpfc-toolbar-child")
));
$wp_admin_bar->add_menu( array(
'id' => 'wpfc-toolbar-parent-delete-cache-and-minified',
'title' => __("Delete Cache and Minified CSS/JS", "wp-fastest-cache"),
'parent'=> 'wpfc-toolbar-parent',
'meta' => array("class" => "wpfc-toolbar-child")
));
if($this->is_multi){
$wp_admin_bar->add_menu( array(
'id' => 'wpfc-toolbar-parent-clear-cache-of-allsites',
'title' => __("Clear Cache of All Sites", "wp-fastest-cache"),
'parent'=> 'wpfc-toolbar-parent',
'meta' => array("class" => "wpfc-toolbar-child")
));
}else{
if(isset($_GET["page"]) && $_GET["page"] == "wpfastestcacheoptions"){
$wp_admin_bar->add_menu( array(
'id' => 'wpfc-toolbar-parent-settings',
'title' => __("Settings", "wp-fastest-cache"),
'parent'=> 'wpfc-toolbar-parent',
'meta' => array("class" => "wpfc-toolbar-child")
));
}
}
}
}
?>
\ No newline at end of file
This diff could not be displayed because it is too large.
<?php
/**
* WP-CLI commands for WP Fastest Cache.
*/
if(!defined('ABSPATH')){
exit;
}
// This is a WP-CLI command, so bail if it's not available.
if(!defined('WP_CLI')){
return;
}
class wpfcCLI extends \WP_CLI_Command
{
/**
* Clears the cache.
*
* ## EXAMPLES
* wp fastest-cache clear all
* wp fastest-cache clear all and minified
*
*
* @subcommand clear
*
* @param array $args Args.
* @param array $args_assoc Associative args.
*
* @return void
*/
public function wrong_usage(){
$message = array("*************************************************************************",
"* Wrong usage! *",
"* Please read: https://www.wpfastestcache.com/features/wp-cli-commands/ *",
"*************************************************************************");
WP_CLI::error_multi_line($message);
}
public function clear($args, $args_assoc){
if(isset($GLOBALS['wp_fastest_cache'])){
if(method_exists($GLOBALS['wp_fastest_cache'], 'deleteCache')){
if(isset($args[0])){
if($args[0] == "all"){
if(isset($args[1]) && isset($args[2])){
if($args[1] == "and" && $args[2] == "minified"){
WP_CLI::line("Clearing the ALL cache...");
$GLOBALS['wp_fastest_cache']->deleteCache(true);
WP_CLI::success("The cache has been cleared!");
}else{
self::wrong_usage();
}
}else{
WP_CLI::line("Clearing the ALL cache...");
$GLOBALS['wp_fastest_cache']->deleteCache();
WP_CLI::success("The cache has been cleared!");
}
}else{
self::wrong_usage();
}
}else{
self::wrong_usage();
}
}else{
WP_CLI::error("deleteCache() does not exist!");
}
}else{
WP_CLI::error("GLOBALS['wp_fastest_cache'] has not been defined!");
}
}
}
WP_CLI::add_command( 'fastest-cache', 'wpfcCLI' );
?>
\ No newline at end of file
<?php
class WpFastestCacheColumn{
public function __construct(){}
public function add(){
add_filter('post_row_actions', array($this, 'add_clear_cache_link'), 10, 2);
add_filter('page_row_actions', array($this, 'add_clear_cache_link'), 10, 2);
add_action('admin_enqueue_scripts', array($this, 'load_js'));
add_action('wp_ajax_wpfc_clear_cache_column', array($this, "clear_cache_column"));
}
public function add_clear_cache_link($actions, $post){
$actions['clear_cache_link'] = '<a data-id="'.$post->ID.'" data-nonce="'.wp_create_nonce('clear-cache_'.$post->ID).'" id="wpfc-clear-cache-link-'.$post->ID.'" style="cursor:pointer;">' . __('Clear Cache') . '</a>';
return $actions;
}
public function clear_cache_column(){
if(wp_verify_nonce($_GET["nonce"], 'clear-cache_'.$_GET["id"])){
$GLOBALS["wp_fastest_cache"]->singleDeleteCache(false, esc_sql($_GET["id"]));
die(json_encode(array("success" => true)));
}else{
die(json_encode(array("success" => false)));
}
}
public function load_js(){
wp_enqueue_script("wpfc-column", plugins_url("wp-fastest-cache/js/column.js"), array(), time(), true);
}
}
?>
\ No newline at end of file