@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | * Domain Path: /languages/ |
13 | 13 | */ |
14 | 14 | |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; // Exit if accessed directly. |
17 | 17 | } |
18 | 18 | |
@@ -20,43 +20,43 @@ discard block |
||
20 | 20 | |
21 | 21 | public function __construct() { |
22 | 22 | // Enqueue css and js files |
23 | - add_action( 'admin_enqueue_scripts', array( $this, 'embed_admin_assets' ), 101 ); |
|
23 | + add_action('admin_enqueue_scripts', array($this, 'embed_admin_assets'), 101); |
|
24 | 24 | |
25 | 25 | // Add 'Clear Redis cache' button to the admin bar |
26 | - add_action( 'admin_bar_menu', array( $this, 'add_admin_bar_button' ), 101 ); |
|
26 | + add_action('admin_bar_menu', array($this, 'add_admin_bar_button'), 101); |
|
27 | 27 | |
28 | 28 | // Load plugin textdomain |
29 | - add_action( 'plugins_loaded', array( $this, 'load_plugin_textdomain' ) ); |
|
29 | + add_action('plugins_loaded', array($this, 'load_plugin_textdomain')); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | public function embed_admin_assets() { |
33 | 33 | // This is where you can add your CSS/JS entries for wp-admin UI |
34 | - $plugin_url = plugin_dir_url( __FILE__ ); |
|
35 | - $asset_suffix = ( defined( SCRIPT_DEBUG ) && ! empty( SCRIPT_DEBUG ) ) ? '.min' : ''; |
|
36 | - wp_enqueue_style( 'admin-styles', sprintf( '%s/assets/wp-purge-pagespeed-button%s.css', $plugin_url, $asset_suffix ) ); |
|
37 | - wp_enqueue_script( 'admin-styles', sprintf( '%s/assets/wp-purge-pagespeed-button%s.js', $plugin_url, $asset_suffix ), array( 'jquery' ) ); |
|
34 | + $plugin_url = plugin_dir_url(__FILE__); |
|
35 | + $asset_suffix = (defined(SCRIPT_DEBUG) && ! empty(SCRIPT_DEBUG)) ? '.min' : ''; |
|
36 | + wp_enqueue_style('admin-styles', sprintf('%s/assets/wp-purge-pagespeed-button%s.css', $plugin_url, $asset_suffix)); |
|
37 | + wp_enqueue_script('admin-styles', sprintf('%s/assets/wp-purge-pagespeed-button%s.js', $plugin_url, $asset_suffix), array('jquery')); |
|
38 | 38 | } |
39 | 39 | |
40 | - public function add_admin_bar_button( $wp_admin_bar ) { |
|
40 | + public function add_admin_bar_button($wp_admin_bar) { |
|
41 | 41 | $args = [ |
42 | 42 | 'id' => 'pagespeed_purge', |
43 | 43 | 'href' => '#pagespeed_purge', |
44 | - 'title' => __( 'Purge Pagespeed Cache', 'wp-purge-pagespeed-button' ), |
|
44 | + 'title' => __('Purge Pagespeed Cache', 'wp-purge-pagespeed-button'), |
|
45 | 45 | ]; |
46 | 46 | |
47 | - $wp_admin_bar->add_menu( $args ); |
|
47 | + $wp_admin_bar->add_menu($args); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | public function load_plugin_textdomain() { |
51 | 51 | $textdomain = 'wp-purge-pagespeed-button'; |
52 | - $plugin_locale = apply_filters( 'plugin_locale', get_locale(), $textdomain ); |
|
53 | - $plugin_dir = dirname( __FILE__ ); |
|
52 | + $plugin_locale = apply_filters('plugin_locale', get_locale(), $textdomain); |
|
53 | + $plugin_dir = dirname(__FILE__); |
|
54 | 54 | |
55 | 55 | // wp-content/languages/plugin-name/plugin-name-ru_RU.mo |
56 | - load_textdomain( $textdomain, sprintf( '%s/plugins/%s-%s.mo', WP_LANG_DIR , $textdomain, $plugin_locale ) ); |
|
56 | + load_textdomain($textdomain, sprintf('%s/plugins/%s-%s.mo', WP_LANG_DIR, $textdomain, $plugin_locale)); |
|
57 | 57 | |
58 | 58 | // wp-content/plugins/plugin-name/languages/plugin-name-ru_RU.mo |
59 | - load_textdomain( $textdomain, sprintf( '%s/languages/%s-%s.mo', $plugin_dir , $textdomain, $plugin_locale ) ); |
|
59 | + load_textdomain($textdomain, sprintf('%s/languages/%s-%s.mo', $plugin_dir, $textdomain, $plugin_locale)); |
|
60 | 60 | } |
61 | 61 | } |
62 | 62 |