@@ -11,4 +11,4 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | 13 | |
| 14 | -add_filter( 'allow_major_auto_core_updates', '__return_true' ); |
|
| 14 | +add_filter('allow_major_auto_core_updates', '__return_true'); |
|
@@ -11,9 +11,9 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | 13 | // disable executing this script directly |
| 14 | -if(!defined('ABSPATH')) exit;
|
|
| 14 | +if (!defined('ABSPATH')) exit;
|
|
| 15 | 15 | |
| 16 | -if(!class_exists('AUTO_MAINTENANCE_MODE'))
|
|
| 16 | +if (!class_exists('AUTO_MAINTENANCE_MODE'))
|
|
| 17 | 17 | {
|
| 18 | 18 | class AUTO_MAINTENANCE_MODE |
| 19 | 19 | {
|
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | function __construct() |
| 24 | 24 | {
|
| 25 | 25 | define('AUTO_MAINTENANCE_MODE_VERSION', $this->plugin_version);
|
| 26 | - define('AUTO_MAINTENANCE_MODE_SITE_URL',site_url());
|
|
| 26 | + define('AUTO_MAINTENANCE_MODE_SITE_URL', site_url());
|
|
| 27 | 27 | define('AUTO_MAINTENANCE_MODE_URL', $this->plugin_url());
|
| 28 | 28 | define('AUTO_MAINTENANCE_MODE_PATH', $this->plugin_path());
|
| 29 | 29 | $this->plugin_includes(); |
@@ -39,10 +39,10 @@ discard block |
||
| 39 | 39 | add_action('wp_logout', array($this, 'amm_clear_transient'));
|
| 40 | 40 | } |
| 41 | 41 | function amm_create_transient() {
|
| 42 | - if( is_user_logged_in() ) {
|
|
| 43 | - if ( false === ( $tmp_value = get_transient( 'amm_is_any_user_logged_in' ) ) ) {
|
|
| 42 | + if (is_user_logged_in()) {
|
|
| 43 | + if (false === ($tmp_value = get_transient('amm_is_any_user_logged_in'))) {
|
|
| 44 | 44 | $value = true; |
| 45 | - set_transient( 'amm_is_any_user_logged_in', $value, 60*60 ); |
|
| 45 | + set_transient('amm_is_any_user_logged_in', $value, 60*60);
|
|
| 46 | 46 | } |
| 47 | 47 | } |
| 48 | 48 | } |
@@ -51,30 +51,30 @@ discard block |
||
| 51 | 51 | } |
| 52 | 52 | function plugins_loaded_handler() |
| 53 | 53 | {
|
| 54 | - load_plugin_textdomain('auto-maintenance-mode', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/');
|
|
| 54 | + load_plugin_textdomain('auto-maintenance-mode', false, dirname(plugin_basename(__FILE__)) . '/languages/');
|
|
| 55 | 55 | } |
| 56 | 56 | function plugin_url() |
| 57 | 57 | {
|
| 58 | - if($this->plugin_url) return $this->plugin_url; |
|
| 59 | - return $this->plugin_url = plugins_url( basename( plugin_dir_path(__FILE__) ), basename( __FILE__ ) ); |
|
| 58 | + if ($this->plugin_url) return $this->plugin_url; |
|
| 59 | + return $this->plugin_url = plugins_url(basename(plugin_dir_path(__FILE__)), basename(__FILE__)); |
|
| 60 | 60 | } |
| 61 | - function plugin_path(){
|
|
| 62 | - if ( $this->plugin_path ) return $this->plugin_path; |
|
| 63 | - return $this->plugin_path = untrailingslashit( plugin_dir_path( __FILE__ ) ); |
|
| 61 | + function plugin_path() {
|
|
| 62 | + if ($this->plugin_path) return $this->plugin_path; |
|
| 63 | + return $this->plugin_path = untrailingslashit(plugin_dir_path(__FILE__)); |
|
| 64 | 64 | } |
| 65 | 65 | function is_valid_page() {
|
| 66 | 66 | return in_array($GLOBALS['pagenow'], array('wp-login.php', 'wp-register.php'));
|
| 67 | 67 | } |
| 68 | 68 | function amm_template_redirect() |
| 69 | 69 | {
|
| 70 | - if(is_user_logged_in()){
|
|
| 70 | + if (is_user_logged_in()) {
|
|
| 71 | 71 | //do not display maintenance page |
| 72 | 72 | // $this->amm_create_transient_on_login(); |
| 73 | 73 | } |
| 74 | 74 | else |
| 75 | 75 | {
|
| 76 | - if( !is_admin() && !$this->is_valid_page()){ //show maintenance page
|
|
| 77 | - if ( false === ( $tmp_value = get_transient( 'amm_is_any_user_logged_in' ) ) ) {
|
|
| 76 | + if (!is_admin() && !$this->is_valid_page()) { //show maintenance page
|
|
| 77 | + if (false === ($tmp_value = get_transient('amm_is_any_user_logged_in'))) {
|
|
| 78 | 78 | $this->load_amm_page(); |
| 79 | 79 | } |
| 80 | 80 | } |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | </div> |
| 109 | 109 | <div id="content"> |
| 110 | 110 | <h1><?php _e('Auto Maintenance Mode', 'auto-maintenance-mode')?></h1>
|
| 111 | - <!-- <p><?php echo $link_text;?></p> --> |
|
| 111 | + <!-- <p><?php echo $link_text; ?></p> --> |
|
| 112 | 112 | <p><?php _e('Maintenance mode is enabled automatically, due to lack of activity from logged-in users!', 'auto-maintenance-mode')?></p>
|
| 113 | 113 | <p><?php _e('To disable the maintenance mode, please ', 'auto-maintenance-mode')?><strong><a href="<?php echo wp_login_url()?>"><?php _e('login now', 'auto-maintenance-mode'); ?></a></strong><?php _e(' or visit this page or any page of this site using a browser where you have already logged-in.', 'auto-maintenance-mode')?></p>
|
| 114 | 114 | <p><?php _e('Sorry for the inconvenience.', 'auto-maintenance-mode')?></p>
|
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | * License: GPL |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
|
| 12 | +if (!defined('ABSPATH')) exit; // Exit if accessed directly |
|
| 13 | 13 | |
| 14 | 14 | // directly from https://wordpress.org/plugins/disable-emojis/ |
| 15 | 15 | |
@@ -17,14 +17,14 @@ discard block |
||
| 17 | 17 | * Disable the emoji's |
| 18 | 18 | */ |
| 19 | 19 | function tiny_disable_emojis() { |
| 20 | - remove_action( 'wp_head', 'print_emoji_detection_script', 7 ); |
|
| 21 | - remove_action( 'admin_print_scripts', 'print_emoji_detection_script' ); |
|
| 22 | - remove_action( 'wp_print_styles', 'print_emoji_styles' ); |
|
| 23 | - remove_action( 'admin_print_styles', 'print_emoji_styles' ); |
|
| 24 | - remove_filter( 'the_content_feed', 'wp_staticize_emoji' ); |
|
| 25 | - remove_filter( 'comment_text_rss', 'wp_staticize_emoji' ); |
|
| 26 | - remove_filter( 'wp_mail', 'wp_staticize_emoji_for_email' ); |
|
| 27 | - add_filter( 'tiny_mce_plugins', 'tiny_disable_emojis_tinymce' ); |
|
| 20 | + remove_action('wp_head', 'print_emoji_detection_script', 7); |
|
| 21 | + remove_action('admin_print_scripts', 'print_emoji_detection_script'); |
|
| 22 | + remove_action('wp_print_styles', 'print_emoji_styles'); |
|
| 23 | + remove_action('admin_print_styles', 'print_emoji_styles'); |
|
| 24 | + remove_filter('the_content_feed', 'wp_staticize_emoji'); |
|
| 25 | + remove_filter('comment_text_rss', 'wp_staticize_emoji'); |
|
| 26 | + remove_filter('wp_mail', 'wp_staticize_emoji_for_email'); |
|
| 27 | + add_filter('tiny_mce_plugins', 'tiny_disable_emojis_tinymce'); |
|
| 28 | 28 | } |
| 29 | 29 | // add_action( 'init', 'tiny_disable_emojis' ); |
| 30 | 30 | |
@@ -34,16 +34,16 @@ discard block |
||
| 34 | 34 | * @param array $plugins |
| 35 | 35 | * @return array Difference betwen the two arrays |
| 36 | 36 | */ |
| 37 | -function tiny_disable_emojis_tinymce( $plugins ) { |
|
| 38 | - if ( is_array( $plugins ) ) { |
|
| 39 | - return array_diff( $plugins, array( 'wpemoji' ) ); |
|
| 37 | +function tiny_disable_emojis_tinymce($plugins) { |
|
| 38 | + if (is_array($plugins)) { |
|
| 39 | + return array_diff($plugins, array('wpemoji')); |
|
| 40 | 40 | } else { |
| 41 | 41 | return array(); |
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | /* loads loadCSS and script.js */ |
| 46 | -function tiny_hook_header_javascript () { |
|
| 46 | +function tiny_hook_header_javascript() { |
|
| 47 | 47 | $code = <<<'EOD' |
| 48 | 48 | <script type="text/javascript"> |
| 49 | 49 | document.documentElement.className = 'js'; |
@@ -210,10 +210,10 @@ discard block |
||
| 210 | 210 | |
| 211 | 211 | echo $code; |
| 212 | 212 | } |
| 213 | -add_action( 'wp_head', 'tiny_hook_header_javascript', 999 ); |
|
| 213 | +add_action('wp_head', 'tiny_hook_header_javascript', 999); |
|
| 214 | 214 | |
| 215 | 215 | /* loads loadCSS and script.js */ |
| 216 | -function tiny_hook_critical_css () { |
|
| 216 | +function tiny_hook_critical_css() { |
|
| 217 | 217 | $code = <<<'EOD' |
| 218 | 218 | <style> |
| 219 | 219 | /* Critical CSS - uncompressed CSS can be found at critical.css in the plugin's folder */ |
@@ -221,10 +221,10 @@ discard block |
||
| 221 | 221 | |
| 222 | 222 | echo $code; |
| 223 | 223 | } |
| 224 | -add_action( 'wp_head', 'tiny_hook_critical_css', 0 ); |
|
| 224 | +add_action('wp_head', 'tiny_hook_critical_css', 0); |
|
| 225 | 225 | |
| 226 | 226 | /* load javascript at the footer */ |
| 227 | -function tiny_hook_footer_javascript () { |
|
| 227 | +function tiny_hook_footer_javascript() { |
|
| 228 | 228 | $code = <<<'EOD' |
| 229 | 229 | <script type="text/javascript"> |
| 230 | 230 | |
@@ -245,10 +245,10 @@ discard block |
||
| 245 | 245 | |
| 246 | 246 | echo $code; |
| 247 | 247 | } |
| 248 | -add_action( 'wp_footer', 'tiny_hook_footer_javascript', 999 ); |
|
| 248 | +add_action('wp_footer', 'tiny_hook_footer_javascript', 999); |
|
| 249 | 249 | |
| 250 | 250 | // de_queue script that can be loaded alternatively |
| 251 | -add_action( 'wp_enqueue_scripts', function() { |
|
| 251 | +add_action('wp_enqueue_scripts', function() { |
|
| 252 | 252 | // Uncomment the following, if granvillephotobooth.com start using comments |
| 253 | 253 | // if( is_home() || is_front_page() ) |
| 254 | 254 | // wp_dequeue_script( 'comment-reply' ); |
@@ -258,26 +258,26 @@ discard block |
||
| 258 | 258 | // wp_deregister_script( 'jquery' ); |
| 259 | 259 | |
| 260 | 260 | // sample: let's defer theme scripts inc lightbox script |
| 261 | - wp_dequeue_script( 'js_handle' ); |
|
| 261 | + wp_dequeue_script('js_handle'); |
|
| 262 | 262 | }, 20); |
| 263 | 263 | |
| 264 | 264 | // de_register the styles that load asynchronously |
| 265 | -add_action( 'wp_enqueue_scripts', function() { |
|
| 265 | +add_action('wp_enqueue_scripts', function() { |
|
| 266 | 266 | // theme styles |
| 267 | - wp_deregister_style( 'style_handle' ); |
|
| 268 | -}, 20 ); |
|
| 267 | + wp_deregister_style('style_handle'); |
|
| 268 | +}, 20); |
|
| 269 | 269 | |
| 270 | 270 | // optimizi home page image/s |
| 271 | 271 | // add_filter('the_content', 'tiny_jetpack_images_optimization'); |
| 272 | 272 | function tiny_jetpack_images_optimization() { |
| 273 | - if( wp_is_mobile() ) { |
|
| 273 | + if (wp_is_mobile()) { |
|
| 274 | 274 | // let's do something - resize images |
| 275 | 275 | } |
| 276 | 276 | // return $content; |
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | // Add vary: user-agent header |
| 280 | -add_filter('wp_headers', function ($headers) { |
|
| 280 | +add_filter('wp_headers', function($headers) { |
|
| 281 | 281 | $headers['Vary'] = 'User-Agent'; |
| 282 | 282 | return $headers; |
| 283 | 283 | }); |
@@ -12,16 +12,16 @@ |
||
| 12 | 12 | |
| 13 | 13 | function tiny_remove_menus() { |
| 14 | 14 | // Hide Ewww image optimizer settings that are found in four places |
| 15 | - $page = remove_submenu_page( 'options-general.php', 'ewww-image-optimizer/ewww-image-optimizer.php' ); |
|
| 16 | - $page = remove_submenu_page( 'tools.php', 'ewww-image-optimizer-aux-images' ); |
|
| 17 | - $page = remove_submenu_page( 'themes.php', 'ewww-image-optimizer-theme-images' ); |
|
| 18 | - $page = remove_submenu_page( 'upload.php', 'ewww-image-optimizer-bulk' ); |
|
| 15 | + $page = remove_submenu_page('options-general.php', 'ewww-image-optimizer/ewww-image-optimizer.php'); |
|
| 16 | + $page = remove_submenu_page('tools.php', 'ewww-image-optimizer-aux-images'); |
|
| 17 | + $page = remove_submenu_page('themes.php', 'ewww-image-optimizer-theme-images'); |
|
| 18 | + $page = remove_submenu_page('upload.php', 'ewww-image-optimizer-bulk'); |
|
| 19 | 19 | } |
| 20 | -add_action( 'admin_menu', 'tiny_remove_menus', 999 ); |
|
| 20 | +add_action('admin_menu', 'tiny_remove_menus', 999); |
|
| 21 | 21 | |
| 22 | 22 | function tiny_remove_admin_bar_nodes() { |
| 23 | 23 | // Hide WP Logo from the admin bar |
| 24 | 24 | global $wp_admin_bar; |
| 25 | - $wp_admin_bar->remove_node( 'wp-logo' ); |
|
| 25 | + $wp_admin_bar->remove_node('wp-logo'); |
|
| 26 | 26 | } |
| 27 | -add_action( 'admin_bar_menu', 'tiny_remove_admin_bar_nodes', 999 ); |
|
| 27 | +add_action('admin_bar_menu', 'tiny_remove_admin_bar_nodes', 999); |
|
@@ -10,4 +10,4 @@ |
||
| 10 | 10 | * License: GPL |
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | -add_filter( 'got_rewrite', '__return_true' ); |
|
| 13 | +add_filter('got_rewrite', '__return_true'); |
|
@@ -10,11 +10,11 @@ |
||
| 10 | 10 | * License: GPL |
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | -remove_action( 'load-plugins.php', 'wp_update_plugins' ); |
|
| 14 | -remove_action( 'load-update.php', 'wp_update_plugins' ); |
|
| 15 | -remove_action( 'admin_init', '_maybe_update_plugins' ); |
|
| 16 | -remove_action( 'wp_update_plugins', 'wp_update_plugins' ); |
|
| 17 | -remove_action( 'load-update-core.php', 'wp_update_plugins' ); |
|
| 13 | +remove_action('load-plugins.php', 'wp_update_plugins'); |
|
| 14 | +remove_action('load-update.php', 'wp_update_plugins'); |
|
| 15 | +remove_action('admin_init', '_maybe_update_plugins'); |
|
| 16 | +remove_action('wp_update_plugins', 'wp_update_plugins'); |
|
| 17 | +remove_action('load-update-core.php', 'wp_update_plugins'); |
|
| 18 | 18 | |
| 19 | -add_filter( 'pre_transient_update_plugins', '__return_zero' ); |
|
| 20 | -add_filter( 'pre_site_transient_update_plugins', '__return_zero' ); |
|
| 19 | +add_filter('pre_transient_update_plugins', '__return_zero'); |
|
| 20 | +add_filter('pre_site_transient_update_plugins', '__return_zero'); |
|
@@ -11,4 +11,4 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | 13 | |
| 14 | -add_filter( 'allow_dev_auto_core_updates', '__return_true' ); |
|
| 14 | +add_filter('allow_dev_auto_core_updates', '__return_true'); |
|
@@ -10,4 +10,4 @@ |
||
| 10 | 10 | * License: GPL |
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | -add_filter( 'auto_update_theme', '__return_true' ); |
|
| 13 | +add_filter('auto_update_theme', '__return_true'); |
|
@@ -11,4 +11,4 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | 13 | |
| 14 | -add_filter( 'auto_update_plugin', '__return_true' ); |
|
| 14 | +add_filter('auto_update_plugin', '__return_true'); |
|