예제 #1
0
/**
 * Initialise the classes in this plugin.
 *
 * @since 1.1.0
 *
 * @todo Consider moving this to a dependency injection container, so we can avoid globals?
 */
function sg_cachepress_start()
{
    global $sg_cachepress, $sg_cachepress_options, $sg_cachepress_environment, $sg_cachepress_memcache, $sg_cachepress_admin, $sg_cachepress_supercacher;
    $sg_cachepress_options = new SG_CachePress_Options();
    $sg_cachepress = new SG_CachePress($sg_cachepress_options);
    $sg_cachepress_environment = new SG_CachePress_Environment($sg_cachepress_options);
    $sg_cachepress_admin = new SG_CachePress_Admin($sg_cachepress_options);
    $sg_cachepress_memcache = new SG_CachePress_Memcache($sg_cachepress_options, $sg_cachepress_environment);
    $sg_cachepress_supercacher = new SG_CachePress_Supercacher($sg_cachepress_options, $sg_cachepress_environment);
    $sg_cachepress->run();
    $sg_cachepress_admin->run();
    if ($sg_cachepress_environment->cache_is_enabled()) {
        if ($sg_cachepress_environment->autoflush_enabled()) {
            $sg_cachepress_supercacher->run();
        }
    }
    if ($sg_cachepress_environment->memcached_is_enabled()) {
        $sg_cachepress_memcache->run();
    }
}
 /**
  * Print notification in the admin section, or via AJAX
  *
  * @since Unknown
  *
  * @param string|bool $message Message to be displayed if purge is successful. If this param is false no output would be done
  * @return null
  */
 public static function notify($message)
 {
     add_action('muplugins_loaded', SG_CachePress_Memcache::notice($message));
 }