This commit is contained in:
2026-07-02 15:54:39 -06:00
commit 9883323161
17470 changed files with 4470592 additions and 0 deletions
File diff suppressed because one or more lines are too long
Binary file not shown.

After

Width:  |  Height:  |  Size: 551 B

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="12pt" height="12pt" viewBox="0 0 12 12" version="1.1">
<g id="surface1">
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(100%,100%,100%);fill-opacity:1;" d="M 0 0 L 0 0.0078125 L 0.0078125 0 Z M 0 0 "/>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(100%,100%,100%);fill-opacity:1;" d="M 6.140625 2.621094 L 4.355469 2.621094 L 4.355469 5.902344 L 6.140625 5.902344 C 7.5625 5.902344 7.902344 5.605469 7.902344 4.363281 L 7.902344 4.160156 C 7.898438 2.917969 7.554688 2.621094 6.140625 2.621094 Z M 6.140625 2.621094 "/>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(100%,100%,100%);fill-opacity:1;" d="M 0 0 L 0 12 L 7.691406 12 L 12.003906 7.683594 L 12.003906 0 Z M 8.984375 4.363281 C 8.984375 6.304688 8.253906 6.847656 6.136719 6.847656 L 4.355469 6.847656 L 4.355469 10.027344 C 4.363281 10.105469 4.339844 10.183594 4.285156 10.246094 C 4.226562 10.304688 4.152344 10.335938 4.074219 10.332031 C 3.824219 10.332031 3.289062 10.261719 3.289062 10.121094 L 3.289062 1.980469 C 3.289062 1.71875 3.417969 1.667969 3.585938 1.667969 L 6.140625 1.667969 C 8.296875 1.667969 8.996094 2.261719 8.996094 4.160156 Z M 8.984375 4.363281 "/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

