public function test_admin_bar_menu()
 {
     if (!class_exists('\\WP_Admin_Bar')) {
         require_once ABSPATH . '/wp-includes/class-wp-admin-bar.php';
     }
     $admin_bar = new \WP_Admin_Bar();
     $cachetop = new Cachetop();
     $cachetop->admin_bar_menu($admin_bar);
     $nodes = $admin_bar->get_nodes();
     $this->assertArrayHasKey('cachetop', $nodes);
     $this->assertArrayHasKey('cachetop-flush', $nodes);
     $this->assertArrayHasKey('cachetop-flush-all', $nodes);
 }
예제 #2
0
<?php

/**
 * Plugin name: Cachetop
 * Plugin URI: https://github.com/isotopsweden/wc-cachetop
 * Description: Cache pages by generating static HTML and store it in Redis or Filesystem.
 * Author: Isotop AB
 * Author URI: https://www.isotop.se
 * Version: 1.0.0
 * Textdomain: cachetop
 * Domain Path: /languages/
 */
if (file_exists(__DIR__ . '/vendor/autoload.php')) {
    require_once __DIR__ . '/vendor/autoload.php';
}
/**
 * Bootstrap the Cachetop plugin.
 *
 * @return \Isotop\Cachetop\Cachetop
 */
add_action('plugins_loaded', function () {
    return \Isotop\Cachetop\Cachetop::instance();
});
예제 #3
0
/**
 * Get the current Cachetop class instance.
 *
 * @return \Isotop\Cachetop\Cachetop
 */
function cachetop()
{
    return Cachetop::instance();
}