コード例 #1
0
ファイル: MgCacheRouting.php プロジェクト: mindgruve/mg-cache
 /**
  * Rewrite Rules Filter
  *
  * @param array $rules
  * @return array
  */
 public function rewriteRulesFilter($rules)
 {
     if (MgCache::$active) {
         if (!class_exists('MgCache')) {
             include_once __DIR__ . '/mg-cache.php';
         }
         MgCache::load();
         $rules['wp/wp-content/cache/prod/(\\w+)\\.css$'] = 'index.php?pagename=mg_asset_css&fingerprint=$matches[1]';
         $rules['wp/wp-content/cache/prod/(\\w+)\\.js$'] = 'index.php?pagename=mg_asset_js&fingerprint=$matches[1]';
     }
     return $rules;
 }
コード例 #2
0
ファイル: mg-cache.php プロジェクト: mindgruve/mg-cache
        /**
         * Register Routes
         *
         * @return null
         */
        public static function registerRoutes()
        {
            include_once 'MgCacheRouting.php';
            MgCacheRouting::init();
        }
        /**
         * Register Admin
         *
         * @return null
         */
        public static function registerAdmin()
        {
            include_once 'admin/MgCacheAdmin.php';
            add_submenu_page("options-general.php", "Mg Cache", "Cache", "update_themes", basename(__FILE__), array('MgCacheAdmin', 'printAdminPage'));
        }
        public function flushRewriteRules()
        {
            $routesFlushed = get_option(MgCacheHelper::$adminOptionsName . '_routes_flushed', null);
            if (!$routesFlushed) {
                flush_rewrite_rules();
                update_option(MgCacheHelper::$adminOptionsName . '_routes_flushed', true);
            }
        }
    }
    MgCache::init();
}