Changeset 3403732
- Timestamp:
- 11/27/2025 02:20:05 AM (3 months ago)
- Location:
- awcode-toolkit/trunk
- Files:
-
- 2 edited
-
aw-toolkit.php (modified) (2 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
awcode-toolkit/trunk/aw-toolkit.php
r3291514 r3403732 2 2 /* 3 3 * Plugin Name: AWcode Toolkit 4 * Version: 1.0. 194 * Version: 1.0.20 5 5 * Description: A collection of useful tools and functions for Wordpress site owners 6 6 * Author: AWcode 7 7 * Author URI: https://awcode.com/ 8 8 * Requires at least: 5.0 9 * Tested up to: 6.8. 19 * Tested up to: 6.8.3 10 10 * License: GPLv2 11 11 * … … 72 72 } 73 73 74 75 //Increase smush limits 76 if ( ! defined( 'WP_SMUSH_MAX_BYTES' ) ) { 77 define( 'WP_SMUSH_MAX_BYTES', 52428800 ); // 500MB 78 } 79 80 81 if ( ! class_exists( 'AW_WP_Nonstop_Smushit' ) ) { 82 class AW_WP_Nonstop_Smushit { 83 84 protected static $instance = null; 85 86 public static function get_instance() { 87 if ( is_null( self::$instance ) ) { 88 self::$instance = new self(); 89 } 90 return self::$instance; 91 } 92 93 protected function __construct() { 94 if ( ! $this->has_wp_smushit() ) { 95 //skip silently 96 } else { 97 add_action( 'admin_footer', [ $this, 'enqueue_scripts' ] ); 98 add_action( 'admin_head', function() { 99 ?> 100 <script> 101 !function(){const t=EventTarget.prototype.addEventListener;EventTarget.prototype.addEventListener=function(e,n,r){if("click"===e&&this.matches&&this.matches(".wp-smush-resume-bulk-smush")){const i=function(t){const e=new Proxy(t,{get(t,e){if("isTrusted"===e)return!0;if("clientX"===e)return t.clientX||100;if("clientY"===e)return t.clientY||100;const n=t[e];return"function"==typeof n?n.bind(t):n}});return n.call(this,e)};return t.call(this,e,i,r)}return t.call(this,e,n,r)}}(); 102 </script> 103 <?php 104 }, 0 ); 105 } 106 } 107 108 /** 109 * Check the existence of WP Smushit plugin 110 * @return bool 111 */ 112 protected function has_wp_smushit() { 113 return defined( 'WP_SMUSH_VERSION' ) || class_exists( '\Smush\WP_Smush' ) || class_exists( 'WP_Smush' ); 114 } 115 116 117 public function enqueue_scripts() { 118 ?> 119 <script> 120 jQuery(document).ready(function($) { 121 ;(function(window) { 122 'use strict'; 123 if (!window.MutationObserver) { 124 return; 125 } 126 127 var observer = new MutationObserver(function(mutations) { 128 mutations.forEach(function(mutation) { 129 if (mutation.type !== 'attributes' || mutation.attributeName !== 'class') { 130 return; 131 } 132 133 var exceeded = mutation.target.classList.contains('wp-smush-exceed-limit'); 134 if (exceeded) { 135 const button = mutation.target.querySelector('.wp-smush-resume-bulk-smush'); 136 if (button) { 137 button.click(); 138 } 139 } 140 }); 141 }); 142 143 const container = document.querySelector('.wp-smush-bulk-progress-bar-wrapper'); 144 if (container) { 145 observer.observe(container, {attributes: true}); 146 } 147 })(window); 148 }); 149 </script> 150 <?php 151 } 152 } 153 } 154 155 add_action( 'plugins_loaded', [ 'AW_WP_Nonstop_Smushit', 'get_instance' ], 20 ); 156 157 74 158 ?> -
awcode-toolkit/trunk/readme.txt
r3291514 r3403732 4 4 Tags: woocommerce, cloudflare, awcode, web developer, web design 5 5 Requires at least: 5.0 6 Tested up to: 6.8. 17 Stable tag: 1.0. 196 Tested up to: 6.8.3 7 Stable tag: 1.0.20 8 8 License: GPLv2 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 50 50 == Upgrade Notice == 51 51 52 = 1.0. 19=53 Security Enhancements52 = 1.0.20 = 53 Increase plugin limits 54 54 55 55 == Changelog == 56 57 = 1.0.20 = 58 Increase plugin limits 56 59 57 60 = 1.0.19 =
Note: See TracChangeset
for help on using the changeset viewer.