@@ -0,0 +1 @@
<?php // Silence is golden
@@ -0,0 +1,91 @@
/**
* Pressable Cache Management - Flush cache for individual page column
* Branded modal popup replaces browser alert()
*/
if (window.attachEvent) {
window.attachEvent('onload', flush_object_cache_column_button_action);
} else {
if (window.onload) {
var curronload_1 = window.onload;
var newonload_1 = function(evt) { curronload_1(evt); flush_object_cache_column_button_action(evt); };
window.onload = newonload_1;
} else {
window.onload = flush_object_cache_column_button_action;
}
}
/* ── Branded modal (injected once) ─────────────────────────────────────── */
function pcmEnsureModal() {
if (document.getElementById('pcm-col-modal-overlay')) return;
var overlay = document.createElement('div');
overlay.id = 'pcm-col-modal-overlay';
overlay.style.cssText =
'display:none;position:fixed;inset:0;background:rgba(4,0,36,.45);'
+ 'z-index:999999;align-items:center;justify-content:center;';
overlay.innerHTML =
'<div style="background:#fff;border-radius:12px;padding:28px 32px;max-width:420px;width:90%;'
+ 'box-shadow:0 8px 40px rgba(4,0,36,.18);font-family:sans-serif;position:relative;">'
+ '<div style="width:48px;height:4px;background:#03fcc2;border-radius:4px;margin-bottom:16px;"></div>'
+ '<p id="pcm-col-modal-msg" style="margin:0 0 22px;font-size:14px;color:#040024;line-height:1.6;"></p>'
+ '<button id="pcm-col-modal-ok" style="background:#dd3a03;color:#fff;border:none;border-radius:8px;'
+ 'padding:10px 28px;font-size:13.5px;font-weight:700;cursor:pointer;font-family:sans-serif;'
+ 'transition:background .2s;">OK</button>'
+ '</div>';
document.body.appendChild(overlay);
overlay.style.display = 'flex'; overlay.style.display = 'none'; // force style parse
document.getElementById('pcm-col-modal-ok').addEventListener('click', function() {
overlay.style.display = 'none';
});
overlay.addEventListener('click', function(e) {
if (e.target === overlay) overlay.style.display = 'none';
});
// hover on OK button
var okBtn = document.getElementById('pcm-col-modal-ok');
okBtn.addEventListener('mouseenter', function() { okBtn.style.background = '#b82f00'; });
okBtn.addEventListener('mouseleave', function() { okBtn.style.background = '#dd3a03'; });
}
function pcmShowColumnModal(msg) {
pcmEnsureModal();
document.getElementById('pcm-col-modal-msg').textContent = msg;
document.getElementById('pcm-col-modal-overlay').style.display = 'flex';
}
function flush_object_cache_column_button_action() {
jQuery(document).ready(function($) {
$("a[id^='flush-object-cache-url']").on('click', function(e) {
e.preventDefault();
var post_id = $(e.currentTarget).attr('data-id');
var nonce = $(e.currentTarget).attr('data-nonce');
$('#flush-object-cache-url-' + post_id).css('cursor', 'wait');
$.ajax({
type: 'GET',
url: ajaxurl,
data: { action: 'pcm_flush_object_cache_column', id: post_id, nonce: nonce },
dataType: 'json',
cache: false,
success: function(data) {
$('#flush-object-cache-url-' + post_id).css('cursor', 'pointer');
if (typeof data.success !== 'undefined' && data.success === true) {
pcmShowColumnModal('Batcache flushed successfully \u2705');
} else {
pcmShowColumnModal('Something went wrong while trying to flush the cache for this page.');
}
},
error: function() {
$('#flush-object-cache-url-' + post_id).css('cursor', 'pointer');
pcmShowColumnModal('Request failed. Please try again.');
}
});
return false;
});
});
}
@@ -0,0 +1,89 @@
/**
* Pressable Cache Management — Toolbar JS
*
* Handles the combined "Flush Cache for This Page" admin bar button.
*
* Bug fixes vs previous version:
* 1. data-edge on <li> is unsupported by WP add_menu() meta — now uses pcmToolbarData.flushEdge
* passed via wp_localize_script() which works on both admin and frontend.
* 2. Event delegation now targets document.body and checks closest('li').attr('id') correctly,
* rather than querying a non-existent '#wp-admin-bar-*-default' wrapper selector.
* 3. pcm_nonce was only available on frontend (wp_footer). Now comes from pcmToolbarData.nonce
* which is always present via wp_localize_script.
* 4. AJAX handlers now return wp_send_json_success() so jQuery parses valid JSON.
*/
jQuery(document).ready(function($) {
// Ensure the loader overlay exists once
if ( !$('#revert-loader-toolbar').length ) {
$('body').append('<div id="revert-loader-toolbar"></div>');
}
// Resolve AJAX URL: prefer localized value, fall back to WP global
var ajaxUrl = ( typeof pcmToolbarData !== 'undefined' && pcmToolbarData.ajaxurl )
? pcmToolbarData.ajaxurl
: ( typeof ajaxurl !== 'undefined' ? ajaxurl : '' );
// Nonce: from wp_localize_script (works on both admin + frontend)
var nonce = ( typeof pcmToolbarData !== 'undefined' ) ? pcmToolbarData.nonce : '';
// Whether edge cache flush should also fire (passed from PHP via wp_localize_script)
var flushEdge = ( typeof pcmToolbarData !== 'undefined' && pcmToolbarData.flushEdge === '1' );
// ── IDs for both branding variants ───────────────────────────────────────
var combinedIds = [
'wp-admin-bar-pcm-toolbar-parent-flush-cache-of-this-page',
'wp-admin-bar-pcm-toolbar-parent-remove-branding-flush-cache-of-this-page',
];
// ── Fire a single AJAX GET, returns a jQuery deferred ────────────────────
function sendRequest( action ) {
return $.ajax({
type : 'GET',
url : ajaxUrl,
data : { action: action, path: window.location.pathname, nonce: nonce },
dataType: 'json',
cache : false,
});
}
// ── Sequential flush: Batcache first, then Edge Cache if active ───────────
function flushCurrentPage() {
$('#revert-loader-toolbar').show();
sendRequest('pcm_delete_current_page_cache')
.always(function() {
if ( flushEdge ) {
sendRequest('pcm_purge_current_page_edge_cache')
.always(done);
} else {
done();
}
});
}
function done() {
if ( typeof pcmCacheStatics !== 'undefined' ) {
pcmCacheStatics.update();
} else {
$('#revert-loader-toolbar').hide();
}
}
// ── Event delegation on body — catches clicks anywhere inside the <li> ───
// We delegate from body because the admin bar is injected late and the
// submenu UL wrapper varies by WP version. Matching by the <li> id directly
// is the most reliable approach and avoids the broken '-default' suffix.
$('body').on('click', function(e) {
// Walk up from the clicked element to find the nearest <li>
var $li = $(e.target).closest('li');
var id = $li.attr('id') || '';
if ( combinedIds.indexOf(id) !== -1 ) {
e.preventDefault();
flushCurrentPage();
}
});
});
@@ -0,0 +1,6 @@
/**
* Pressable Cache Management — toolbar_remove_branding.js
* This file is intentionally empty.
* The branding-off toolbar handler is now consolidated in toolbar.js
* (PCM_TOOLBAR_REMOVE_BRANDING object) to avoid duplicate AJAX calls.
*/