| 1 |
<?php |
| 2 |
if (!defined('ABSPATH')) exit; |
| 3 |
|
| 4 |
class Pagely extends berqIntegrations { |
| 5 |
function __construct() { |
| 6 |
add_action('berqwp_stored_page_cache', [$this, 'flush_page_cache']); |
| 7 |
add_action('berqwp_flush_page_cache', [$this, 'flush_page_cache']); |
| 8 |
add_action('berqwp_flush_all_cache', [$this, 'flush_all_cache']); |
| 9 |
} |
| 10 |
|
| 11 |
function flush_all_cache() { |
| 12 |
if (class_exists('PagelyCachePurge')) { |
| 13 |
$purger = new PagelyCachePurge(); |
| 14 |
$purger->purgeAll(); |
| 15 |
} |
| 16 |
} |
| 17 |
|
| 18 |
function flush_page_cache($slug) { |
| 19 |
|
| 20 |
if (empty($slug)) { |
| 21 |
$slug = '/'; |
| 22 |
} |
| 23 |
|
| 24 |
if (class_exists('PagelyCachePurge')) { |
| 25 |
$purger = new PagelyCachePurge(); |
| 26 |
$purger->purgePath($slug); |
| 27 |
} |
| 28 |
} |
| 29 |
|
| 30 |
} |
| 31 |
|
| 32 |
new Pagely(); |