PluginProbe
Leverage Browser Caching / trunk
Leverage Browser Caching vtrunk
3.1 3.0 trunk 2.3 2.4 2.5 2.6 2.7
leverage-browser-caching / leverage-browser-caching.php

leverage-browser-caching.php in Leverage Browser Caching trunk, at leverage-browser-caching.php

66 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: Leverage Browser Caching
4 * Description: Speed up WordPress with browser caching. Automatically adds expiry headers for images, CSS, JS & fonts via .htaccess Zero config (Apache only)
5 * Version: 3.1
6 * Author: Rinku Yadav
7 * Author URI: https://lbcache.com
8 * License: GPLv2 or later
9 * License URI: http://www.gnu.org/licenses/gpl-2.0.html
10 * Text Domain: leverage-browser-caching
11 *
12 * @package Leverage Browser Caching
13 */
14
15 // Exit if directly accessed files.
16 if ( ! defined( 'ABSPATH' ) ) {
17 exit;
18 }
19
20 // Set path to constant.
21 if ( ! defined( 'LBROWSERC_PATH' ) ) {
22 define( 'LBROWSERC_PATH', wp_normalize_path( plugin_dir_path( __FILE__ ) ) );
23 }
24
25 // Set url to constant.
26 if ( ! defined( 'LBROWSERC_URL' ) ) {
27 define( 'LBROWSERC_URL', plugin_dir_url( __FILE__ ) );
28 }
29
30 // Set __FILE__ to constant.
31 if ( ! defined( 'LBROWSERC_FILE' ) ) {
32 define( 'LBROWSERC_FILE', __FILE__ );
33 }
34
35 // Set plugin base.
36 if ( ! defined( 'LBROWSERC_BASE_FILE' ) ) {
37 define( 'LBROWSERC_BASE_FILE', plugin_basename( __FILE__ ) );
38 }
39
40 // Load core class.
41 require_once LBROWSERC_PATH . 'inc/classes/class-lbrowserc-core.php';
42
43 $lbrowserc = new Lbrowserc_Core();
44
45 // Write caching rules to .htaccess on activation; remove them on deactivation.
46 register_activation_hook( LBROWSERC_FILE, array( $lbrowserc, 'add_code' ) );
47 register_deactivation_hook( LBROWSERC_FILE, array( $lbrowserc, 'remove_code' ) );
48
49 // Load dismissible notice class globally so its deactivation hook can fire properly.
50 require_once LBROWSERC_PATH . 'inc/classes/class-lbrowserc-notice.php';
51 $lbrowserc_notice = new Lbrowserc_Notice();
52
53 // Clear dismissed state on deactivation so notice reappears after re-activation.
54 register_deactivation_hook( LBROWSERC_FILE, array( $lbrowserc_notice, 'reset_notice' ) );
55
56 // Load admin-only classes: plugin action links, and admin page.
57 if ( is_admin() ) {
58 require_once LBROWSERC_PATH . 'inc/classes/class-lbrowserc-links.php';
59 new Lbrowserc_Links();
60
61 require_once LBROWSERC_PATH . 'inc/classes/class-lbrowserc-admin-page.php';
62 new Lbrowserc_Admin_Page();
63 }
64
65
66