PluginProbe
Prevent Browser Caching / 2.3.7
Prevent Browser Caching v2.3.7
3.2.1 3.2.0 3.1.0 3.0.0 2.3.7 trunk 1.1 2.0 2.1 2.2 2.3 2.3.3 2.3.4 2.3.5 2.3.6
prevent-browser-caching / prevent-browser-caching.php

prevent-browser-caching.php in Prevent Browser Caching 2.3.7, at prevent-browser-caching.php

78 lines 2.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: Prevent Browser Caching
4 * Description: Updates the assets version of all CSS and JS files. Shows the latest changes on the site without asking the client to clear browser cache.
5 * Version: 2.3.7
6 * Requires at least: 4.0
7 * Requires PHP: 5.6
8 * Author: Kostya Tereshchuk
9 * Author URI: https://tutori.org/kostya/
10 * License: GPLv2 or later
11 * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
12 * Text Domain: prevent-browser-caching
13 * Domain Path: /lang/
14 */
15
16 // Exit if accessed directly.
17 if ( ! defined( 'ABSPATH' ) ) {
18 exit;
19 }
20
21 if ( ! function_exists( 'prevent_browser_caching_plugin_actions' ) ) {
22 /**
23 * Add settings to plugin links.
24 * @param $actions
25 * @return mixed
26 */
27 function prevent_browser_caching_plugin_actions( $actions )
28 {
29 array_unshift( $actions, "<a href=\"" . menu_page_url( 'prevent-browser-caching', false ) . "\">" . esc_html__( "Settings" ) . "</a>" );
30 return $actions;
31 }
32 add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), 'prevent_browser_caching_plugin_actions', 10, 1 );
33 }
34
35 if ( ! function_exists( 'prevent_browser_caching_load_textdomain' ) ) {
36 /**
37 * Set languages directory.
38 */
39 function prevent_browser_caching_load_textdomain()
40 {
41 load_plugin_textdomain( 'prevent-browser-caching', false, dirname( plugin_basename( __FILE__ ) ) . '/lang/' );
42 }
43 add_action( 'plugins_loaded', 'prevent_browser_caching_load_textdomain' );
44 }
45
46 if ( ! function_exists( 'prevent_browser_caching' ) ) {
47 /**
48 * Changes the version of CSS and JS files.
49 * Disables loading Prevent_Browser_Caching class if this function is used before setup theme.
50 *
51 * @param array $args
52 */
53 function prevent_browser_caching( $args = array() ) {
54 if ( ! class_exists( 'Prevent_Browser_Caching_Function' ) ) {
55 include_once 'includes/class-prevent-browser-caching-function.php';
56 }
57
58 Prevent_Browser_Caching_Function::instance( $args );
59 }
60 }
61
62 if ( ! function_exists( 'maybe_load_class_prevent_browser_caching' ) ) {
63 /**
64 * Load Prevent_Browser_Caching class if the function prevent_browser_caching is not used before setup theme.
65 */
66 function maybe_load_class_prevent_browser_caching()
67 {
68 if ( ! class_exists( 'Prevent_Browser_Caching' ) && ! class_exists( 'Prevent_Browser_Caching_Function' ) ) {
69 include_once 'includes/class-prevent-browser-caching.php';
70 }
71 }
72
73 add_action( 'after_setup_theme', 'maybe_load_class_prevent_browser_caching' );
74 }
75
76 if ( is_admin() ) {
77 include_once 'includes/admin/class-prevent-browser-caching-admin-settings.php';
78 }